I'm trying to predict for the model, yet it is showing an error:
Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) :
variable lengths differ (found for 'Welfare.Measurment')
The test and train data are similar, same name and structure of variables. I even tried to rbind
the two data frames, but the error persists.
Here is the code:
model3 <- lm(log(Poverty.Line.Day) ~ (log(data_abs$Median)) +
Welfare.Measurment + Control, data=data_abs)
predicted_poverty_Line <-
exp(predict(model3, dataF))*exp((summary(model3)$sigma)^2/2)