sim_cv: sim_cv

Description Usage Arguments Value Examples

View source: R/sim_functions.R

Description

Function that simulates data and performs TMLE estimates data is 4 covariates and binary treatment and outcome. The covariates are generated according to the gendata function.

Usage

1
2
3
sim_cv(n, g0, Q0, SL.library, SL.libraryG, method = "method.NNLS",
  cv = TRUE, V = 10, SL = 10L, gform, Qform, estimator, dgp = NULL,
  gendata.fcn)

Arguments

n,

sample size

g0,

treatment mechanism function, call g0_linear to see the format

Q0,

outcome model function, call Q0 linear to see the format–WILL be more generalized but for now rather limited

SL.library,

SuperLearner library for outcome predictions

SL.libraryG,

SuperLearner Library for treatment mechanism

method,

SuperLearner meta fitting method

cv,

set to TRUE for CV-TMLE

V,

number of folds for the CV tmle

SL,

number of folds for each superlearner

gform,

a linear form to specify for estimating pscore

Qform,

a linear form to specify for estimating outcome prediction

estimator,

a character vector containing any set of "single 1step" for one step tmle single param estimates for ATE and blip variance, "single iterative" for the same with iterative tmle, or "simul 1 step", "simul line", "simul full" to compute simultaneous estimates and CI's for ATE and blip variance. line, full and 1 step are just different targeting methods for tmle

dgp,

a list containing an element named DF for the data.frame with A, Y and covariates which are named whatever, BV0 and ATE0 for true blip variance and average treatment effect respectively.

Value

a vector with the following elements in this order: TMLE pt estimates and confidence intervals each with estimate, left and right bounds and initial estimates for BV and ATE Superlearner coefficients and risks for both pscore and outcome estimation, tmle pt estimates, CI's for BV and ATE for Qform model assumed plus initial estimates for these as well as pt estimates and CI's for BV and ATE using the delta method, ie sandwich estimator under non-parametric model

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# basic example with very simple SuperLearner library
SL.library = c("SL.glm", "SL.mean")
SL.libraryG = c("SL.glm", "SL.mean")
n=1000
g0 = g0_linear
Q0 = Q0_trig
gform = formula("A ~.")
Qform = formula("Y ~ A*(W1 + W2 + W3 + W4)")
estimator = c("single iterative")
result = sim_cv(n, g0, Q0, SL.library, SL.libraryG, method = "method.NNLS", 
                  cv = TRUE, V = 2, SL = 2L, gform, Qform, estimator, dgp = NULL)
          

jlstiles/sim.papers documentation built on May 23, 2019, 5:03 a.m.