View source: R/CategoricalAdjustment.r
createAdjustmentMatrices | R Documentation |
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.
createAdjustmentMatrices(cat.varnames, dict, rows)
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 |
Create empty categorical variable adjustment matrices for specified number of iterations. Initial matrix values are NA (i.e: no adjustment).
A list of empty categorical variable adjustment matrices
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.