getSample: Generates Data

Description Usage Arguments Details Value Author(s) References Examples

Description

Generates a run of simulated observations of the form (W,G,A,Y,Y1,Y0) under the specified treatment mechanism.

Usage

1
2
3
getSample(n, tm = oneOne, rule = NULL, piV = c(1/2, 1/3, 1/6), 
    family = c("beta", "gamma"), Qbar = Qbar1, Vbar = Vbar1, 
    what, slice.by = n)

Arguments

n

An integer, the number of observations to be generated.

tm

A function describing the treatment mechanism to be employed. Defaults to the balanced (1:1) treatment mechanism, ie, function oneOne. The G column equals the vector tm(W).

rule

Either 'NULL' (default value) or a function describing the rule to be employed when what equals "MOR". In that case, it must be a function of W with values in \{0,1\}. If what equals "MOR" and rule is 'NULL', then the optimal treatment rule is used.

piV

Marginal distribution of V. Defaults to c(1/2, 1/3, 1/6).

family

A character, either "beta" (default) or "gamma", the nature of the law of outcome.

Qbar

A function, the conditional expectation of Y given (A,W). Defaults to Qbar1.

Vbar

A function, the conditional variance of Y given (A,W). Defaults to Vbar1.

what

A character. If it is not missing then it must be equal to either "ATE" (Average Treatment Effect) or "MOR" (Mean under the Optimal treatment Rule). In that case, ONLY estimates of the true parameter and optimal standard deviation under the specified simulation scheme (and, possibly, treatment mechanism) are computed and returned.

slice.by

An integer. If it is smaller than argument 'n', then the simulation is decomposed into 'n%/%slice.by' smaller simulations of 'slice.by' observations and one of 'n%%slice.by' observations. Defaults to 'n' (ie, no decomposition). Mainly for internal use.

Details

By default, implements the same simulation scheme as in Chambaz, van der Laan, Scand. J. Stat., 41(1):104–140 (2014).

Value

If what is 'NULL' then returns a data.frame of observations with columns Y1 and Y0 (counterfactual outcomes), Y (actual outcome), A (assigned treatment), G (the conditional probability that A=1 given W), the rest being interpreted as covariates. Otherwise, returns the estimated true parameter value and standard deviation of the efficient influence curve under the specified simulation scheme and treatment mechanism, if 'what' equals "ATE", or the standard deviationS of the efficient influence curve under the specified simulation scheme and (i) treatment mechanism and (ii) either the treatment rule given by argument rule or the optimal treatment rule, if 'what' equals "MOR".

Author(s)

Antoine Chambaz [aut, cre]

References

Chambaz, van der Laan, Scand. J. Stat., 41(1):104–140 (2014).

Examples

1
2
3
4
5
6
## Setting the verbosity parameter
library(R.utils)
log <- Arguments$getVerbose(-8, timestamp=TRUE)

##
obs <- getSample(10)

achambaz/tsml.cara.rct documentation built on May 10, 2019, 5:10 a.m.