[R] the problem about sample size

Helena Chui chui0009 at flinders.edu.au
Sun Mar 4 04:54:09 CET 2012


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.


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, there,
> I run into the same sample size error in JM. Have you found the solution
> the error?

What error?

> 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
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list