calibrationMarginStats: Stats for initial weights, calibrated weights, and margins.

View source: R/calmarFunctions.R

calibrationMarginStatsR Documentation

Stats for initial weights, calibrated weights, and margins.

Description

Gives stats about the calibration process: differences between totals after/before calibration and margins. Totals for categorical variables are displayed in percentages. (same as first panels output in Calmar/Calmar 2) Output is a list, which might not be convenient for exports (e.g. for integration into a scientific report). In such cases, use function marginStats, which outputs a dataframe.

Usage

calibrationMarginStats(
  data,
  marginMatrix,
  popTotal = NULL,
  pct = FALSE,
  colWeights,
  colCalibratedWeights = NULL,
  calibThreshold = 1
)

Arguments

data

dataframe containing the survey data

marginMatrix

matrix of margins

popTotal

total of population, useful if margins are entered in relative value

pct

Set this to true if margins for categorical variables are written in percentages

colWeights

name of weights column in the dataframe

colCalibratedWeights

name of calibrated weights column in the dataframe (if applicable)

calibThreshold

If difference between calibration estimate and margin differ more than this parameter, calibration is considered to have failed

Value

List containing stats on weights and margins

See Also

marginStats


icarus documentation built on May 31, 2023, 9:43 p.m.