[R] the problem about sample size

Petr PIKAL petr.pikal at precheza.cz
Mon Mar 5 08:21:25 CET 2012


Hi

I am not at all an expert in this matter, so you shall copy you message to 
r-help list too. However I would try na.action=na.exclude as it shall 
preserve the length of variables.

Regards
Petr 

> 
> Hi,
> 
> Sorry I didn't know the original post in this thread was not included. 
I'm
> using R version 2.14.0 (2011-10-31).
> 
> This is the program:
> 
> fitLME4 <- lme(iadl ~ obstime,
> random = ~ obstime | id, data = iadl.long.df, na.action=na.omit)
> fitSURV <- coxph(Surv(Time, death) ~ agew1, data = last_aa.df, x = TRUE) 

> fit.JM4 <- jointModel(fitLME1, fitSURV, timeVar = "obstime", method = 
> "piecewise-PH-GH")
> 
> This is the error message:
> 
> Error in jointModel(fitLME1, fitSURV, timeVar = "obstime", method = 
> "piecewise-PH-GH") : 
>   sample sizes in the longitudinal and event processes differ; maybe you 

> forgot the cluster() argument.
> 
> I have missing data in the lme data and that's why I used na.omit. But 
> results of the lme and coxph show the same number of participants.
> 
> From lme:
> Number of Observations: 4818
> Number of Groups: 2087 
> 
> From coxph:
> n= 2087, number of events= 1721 
> 
> If the number of groups in lme = n in coxph, why am I getting the error 
> message that sample sizes differ?
> 
> Many thanks for your help.
> 
> Helena
> 
> ________________________________________
> From: Petr PIKAL [petr.pikal at precheza.cz]
> Sent: Thursday, March 01, 2012 6:17 PM
> To: Helena Chui
> Cc: r-help at r-project.org; r-help-bounces at r-project.org
> Subject: Re: [R] the problem about sample size
> 
> Hi
> >
> > Hi, there,
> >
> > I run into the same sample size error in JM. Have you found the 
solution
> for
> > the error?
> 
> What error?
> Petr
> 
> >
> > Many thanks,
> > Helena
> >
> > --
> > View this message in context: 
http://r.789695.n4.nabble.com/the-problem-
> > about-sample-size-tp1592855p4434009.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.



More information about the R-help mailing list