tx_function_factory: Generate a function that makes treatment effects.

View source: R/calc_power.R

tx_function_factoryR Documentation

Generate a function that makes treatment effects.

Description

The function returned is a function that returns a vector of treatment impacts to go with passed vector of Y0 values. I.e., final function is of format: tx_function( Y0 ).

Usage

tx_function_factory(distribution, ATE = 0, rho = 0, tx_scale = 1, ...)

Arguments

distribution

A string name of a distribution. "constant" is a constant treatment effect. "scale" is a scaling of Y0. "rexp" and "rnorm" are those random distributions, generated independent of the Y0. "linear" is a linear function of Y0; see above.

ATE

the average treatment effect. Ignored by "scale" option.

rho

Strength of relationship between the control-side distribution and the individual treatment impacts (assuming variation in both). NOTE: Depending on the details of how individual impacts are generated, rho may not be a strict correlation. See details of the impact generation functions for more.

tx_scale

Scaling factor for impacts. For rexp and rnorm, final treatment effects will have this standard deviation, in expectation. to achieve desired standard deviation of impacts generated by tx_function by (default is 1). Ignored by "constant" and "scale" options.

...

Extra parameters to pass to distribution function (e.g., sd for rnorm).

Details

For the linear option, the impacts are a linear function of Y0 of

tau = ATE + rho Y0 + epsilon,

with epsilon normally distributed with standard deviation of tx_scale.

For rexp and rnorm, impacts are generated with the passed distribution, and then ordered so if they were transformed to a normal distribution they would have about a rho correlation with the passed outcomes.

For scale, the impact is simply a scaling of the Y0 by "rho". This is equivalent to setting ATE = 0 and tx_scale = 0 with "linear", above).

For constant, all parameters other than the ATE are ignored.

Value

A function of the form tx_function( Y0 ).


li-xinran/RIQITE documentation built on July 1, 2023, 6:58 p.m.