rstatlt
rstatlt

Reputation: 63

R: Classification table for svyglm (survey package)

I trying to do logistic regression analysis with 'survey' package.

I am struggeling with Classification table of my model.

design1 <- svydesign(ids = ~num, weights = ~weights, data = mydata, fpc=~nm, strata = ~strata1)

glm_m<- svyglm(var1 ~ sex + age1 + educat, design = design1, family = quasibinomial())

How should I continue to do a Classification table next? And second, after that calculate a Hosmer-Lemeshow Goodness of Fit (GOF) Test with a survey data?

Upvotes: 0

Views: 250

Answers (1)

Thomas Lumley
Thomas Lumley

Reputation: 2765

You'll need a classification to get a classification table. Suppose you want a threshold at 0.5. Then svytable to get a population table

design1<-update(design1, fittedp=fitted(design1))
design1<-update(design1, fittedclass= fittedp>0.5)
svytable(~var1+fittedclass, design1)

There are at least two different extensions of the Hosmer-Lemeshow test to survey data, but I don't know of an R implementation of either.

Upvotes: 1

Related Questions