dose_sensitivity_mc_gen {doseSens}R Documentation

Sharp null monte-carlo sensitivity analysis for continuous exposures and binary outcomes.

Description

Sharp null monte-carlo sensitivity analysis for continuous exposures and binary outcomes.

Usage

dose_sensitivity_mc_gen(
  Z,
  Q,
  index,
  mc,
  gamma,
  weights = NA,
  obsT = NULL,
  trans = identity,
  direct = "upper",
  seed = 1,
  verbose = FALSE
)

Arguments

Z

A length N vector of (nonnegative) observed doses.

Q

A length N vector of observed binary outcomes.

index

A length N vector of indices indicating matched set membership.

mc

An integer for the total number of Monte-Carlo samples desired.

gamma

The nonnegative sensitivity parameter; gamma = 0 means no unmeasured confounding.

weights

Weights for each stratum to apply for the test statistic

obsT

The observed value of the test statistic; default is NULL

trans

The transformation of the doses to use for the test statistic. Default is the identity function.

direct

The direction of the test - "upper" or "lower"; default is upper.

seed

seed for random number generation.

verbose

Whether to print status updates or not; default is FALSE.

Value

A list containing two objects:

mc

A length mc vector containing the monte-carlo samples of the test statistic.

p

The monte-carlo p-value.

Examples

# Load the data
data <- treat_out_match
# Make a threshold at log(3.5) transformation function.
above = function(Z) { return(Z > log(3.5)) }
# Conduct randomization test.
solution <- dose_sensitivity_mc_gen(data$treat, data$complain, data$match_ind,
mc = 250, gamma = 0, trans = above)


[Package doseSens version 0.1.0 Index]