[R] a simple mixed model
peter dalgaard
pdalgd at gmail.com
Sun May 27 09:09:58 CEST 2012
On May 27, 2012, at 07:12 , array chip wrote:
> Hi, I was reviewing a manuscript where a linear mixed model was used. The data is simple: a response variable "y" was measured for each subject over 3 time points (visit 1, 2 and 3) that were about a week apart between 2 visits. The study is a non-drug study and one of the objectives was to evaluate the repeatability of response variable "y".
>
>
> The author wanted to estimate within-subject variance for that purpose. This is what he wrote "within-subject variance was generated from SAS 'Prog Mixed' procedure with study visit as fixed effect and subject as random effect". I know that the study visit was a factor variable, not a numeric variable. Because each subject has 3 repeated measurements from 3 visits, how can a model including subject as random effect still use visit as fixed factor? If I would do it in R, I would just use a simple model to get within-subject variance:
>
> obj<-lmer(y~1+(1|subject),data=data)
>
> What does a model "obj<-lmer(y~visit+(1|subject),data=data)" mean?
>
> appreciate any thoughts!
Sounds like a pretty standard two-way ANOVA with random row effects.
If the design is complete (M x K with K = 3 in this case), you look at the row and column means. An additive model is assumed and the residual (interaction) is used to estimate the error variance.
The variation of the row means is compared to the residual variance. If tau is the variance between row levels, the variance of the row means is sigma^2/K + tau, and tau can be estimated by subtraction.
The column averages can be tested for systematic differences between visits with the usual F test. A non-zero effect here indicates that visits 1, 2, 3 have some _systematic_ difference across all individuals.
For an incomplete design, the model is the same, but the calculations are less simple.
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help
mailing list