Svetlana Ratushnyak
Svetlana Ratushnyak

Reputation: 25

to predict values in lme4

I used library(lme4) to build my model. The model is

modTTO <- lmer(as.numeric(`TTO value`) ~ mo2+mo3+sc2+sc3+ua2+ua3+pd2+pd3+ad2+ad3 + (1 | internal_id), TTO, REML=FALSE)

Now I want to predict values for 81 states in a new data frame. I tried predicted$values<-predict(modTTO, type="response")

I got an error

Error in $<-.data.frame(*tmp*, values, value = c(-0.252543831995977, : replacement has 3000 rows, data has 81

How do I predict values for these particular 81 states.

Thank you!

Upvotes: 0

Views: 87

Answers (1)

alexwhitworth
alexwhitworth

Reputation: 4907

Please read the help documentation on predict before posting. This is clearly described there.

predicted$values <- predict(modTTO, newdata= predicted, type= 'repsonse')

Upvotes: 1

Related Questions