modifyPropsContinuous: Runs modifyProps on a continuous variable Takes a continuous...

View source: R/modifyProps.r

modifyPropsContinuousR Documentation

Runs modifyProps on a continuous variable Takes a continuous variable, converts it to a categorical variable using the binbreaks, modifyProps is then called on that categorical variable. The categorical variable is then converted back to a continuos variable using the catToContModels

Description

Runs modifyProps on a continuous variable Takes a continuous variable, converts it to a categorical variable using the binbreaks, modifyProps is then called on that categorical variable. The categorical variable is then converted back to a continuos variable using the catToContModels

Usage

modifyPropsContinuous(
  x.cont,
  desired_props,
  catToContModels,
  cont.binbreaks,
  propens = NULL,
  logiset = NULL,
  accuracy = 0.01,
  envir = parent.frame()
)

Arguments

x.cont

a continuous variable to be adjusted

desired_props

desired proportions

catToContModels

a list of models which will to used to convert the adjusted categorical variable back to continuous

cont.binbreaks

binbreaks for the continuous variable to be adjusted

propens

matrix or vector of the propensity scores for each child For binary variables there is one column of propensity scores: the propensities to change from a 0 to a 1. For categorical variables with more than two categories there are multiple columns of propensity scores: E.g. for a three category variables the propensities to change from category 1 to category 2 are in the first column and the propensities to change from category 2 to category 3 are in the second column.

logiset

logical vector indicating which observations to include, or NULL to include all.

accuracy

gives how close the end proportions are allowed to be away from the desired proportions before an error message is given - the default is 0.01. If the '.accuracy' global variable exists, its value will be used instead of that in function call.

envir

environment in which to evaluate model variables.

Value

an 'adjusted' continuous variable that if binned will have the same proportions as requested in desired_props


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