Author: Mark Clements

## Table of Contents

- 1. Axiom/Fricas source file
  - 1.1. General case
  - 1.2. Proportional hazards
  - 1.3. Proportional odds
  - 1.4. Probit
  - 1.5. Additive hazards
  - 1.6. Aranda-Ordaz
  - 1.7. Other links

## 1 Axiom/Fricas source file

### 1.1 General case

    (95) -> )cl p all
       Compiled code for rule2 has been cleared.
       Compiled code for G has been cleared.
    (95) -> η := operator 'η

       (95)  η
                                                              Type: BasicOperator
    (96) -> G := operator 'G

       (96)  G
                                                              Type: BasicOperator
    (97) -> 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) -> S := G(η(t,β))

       (98)  G(η(t,β))
                                                        Type: Expression(Integer)
    (99) -> H := -log(S)

       (99)  - log(G(η(t,β)))
                                                        Type: Expression(Integer)
    (100) -> h := D(H,t)

                 ,
                G (η(t,β))η  (t,β)
                           ,1
       (100)  - ------------------
                     G(η(t,β))
                                                        Type: Expression(Integer)
    (101) -> [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) -> [rule1 expr for expr in [S,H,h]]

                                           ,
                                      XD βG (X β)

       (102)  [G(X β),- log(G(X β)),- -----------]
                                         G(X β)
                                                  Type: List(Expression(Integer))
    (103) -> [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))

### 1.2 Proportional hazards

    (104) -> G(x) == exp(-exp(x))
                                                                       Type: Void
    (105) -> S := G(η(t,β))
        Compiling function G with type Expression(Integer) -> Expression(
          Integer)

                    η(t,β)
                - %e
       (105)  %e
                                                        Type: Expression(Integer)
    (106) -> H := -log(S)

                η(t,β)
       (106)  %e
                                                        Type: Expression(Integer)
    (107) -> h := D(H,t)

                η(t,β)
       (107)  %e      η  (t,β)
                       ,1
                                                        Type: Expression(Integer)
    (108) -> D(G(x),x)
        Compiling function G with type Variable(x) -> Expression(Integer)

                         x
                  x  - %e
       (108)  - %e %e
                                                        Type: Expression(Integer)
    (109) -> [rule1 expr for expr in [S,H,h]]

                     X β
                 - %e      X β        X β
       (109)  [%e       ,%e   ,XD β %e   ]
                                                  Type: List(Expression(Integer))
    (110) -> [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))

### 1.3 Proportional odds

    (111) -> 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) -> S := G(η(t,β))
        Compiling function G with type Expression(Integer) -> Expression(
          Integer)

                    1
       (112)  ------------
                η(t,β)
              %e       + 1
                                                        Type: Expression(Integer)
    (113) -> H := -log(S)

                          1
       (113)  - log(------------)
                      η(t,β)
                    %e       + 1
                                                        Type: Expression(Integer)
    (114) -> h := D(H,t)

                η(t,β)
              %e      η  (t,β)
                       ,1
       (114)  ----------------
                  η(t,β)
                %e       + 1
                                                        Type: Expression(Integer)
    (115) -> D(G(x),x)
        Compiling function G with type Variable(x) -> Expression(Integer)

                         x
                       %e
       (115)  - -----------------
                   x 2      x
                (%e )  + 2%e  + 1
                                                        Type: Expression(Integer)
    (116) -> [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) -> [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))

### 1.4 Probit

Is there a more canonical approach in Axiom?

    (118) -> Φ := operator 'Φ

       (118)  Φ
                                                              Type: BasicOperator
    (119) -> φ := operator 'φ

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

       (122)  Φ(- η(t,β))
                                                        Type: Expression(Integer)
    (123) -> H := -log(S)

       (123)  - log(Φ(- η(t,β)))
                                                        Type: Expression(Integer)
    (124) -> h := D(H,t)

               ,
              Φ (- η(t,β))η  (t,β)
                           ,1
       (124)  --------------------
                   Φ(- η(t,β))
                                                        Type: Expression(Integer)
    (125) -> rule2 D(G(x),x)
        Compiling function G with type Variable(x) -> Expression(Integer)
       Compiling body of rule rule2 to compute value of type RewriteRule(
          Integer,Integer,Expression(Integer))

       (125)  - φ(- x)
                                                        Type: Expression(Integer)
    (126) -> [rule1 rule2 expr for expr in [S,H,h]]

                                        XD β φ(- X β)
       (126)  [Φ(- X β),- log(Φ(- X β)),-------------]
                                           Φ(- X β)
                                                  Type: List(Expression(Integer))
    (127) -> [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))

### 1.5 Additive hazards

    (128) -> G(x) == exp(-x)
       Compiled code for G has been cleared.
       1 old definition(s) deleted for function or rule G
                                                                       Type: Void
    (129) -> S := G(η(t,β))
        Compiling function G with type Expression(Integer) -> Expression(
          Integer)

                - η(t,β)
       (129)  %e
                                                        Type: Expression(Integer)
    (130) -> H := -log(S)

       (130)  η(t,β)
                                                        Type: Expression(Integer)
    (131) -> h := D(H,t)

       (131)  η  (t,β)
               ,1
                                                        Type: Expression(Integer)
    (132) -> D(G(x),x)
        Compiling function G with type Variable(x) -> Expression(Integer)

                  - x
       (132)  - %e
                                                        Type: Expression(Integer)
    (133) -> [rule1 expr for expr in [S,H,h]]

                 - X β
       (133)  [%e     ,X β,XD β]
                                                  Type: List(Expression(Integer))
    (134) -> [rule1 D(expr,β) for expr in [S,H,h]]

                     - X β
       (134)  [- X %e     ,X,XD]
                                                  Type: List(Expression(Integer))

### 1.6 Aranda-Ordaz

    (135) -> 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) -> S := G(η(t,β))
        Compiling function G with type Expression(Integer) -> Expression(
          Integer)

                          η(t,β)
                  log(θ %e       + 1)
                - -------------------
                           θ
       (136)  %e
                                                        Type: Expression(Integer)
    (137) -> H := -log(S)

                      η(t,β)
              log(θ %e       + 1)
       (137)  -------------------
                       θ
                                                        Type: Expression(Integer)
    (138) -> h := D(H,t)

                η(t,β)
              %e      η  (t,β)
                       ,1
       (138)  ----------------
                   η(t,β)
               θ %e       + 1
                                                        Type: Expression(Integer)
    (139) -> D(G(x),x)
        Compiling function G with type Variable(x) -> Expression(Integer)

                               x
                       log(θ %e  + 1)
                     - --------------
                  x           θ
                %e %e
       (139)  - ---------------------
                          x
                      θ %e  + 1
                                                        Type: Expression(Integer)
    (140) -> [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) -> [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))

### 1.7 Other links

The development for other links would be similar.

Author: Mark Clements

Created: 2016-11-26 Sat 19:04

Validate