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

Multilevel data #51

Open
lucasxteixeira opened this issue Aug 3, 2023 · 2 comments
Open

Multilevel data #51

lucasxteixeira opened this issue Aug 3, 2023 · 2 comments

Comments

@lucasxteixeira
Copy link

Hello @ngreifer,
First, I want to thank you for the great effort you've put into this package.

I have a question that I'm not entirely sure is suited here: does WeightIt offer any support for IPW with multilevel data?
https://doi.org/10.1002/sim.5786
https://doi.org/10.1080/00273171.2021.1925521

I was wondering if it could be as straightforward as including a simple if clause with lme4::glmer instead of stats::glm.
In any case, if you believe it's a viable and worthwhile addition, I'd gladly implement this. Any guidance on where to begin would be immensely helpful.

Best regards,

@ngreifer
Copy link
Owner

ngreifer commented Aug 3, 2023

I have thought about it and attempted to implement it, but right now it is not supported. Unfortunately it is not as simple as detecting whether the model has a random effect and then supplying it to glmer() if it does. This is high on my list of features to add (probably the next big feature), so thank you for suggesting it and reminding me that there is demand for it. I've been focusing on MatchIt lately and haven't updated WeightIt in a while. I don't normally accept pull requests, but if you want to try making a version that supports multilevel PS I would consider it. For now, if you have multilevel data, you can always estimate the propensity scores with glmer() outside WeightIt and then supply the propensity scores to the ps argument of WeightIt or to get_w_from_ps().

@lucasxteixeira
Copy link
Author

Awesome, understood.
While I'm not a specialist in statistics and may not be familiar with every minor detail of the method, I am proficient in coding and can help with that aspect. I would just need some general directions of where to change (files, folders, ...) so that I can proper keep your current organization.

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

No branches or pull requests

2 participants