I am trying to use the mboost package in R to apply a multinomial logistic regression model. I found this example online but I added the "newdata = iris" in the predict function to see how the prediction formula worked in mboost for new data. I am getting an error however. First here is the code:
library(mboost)
### fitting multinomial logit model via a linear array model
X0 <- K0 <- diag(nlevels(iris$Species) - 1)
colnames(X0) <- levels(iris$Species)[-nlevels(iris$Species)]
mlm <- mboost(Species ~ bols(Sepal.Length, df = 2) %O%
buser(X0, K0, df = 2), data = iris,
family = Multinomial())
round(predict(mlm, type = "response", newdata = iris), 2)
The error I'm getting is as follows:
Error in [.data.frame
(newdata, nm) : undefined columns selected
I just re-used the iris data in the prediction just as a test but has anyone experienced this problem before?