calibratr: Help calibrate survey weights to population totals

View source: R/calibrate.R

calibratrR Documentation

Help calibrate survey weights to population totals

Description

given the popn dataset, the survey dataset, and a formula describing the calibration equation, produce calibration weights

Usage

calibratr(fml, pdat, pweight, sdesign, calfun = "linear")

Arguments

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

Details

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.

Value

a vector of calibrated weights


dfeehan/calibratr documentation built on May 3, 2023, 4:05 a.m.