# sensitivityJR: Principal stratification sensitivity analysis relaxing the... In sensitivityPStrat: Principal Stratification Sensitivity Analysis Functions

## Description

Principal stratification sensitivity analysis relaxing monotonicity as described by Jemiai and Rotnitzky (2005) and implemented by Shepherd, Redman, and Ankerst (2008).

## Usage

 ```1 2 3 4 5 6 7``` ```sensitivityJR(z, s, y, beta0, beta1, phi, Pi, psi, selection, groupings, ci = 0.95, ci.method = c("analytic","bootstrap"), ci.type = "twoSided", custom.FUN=NULL, na.rm = FALSE, N.boot = 100, interval = c(-100, 100), upperTest = FALSE, lowerTest = FALSE, twoSidedTest = TRUE, verbose=getOption("verbose"), isSlaveMode = FALSE) ```

## Arguments

 `z` vector; contains the grouping values (e.g., treatment assignment) for each record. `s` vector; indicates whether a record is selected. `y` vector; outcome values. Can be `NA` for unselected records. `beta0` vector; values of the sensitivity parameter β0 linking outcome in group g0 with selection if assigned group g1. `beta1` vector; values of the sensitivity parameter β1 linking outcome in group g1 with selection if assigned group g0. `phi, Pi, psi` vector; sensitivity parameters specifying the joint distribution of S(\var{g0}), S(\var{g1}). Only one of the three parameters should be specified. `psi` is the log-odds ratio of selection. `Pi` is the probability of being in the always selected principal stratum (Pr(S(\var{g0}) = S(\var{g1}) = selected)). `phi` is the probability of selection in group g0 given selection in group g1 (Pr(S(\var{g0}) = 1|S(\var{g1}) = 1)). `selection` The value of `s` indicating selection. `groupings` vector of two elements `c(g0,g1)`; describes to possible group values. The first element g0 being the value of `z` the delineates the first group, the last element g1 being the value of `z` which delineates the second group. `ci` numeric vector; confidence interval value. Defaults to `0.95` `ci.method` character; method by which the confidence interval and variance are calculated. Can be “analytic” or “bootstrap”. Defaults to `c("analytic","bootstrap")` `ci.type` character vector; type of confidence interval that the corresponding `ci` element is referring to. Can be “upper”, “lower”, or “twoSided”. Defaults to `"twoSided"`. `custom.FUN` function; function to calculate custom result. `mu0`, `mu1`, `p0`, `p1` are available to be used as arguments in the custom function, where \code{mu0} = E(Y(\var{g0})|S(\var{g0}) = S(\var{g1}) = selected), \code{mu1} = E(Y(\var{g1})|S(\var{g0}) = S(\var{g1}) = selected), \code{p0} = P(S(\var{g0}) = selected), and \code{p1} = P(S(\var{g1}) = selected). The custom function must return a single value. `na.rm` logical; indicates whether records that are invalid due to `NA` values should be removed from the data set. `N.boot` integer; number of bootstrap repetitions that will be run when `ci.method` includes “bootstrap”. `interval` numeric vector of length 2. Controls the range limits used by optimize to estimate α0 and α1. `lowerTest` logical. Return the lower one sided p-value for the ACE. Defaults to `FALSE` `upperTest` logical. Return the upper one sided p-value for the ACE. Defaults to `FALSE` `twoSidedTest` logical. Return a two sided p-value for the ACE. Defaults to `TRUE` `verbose` logical; prints dots when bootstrapping to show that something is happening. Bootstrapping can take a long time. `isSlaveMode` logical. Internal Use only. Used in recursion.

## Details

Performs a sensitivity analysis estimating the average causal effect among those who would have been selected regardless of treatment assignment (ACE) without assuming monotonicity (i.e., that one of the principal strata is empty). The method assumes no interference (i.e., potential outcomes of all subjects are unaffected by treatment assignment of other subjects) and ignorable (i.e., random) treatment assignment. ACE is identified by assuming values for the sensitivity parameters `beta0`, `beta1`, and one of the parameters `phi`, `psi`, or `Pi`. The sensitivity parameters `beta0` and `beta1` have a log-odds ratio interpretation (see help for `sensitivityGBH`).

Only one of the parameters `phi`, `psi`, or `Pi` should be specified as all depend on each other. `psi` is unrestrained taking any value on the real line. The other parameters, `psi` and `Pi` have constraints and there will be estimation problems if these parameters are set at values outside the of their range of acceptable values based on the observed data. See Shepherd, Gilbert, Dupont (in press) for more details.

## Value

object of class `sensitivity3d`

 `ACE` array; estimated values of ACE for all combinations of `beta0`, `beta1`, and `phi`, `Pi`, `psi`. Array dimensions are `length(beta0)`, `length(beta1)`, `length(psi)`. `ACE.ci` array; confidence interval determined by `quantile` if `ci.method` includes “bootstrap”. Otherwise calculated using analytic variance with large sample normal approximation. Array dimensions the same as `ACE` element. `ACE.var` array; estimated variance of ACE. Array dimensions the same as `ACE` element. `ACE.p` vector; estimated p-value of ACE. `beta0` vector; β values used for the first group. `alphahat0` vector; estimated α values for the first group. `Fas0` function; estimator for the distribution function of y0 in the first group in the always selected stratum. `beta1` vector; β values used for the second group. `alphahat1` vector; estimated α values for the second group. `Fas1` function; estimator for the distribution function of y1 in the second group in the always selected stratum. `phi` vector; phi values used. `Pi` vector; Pi values used. `psi` vector; psi values used. `ci.map` list; mapping of confidence interval to quantile probability. Use numbers contained within as indices to the `SCE.ci` element.

## Author(s)

Bryan E. Shepherd
Department of Biostatistics
Vanderbilt University

Charles Dupont
Department of Biostatistics
Vanderbilt University

## References

Jemiai Y (2005), “Semiparametric Methods for Inferring Treatment Effects on Outcomes Defined Only if a Post-Randomization Event Occurs,” unpublished doctoral dissertation under the supervision of A. Rotnitzky, Harvard School of Public Health, Dept. of Biostatistics.

Shepherd BE, Redman MW, Ankerst DP (2008), “Does Finasteride affect the severity of prostate cancer? A causal sensitivity analysis,” Journal of the American Statistical Association 2008, 484, 1392-1404.

Shepherd BE, Gilbert PB, and Dupont CT, “Sensitivity analyses comparing time-to-event outcomes only existing in a subset selected postrandomization and relaxing monotonicity,” Biometrics, in press.

`sensitivityGBH`, `sensitivitySGD`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23``` ```data(vaccine.trial) ansJR<-with(vaccine.trial, sensitivityJR(z=treatment,s=hiv.outcome,y=logVL, beta0=c(-1,-.5,0,.5,1), beta1=c(-1,-.5,0,.5,1), phi=c(0.95,0.9), selection="infected", groupings=c("placebo","vaccine"), N.boot=100) ) ansJR data(vaccine.trial) ansJR<-with(vaccine.trial, sensitivityJR(z=treatment,s=hiv.outcome,y=logVL, beta0=c(-1,-.5,0,.5,1), beta1=c(-1,-.5,0,.5,1), phi=c(0.95,0.9), selection="infected", groupings=c("placebo","vaccine"), custom.FUN=function(mu0, mu1, ...) mu1 - mu0, upperTest=TRUE, lowerTest=TRUE, twoSidedTest=TRUE, N.boot=100) ) ansJR ```