leeper / prediction

Tidy, Type-Safe 'prediction()' Methods
https://cran.r-project.org/package=prediction
Other
89 stars 14 forks source link

can't produce summary stats for svyglm objects #52

Open mattysimonson opened 3 years ago

mattysimonson commented 3 years ago

The documentation claims to be able to handle svyglm models from the survey library, and indeed, the prediction() does calculate point estimates and standard errors. However, the library seems unable to summarise these results. Here is an example based on an example in the svyglm function documentation.

data(api)
dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)
api.reg <- svyglm(api.stu~enroll, design=dstrat)

p1 <- predict(api.reg, type = "response", se.fit = T)
mean(p1)

p2 <- prediction(api.reg)
summary(p2)

When I run this in R 3.6.3 on a macOS Mohave 10.14.4 I get

Prediction SE z p lower upper 621.5 NA NA NA NA NA