[R] AFTREG with ID argument
Philipp Rappold
philipp.rappold at gmail.com
Fri Feb 5 12:24:26 CET 2010
Dimitris,
thanks for the hint, I'll definitely give it a shot later.
But for now it would be great to understand the aftreg arguments
first :)
All the best
Philipp
Dimitris Rizopoulos wrote:
> In case this time-dependent covariate is an internal time-dependent
> covariate (aka endogenous time-dependent covariate), you can use the
> jointModel() function from package JM, with the option "weibull-AFT-GH"
> for the 'method' argument.
>
> For more information you may have a look at:
> http://rwiki.sciviews.org/doku.php?id=packages:cran:jm
>
>
> I hope it helps.
>
> Best,
> Dimitris
>
>
> Philipp Rappold wrote:
>> Dear all,
>>
>> I have some trouble using the "id"-argument with aftreg (accelerated
>> failure time regression analysis from the eha library).
>>
>> As far as I understand it, the id argument is used to group
>> individuals together if there are time-varying covariates and the data
>> is arranged in counting process style.
>>
>> Unfortunately, i cannot figure out how to use the "id"-argument. The
>> most straight-forward way would be to simply state the grouping
>> variable, but it throws an error. I've included an example below: the
>> dataframe for regression is called "test", with the grouping variable
>> "person".
>>
>> > test
>> start end censor person var1
>> 1 0 1 0 1 0.5
>> 2 1 2 0 1 0.4
>> 3 2 3 0 1 0.6
>> 4 3 4 1 1 -0.3
>> 5 0 1 0 2 0.6
>> 6 1 2 0 2 0.7
>> 7 2 3 0 2 0.6
>>
>> > fit <- aftreg(Surv(start, end, censor)~var1, data=test, id=person)
>> Error in order(id, Y[, 1]) : argument 1 is not a vector
>>
>> > fit <- aftreg(Surv(start, end, censor)~var1, data=test,
>> id=test["person"])
>> Error in `[.data.frame`(id, ord) : undefined columns selected
>>
>>
>>
>> What would be the correct way to fit this example model?
>>
>> Thanks + all the best
>> Philipp
>>
>> ______________________________________________
>> 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.
>>
>
More information about the R-help
mailing list