[R] AFT model time-dependent with weibull distribution
javier palacios
xpfenech at gmail.com
Fri Aug 19 14:55:33 CEST 2011
Dear R-community,
I have tried to estimate an accelerated failure time(AFT) and proportional
hazard (PH) parametric survival model with time-independent and
time-dependent covariates. For that purpose, I have used the eha package.
Please, consider this example:
weibullph <- phreg(Surv(sta,time,S) ~ TDC1 + TIC1, dist="weibull",
data.frame=Data)
weibullaft<-aftreg(Surv(sta,time,S) ~ TDC1 + TIC1, dist="weibull",
data.frame=Data)
## aftreg gives error when I add ID argument...
Error in aftreg.fit(X, Y, dist, strats, offset, init, shape, id, control, :
Overlapping intervals for id 2
>From help(aftreg): id If there are more than one spell per individual, it is
essential to keep spells together by the id argument. This allows for
time-varying covariates.
data table:
Data
S sta time TDC1 total_time TIC1 ID
A 1 0 1 48.50 1 1 1
B 0 0 1 65.96 2 1 2
B 1 1 2 65.08 2 1 2
C 0 0 1 0.00 2 4 3
C 1 1 2 0.00 2 4 3
D 0 0 1 72.74 2 5 4
D 1 1 2 72.52 2 5 4
E 0 0 1 61.84 2 3 5
E 0 1 2 60.56 2 3 5
F 0 0 1 35.04 4 2 6
F 0 1 2 36.97 4 2 6
F 0 2 3 37.92 4 2 6
F 1 3 4 39.01 4 2 6
time - time to event
sta - starting time
TDC - time dependent covariates
TIC - time independent covariate
total_time - total time at risk
ID - ID
1- What happens if the ID is not included?
2- How can I solve this error?
3- Why the phreg function does not need an ID?
Thanks,
Javier
--
View this message in context: http://r.789695.n4.nabble.com/AFT-model-time-dependent-with-weibull-distribution-tp3755079p3755079.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list