[R] AFT model time-dependent with weibull distribution
Göran Broström
goran.brostrom at gmail.com
Fri Aug 19 23:42:42 CEST 2011
On Fri, Aug 19, 2011 at 2:55 PM, javier palacios <xpfenech at gmail.com> wrote:
> 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
Does not happen to me.
>
> >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
Duplicated rownames are no allowed.
>
> 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?
Read the documentation
> 2- How can I solve this error?
Read the documentation
> 3- Why the phreg function does not need an ID?
Read the documentation (and a good text book on survival analysis)
And please read the posting guide; the elementary information is missing.
>
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Göran Broström
More information about the R-help
mailing list