Skip to content

Improve documentation#632

Open
nalimilan wants to merge 2 commits intomasterfrom
nl/docs
Open

Improve documentation#632
nalimilan wants to merge 2 commits intomasterfrom
nl/docs

Conversation

@nalimilan
Copy link
Member

Develop documentation about weights. Add docstrings for vcov and stderror. Move implementation and comparison with R to separate page and mention weights. Show using lines in examples instead of running them in a hidden block so that users can reproduce them. Also improve various details.

Develop documentation about weights. Add docstrings for `vcov` and `stderror`.
Move implementation and comparison with R to separate page and mention weights.
Show `using` lines in examples instead of running them in a hidden block so
that users can reproduce them. Also improve various details.
@nalimilan nalimilan requested a review from andreasnoack January 3, 2026 21:26
@codecov
Copy link

codecov bot commented Jan 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.94%. Comparing base (8976b53) to head (4b538fa).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #632   +/-   ##
=======================================
  Coverage   96.94%   96.94%           
=======================================
  Files           8        8           
  Lines        1213     1213           
=======================================
  Hits         1176     1176           
  Misses         37       37           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +320 to +321
When the model is weighted with `ProbabilityWeights`, the sandwich estimator is used,
scaling by `nobs(x)/(nobs(x) - 1)` degrees of freedom.
Copy link
Member Author

@nalimilan nalimilan Jan 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gragusa It's not clear to me what justifies these degrees of freedom, nor why Stata uses a different approach. Would you have references about this in R's survey and Stata, and/or would you suggest wording improvements? These would be useful for users.

Am I right that this is completely different from the df.resid argument that can be passed to summary.svyglm?

Comment on lines +152 to +159
Using analytic weights corresponds to weighted least squares.
This gives the same results as R and Stata.

Probability weights give the same point estimates as analytic weights, but standard errors
and p-values are based on a sandwich (heteroskedasticity-robust) estimator.
This gives the same results as the R `survey` package with a simple survey design
without strata nor clustering, but differs from Stata with the `pweights` option, which
adopts the same approach but with a different assumption regarding degrees of freedom.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gragusa This paragraph is worth checking too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant