Dear John, lme() not longer requires a GroupedData object. You can directly use a data.frame which is easier to specify different models.
You want something like lme(value ~ time * group, random = ~ time|SS, data = data1) PS Note that the R-Sig-mixedmodels is more suited for this kind of question. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2016-08-25 0:46 GMT+02:00 John Sorkin <jsor...@grecc.umaryland.edu>: > I apologize for sending this message again. The last time I sent it, the > subject line was not correct. I have corrected the subject line. > > I am trying to run a repeated measures analysis of data in which each > subject (identified by SS) has 3 observations at three different times (0, > 3, and 6). There are two groups of subjects (identified by group). I want > to know if the response differs in the two groups. I have tried to used > lme. Lme tell me if there is a time effect, but does not tell me if there > is a group effect. Once I get this to work I will want to know if there is > a significant group*time effect. Can someone tell me how to get an estimate > for group. Once I get that, I believe getting an estimate for group*time > should be straight forward. The code I have tired to use follows. > Thank you, > John > > > # This is my data > > data1 > SS group time value baseline > 1 1 Cont 0 9.000000 9.000000 > 2 2 Cont 0 3.000000 3.000000 > 3 3 Cont 0 8.000000 8.000000 > 4 4 Inte 0 5.690702 5.690702 > 5 5 Inte 0 7.409493 7.409493 > 6 6 Inte 0 7.428018 7.428018 > 7 1 Cont 3 13.713148 9.000000 > 8 2 Cont 3 9.841107 3.000000 > 9 3 Cont 3 12.843236 8.000000 > 10 4 Inte 3 9.300899 5.690702 > 11 5 Inte 3 10.936389 7.409493 > 12 6 Inte 3 12.358499 7.428018 > 13 1 Cont 6 18.952390 9.000000 > 14 2 Cont 6 15.091527 3.000000 > 15 3 Cont 6 17.578812 8.000000 > 16 4 Inte 6 12.325499 5.690702 > 17 5 Inte 6 15.486513 7.409493 > 18 6 Inte 6 18.284965 7.428018 > > # Create a grouped data object. SS identifies each subject > > # group indentifies group, intervention or control. > > GD<- groupedData(value~time|SS/group,data=data1,FUN=mean) > > # Fit the model. > > fit1 <- lme(GD) > > cat("The results give information about time, but does not say if the > gruops are different\n") > The results give information about time, but does not say if the gruops > are different > > summary(fit1) > Linear mixed-effects model fit by REML > Data: GD > AIC BIC logLik > 74.59447 81.54777 -28.29724 > > Random effects: > Formula: ~time | SS > Structure: General positive-definite > StdDev Corr > (Intercept) 1.3875111 (Intr) > time 0.2208046 -0.243 > > Formula: ~time | group %in% SS > Structure: General positive-definite > StdDev Corr > (Intercept) 1.3875115 (Intr) > time 0.2208051 -0.243 > Residual 0.3800788 > > Fixed effects: value ~ time > Value Std.Error DF t-value p-value > (Intercept) 6.747442 0.8135067 11 8.294268 0 > time 1.588653 0.1326242 11 11.978601 0 > Correlation: > (Intr) > time -0.268 > > Standardized Within-Group Residuals: > Min Q1 Med Q3 Max > -1.11412947 -0.44986535 0.08034174 0.34615610 1.29943887 > > Number of Observations: 18 > Number of Groups: > SS group %in% SS > 6 6 > > > > > > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > Confidentiality Statement: > This email message, including any attachments, is for ...{{dropped:16}} ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.