[R] a simple mixed model

peter dalgaard pdalgd at gmail.com
Sun May 27 11:28:39 CEST 2012


On May 27, 2012, at 10:10 , array chip wrote:

> Hi Peter, I might be unclear in my description of the data. Each patient was measured for a response variable "y" at 3 time points, there is no drug or other treatment involved. The objective was to examine the repeatability of the measurements of response variable "y". Since this is repeated measure, I thought it should be analyzed by a simple mixed model? When you suggested a MxK (K=3) design, what is M then?


Number of patients, what else? 

The basic point is that time (visit #) is treated as a "treatment" in a block design (which pretty obviously can't be randomized). This may or may not be relevant, but it won't hurt to include a null effect, except for the loss of a couple of DF.


> Thanks very much,
> 
> John
> 
> 
> 
> From: peter dalgaard <pdalgd at gmail.com>
> To: array chip <arrayprofile at yahoo.com> 
> Cc: "r-help at r-project.org" <r-help at r-project.org> 
> Sent: Sunday, May 27, 2012 12:09 AM
> Subject: Re: [R] a simple mixed model
> 
> 
> 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
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 

-- 
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