https://github.com/cran/rstpm2
Raw File
Tip revision: c12a9847539968aa375d4df8349a3a524e7c1bb5 authored by Mark Clements on 17 January 2019, 14:50:04 UTC
version 1.4.5
Tip revision: c12a984
math.html
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2016-11-26 Sat 19:04 -->
<meta  http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta  name="viewport" content="width=device-width, initial-scale=1" />
<title></title>
<meta  name="generator" content="Org-mode" />
<meta  name="author" content="Mark Clements" />
<style type="text/css">
 <!--/*--><![CDATA[/*><!--*/
  .title  { text-align: center;
             margin-bottom: .2em; }
  .subtitle { text-align: center;
              font-size: medium;
              font-weight: bold;
              margin-top:0; }
  .todo   { font-family: monospace; color: red; }
  .done   { font-family: monospace; color: green; }
  .priority { font-family: monospace; color: orange; }
  .tag    { background-color: #eee; font-family: monospace;
            padding: 2px; font-size: 80%; font-weight: normal; }
  .timestamp { color: #bebebe; }
  .timestamp-kwd { color: #5f9ea0; }
  .org-right  { margin-left: auto; margin-right: 0px;  text-align: right; }
  .org-left   { margin-left: 0px;  margin-right: auto; text-align: left; }
  .org-center { margin-left: auto; margin-right: auto; text-align: center; }
  .underline { text-decoration: underline; }
  #postamble p, #preamble p { font-size: 90%; margin: .2em; }
  p.verse { margin-left: 3%; }
  pre {
    border: 1px solid #ccc;
    box-shadow: 3px 3px 3px #eee;
    padding: 8pt;
    font-family: monospace;
    overflow: auto;
    margin: 1.2em;
  }
  pre.src {
    position: relative;
    overflow: visible;
    padding-top: 1.2em;
  }
  pre.src:before {
    display: none;
    position: absolute;
    background-color: white;
    top: -10px;
    right: 10px;
    padding: 3px;
    border: 1px solid black;
  }
  pre.src:hover:before { display: inline;}
  pre.src-sh:before    { content: 'sh'; }
  pre.src-bash:before  { content: 'sh'; }
  pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
  pre.src-R:before     { content: 'R'; }
  pre.src-perl:before  { content: 'Perl'; }
  pre.src-java:before  { content: 'Java'; }
  pre.src-sql:before   { content: 'SQL'; }

  table { border-collapse:collapse; }
  caption.t-above { caption-side: top; }
  caption.t-bottom { caption-side: bottom; }
  td, th { vertical-align:top;  }
  th.org-right  { text-align: center;  }
  th.org-left   { text-align: center;   }
  th.org-center { text-align: center; }
  td.org-right  { text-align: right;  }
  td.org-left   { text-align: left;   }
  td.org-center { text-align: center; }
  dt { font-weight: bold; }
  .footpara { display: inline; }
  .footdef  { margin-bottom: 1em; }
  .figure { padding: 1em; }
  .figure p { text-align: center; }
  .inlinetask {
    padding: 10px;
    border: 2px solid gray;
    margin: 10px;
    background: #ffffcc;
  }
  #org-div-home-and-up
   { text-align: right; font-size: 70%; white-space: nowrap; }
  textarea { overflow-x: auto; }
  .linenr { font-size: smaller }
  .code-highlighted { background-color: #ffff00; }
  .org-info-js_info-navigation { border-style: none; }
  #org-info-js_console-label
    { font-size: 10px; font-weight: bold; white-space: nowrap; }
  .org-info-js_search-highlight
    { background-color: #ffff00; color: #000000; font-weight: bold; }
  /*]]>*/-->
</style>
<script type="text/javascript">
/*
@licstart  The following is the entire license notice for the
JavaScript code in this tag.

Copyright (C) 2012-2013 Free Software Foundation, Inc.

The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version.  The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.

As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.


@licend  The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
 function CodeHighlightOn(elem, id)
 {
   var target = document.getElementById(id);
   if(null != target) {
     elem.cacheClassElem = elem.className;
     elem.cacheClassTarget = target.className;
     target.className = "code-highlighted";
     elem.className   = "code-highlighted";
   }
 }
 function CodeHighlightOff(elem, id)
 {
   var target = document.getElementById(id);
   if(elem.cacheClassElem)
     elem.className = elem.cacheClassElem;
   if(elem.cacheClassTarget)
     target.className = elem.cacheClassTarget;
 }
/*]]>*///-->
</script>
</head>
<body>
<div id="content">
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgheadline8">1. Axiom/Fricas source file</a>
<ul>
<li><a href="#orgheadline1">1.1. General case</a></li>
<li><a href="#orgheadline2">1.2. Proportional hazards</a></li>
<li><a href="#orgheadline3">1.3. Proportional odds</a></li>
<li><a href="#orgheadline4">1.4. Probit</a></li>
<li><a href="#orgheadline5">1.5. Additive hazards</a></li>
<li><a href="#orgheadline6">1.6. Aranda-Ordaz</a></li>
<li><a href="#orgheadline7">1.7. Other links</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-orgheadline8" class="outline-2">
<h2 id="orgheadline8"><span class="section-number-2">1</span> Axiom/Fricas source file</h2>
<div class="outline-text-2" id="text-1">
</div><div id="outline-container-orgheadline1" class="outline-3">
<h3 id="orgheadline1"><span class="section-number-3">1.1</span> General case</h3>
<div class="outline-text-3" id="text-1-1">
<pre class="example">
(95) -&gt; )cl p all
   Compiled code for rule2 has been cleared.
   Compiled code for G has been cleared.
(95) -&gt; η := operator 'η
 
   (95)  η
                                                          Type: BasicOperator
(96) -&gt; G := operator 'G
 
   (96)  G
                                                          Type: BasicOperator
(97) -&gt; rule1 := rule (D(η(t,β),β)==X; D(η(t,β),t)==XD*β; D(η(t,β),[t,β])==XD; η(t,β)==X*β)
 
   (97)  {η  (t,β) == X,η  (t,β) == XD β,η    (t,β) == XD,η(t,β) == X β}
           ,2            ,1               ,1,2
                           Type: Ruleset(Integer,Integer,Expression(Integer))
(98) -&gt; S := G(η(t,β))
 
   (98)  G(η(t,β))
                                                    Type: Expression(Integer)
(99) -&gt; H := -log(S)
 
   (99)  - log(G(η(t,β)))
                                                    Type: Expression(Integer)
(100) -&gt; h := D(H,t)
 
             ,
            G (η(t,β))η  (t,β)
                       ,1
   (100)  - ------------------
                 G(η(t,β))
                                                    Type: Expression(Integer)
(101) -&gt; [D(expr,β) for expr in [S,H,h]]
 
   (101)
                           ,
                          G (η(t,β))η  (t,β)
     ,                               ,2
   [G (η(t,β))η  (t,β), - ------------------,
               ,2              G(η(t,β))

                     ,                                               ,,
         - G(η(t,β))G (η(t,β))η    (t,β) - G(η(t,β))η  (t,β)η  (t,β)G  (η(t,β))
                               ,1,2                  ,1      ,2
       + 
          ,        2
         G (η(t,β)) η  (t,β)η  (t,β)
                     ,1      ,2
    /
                2
       G(η(t,β))
     ]
                                              Type: List(Expression(Integer))
(102) -&gt; [rule1 expr for expr in [S,H,h]]
 
                                       ,
                                  XD βG (X β)

   (102)  [G(X β),- log(G(X β)),- -----------]
                                     G(X β)
                                              Type: List(Expression(Integer))
(103) -&gt; [rule1 D(expr,β) for expr in [S,H,h]]
 
   (103)
                  ,
                XG (X β)
      ,
   [XG (X β), - --------,
                 G(X β)
                    ,,                ,     2             ,
    - X XD β G(X β)G  (X β) + X XD β G (X β)  - XD G(X β)G (X β)

    ------------------------------------------------------------]
                                     2
                               G(X β)
                                              Type: List(Expression(Integer))
</pre>
</div>
</div>

<div id="outline-container-orgheadline2" class="outline-3">
<h3 id="orgheadline2"><span class="section-number-3">1.2</span> Proportional hazards</h3>
<div class="outline-text-3" id="text-1-2">
<pre class="example">
(104) -&gt; G(x) == exp(-exp(x))
                                                                   Type: Void
(105) -&gt; S := G(η(t,β))
    Compiling function G with type Expression(Integer) -&gt; Expression(
      Integer) 

                η(t,β)
            - %e
   (105)  %e
                                                    Type: Expression(Integer)
(106) -&gt; H := -log(S)
 
            η(t,β)
   (106)  %e
                                                    Type: Expression(Integer)
(107) -&gt; h := D(H,t)
 
            η(t,β)
   (107)  %e      η  (t,β)
                   ,1
                                                    Type: Expression(Integer)
(108) -&gt; D(G(x),x)
    Compiling function G with type Variable(x) -&gt; Expression(Integer) 

                     x
              x  - %e
   (108)  - %e %e
                                                    Type: Expression(Integer)
(109) -&gt; [rule1 expr for expr in [S,H,h]]
 
                 X β
             - %e      X β        X β
   (109)  [%e       ,%e   ,XD β %e   ]
                                              Type: List(Expression(Integer))
(110) -&gt; [rule1 D(expr,β) for expr in [S,H,h]]
 
                          X β
                 X β  - %e        X β                X β
   (110)  [- X %e   %e       ,X %e   ,(X XD β + XD)%e   ]
                                              Type: List(Expression(Integer))
</pre>
</div>
</div>


<div id="outline-container-orgheadline3" class="outline-3">
<h3 id="orgheadline3"><span class="section-number-3">1.3</span> Proportional odds</h3>
<div class="outline-text-3" id="text-1-3">
<pre class="example">
(111) -&gt; G(x) == 1/(1+exp(x))
   Compiled code for G has been cleared.
   1 old definition(s) deleted for function or rule G 
                                                                   Type: Void
(112) -&gt; S := G(η(t,β))
    Compiling function G with type Expression(Integer) -&gt; Expression(
      Integer) 

                1
   (112)  ------------
            η(t,β)
          %e       + 1
                                                    Type: Expression(Integer)
(113) -&gt; H := -log(S)
 
                      1
   (113)  - log(------------)
                  η(t,β)
                %e       + 1
                                                    Type: Expression(Integer)
(114) -&gt; h := D(H,t)
 
            η(t,β)
          %e      η  (t,β)
                   ,1
   (114)  ----------------
              η(t,β)
            %e       + 1
                                                    Type: Expression(Integer)
(115) -&gt; D(G(x),x)
    Compiling function G with type Variable(x) -&gt; Expression(Integer) 

                     x
                   %e
   (115)  - -----------------
               x 2      x
            (%e )  + 2%e  + 1
                                                    Type: Expression(Integer)
(116) -&gt; [rule1 expr for expr in [S,H,h]]
 
                                             X β
               1               1      XD β %e
   (116)  [---------,- log(---------),----------]
             X β             X β         X β
           %e    + 1       %e    + 1   %e    + 1
                                              Type: List(Expression(Integer))
(117) -&gt; [rule1 D(expr,β) for expr in [S,H,h]]
 
                        X β             X β        X β 2                  X β
                    X %e            X %e     XD (%e   )  + (X XD β + XD)%e
   (117)  [- ---------------------,---------,--------------------------------]
                X β 2      X β       X β              X β 2      X β
             (%e   )  + 2%e    + 1 %e    + 1       (%e   )  + 2%e    + 1
                                              Type: List(Expression(Integer))
</pre>
</div>
</div>


<div id="outline-container-orgheadline4" class="outline-3">
<h3 id="orgheadline4"><span class="section-number-3">1.4</span> Probit</h3>
<div class="outline-text-3" id="text-1-4">
<p>
Is there a more canonical approach in Axiom?
</p>

<pre class="example">
(118) -&gt; Φ := operator 'Φ

   (118)  Φ
                                                          Type: BasicOperator
(119) -&gt; φ := operator 'φ
 
   (119)  φ
                                                          Type: BasicOperator
(120) -&gt; rule2 == rule D(Φ(x),x)==φ(x)
                                                                    Type: Void
(121) -&gt; G(x) == Φ(-x)
    Compiled code for G has been cleared.
   1 old definition(s) deleted for function or rule G 
                                                                   Type: Void
(122) -&gt; S := G(η(t,β))
    Compiling function G with type Expression(Integer) -&gt; Expression(
      Integer) 

   (122)  Φ(- η(t,β))
                                                    Type: Expression(Integer)
(123) -&gt; H := -log(S)
 
   (123)  - log(Φ(- η(t,β)))
                                                    Type: Expression(Integer)
(124) -&gt; h := D(H,t)
 
           ,
          Φ (- η(t,β))η  (t,β)
                       ,1
   (124)  --------------------
               Φ(- η(t,β))
                                                    Type: Expression(Integer)
(125) -&gt; rule2 D(G(x),x)
    Compiling function G with type Variable(x) -&gt; Expression(Integer) 
   Compiling body of rule rule2 to compute value of type RewriteRule(
      Integer,Integer,Expression(Integer)) 

   (125)  - φ(- x)
                                                    Type: Expression(Integer)
(126) -&gt; [rule1 rule2 expr for expr in [S,H,h]]
 
                                    XD β φ(- X β)
   (126)  [Φ(- X β),- log(Φ(- X β)),-------------]
                                       Φ(- X β)
                                              Type: List(Expression(Integer))
(127) -&gt; [rule1 rule2 D(expr,β) for expr in [S,H,h]]
 
   (127)
                  X φ(- X β)
   [- X φ(- X β), ----------,
                   Φ(- X β)
                      ,                         2
    - X XD β Φ(- X β)φ (- X β) + X XD β φ(- X β)  + XD Φ(- X β)φ(- X β)

    -------------------------------------------------------------------]
                                         2
                                 Φ(- X β)
                                              Type: List(Expression(Integer))
</pre>
</div>
</div>

<div id="outline-container-orgheadline5" class="outline-3">
<h3 id="orgheadline5"><span class="section-number-3">1.5</span> Additive hazards</h3>
<div class="outline-text-3" id="text-1-5">
<pre class="example">
(128) -&gt; G(x) == exp(-x)
   Compiled code for G has been cleared.
   1 old definition(s) deleted for function or rule G 
                                                                   Type: Void
(129) -&gt; S := G(η(t,β))
    Compiling function G with type Expression(Integer) -&gt; Expression(
      Integer) 

            - η(t,β)
   (129)  %e
                                                    Type: Expression(Integer)
(130) -&gt; H := -log(S)
 
   (130)  η(t,β)
                                                    Type: Expression(Integer)
(131) -&gt; h := D(H,t)
 
   (131)  η  (t,β)
           ,1
                                                    Type: Expression(Integer)
(132) -&gt; D(G(x),x)
    Compiling function G with type Variable(x) -&gt; Expression(Integer) 

              - x
   (132)  - %e
                                                    Type: Expression(Integer)
(133) -&gt; [rule1 expr for expr in [S,H,h]]
 
             - X β
   (133)  [%e     ,X β,XD β]
                                              Type: List(Expression(Integer))
(134) -&gt; [rule1 D(expr,β) for expr in [S,H,h]]
 
                 - X β
   (134)  [- X %e     ,X,XD]
                                              Type: List(Expression(Integer))
</pre>
</div>
</div>

<div id="outline-container-orgheadline6" class="outline-3">
<h3 id="orgheadline6"><span class="section-number-3">1.6</span> Aranda-Ordaz</h3>
<div class="outline-text-3" id="text-1-6">
<pre class="example">
(135) -&gt; G(x) == exp(-log(θ*exp(x)+1)/θ)
   Compiled code for G has been cleared.
   1 old definition(s) deleted for function or rule G 
                                                                   Type: Void
(136) -&gt; S := G(η(t,β))
    Compiling function G with type Expression(Integer) -&gt; Expression(
      Integer) 

                      η(t,β)
              log(θ %e       + 1)
            - -------------------
                       θ
   (136)  %e
                                                    Type: Expression(Integer)
(137) -&gt; H := -log(S)
 
                  η(t,β)
          log(θ %e       + 1)
   (137)  -------------------
                   θ
                                                    Type: Expression(Integer)
(138) -&gt; h := D(H,t)
 
            η(t,β)
          %e      η  (t,β)
                   ,1
   (138)  ----------------
               η(t,β)
           θ %e       + 1
                                                    Type: Expression(Integer)
(139) -&gt; D(G(x),x)
    Compiling function G with type Variable(x) -&gt; Expression(Integer) 

                           x
                   log(θ %e  + 1)
                 - --------------
              x           θ
            %e %e
   (139)  - ---------------------
                      x
                  θ %e  + 1
                                                    Type: Expression(Integer)
(140) -&gt; [rule1 expr for expr in [S,H,h]]
 
                       X β
               log(θ %e    + 1)
             - ----------------         X β              X β
                       θ        log(θ %e    + 1)  XD β %e
   (140)  [%e                  ,----------------,-----------]
                                        θ            X β
                                                 θ %e    + 1
                                              Type: List(Expression(Integer))
(141) -&gt; [rule1 D(expr,β) for expr in [S,H,h]]
 
   (141)
                         X β
                 log(θ %e    + 1)
               - ----------------
          X β            θ               X β
      X %e   %e                      X %e
   [- ---------------------------, -----------,
                  X β                  X β
              θ %e    + 1          θ %e    + 1
            X β 2                  X β
    XD θ (%e   )  + (X XD β + XD)%e
    ----------------------------------]
          2   X β 2        X β
         θ (%e   )  + 2θ %e    + 1
                                              Type: List(Expression(Integer))
</pre>
</div>
</div>

<div id="outline-container-orgheadline7" class="outline-3">
<h3 id="orgheadline7"><span class="section-number-3">1.7</span> Other links</h3>
<div class="outline-text-3" id="text-1-7">
<p>
The development for other links would be similar.
</p>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Mark Clements</p>
<p class="date">Created: 2016-11-26 Sat 19:04</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>
back to top