Reputation: 7061
I am trying to predict
a glmer
object with an argument newparams
like this:
library(lme4)
set.seed(123)
df<-data.frame(id=sample(LETTERS[1:10], 50, T),
y=rbinom(50, 1, 0.3),
x1=rbinom(50, 1, 0.5),
x2=as.integer(rnorm(50, 40, 5)))
df<-df[order(df$id),]
fit<-glmer(y~x1+x2+(1|id), data=df, binomial)
predict(fit, newparams=list(theta=getME(fit, "theta"), beta=fixef(fit)))
Error in predict(fit, newparams = list(theta = getME(fit, "theta"),
unused argument (newparams = list(theta = getME(fit, "theta"), beta = fixef(fit)))
May somebody here know what's the reason?
Upvotes: 0
Views: 771
Reputation: 121608
I think you should set newdata
argument. This works fine :
predict(fit, newdata=df,
newparams=list(theta=getME(fit, "theta"), beta=fixef(fit)))
PS
using your code I get a different error:
Error: inherits(fr, "data.frame") is not TRUE
Upvotes: 2