createAdjustmentMatrix: Creates an empty adjustment matrix of NAs. An adjustment...

View source: R/CategoricalAdjustment.r

createAdjustmentMatrixR Documentation

Creates an empty adjustment matrix of NAs. An adjustment matrix contains cells for each categorical value across a supplied number of rows. Each row represents an iteration.

Description

Creates an empty adjustment matrix of NAs. An adjustment matrix contains cells for each categorical value across a supplied number of rows. Each row represents an iteration.

Usage

createAdjustmentMatrix(
  varname,
  coding = cont.binbreaks[-1],
  rows,
  is_a_level_var = is_level_var(varname),
  cont.binbreaks = NULL,
  catToContModels = NULL
)

Arguments

varname

variable name. This can be a standard variable name, eg: "catpregsmk2" or a level variable name, eg: "z1homeownLvl1".

coding

codings for the variable, eg: c('0'='Own home','1'='Not owned')

rows

row names, or a numeric scalar for the number of rows in which case the rows will be labelled "Year 1", "Year 2"... up to rows.

is_a_level_var

is this a multi-level binary variable? i.e: are the values for this variable stored in multiple binary variables, eg: SESBTHLvl1, SESBTHLvl2, SESBTHLvl3? Defaults to testing whether varname ends in LvlX.

cont.binbreaks

binbreaks for continuous variable. It is the scale to convert a continuous variable to categorical variable when we do adjustment on it.

catToContModels

It is the models that convert the adjustment on categorical variable (we convert from a continuous variable according to binbreaks) back to the correspongding continuous variable.

Value

a matrix of NAs with columns specified by codings, and rows specified by rows and a "varnames" attribute which specifies the variables that need to be adjusted. If varname is a level variable then this will contain all the individual binary level varnames, eg: "z1homeownLvl0", "z1homeownLvl1" otherwise it will just varname.


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