Conversation
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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
nalimilan
commented
Jan 3, 2026
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. |
Member
Author
There was a problem hiding this comment.
@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?
nalimilan
commented
Jan 3, 2026
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. |
Member
Author
There was a problem hiding this comment.
@gragusa This paragraph is worth checking too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Develop documentation about weights. Add docstrings for
vcovandstderror. Move implementation and comparison with R to separate page and mention weights. Showusinglines in examples instead of running them in a hidden block so that users can reproduce them. Also improve various details.