[R] How to plot fitted values from lmer (lme4 package)?

jebyrnes jebyrnes at ucdavis.edu
Fri Feb 15 08:04:25 CET 2008


The trick is to use the fitted() function, not predict(), to get your fitted
values.  You should then be able to use that vector of values in just the
same way that you use your current mean values as below.


Darren Norris wrote:
> 
> 
> lmodel<-with(a_dataframe,lm(mean_ind~sin(time*2*pi)+cos(time*2*pi)))
> plot(time,a_dataframe$mean_ind,pch=".")
> lines(time,predict(lmodel))
> 
> How can I do the same with lmer? I have tried a variety of things with
> “predict”, trying to put the results from lmer as a “groupedData” object
> etc. But I can’t seem to make it work. Any simple solutions? 
> Many thanks for any help.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-plot-fitted-values-from-lmer-%28lme4-package%29--tp15492920p15495816.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list