R/discrete-survival-haplo.R
interval.logitsurv.discrete.Rd
$$ logit(P(T >t | x)) = log(G(t)) + x \beta $$ $$ P(T >t | x) = \frac{1}{1 + G(t) exp( x \beta) } $$
interval.logitsurv.discrete(
formula,
data,
beta = NULL,
no.opt = FALSE,
method = "NR",
stderr = TRUE,
weights = NULL,
offsets = NULL,
exp.link = 1,
increment = 1,
...
)
formula
data
starting values
optimization TRUE/FALSE
NR, nlm
to return only estimate
weights following id for GLM
following id for GLM
parametrize increments exp(alpha) > 0
using increments dG(t)=exp(alpha) as parameters
Additional arguments to lower level funtions lava::NR optimizer or nlm
This is thus also the cumulative odds model, since $$ P(T \leq t | x) = \frac{G(t) \exp(x \beta) }{1 + G(t) exp( x \beta) } $$
The baseline \(G(t)\) is written as \(cumsum(exp(\alpha))\) and this is not the standard parametrization that takes log of \(G(t)\) as the parameters.
Input are intervals given by ]t_l,t_r] where t_r can be infinity for right-censored intervals When truly discrete ]0,1] will be an observation at 1, and ]j,j+1] will be an observation at j+1
Likelihood is maximized: $$ \prod P(T_i >t_{il} | x) - P(T_i> t_{ir}| x) $$
data(ttpd)
dtable(ttpd,~entry+time2)
#>
#> time2 1 2 3 4 5 6 Inf
#> entry
#> 0 316 0 0 0 0 0 0
#> 1 0 133 0 0 0 0 0
#> 2 0 0 150 0 0 0 0
#> 3 0 0 0 23 0 0 0
#> 4 0 0 0 0 90 0 0
#> 5 0 0 0 0 0 68 0
#> 6 0 0 0 0 0 0 220
out <- interval.logitsurv.discrete(Interval(entry,time2)~X1+X2+X3+X4,ttpd)
summary(out)
#> Estimate Std.Err 2.5% 97.5% P-value
#> time1 -2.0064 0.1523 -2.30496 -1.7079 1.273e-39
#> time2 -2.1749 0.1599 -2.48838 -1.8614 4.118e-42
#> time3 -1.4581 0.1544 -1.76071 -1.1554 3.636e-21
#> time4 -2.9260 0.2453 -3.40677 -2.4453 8.379e-33
#> time5 -1.2051 0.1706 -1.53946 -0.8706 1.633e-12
#> time6 -0.9102 0.1860 -1.27468 -0.5457 9.843e-07
#> X1 0.9913 0.1179 0.76024 1.2223 4.100e-17
#> X2 0.6962 0.1162 0.46847 0.9238 2.064e-09
#> X3 0.3466 0.1159 0.11941 0.5738 2.788e-03
#> X4 0.3223 0.1151 0.09668 0.5478 5.111e-03
pred <- predictlogitSurvd(out,se=FALSE)
plotSurvd(pred)