Title: | Sensitivity Analysis Informed by a Test for Bias |
---|---|
Description: | After testing for biased treatment assignment in an observational study using an unaffected outcome, the sensitivity analysis is constrained to be compatible with that test. The package uses the optimization software gurobi obtainable from <https://www.gurobi.com/>, together with its associated R package, also called gurobi; see: <https://www.gurobi.com/documentation/7.0/refman/installing_the_r_package.html>. The method is a substantial computational and practical enhancement of a concept introduced in Rosenbaum (1992) Detecting bias with confidence in observational studies Biometrika, 79(2), 367-374 <doi:10.1093/biomet/79.2.367>. |
Authors: | Paul R Rosenbaum |
Maintainer: | Paul R Rosenbaum <[email protected]> |
License: | GPL-2 |
Version: | 1.0.7 |
Built: | 2024-12-13 06:30:42 UTC |
Source: | CRAN |
After testing for biased treatment assignment in an observational study using an unaffected outcome, the sensitivity analysis is constrained to be compatible with that test. The package uses the optimization software gurobi obtainable from <https://www.gurobi.com/>, together with its associated R package, also called gurobi; see: <https://www.gurobi.com/documentation/7.0/refman/installing_the_r_package.html>. The method is a substantial computational and practical enhancement of a concept introduced in Rosenbaum (1992) Detecting bias with confidence in observational studies Biometrika, 79(2), 367-374 <doi:10.1093/biomet/79.2.367>.
The DESCRIPTION file:
Package: | informedSen |
Type: | Package |
Title: | Sensitivity Analysis Informed by a Test for Bias |
Version: | 1.0.7 |
Author: | Paul R Rosenbaum |
Maintainer: | Paul R Rosenbaum <[email protected]> |
Description: | After testing for biased treatment assignment in an observational study using an unaffected outcome, the sensitivity analysis is constrained to be compatible with that test. The package uses the optimization software gurobi obtainable from <https://www.gurobi.com/>, together with its associated R package, also called gurobi; see: <https://www.gurobi.com/documentation/7.0/refman/installing_the_r_package.html>. The method is a substantial computational and practical enhancement of a concept introduced in Rosenbaum (1992) Detecting bias with confidence in observational studies Biometrika, 79(2), 367-374 <doi:10.1093/biomet/79.2.367>. |
License: | GPL-2 |
Encoding: | UTF-8 |
LazyData: | true |
Imports: | sensitivitymult, stats |
Enhances: | gurobi |
Depends: | R (>= 3.5.0) |
NeedsCompilation: | no |
Packaged: | 2021-08-02 20:56:29 UTC; rosenbap |
Repository: | CRAN |
Date/Publication: | 2021-08-04 09:50:05 UTC |
Index of help topics:
HDL Light Daily Alcohol and HDL Cholesterol Levels informedSen-package Sensitivity Analysis Informed by a Test for Bias informedsen Sensitivity Analysis Informed by a Test for Unmeasured Bias senmscores Computes M-scores for M-tests.
The package performs a sensitivity analysis within a confidence set provided by a test for unmeasured bias. The method is a substantial computational and practical enhancement of a concept introduced in Rosenbaum (1992) Detecting bias with confidence in observational studies. Biometrika, 79(2), 367-374. <doi:10.1093/biomet/79.2.367> The main function in the package is informedsen. The package uses the optimization software gurobi obtainable from <https://www.gurobi.com/>, together with its associated R package, also called gurobi; see: <https://www.gurobi.com/documentation/7.0/refman/installing_the_r_package.html>. See the example in informedsen for discussion about obtaining gurobi and its associated local R-package.
Paul R Rosenbaum
Maintainer: Paul R Rosenbaum <[email protected]>
Rosenbaum, P. R. (1984). From association to causation in observational studies: The role of tests of strongly ignorable treatment assignment. Journal of the American Statistical Association 79, 41-48. <doi:10.1080/01621459.1984.10477060>
Rosenbaum, P. R. (1989a). On permutation tests for hidden biases in observational studies. The Annals of Statistics 17, 643-653. <doi:10.1214/aos/1176347131>
Rosenbaum, P. R. (1989b). The role of known effects in observational studies. Biometrics 45, 557-569. <doi:10.2307/2531497>
Rosenbaum, P. R. (1992). Detecting bias with confidence in observational studies. Biometrika, 79(2), 367-374. <doi:10.1093/biomet/79.2.367>
Rosenbaum, P. R. (2007) Sensitivity analysis for m-estimates, tests and confidence intervals in matched observational studies. Biometrics, 2007, 63, 456-464. <doi:10.1111/j.1541-0420.2006.00717.x>
Rosenbaum, P. R. (2021). Sensitivity analyses informed by tests for bias in observational studies. Manuscript. This manuscript describes and illustrates the new computational tools that make feasible the method in Rosenbaum (1992). The example in the package is the example in this manuscript.
## Not run: # To run these examples, you MUST have gurobi installed. # The makers of gurobi provide free access to academics. # Additionally, you must install the local R package gurobi # that is provided by installing gurobi. # The examples are from Rosenbaum (2021) data(HDL) shdl<-senmscores(HDL$hdl,HDL$z,HDL$mset) smmerc<-senmscores(HDL$mmercury,HDL$z,HDL$mset) sc<-cbind(shdl,smmerc) informedsen(3.5, sc, HDL$z, HDL$mset, alpha = 0.05) informedsen(3.4, sc, HDL$z, HDL$mset, alpha = c(0.04,0.01)) ## End(Not run)
## Not run: # To run these examples, you MUST have gurobi installed. # The makers of gurobi provide free access to academics. # Additionally, you must install the local R package gurobi # that is provided by installing gurobi. # The examples are from Rosenbaum (2021) data(HDL) shdl<-senmscores(HDL$hdl,HDL$z,HDL$mset) smmerc<-senmscores(HDL$mmercury,HDL$z,HDL$mset) sc<-cbind(shdl,smmerc) informedsen(3.5, sc, HDL$z, HDL$mset, alpha = 0.05) informedsen(3.4, sc, HDL$z, HDL$mset, alpha = c(0.04,0.01)) ## End(Not run)
An observational study of light daily alcohol consumption (1-3 drinks per day) versus little or no alcohol, and its possible effects on HDL cholesterol levels. The level of methylmercury is viewed as an unaffected outcome and used to test for biased treatment assignment. Data is from NHANES 2013/2014 and 2015/2016.
data("HDL")
data("HDL")
A data frame with 800 observations on the following 9 variables.
SEQN
NHANES sequence number
nh
Either 1314 for NHANES 2013/2014 or 1516 for NHANES 2015/2016
z
Treatment indicator, z=1 for light daily alcohol or z=0 for little or no alcohol.
mset
Matched set indicator, 1 to 200, for 200 matched sets, each containing one treated and three controls.
age
Age in years. Used in matching.
female
1 for female, 0 for male. Used in matching.
education
NHANES 1-5 education scale. 1 is <9th grade, 3 is high school, 5 is at least a BA degree.
hdl
HDL cholesterol level
mmercury
Methylmercury level
US National Health and Nutrition Examination Survey. Publicly available on-line.
LoConte, N. K., Brewster, A. M., Kaur, J. S., Merrill, J. K., and Alberg, A. J. (2018). Alcohol and cancer: a statement of the American Society of Clinical Oncology. Journal of Clinical Oncology 36, 83-93.
Rosenbaum, P. R. (2021). Sensitivity analyses informed by tests for bias in observational studies. Manuscript. See its data appendix.
Suh, I., Shaten, B. J., Cutler, J. A., and Kuller, L. H. (1992). Alcohol use and mortality from coronary heart disease: the role of high-density lipoprotein cholesterol. Annals of Internal Medicine 116, 881-887.
data(HDL) boxplot(HDL$age~HDL$z) # ages are similar boxplot(HDL$hdl~HDL$z) # hdl is higher boxplot(HDL$mmercury~HDL$z,log="y") # methylmercury is higher
data(HDL) boxplot(HDL$age~HDL$z) # ages are similar boxplot(HDL$hdl~HDL$z) # hdl is higher boxplot(HDL$mmercury~HDL$z,log="y") # methylmercury is higher
The function does a a sensitivity analysis for one outcome informed or constrained by the results of a test for unmeasured bias based on another outcome known to be unaffected by the treatment. The package uses gurobi to solve a quadratically constrained quadratic program. To use the package, the gurobi solver must be installed. See the discussion about installing gurobi in the example below.
informedsen(gamma, sc, z, mset, alpha = 0.05)
informedsen(gamma, sc, z, mset, alpha = 0.05)
gamma |
The sensitivity parameter. A number greater than or equal to 1. |
sc |
A matrix with N rows and at least two columns. The first column is the primary outcome, typically after scoring using senmscores. The remaining columns are unaffected outcomes used to test for bias, typically after scoring using senmscores. |
z |
A vector of length N whose N coordinates are 1 for treated, 0 for control. |
mset |
A vector of length N indicating the matched set. Each matched set contains one treated individual and the same fixed number of controls. |
alpha |
A vector with length equal to the number of columns of sc. The jth coordinate of alpha is the level of the test applied to the jth column of sc. If alpha is a scalar, it is repeated for every column of sc. |
result |
Text indicating whether or not the test for bias rejects all biases of magnitude Gamma or less. If yes, then the conclusion is that you must increase Gamma to continue. If no, then the test on the promary outcome is conducted inside the confidence set defined by a test for bias. The text begins after gurobi prints its standard output for the underlying optimization problem. |
optimization.problem |
Reiterates the result above, where the word yes means the optimization problem is infeasible, and the word no means it is feasible. See the conclusion for a scientific interpretation of this aspect of the output. |
conclusion |
Text indicating the result of the test for effect on the primary outcome. |
deviates |
A vector of standardized deviates that might be compared with the standard Normal distribution. There is one deviate for each column of sc. If sc has column names, then the column names label the deviates. The deviates are computed at the treatment assignment probabilities, theta, that solve the constrained optimization problem. |
alphas |
A vector of two-sided levels used for the deviates, together with their total. The total is relevant if the Bonferroni inequality is used to ensure joint level of all the tests. The absolute deviates might be compared with qnorm(1-alphas/2) for a two-sided test. |
When gurobi is called, it produces extensive output. The output for informedsen appears at the end, after gurobi has produced its output. Most users will wish to skip to the end, for the output from informedsen, returning to the gurobi output only if needed.
informedsen checks that your input has the required form, and it will stop if there is a problem with your input. For instance, informedsen will stop if you supply a value of gamma that is less than one.
Paul R. Rosenbaum
Berger, R. L. and Boos, D. D. (1994). P-values maximized over a confidence set for the nuisance parameter. Journal of the American Statistical Association, 89, 1012-1016. <doi:10.1080/01621459.1994.10476836>
Rosenbaum, P. R. (1984). From association to causation in observational studies: The role of tests of strongly ignorable treatment assignment. Journal of the American Statistical Association 79, 41-48. <doi:10.1080/01621459.1984.10477060>
Rosenbaum, P. R. (1989a). On permutation tests for hidden biases in observational studies. The Annals of Statistics 17, 643-653. <doi:10.1214/aos/1176347131>
Rosenbaum, P. R. (1989b). The role of known effects in observational studies. Biometrics 45, 557-569. <doi:10.2307/2531497>
Rosenbaum, P. R. (1992). Detecting bias with confidence in observational studies. Biometrika, 79(2), 367-374. <doi:10.1093/biomet/79.2.367>
Rosenbaum, P. R. (2007) Sensitivity analysis for m-estimates, tests and confidence intervals in matched observational studies. Biometrics, 2007, 63, 456-464. <doi:10.1111/j.1541-0420.2006.00717.x>
Rosenbaum, P. R. (2021). Sensitivity analyses informed by tests for bias in observational studies. Manuscript.
## Not run: # To run these examples, you MUST have gurobi installed. # gurobi is available for free to academic faculty # Search for the gurobi web page, and click the menu for Academia # Search for "gurobi and R" to find gurobi's local R package # connecting gurobi and R. You must install both gurobi # and its local R package to run informedsen. # # The examples are from Rosenbaum (2021) # # gurobi generates output before the output from informedsen # appears. In a first use, you might skip to the output # from informedsen, which begins with text labeled result. # data(HDL) shdl<-senmscores(HDL$hdl,HDL$z,HDL$mset) smmerc<-senmscores(HDL$mmercury,HDL$z,HDL$mset) sc<-cbind(shdl,smmerc) # A test within the confidence set informedsen(3.5, sc, HDL$z, HDL$mset, alpha = 0.05) # A test within the confidence set using # the method of Berger and Boos (1994) informedsen(3.4, sc, HDL$z, HDL$mset, alpha = c(0.04,0.01)) # An example in which the confidence set is empty informedsen(1.25, sc, HDL$z, HDL$mset, alpha = .05) ## End(Not run)
## Not run: # To run these examples, you MUST have gurobi installed. # gurobi is available for free to academic faculty # Search for the gurobi web page, and click the menu for Academia # Search for "gurobi and R" to find gurobi's local R package # connecting gurobi and R. You must install both gurobi # and its local R package to run informedsen. # # The examples are from Rosenbaum (2021) # # gurobi generates output before the output from informedsen # appears. In a first use, you might skip to the output # from informedsen, which begins with text labeled result. # data(HDL) shdl<-senmscores(HDL$hdl,HDL$z,HDL$mset) smmerc<-senmscores(HDL$mmercury,HDL$z,HDL$mset) sc<-cbind(shdl,smmerc) # A test within the confidence set informedsen(3.5, sc, HDL$z, HDL$mset, alpha = 0.05) # A test within the confidence set using # the method of Berger and Boos (1994) informedsen(3.4, sc, HDL$z, HDL$mset, alpha = c(0.04,0.01)) # An example in which the confidence set is empty informedsen(1.25, sc, HDL$z, HDL$mset, alpha = .05) ## End(Not run)
Computes M-scores for an M-test with one outcome in 1-to-k matched sets, for fixed k>=1. For the one-sample problem or matched pairs, Maritz (1979) proposed robust tests and confidence intervals based on Huber's (1981) M-estimates. These tests are extended to matching with several controls in Rosenbaum (2007).
senmscores(y, z, mset, inner = 0, trim = 3, lambda = 1/2)
senmscores(y, z, mset, inner = 0, trim = 3, lambda = 1/2)
y |
A vector of length N for one outcome. |
z |
A vector whose N coordinates are 1 for treated, 0 for control. |
mset |
A vector of length N giving the matched set. |
inner |
See trim. |
trim |
The two values, inner and trim, define the M-statistic's psi-function. The psi-function is an odd function, psi(y) = -psi(-y), so it suffices to define it for nonnegative y. For nonnegative y, psi(y) equals 0 for y between 0 and inner, rises linearly from 0 to 1 for y between inner and trim, and equals 1 for y greater than trim. There are two requirements: inner must be nonnegative, and trim must be larger than inner. |
lambda |
A number strictly between 0 and 1. The M-scores are psi(y/s) where s is the lambda quantile of the within-set absolute pair differences. |
The choice of psi-function to increase insensitivity to unmeasured bias is discussed in Rosenbaum (2013), where the parameter inner is proposed.
A vector of length N containing the M-scores.
The function is essentially a wrapper for the mscoresv function in the sensitivitymult package. It is easier to use senmscores when using the informedSen package.
Paul R. Rosenbaum
Huber, P. (1981). Robust Statistics. NY: Wiley.
Maritz, J. S. (1979). A note on exact robust condence intervals for location. Biometrika 66, 163-170.
Rosenbaum, P. R. (2007) Sensitivity analysis for m-estimates, tests and confidence intervals in matched observational studies. Biometrics, 2007, 63, 456-464. <doi:10.1111/j.1541-0420.2006.00717.x>
Rosenbaum, P. R. (2013). Impact of multiple matched controls on design sensitivity in observational studies. Biometrics 69 118-127. (Introduces inner trimming.) <doi:10.1111/j.1541-0420.2012.01821.x>
Rosenbaum, P. R. (2015). Two R packages for sensitivity analysis in observational studies. Observational Studies, v. 1. (Free on-line.)
data(HDL) shdl<-senmscores(HDL$hdl,HDL$z,HDL$mset) plot(HDL$hdl,shdl)
data(HDL) shdl<-senmscores(HDL$hdl,HDL$z,HDL$mset) plot(HDL$hdl,shdl)