I would like to find the predicted values from my glm.nb
model. But it is returning errors. This was not fixed when I made the input dataframe to predict 3 columns of dates called date, date2 and date3. The output I want is a vector of 100 predicted values. Model-fitting data should positive count data and dates.
model_nb <- glm.nb(cases ~ date, date2, date3, data=data)
dates <- seq(50,100,length=100)
preds3 <- predict(model_nb, newdata=data.frame(date=dates), se.fit=TRUE, type='response')
The error message is:
Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) : variable lengths differ (found for 'date2')