[R] setting up LMER for repeated measures and how do I get a p value for my fixed effect, group?

Kingsford Jones kingsfordjones at gmail.com
Thu Jul 23 20:36:42 CEST 2009


On Thu, Jul 23, 2009 at 9:02 AM, John Sorkin<jsorkin at grecc.umaryland.edu> wrote:
> R 2.8.1
> Windows XP
>
> I am trying to analyze repeated measures data (the data are listed at the end of this Email message) and I need help to make sure that I have properly specified my model, and would like to know why lmer does not return a p value for Group, my fixed effect.
>

The model looks appropriate to me.  If you had more repeated measures
within subjects you might want to model the temporal correlation by
structuring the within-subject error covariance; the correlation
argument to nlme::lme accepts a variety of corClasses for this purpose
(e.g. AR1).

FAQ 7.35 provides a link to one explanation for why lmer omits p-values:

https://stat.ethz.ch/pipermail/r-help/2006-May/094765.html

However in your balanced, normal case you can get (in this case
identical) p-values using eith aov or lme:

fit2 <- aov(Value ~ Group + Error(SS), data = smallDS)
#or
library(nlme)
fit3 <- lme(Value ~ Group, data = smallDS, random = ~1|SS)

As you might have suspected from the lmer t-value close to 0, the
associated p-value is about .5.

hth,

Kingsford Jones

> My subjects are divided into two groups (variable GROUP), individual subjects are indicated by the variable SS, Value is the outcome measure, each subject has Value measured three times.
>
> I have used the following code:
>
> fit1<-lmer(Value~Group+(1|SS),data=smallDS)
> print(fit1)
>
> Linear mixed model fit by REML
> Formula: Value ~ Group + (1 | SS)
>   Data: Dataset
>   AIC   BIC logLik deviance REMLdev
>  284.8 290.4 -138.4    291.4   276.8
> Random effects:
>  Groups   Name        Variance Std.Dev.
>  SS       (Intercept) 1038.0   32.218
>  Residual              552.7   23.510
> Number of obs: 30, groups: SS, 10
>
> Fixed effects:
>                        Estimate Std. Error t value
> (Intercept)               152.87      15.63   9.778
> Group[T.ContSIRNAnoEGF]   -15.87      22.11  -0.718
>
> Correlation of Fixed Effects:
>            (Intr)
> G[T.CSIRNAE -0.707
>
>
> Questions:
> (1) Have I set up lmer properly to analyze the repeated measures data?
> (2) How can I get a p value for Group, my fixed effect?
>
>
>
>      Group SS Value
>  [1,]     2  1   127
>  [2,]     2  1   179
>  [3,]     2  1   159
>  [4,]     2  2   186
>  [5,]     2  2   173
>  [6,]     2  2   178
>  [7,]     2  3   117
>  [8,]     2  3   116
>  [9,]     2  3    70
> [10,]     2  4   176
> [11,]     2  4   149
> [12,]     2  4   138
> [13,]     2  5   100
> [14,]     2  5   105
> [15,]     2  5    82
> [16,]     1  6   142
> [17,]     1  6   195
> [18,]     1  6   222
> [19,]     1  7   218
> [20,]     1  7   178
> [21,]     1  7   147
> [22,]     1  8   135
> [23,]     1  8   162
> [24,]     1  8   177
> [25,]     1  9   104
> [26,]     1  9   102
> [27,]     1  9   121
> [28,]     1 10   135
> [29,]     1 10   121
> [30,]     1 10   134
>
>
> John David Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology
> 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 th...{{dropped:6}}
>
> ______________________________________________
> 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