createAdjustmentMatrices: Categorical adjusment

View source: R/CategoricalAdjustment.r

createAdjustmentMatricesR Documentation

Categorical adjusment

Description

Before or during the simulation the user may wish to specify the proportion of category values desired for a simframe variable. Eg: a user may wish the proportion of home owners in year 2 to be 0.4, 0.6. Desired proportions can be specified in a categorical adjustment matrix in which rows = iterations. In the above example instead of simulating the home ownership variable in year 2, it will be set to the desired proportions 0.4, 0.6. A desired proportion of NA will leave the variable unchanged. If propensities are supplied they will be used to select which micro-units to adjust, otherwise the selection will be random Propensities are specified via the global list variable propensities.

Usage

createAdjustmentMatrices(cat.varnames, dict, rows)

Arguments

cat.varnames

names of vars to create adjustment matrices for. This can be a name of a single variable, eg: "catpregsmk2" or the name of a multi-level binary variable that eg: "z1accomLvl1". A multi-level binary variable will be part of a set eg: c("z1accomLvl0", "z1accomLvl1") of variables. Only one of the multi-level binary variables in the set need be specified. The others will be determined from the dictionary codings.

dict

Dictionary object. Used to name the columns of the adjustment matrices and also to determine the set of variables when a multi-level binary variable is supplied via cat.varnames.

rows

row names, or a numeric scalar for the number of rows number of iterations to create

Details

Create empty categorical variable adjustment matrices for specified number of iterations. Initial matrix values are NA (i.e: no adjustment).

Value

A list of empty categorical variable adjustment matrices


kcha193/simarioV2 documentation built on April 8, 2024, 4:51 p.m.