I'm struggling to translate codes from Stata to R. I want to do multilevel modeling with complex survey design in R, and I've done a lot of digging but I can't seem to find the perfect solution (or maybe I'm just not understanding codes).
Here's the Stata code:
svyset id_1, weight(wt_1) strata(strat_id)|| _n, weight(wt_2)
svy, subpop(subpopulation): melogit dep1 independent_vars || id_1: independent_vars2, or
In R, I've found BIFIEsurvey package, but I'm not sure if my code is parallel to Stata. Also there seems to be no option of subpopulation in R, so I'm wondering if there's alternative solutions.
model <- BIFIEsurvey::BIFIE.twolevelreg(BIFIEobj=data, dep = "dep1", formula.fixed=~ independent_vars, formula.random = ~ independent_vars2, idcluster = "strat_id", wgtlevel1 = "wt_1", wgtlevel2="wt_2", se = FALSE)
Thank you for any suggestions.