[R-sig-ME] Matrix of predicted values using lme or lmer

Ben Bolker bbolker at gmail.com
Sat Jun 23 21:30:43 CEST 2012


Matthew Smith <mts002 at ...> writes:

> 
> I am currently trying to used a mixed model to perform a Procrustes  
> Trajectory analysis on some shape data. I have 17 relative warps  
> scores as my dependent matrix accompanied by individual, treatment,  
> size, and day. Shape data was collected at 3 separate time points for  
> each individual, so this is a repeated measures design. Since I do not  
> want to analyze each relative warp separate, I have chosen to use  
> individual as a random effect along with my fixed effects.

> The procedure calls for a residual randomization, in which residual  
> values from a reduced model are added to the predicted values of the  
> full model.
> 
> The origin code use the lm function, but since I wanted to add random  
> effects, I am using lme. My problem lies in when I attempt to get a  
> matrix of predicted values rows=# of obs, cols=17 (each RW), it does  
> not match up.
> 
> I read several discussion forums online and other threads, but I  
> cannot seem to come up with a clear answer. Is there a predict command  
> for the lme function that will take into account both the fixed and  
> random effects? If not, is there one that just takes into account the  
> fixed effects?

  Without a reproducible example, it's a little hard to say.  The
predict method for lme definitely takes the random effects into account
(have you read ?predict.lme ?) -- whether the random effects are taken
into account or not depends on the 'level' argument: level=0 excludes
all random effects; the behavior defaults to including all random effects.

  In order to do a multivariate analysis with lme, I believe you will
need to convert your data to 'long form', i.e. each row will represent
a measurement of a particular warp score on a particular individual
at a particular time.  Someone here may be able to suggest a good reference
for doing this kind of multivariate analysis in lme (as I recall, it
is *not* covered thoroughly in Pinheiro and Bates 2000, which is otherwise
the standard reference text).

  Ben Bolker



More information about the R-sig-mixed-models mailing list