repeated measures with missing data
Dear Rafael, The line below had one closing bracket to much. The line below should work. am2 <- lmer(dv ~ myfactor + (1|subject), data = mydata) Furthermore I would advise to change myfactor for a character variable to a factor. HTH, Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics & Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx at inbo.be www.inbo.be 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
-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] Namens Rafael Diaz
Verzonden: maandag 5 juli 2010 3:37
Aan: r-help at r-project.org
Onderwerp: [R] repeated measures with missing data
Dear R help group, I am teaching myself linear mixed models
with missing data since I would like to analyze a stats
design with these kind of models. The textbook example is for
the procedure "proc MIXED" in SAS, but I would like to know
if there is an equivalent in R. This example only includes
two time-measurements across subjects (a t-test "with missing
values"), but I will need to to this with three
time-measurements (repeated measures ANOVA with missing values):
Patient Treatment
A B
1 20 12
2 26 24
3 16 17
4 29 21
5 22 N/A
6 N/A 12
I have tried this analysis using using the instructions below
with the help of "Mixed-Effects Models in S and S-Plus", but
have not been able to go around the missing data issue as follows:
tmtA <- c(20,26, 16,29,22,NA)
tmtB <- c(12,24,17,21,NA,17)
require(lme4)
dv <- c(20,12,26,24,16,17,29,21,22,17)
subject <- rep(c("s1","s2","s3","s4","s5","s6"),each=2)
subject <- subject[-c(10,11)]
myfactor <- rep(c("f1","f2"), 6)
myfactor <- myfactor[-c(10,11)]
mydata <- data.frame(dv, subject, myfactor)
am2 <- lmer(dv ~ myfactor + (1|subject)), data = mydata)
summary(am2)
anova(am2)
subject <- subject[-c(10,11)]
Any help would be greatly appreciated. Thank you,
Rafael Diaz
Assistant Professor
Math and Stats Dept
California State University Sacramento
[[alternative HTML version deleted]]
______________________________________________ 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.
Druk dit bericht a.u.b. niet onnodig af. Please do not print this message unnecessarily. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.