Description Usage Arguments Details Value Note Author(s) References See Also Examples
Computes a Sensitivity analysis for a coefficient from a regression model (linear, logistic, Cox) on Observational data. Computes new coefficient estimate and confidence interval for various relationships between the response, predictor of interest, and an unmeasured variable. The last 3 letters of each function refer to the type of the variables in the order Y, X, U with C meaning categorical, N meaning normal (continuous), and S being a survival object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  obsSensCCC(model, which = 2, g0 = c(2, 6, 10), g1, p0 = seq(0, 1, 0.2), p1 = p0, logOdds = FALSE, method = c("approx", "sim"))
obsSensCCN(model, which = 2, gamma = round(seq(0, 2 * bstar, length = 6), 4), delta = seq(0, 3, 0.5), logOdds = FALSE, method = c("approx", "sim"))
obsSensCNN(model, which = 2, gamma = round(seq(0, 2 * bstar, length = 6), 4), rho = c(0, 0.5, 0.75, 0.85, 0.9, 0.95, 0.98, 0.99), sdx, logOdds = FALSE, method = c("approx", "sim"))
obsSensNCC(model, which = 2, g0 = c(2, 6, 10), g1, p0 = seq(0, 1, 0.2), p1 = p0, log = TRUE, method = c("approx", "sim"))
obsSensNCN(model, which = 2, gamma = round(seq(0, 3, length = 6), 4), delta = seq(0, 3, 0.5), log = TRUE, method = c("approx", "sim"))
obsSensNNN(model, which = 2, gamma = round(seq(0, 2 * bstar, length =
6), 4), rho = c(0, 0.5, 0.75, 0.85, 0.9, 0.95, 0.98, 0.99), sdx, log = TRUE, method = c("approx", "sim"))
obsSensSCC(model, which = 2, g0 = c(2, 6, 10), g1, p0 = seq(0, 1, 0.2), p1 = p0, logHaz = FALSE, method = c("approx", "sim"))
obsSensSCN(model, which = 2, gamma = round(seq(0, 3, length = 6), 4), delta = seq(0, 3, 0.5), logHaz = FALSE, method = c("approx", "sim"))
obsSensSNN(model, which = 2, gamma = round(seq(0, 3, length = 6), 4), rho = c(0, 0.5, 0.75, 0.85, 0.9, 0.95, 0.98, 0.99), sdx, logHaz = FALSE, method = c("approx", "sim"))

