Skip to content

rigr + survey weights (advice for future users) #150

@adw96

Description

@adw96

The issue here is that the documentation for weights should be updated to give guidance on using survey weights.

Someone wrote recently about using survey weights from survey::svydesign() as the input to the weights argument for rigr::regress(). Their reasoning for doing so was that rigr gives robust errors, which they wanted.

It turns out that survey:: svyglm does give robust standard errors, even though they aren't labeled as such. From the docs: "svyglm always returns 'model-robust' standard errors; the Horvitz-Thompson-type standard errors used everywhere in the survey package are a generalisation of the model-robust 'sandwich' estimators. In particular, a quasi-Poisson svyglm will return correct standard errors for relative risk regression models."

Therefore, when working with survey weights, we recommend that you just use svyglm(), not regress(), and keep in mind that you do get robust errors from svyglm().

FYI, the only reason why standard errors differ between svyglm() and regress() with svydesign(id=~1, ...) is because From Thomas Lumley "regress() [covariances] is scaled by n/(n-p), where p is the number of predictors in the model. This is not used by svyglm() because it doesn't generalise well to cluster sampling."

Similarly, svycontrast can be used instead of lincom with svyglm objects.

I hope this helps folx working with survey weights in future!

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions