Does anyone know how to use BRR weights in Lumley’s survey package for estimating variance if your dataset already has BRR weights it in?
I am working with PISA data, and they already include 80 BRR replicates in their dataset. How can I get as.svrepdesign to use these, instead of trying to create its own? I tried the following and got the subsequent error:
dstrat <- svydesign(id=~uniqueID,strata=~strataVar, weights=~studentWeight,
data=data, nest=TRUE)
dstrat <- as.svrepdesign(dstrat, type="BRR")
Error in brrweights(design$strata[, 1], design$cluster[, 1], ...,
fay.rho = fay.rho, : Can't split with odd numbers of PSUs in a stratum
Any help would be greatly appreciated, thanks.
no need to use
as.svrepdesign()if you have a data frame with the replicate weights already 🙂 you can create the replicate weighted design directly from your data frame.say you have data with a main weight column called
mainwgtand 80 replicate weight columns calledrepwgt1throughrepwgt80you could use this —— this way, you don’t have to identify the exact column numbers. then you can run normal survey commands like —
if you’d like another example, here’s some example code and an explanatory blog post using the current population survey.