Error in model.frame.default()

I am trying to predict in lm model, but when a use predict it does not work

THIS IS MY CODE
modelo1=lm(Y~X11 + X3 + X6 + X5 + X2, data=Datos1)
summary(modelo1)

newdata1=data.frame(X2=150, X3="Rutas de la universidad", X5=200, X6="Sin ingresos", X11=0)
predict(modelo1,
newdata=newdata1,
interval="confidence",
level=0.95)

Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) :
factor X6 has new level Sin ingresos

Does your original data, Datos1, have any values of "Sin ingresos" in the X6 column? The error suggests that it does not.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.