I encounter using "effect" from effects package. My goal is to extract the values of the fitted model for some values of my predictor. The problem is for a mixed model with quadratic predictors but it can be reproduced with a simple linear model.
Let's consider the following generated data :
y=rnorm(n = 12,mean = 10,sd = 3)time=rep(c(0,1,6,10),3)df=data.frame(time,y)
Now I fit a linear model and get the effect of "time" with the effect function :
model=lm(y~time, data=df)fx=effect("time", model)
I was assuming I could get the values of the model for my 4 time values with :
time=fx$xvalues=fx$fit
But instead of my 4 time points fx$x returns a time vector with : 0 2 5 8 10
I don't understand why (but my guess is that I'm doing it wrong). I just wand to get the values of the model for my time points (0,1,6,10). How can I do (that will work too with a lme4::lmer model)?
Thanks in advance