leeper / margins

An R Port of Stata's 'margins' Command
https://cloud.r-project.org/package=margins
Other
260 stars 39 forks source link

T score as opposed to z score for survey data #145

Open mollypak opened 4 years ago

mollypak commented 4 years ago

Hi, I see someone requested this before, and you said it doesn't seem worth it, but in order to get the correct p value and standard errors for complex survey designs (and to do what both STATA and I believe SUDAAN uses when calculating predictive margins), using the t score instead of the z score is important. I would like to ask you to possibly reconsider adding this option?

I know some parts of the survey package will do a df=Inf as a default and always use the t distribution, so that the results are the same as a z score, but can be altered, or df= degf(design). I am not sure how you wrote your code, but if a t score was always the default for results from svyglm, that would be very nice.

leeper commented 4 years ago

I didn't implement this mainly because I didn't (and still don't) have time to do it and write the tests needed to make sure it's all correct. If you're keen, please send a PR.