Learn R Programming

doseSens (version 1.0.0)

Conduct Sensitivity Analysis with Continuous Exposures and Binary or Continuous Outcomes

Description

Performs sensitivity analysis for the sharp null, attributable effects, and weak nulls in matched studies with continuous exposures and binary or continuous outcomes as described in Zhang, Small, Heng (2024) and Zhang, Heng (2024) . Two of the functions require installation of the 'Gurobi' optimizer. Please see for guidance.

Copy Link

Version

Install

install.packages('doseSens')

Monthly Downloads

152

Version

1.0.0

License

MIT + file LICENSE

Maintainer

Jeffrey Zhang

Last Published

October 10th, 2025

Functions in doseSens (1.0.0)

max_expectation

A function to compute a conservative upper bound on the worst-case expectation under the sharp null
lead_bmd

Matched lead bone mineral density dataset
extract_threshold_effect_function

Function factory for extract_threshold_effect.
max_ratio

Find the max ratio of probabilities between two permutations.
extract_threshold_effect

Compute difference in average outcomes above and below a dose threshold.
extract_max_vs_baseline

Compute largest dose outcome minus average of other outcomes.
extract_stochastic_intervention

Compute weighted sum of outcomes.
extract_below_threshold_vs_baseline

Compute average of outcomes below dose threshold minus average of outcomes.
extract_min_vs_baseline

Compute smallest dose outcome minus average of other outcomes.
lead_crime

Matched lead crime dataset
max_ratios_summary

Find the max ratio of probabilities between two permutations for each matched set.
weak_null_test

Asymptotic sensitivity analysis for weak nulls with continuous exposures.
sharp_null_double_test

Asymptotic sharp null sensitivity analysis for a class of test statistics accommodating continuous exposures and any scalar outcome.
normal_test_gen

Sharp null sensitivity analysis for continuous exposures and binary outcomes using normal approximation.
max_ratio_new

Find the max ratio of probabilities between two permutations.
prob_bounds

A function to find the maximum and minimum probability of a permutation.
sharp_double_statistic

Statistic based on inner product between transformations of dose and outcome.
var_est

A function for variance estimation
dev_TV

Computes deviation from uniform distribution in total variation distance for a given amount of unmeasured confounding and a greater than alternative with a binary outcome.
apply_permutation_to_matrix

A function that returns a permuted vector according to a matrix and permutation vector.
dose_sensitivity_mc_gen

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

Compute average of outcomes above dose threshold minus average of outcomes.
constant_effects_test

Asymptotic sensitivity analysis for weak nulls with continuous exposures assuming constant effects across matched sets.
binary_thresh_attribute

Separable algorithm for threshold attributable effect in a sensitivity analysis with at most one over-exposed unit in each matched set. For a greater than alternative, finds the 'a' matched sets that most decrease the mean and/or variance.
change_Delta

A helper that takes a gurobi model object outputted from dose_attributable_general or dose_thresh_attributable_one_sided and changes the Delta parameter. Saves computation time by directly editing the constraint involving Delta without having to reinitialize the other constraints that are kept the same. Outputs a list analogous to output from dose_attributable_general or dose_thresh_attributable_one_sided.
dose_attributable_general

Inference for general attributable effects in sensitivity analysis with continuous exposures and binary outcomes. Gurobi must be installed to use this function.
extract_OLS

A function that returns the coefficient from regressing an outcome vector on a dose vector.
dose_thresh_attributable_one_sided

Inference for threshold attributable effects in sensitivity analysis with continuous exposures and binary outcomes. Gurobi must be installed to use this function.