Description Usage Arguments Details Value Note Author(s) References See Also Examples

`treatSens`

performs dual-parameter sensitivity analysis for unobserved confounding for both continuous and binary treatment variables.

1 2 3 4 5 | ```
treatSens(formula, response.covariates = NULL, sensParam = "coef", resp.family = gaussian,
trt.family = gaussian, theta = 0.5, grid.dim = c(8,4), standardize = TRUE,
nsim = 20, zero.loc = 1/3, verbose = FALSE, buffer = 0.1, weights = NULL,
data = NULL, seed = 1234, iter.j = 10, offset = TRUE, core = NULL, spy.range = NULL,
spz.range = NULL, trim.wt = 10)
``` |

`formula` |
an object of class |

`response.covariates` |
an object of class |

`sensParam` |
a string giving the choice of the form of the sensitivity parameters. Supports "coef" for model coefficient and "cor" for partial correlations (with continuous treatment only) |

`resp.family` |
an assumed family for GLM of the response model. Currently only supports |

`trt.family` |
an assumed family for GLM of the treatment model. The default is |

`theta` |
this option specifies the marginal probability that a binary unobserved confounder takes one |

`grid.dim` |
the final dimensions of output grid. |

`standardize` |
logical. If |

`nsim` |
number of simulated Us to generate (and hence to average over) per cell in grid. The default is |

`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. The default is |

`weights` |
the user can supply a vector of weights or specify one of three causal estimads – |

`data` |
an optional data frame. If not found in data, the variables are taken from |

`seed` |
random seed. The default is |

`iter.j` |
number of iterations used to draw simulated U from its conditional distribution in the iterated algorithm required for the binary treatment variable model. The default is |

`offset` |
Models are fit by setting zeta.z*U or zeta.y*U explicitly as an offset (rather than simply including generated U in the model). Only consistent with |

`core` |
number of CPU cores used for parallel processing. The default is |

`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. This option is used only when |

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.

Weights are calculated for any of three different estimands. The weights for the ATE are calculated as *1/e(x)* for the treatment group observations and *1/(1-e(x))* for the control group observations, where *e(x)* denotes the estimated modification score (that is, the estimate of the probability of being treated conditional on observed covariates, *x*. The weights for the ATT are 1 for the treatment group observations and *e(x)/(1-e(x))* for the control group observations. The weights for the ATC are *(1-e(x))/e(x)* for the treatment group observations and 1 for the control group observations. These weights are discussed in Carnegie et al (2014) and similar versions using the propensity score are discussed in a variety of places including Gelman and Hill, 2007.

`treatSens`

returns an object of class "`sensitivity`

".

An object of class "`sensitivity`

" is a list containing the following components:

`model.type` |
estimation methods used (i.e. " |

`sensParam` |
type of sensitivity parameter used (model coefficient or partial correlation). |

`tau` |
individual estimated treatment effects corresponding to each grid point (combination of sensitivity parameters) and each drawing of simulated U. |

`se.tau` |
individual standard error estimates of treatment effects for each grid point and each drawing of simulated U. |

`zeta.z` |
individual estimated coefficients on U in the treatment model corresponding to each grid point and each drawing of simulated U. |

`zeta.y` |
individual estimated coefficients on U in the outcome model corresponding to each grid point and each drawing of simulated U. |

`se.zz` |
individual standard error estimates of the coefficient on U in the treatment model corresponding to each grid point and each drawing of simulated U. |

`se.zy` |
individual standard error estimates of the coefficient on U in the outcome model corresponding to each grid point and each drawing of simulated U. |

`Y` |
outcome variable |

`Z` |
treatment variable |

`X` |
covariates |

`sig2.trt` |
individual residual variances for the treatment model corresponding to each grid point and each drawing of simulated U. |

`sig2.resp` |
individual residual variances for the outcome model corresponding to each grid point and each drawing of simulated U. |

`tau0` |
averaged estimated treatment effect assuming no unobserved confounding (i.e. naive model). |

`se.tau0` |
averaged standard error estimate of the treatment effect without unobserved confounding (i.e. naive model) |

`Xcoef` |
the coefficients on the covariates in the treatment model (1st column) and the outcome model (2nd column) without unobserved confounding (i.e. naive model). |

`Xcoef.plot` |
coefficients as for |

When `weights`

are specified, `treatSens`

returns clustered robust standard errors.

Matrices and data frames should include only complete cases.

Nicole Bohme Carnegie, Masataka Harada, and Jennifer Hill

Carnegie NB, Hill JH and Harada M. (2016) Assessing sensitivity to unmeasured confounding using simulated potential confounders. Journal of Research on Educational Effectiveness 9(3):395-420.

`sensPlot`

`summary.sensitivity`

`glm`

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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | ```
N = 250 #number of observations
zetay = .5 #coefficient on U in the outcome model
zetaz = .5 #coefficient on U in the treatment model
betaz = c(.75,-.5,.25) #coefficients of X in the treatment model
betay = c(.5,1,-1.5) #coefficients of X in the outcome model
tau = .25 #treatment effect
X = matrix(rnorm(3*N),N,3) #covariates
###################################
# Example with continuous treatment
set.seed(836)
U = rnorm(N, 0, 1) #unmeasured confounder
Z = rnorm(N,X %*% betaz + zetaz*U,1) #treatment variable
Y = rnorm(N,X %*% betay + zetay*U + tau*Z,2) #outcome variable
# sensitivity analysis
# small grid.dim and nsim just for example purposes
out.cont <- treatSens(Y~Z+X, grid.dim = c(3,2), nsim = 5,
standardize = FALSE, verbose = TRUE, zero.loc = "full")
sensPlot(out.cont) # draw contour plot
# You can see when zetay=zetaz=.5, tau is about .25.
###############################
# Example with binary treatment
set.seed(725)
U = rbinom(N,1,.5) #unmeasured confounder
ps = pnorm(X%*%betaz + zetaz*(U-.5)) #propensity score
Z = rbinom(N,1,ps) #treatment variable
epsilon = rnorm(N,0,2) #error term
Y0 = X%*%betay + zetay*(U-.5) + epsilon #potential outcome(Z=0)
Y1 = X%*%betay + zetay*(U-.5) + tau + epsilon #potential outcome(Z=1)
Y = Y0*(1-Z) + Y1*Z #realization of potential outcome
# sensitivity analysis
out.bin <- treatSens(Y~Z+X, trt.family = binomial(link="probit"), nsim = 3,
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
``` |

treatSens documentation built on March 18, 2018, 1:54 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.