model 
A regression model object (result of 
which 
Which coefficient (in the results from

g0 
The slopes on the unmeasured variable when x=0 (on the log scale, not response). 
g1 
The slopes on the unmeasured variable when x=1, if missing then g1=g0=gamma is assumed. 
p0 
Probability that U=1 given x=0. 
p1 
Probability that U=1 given x=1. 
logOdds 
Should the resulting table be on the log scale or response scale. 
log 
Should the resulting table be on the log scale or not. 
logHaz 
Should the resulting table be on the log Hazard ratio scale or Hazard ratio scale. 
method 
Either "approx" or "sim", only approx is currently implemented. 
gamma 
Slopes for U (unmeasured variable). 
delta 
The difference between the mean of Ux=0 and mean of Ux=1. 
rho 
Correlation coefficient between x and U. 
sdx 
Standard Deviation of x (default will try to extract this
from 
These functions are all used to do sensitivity analysis on regression
models for observational data. Currently it works with linear
regression, logistic regression (using glm
), and survival
regressions (using coxph
). All models are of the general form:
y = b1*x + gamma*U + Beta*Z
Where y is the response (or function of the response). The first letter in the triplet at the end of each function name corresponds to the type of response variable, Nnormal/numeric (continuous), CCategorical (binary, logistic regression), and SSurvival (coxph models).
The x variable is the coefficient of interest (usually the treatment variable, or primary predictor of interest). The 2nd letter in the triplet can be CCategorical (x is 0 or 1, usually control vs. treatment) or NNumeric, a continuous variable.
The U variable is an unmeasured potential confounder that we believe may be related to y and x. The final letter in the final triplet refers to the type of unmeasured variable that we want to correct for: CCategorical/binary (01, presentabsent) or NNumerical/continuous (in this case it is assumed to be normal with mean 0 and sd 1).
The Z represents additional covariates in the model that are not of primary interest in the sensitivity analysis. It is assumed that Z and U are independent of each other.
For all the functions you specify the potential relationships between
U and y (gamma
, g0
, and g1
) and potential
relationships between x and U (p0
, p1
, delta
, and
rho
). Then the functions compute a new estimate of b1 (the
slope for x, the variable of interest) and its confidence interval
given each combination of the relationships between U, y, and x.
Currently only the approximation method by Lin et. al. is available. In the future a simulation method will also be implemented.
An obsSens object (S3) stored as a list with the following elements:
beta 
A matrix/array with the adjusted slopes for the different conditions. 
lcl 
A matrix/array with the lower confidence intervals for the slopes. 
ucl 
A matrix/array with the upper confidence intervals for the slopes. 
log 
A logical indicating if the values are on the log scale. 
xname 
The 'name' of the x variable of interest 
type 
Character field with the type of y variable, can be 'cat', 'surv', or 'num'. 
Note: Currently there are no checks on whether the conditions will be appropriate for the approximation to be close. See the first paper below for the conditions when the approximation is good.
Greg Snow greg.snow@imail.org
Lin, DY and Psaty, BM and Kronmal, RA. (1998): Assessing the Sensitivity of Regression Results to Unmeasured Confounders in Observational Studies. Biometrics, 54 (3), Sep, pp. 948963.
Baer, VL et. als (2007): Do Platelet Transfusions in the NICU Adversely Affect Survival? Analysis of 1600 Thrombocytopenic neonates in a mulihospital healthcare system. Journal of Perinatology, 27, pp. 790796.
print.obsSens
, summary.obsSens
1 2 3 4 5 6 7 8 9 10 11 12  # Recreate tables from above references
obsSensCCC( log(23.1), log(c(6.9, 77.7)), g0=c(2,6,10),
p0=seq(0,.5,.1), p1=seq(0,1,.2) )
obsSensSCC( log(1.21), log(c(1.09,1.25)),
p0=seq(0,.5,.1), p1=seq(0,1,.1), g0=3 )
obsSensCNN( log(1.14), log(c(1.10,1.18)),
rho=c(0,.5, .75, .85, .9, .95, .98, .99),
gamma=seq(0,1,.2), sdx=4.5 )

Sensitivity analysis on variable
on an Odds Ratio scale
, , Gamma = 2
P0
P1 0 0.1 0.2 0.3
0 23.10 25.41 27.72 30.03
( 6.900, 77.70) ( 7.590, 85.47) ( 8.280, 93.24) ( 8.970,101.01)
0.2 19.25 21.17 23.10 25.02
( 5.750, 64.75) ( 6.325, 71.22) ( 6.900, 77.70) ( 7.475, 84.17)
0.4 16.50 18.15 19.80 21.45
( 4.929, 55.50) ( 5.421, 61.05) ( 5.914, 66.60) ( 6.407, 72.15)
0.6 14.44 15.88 17.32 18.77
( 4.312, 48.56) ( 4.744, 53.42) ( 5.175, 58.27) ( 5.606, 63.13)
0.8 12.83 14.12 15.40 16.68
( 3.833, 43.17) ( 4.217, 47.48) ( 4.600, 51.80) ( 4.983, 56.12)
1 11.55 12.71 13.86 15.02
( 3.450, 38.85) ( 3.795, 42.73) ( 4.140, 46.62) ( 4.485, 50.50)
P0
P1 0.4 0.5
0 32.34 34.65
( 9.660,108.78) (10.350,116.55)
0.2 26.95 28.87
( 8.050, 90.65) ( 8.625, 97.12)
0.4 23.10 24.75
( 6.900, 77.70) ( 7.393, 83.25)
0.6 20.21 21.66
( 6.037, 67.99) ( 6.469, 72.84)
0.8 17.97 19.25
( 5.367, 60.43) ( 5.750, 64.75)
1 16.17 17.32
( 4.830, 54.39) ( 5.175, 58.27)
, , Gamma = 6
P0
P1 0 0.1 0.2 0.3
0 23.10 34.65 46.20 57.75
( 6.900, 77.70) (10.350,116.55) (13.800,155.40) (17.250,194.25)
0.2 11.55 17.32 23.10 28.87
( 3.450, 38.85) ( 5.175, 58.27) ( 6.900, 77.70) ( 8.625, 97.12)
0.4 7.70 11.55 15.40 19.25
( 2.300, 25.90) ( 3.450, 38.85) ( 4.600, 51.80) ( 5.750, 64.75)
0.6 5.77 8.66 11.55 14.44
( 1.725, 19.42) ( 2.588, 29.14) ( 3.450, 38.85) ( 4.312, 48.56)
0.8 4.62 6.93 9.24 11.55
( 1.380, 15.54) ( 2.070, 23.31) ( 2.760, 31.08) ( 3.450, 38.85)
1 3.85 5.77 7.70 9.62
( 1.150, 12.95) ( 1.725, 19.42) ( 2.300, 25.90) ( 2.875, 32.37)
P0
P1 0.4 0.5
0 69.30 80.85
(20.700,233.10) (24.150,271.95)
0.2 34.65 40.42
(10.350,116.55) (12.075,135.97)
0.4 23.10 26.95
( 6.900, 77.70) ( 8.050, 90.65)
0.6 17.33 20.21
( 5.175, 58.27) ( 6.038, 67.99)
0.8 13.86 16.17
( 4.140, 46.62) ( 4.830, 54.39)
1 11.55 13.47
( 3.450, 38.85) ( 4.025, 45.32)
, , Gamma = 10
P0
P1 0 0.1 0.2 0.3
0 23.10 43.89 64.68 85.47
( 6.900, 77.70) (13.110,147.63) (19.320,217.56) (25.530,287.49)
0.2 8.25 15.67 23.10 30.52
( 2.464, 27.75) ( 4.682, 52.72) ( 6.900, 77.70) ( 9.118,102.67)
0.4 5.02 9.54 14.06 18.58
( 1.500, 16.89) ( 2.850, 32.09) ( 4.200, 47.30) ( 5.550, 62.50)
0.6 3.61 6.86 10.11 13.35
( 1.078, 12.14) ( 2.048, 23.07) ( 3.019, 33.99) ( 3.989, 44.92)
0.8 2.82 5.35 7.89 10.42
( 0.841, 9.48) ( 1.599, 18.00) ( 2.356, 26.53) ( 3.113, 35.06)
1 2.31 4.39 6.47 8.55
( 0.690, 7.77) ( 1.311, 14.76) ( 1.932, 21.76) ( 2.553, 28.75)
P0
P1 0.4 0.5
0 106.26 127.05
(31.740,357.42) (37.950,427.35)
0.2 37.95 45.38
(11.336,127.65) (13.554,152.62)
0.4 23.10 27.62
( 6.900, 77.70) ( 8.250, 92.90)
0.6 16.60 19.85
( 4.959, 55.85) ( 5.930, 66.77)
0.8 12.96 15.49
( 3.871, 43.59) ( 4.628, 52.12)
1 10.63 12.71
( 3.174, 35.74) ( 3.795, 42.73)
Sensitivity analysis on variable
on a Hazard Ratio scale
, , Gamma = 3
P0
P1 0 0.1 0.2 0.3 0.4
0 1.210 1.452 1.694 1.936 2.178
(1.090,1.250) (1.308,1.500) (1.526,1.750) (1.744,2.000) (1.962,2.250)
0.1 1.008 1.210 1.412 1.613 1.815
(0.908,1.042) (1.090,1.250) (1.272,1.458) (1.453,1.667) (1.635,1.875)
0.2 0.864 1.037 1.210 1.383 1.556
(0.779,0.893) (0.934,1.071) (1.090,1.250) (1.246,1.429) (1.401,1.607)
0.3 0.756 0.907 1.059 1.210 1.361
(0.681,0.781) (0.818,0.938) (0.954,1.094) (1.090,1.250) (1.226,1.406)
0.4 0.672 0.807 0.941 1.076 1.210
(0.606,0.694) (0.727,0.833) (0.848,0.972) (0.969,1.111) (1.090,1.250)
0.5 0.605 0.726 0.847 0.968 1.089
(0.545,0.625) (0.654,0.750) (0.763,0.875) (0.872,1.000) (0.981,1.125)
0.6 0.550 0.660 0.770 0.880 0.990
(0.495,0.568) (0.595,0.682) (0.694,0.795) (0.793,0.909) (0.892,1.023)
0.7 0.504 0.605 0.706 0.807 0.908
(0.454,0.521) (0.545,0.625) (0.636,0.729) (0.727,0.833) (0.818,0.938)
0.8 0.465 0.558 0.652 0.745 0.838
(0.419,0.481) (0.503,0.577) (0.587,0.673) (0.671,0.769) (0.755,0.865)
0.9 0.432 0.519 0.605 0.691 0.778
(0.389,0.446) (0.467,0.536) (0.545,0.625) (0.623,0.714) (0.701,0.804)
1 0.403 0.484 0.565 0.645 0.726
(0.363,0.417) (0.436,0.500) (0.509,0.583) (0.581,0.667) (0.654,0.750)
P0
P1 0.5
0 2.420
(2.180,2.500)
0.1 2.017
(1.817,2.083)
0.2 1.729
(1.557,1.786)
0.3 1.512
(1.363,1.562)
0.4 1.344
(1.211,1.389)
0.5 1.210
(1.090,1.250)
0.6 1.100
(0.991,1.136)
0.7 1.008
(0.908,1.042)
0.8 0.931
(0.838,0.962)
0.9 0.864
(0.779,0.893)
1 0.807
(0.727,0.833)
Sensitivity analysis on variable
on an Odds Ratio scale
gamma
rho 0 0.2 0.4 0.6 0.8
0 1.140 1.140 1.140 1.140 1.140
(1.100,1.180) (1.100,1.180) (1.100,1.180) (1.100,1.180) (1.100,1.180)
0.5 1.140 1.115 1.090 1.066 1.043
(1.100,1.180) (1.076,1.154) (1.052,1.129) (1.029,1.104) (1.006,1.080)
0.75 1.140 1.103 1.066 1.032 0.998
(1.100,1.180) (1.064,1.141) (1.029,1.104) (0.995,1.068) (0.963,1.033)
0.85 1.140 1.098 1.057 1.018 0.980
(1.100,1.180) (1.059,1.136) (1.020,1.094) (0.982,1.054) (0.946,1.015)
0.9 1.140 1.095 1.052 1.011 0.971
(1.100,1.180) (1.057,1.134) (1.015,1.089) (0.976,1.047) (0.937,1.006)
0.95 1.140 1.093 1.048 1.004 0.963
(1.100,1.180) (1.055,1.131) (1.011,1.084) (0.969,1.040) (0.929,0.997)
0.98 1.140 1.091 1.045 1.000 0.958
(1.100,1.180) (1.053,1.130) (1.008,1.082) (0.965,1.035) (0.924,0.991)
0.99 1.140 1.091 1.044 0.999 0.956
(1.100,1.180) (1.053,1.129) (1.007,1.081) (0.964,1.034) (0.922,0.990)
gamma
rho 1
0 1.140
(1.100,1.180)
0.5 1.020
(0.984,1.056)
0.75 0.965
(0.931,0.999)
0.85 0.944
(0.911,0.977)
0.9 0.933
(0.901,0.966)
0.95 0.923
(0.891,0.955)
0.98 0.917
(0.885,0.949)
0.99 0.915
(0.883,0.947)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.