Description Usage Arguments Details Value Author(s) References See Also Examples
treatSens.BART
performs dual-parameter sensitivity analysis for unobserved confounding for binary treatment variables using Bayesian Additive Regression Trees (BART).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | treatSens.BART(formula,
trt.model = probitEM(),
theta = 0.5,
grid.dim = c(8, 4),
standardize = TRUE,
zero.loc = 1 / 3,
verbose = FALSE,
buffer = 0.0,
est.type = "ATE",
data = NULL,
seed = 1234,
nsim = 200,
nthin = 10,
nburn = 200,
nthreads = NULL,
spy.range = NULL,
spz.range = NULL,
trim.wt = 10,
benchmarking = "2SD")
|
formula |
an object of class |
trt.model |
an assumed fitting technique for the treatment model. The default is |
theta |
this option specifies the marginal probability that a binary unobserved confounder takes one, i.e. Pr(U = 1). The default is |
grid.dim |
the final dimensions of output grid. |
standardize |
logical. If |
zero.loc |
A parameter used to automatically determine the range of each axis by specifying at what point along the y=x line the "treatment effect=0" contour will cross it. The parameter specifies the fraction of the length of the y=x line that this intersection occurs relative to the entire length of the line segment. The default is |
verbose |
logical. If |
buffer |
restriction to range of coefficients on U to ensure stability around the edges. This option is rarely used. |
est.type |
one of three causal estimads – |
data |
an optional data frame. If not found in data, the variables are taken from |
seed |
random seed, passed to |
nsim |
number of simulated Us to generate (and hence to average over) per cell in grid. |
nthin |
number of BART tree draws to make per every draw of U. |
nburn |
number of draws of U to make and throw away at the start of a run. |
nthreads |
number of CPU cores used for parallel processing. If |
spy.range |
custom range for the sensitiviy parameter associated with Y (the coefficient on U in the outcome model or partial correlation of U with Y given X), e.g. |
spz.range |
custom range for the sensitivity parameter associated with Z (the coefficient on U in the treatment model or partial correlation of U with Z given X), e.g. |
trim.wt |
the maximum size of weight as a percentage of the sample size of the inferential group for the causal estimand. For example, |
benchmarking |
either "2SD" or "1SD". Used to determine the "marginal effects" corresponding to predictors for the plot, where the number of SD units given is the full spread, i.e. distance from below the mean to above. |
This function performs a dual-parameter sensitivity analysis for unobserved confounding by drawing simulated potential confounders U from the conditional distribution of U given observed response, treatment and covariates. Bayesian Additive Regression Trees (bart) are used to fit the response surface and potentially the treatment as well. See treatSens for details of the sensitivity anaylsis algorithm.
Unique options to treatSens.BART
are given by the argument trt.model
. It is specified as an delayed-evaluation function call of the form:
probitEM(maxBackstepIterations = 30L)
- uses glm to perform stochastic expectation maximization; backstep iterations are an internal parameter to glm.fit
probit(family = "cauchy", ...)
- family can be "cauchy"
, "t"
, "normal"
, or "flat"
. Additional options are, scale = 4
, c(df = 3, scale = 4)
, scale = 4
, and none, respectively.
bart(k = 2, ntree = 50, keepevery = 10)
- uses binary bart
with the given parameters.
treatSens.BART
returns an object of class "sensitivity
". See treatSens for details.
Vincent Dorie, Nicole Bohme Carnegie, Masataka Harada, and Jennifer Hill
Dorie V, Harada M, Carnegie NB, and Hill J. (2016) A Flexible, Interpretable Framework for Assessing Sensitivity to Unmeasured Confounding. Statistics in Medicine 35(20):3453-3470
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | N <- 250 # number of observations
zetay <- 0.5 # coefficient on U in the outcome model
zetaz <- 0.5 # coefficient on U in the treatment model
betaz <- c(0.75, -0.5, 0.25) # coefficients of X in the treatment model
betay <- c(0.5, 1.0, -1.5) # coefficients of X in the outcome model
tau <- 0.25 # treatment effect
set.seed(725)
X <- matrix(rnorm(3 * N), N) # covariates
U <- rbinom(N, 1, 0.5) # unmeasured confounder
ps <- pnorm(X %*% betaz + zetaz * (U - 0.5)) # propensity score
Z <- rbinom(N, 1, ps) # treatment variable
epsilon <- rnorm(N, 0.0, 2.0) # error term
Y0 <- X %*% betay + zetay * (U - 0.5) + epsilon # potential outcome(Z=0)
Y1 <- X %*% betay + zetay * (U - 0.5) + tau + epsilon # potential outcome(Z=1)
Y <- Y0 * (1 - Z) + Y1 * Z # realization of potential outcome
# sensitivity analysis
out.bin <- treatSens.BART(Y ~ Z + X, nsim = 3, nthin = 2, nburn = 0,
spy.range = c(0, 4), spz.range = c(-2 , 2), grid.dim = c(5, 3),
standardize = FALSE, verbose = TRUE)
sensPlot(out.bin) # draw contour plot
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.