Can anybody explain why predict
does not work with speedglm
?
Working code:
library(speedglm)
mtcars2<-mtcars
mtcars2$gear<-as.factor(mtcars2$gear)
mtcars_train<-mtcars2[1:10,]
mtcars_test<-mtcars2[11:nrow(mtcars2),]
model<-speedglm(formula = cyl ~ gear,data = mtcars_train,family=poisson(link="log"))
pred<-predict(object = model, newdata = mtcars_test)
pred
I get only NA's.
Is it possible to modify the class of the glm
object such that it uses the regular predict
function? I mean, the speedglm
object is the same form as a regular glm
object, right?
class(model)
#[1] "speedglm" "speedlm"