Reputation: 125
I'm using the function svyVGAM::svy_vglm
to run a multinomial model with survey weights:
mmodel <- svy_glm(y~x1+x2+x3+x4..., family=multinomial, design=w_data)
where x
represent categorical variables, some with three or more levels. Through model summary, I can know the p-value for each coefficient, but I don't know how to get the p-value for the global variable.
In other contexts, anova()
, waldtest()
, lrtest()
, ... could be used, but none of them seem to work with svy_vglm objects. tbl_regression
does not work either: Error: No tidy method for objects of class svy_vglm
.
Any help?
Thanks
Upvotes: 1
Views: 567
Reputation: 2765
You can do this using the coef
and vcov
methods. There's probably a package, but it's not hard to program
Suppose that model
is your model object, design
is your survey design object and index
is a vector with the positions of the coefficients you want to test. If you had ten coefficients and wanted to test all except the first two, you would have index<-3:10
, for example.
beta<-coef(model)[index]
V<-vcov(model)[index,index]
teststat <- crossprod(beta, solve(V,beta))
pf(teststat, df1=length(beta), df2=degf(design), lower.tail=FALSE)
This doesn't give you a likelihood ratio test; you'd probably need to write to the package author and suggest that as a new feature.
Upvotes: 2