calibratr | R Documentation |
given the popn dataset, the survey dataset, and a formula describing the calibration equation, produce calibration weights
calibratr(fml, pdat, pweight, sdesign, calfun = "linear")
fml |
formula describing the calibration design (NB: this relies on varnames and levels being the same in pdat and sdat) |
pdat |
population-level data |
pweight |
weights for adding up rows of population-level data |
sdesign |
survey design object for survey dataset (see survey package) |
calfun |
optional arg for survey package's calibrate fn |
Note that if you get warnings when running this, that may be a sign that the survey data have missingness on some of the calibration variables. Missingness will also cause total calibrated weights to differ from total un-calibrated weights.
a vector of calibrated weights
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.