Open ahcombs opened 1 year ago
Thanks for the report. For the moment, as I suppose is obvious given the behavior of the package, survey weights are not "officially" supported. There are some complexities with regard to the best way to use sampling weights with multilevel models, both computationally and conceptually. Right now, the weights are being passed on to lme4
but errors may be coming from various origins like the pre-processing functions in panelr
removing or changing the weights column. I'll look into this again because I wanted to offer at least some level of support for survey weights and at the time panelr
was first developed, there was an in-progress package being made for fitting multilevel models with survey weights. I'll check in on that or otherwise give users better feedback when they try to use weights.
Hi Jacob,Thanks so much for your response, and for the heads up about the complexities involved. I looked into it a little further after posting this and it seems to me like the error is arising in the panelr preprocessing steps—specifically, the quoting/unquoting of the column name appears to not be working correctly, yielding in some cases a column where all the values are the column name string (I don’t have line numbers in front of me at the moment, apologies). I couldn’t quickly find the fix, but it seemed like something that would probably be simple for someone more familiar with quosures etc than me. Best wishes,AidanOn Jan 12, 2023, at 9:38 AM, Jacob Long @.***> wrote: Thanks for the report. For the moment, as I suppose is obvious given the behavior of the package, survey weights are not "officially" supported. There are some complexities with regard to the best way to use sampling weights with multilevel models, both computationally and conceptually. Right now, the weights are being passed on to lme4 but errors may be coming from various origins like the pre-processing functions in panelr removing or changing the weights column. I'll look into this again because I wanted to offer at least some level of support for survey weights and at the time panelr was first developed, there was an in-progress package being made for fitting multilevel models with survey weights. I'll check in on that or otherwise give users better feedback when they try to use weights.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
I need to model some data with survey weights, and it seems like the weights arguments in wbm and (especially) wbm_stan are not consistently working correctly. Different errors are thrown when estimating models depending on the function and on how weights are provided. Providing weights as a column name in string form does not work for wbm. Nothing that I've tried so far works for wbm_stan. I have reproduced the issue in the code below.
I am using R version 4.1.3 and panelr version 0.7.6.
I've been loving this package otherwise--the usage is straightforward and documentation is great. Thanks for your work!