Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporating survey weights #76

Open
fdabl opened this issue Nov 8, 2021 · 11 comments
Open

Incorporating survey weights #76

fdabl opened this issue Nov 8, 2021 · 11 comments

Comments

@fdabl
Copy link

fdabl commented Nov 8, 2021

Hi Donny,

I know the population joint distribution of some demographic variables (sex, education, gender) and would like to weight the sample in a way to match this population distribution. The package 'survey' allows this for simple statistics such as the mean as well as for general linear models. I guess that they weight the likelihood under the hood in a way to be consistent with the population distribution.

Do you have any plans of adding such a weighting functionality to BGGM? I think this would be a pretty cool feature! I guess one can do this in a 'hacky' way already by sampling the data according to the population joint distribution and estimating networks for each such sampled data set. My intuition is that this should give the correctly weighted result, in expectation. But the computations take a while, and the post-processing might be a bit annoying. So ideally one would incorporate this weighting in the estimation procedure.

Anyway, curious what you think!

Cheers,
Fabian

@donaldRwilliams
Copy link
Owner

hey !

Nice to hear from you :-)

I honestly have not consider that before, but think it is a great idea.

Can you take a look at the cov.wt function in base R to see if that would work ? If so, that would be rather straightforward to implement.

Other than that, I would need some ideas, papers describing some possible approaches, etc.

@fdabl
Copy link
Author

fdabl commented Nov 9, 2021

Same, thanks for your quick reply :-)

Yeah, that might indeed just work! This particular weighting business I'm talking about is called post-stratification. The R package 'survey' has some information on this (and many other things). This and this link also provide the basic idea.

Knowing the population distribution one wants to match, one could just provide BGGM with the relevant weights, and if you can incorporate them with e.g. cov.wt, I think that should be it!

@donaldRwilliams
Copy link
Owner

Cool.

One caveat is that I am not sure how that would work for binary or ordinal data, but I know it is possible (psych package takes weights).

Would implementing the cov.wt for Gaussian data work for you ?

That would be pretty straightforward, and the others would take altering the MCMC samplers.

@fdabl
Copy link
Author

fdabl commented Nov 11, 2021

I would need it for the copula model. I guess that's difficult? If so I'll give this the more computationally intensive resampling approach I mentioned above a shot for the time being.

@donaldRwilliams
Copy link
Owner

I have an idea to do it, but want to confirm it is correct.

Seems if weights are known, then can apply to latent data while sampling ?

I'll reach out to Peter Hoff and Joris to get their thoughts about that. If nothing else, I bet they have a solution.

I'll update here when I hear back

@fdabl
Copy link
Author

fdabl commented Nov 11, 2021

Fantastic, thank you! I think this post-stratification business would be a great addition to BGGM ;-)

@donaldRwilliams
Copy link
Owner

Agreed !

Email sent :-)

@donaldRwilliams
Copy link
Owner

well, looks like this is a tough question. The approach I mentioned kind of "feels" right..lol.. But not sure if I would want to implement it without knowing it was correct. Still waiting on one more response, and hopefully a solution will merge !

@fdabl
Copy link
Author

fdabl commented Nov 22, 2021

Thanks for your efforts, Donny! Any updates on this by any chance?

@donaldRwilliams
Copy link
Owner

Unfortunately, it seem a bit more involved than I had thought, and it would take some time to work out. Ill try to revisit when I get more time !

@fdabl
Copy link
Author

fdabl commented Nov 23, 2021

OK, sounds good. Thank you!

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

No branches or pull requests

2 participants