Title: | Sensitivity Analysis of Omitted Variable Bias |
Version: | 2.0.0 |
Description: | Conduct sensitivity analysis of omitted variable bias in linear econometric models using the methodology presented in Basu (2025) <doi:10.2139/ssrn.4704246>. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
Imports: | dplyr, lmtest, stats, tidyr |
Suggests: | sensemakr |
URL: | https://github.com/dbasu-umass/ovbsa/, https://github.com/dbasu-umass/ovbsa |
BugReports: | https://github.com/dbasu-umass/ovbsa/issues |
NeedsCompilation: | no |
Packaged: | 2025-05-03 21:52:07 UTC; dbasu |
Author: | Deepankar Basu [aut, cre, cph] |
Maintainer: | Deepankar Basu <dbasu@umass.edu> |
Repository: | CRAN |
Date/Publication: | 2025-05-06 08:40:06 UTC |
basic sensitivity analysis of omitted variable bias
Description
basic sensitivity analysis of omitted variable bias
Usage
bsal(kd, ky, alpha, data, outcome, treatment, bnch_reg, other_reg)
Arguments
kd |
sensitivity parameter kD (scalar) |
ky |
sensitivity parameter kY (scalar) |
alpha |
significance level for hypothesis test (e.g. 0.05) |
data |
data frame for analysis |
outcome |
name of outcome variable |
treatment |
name of treatment variable |
bnch_reg |
name(s) of benchmark covariate(s) |
other_reg |
name(s) of other regressors |
Value
a matrix with following rows for case 1, 2 and 3 (in columns):
r2yd.x |
partial R2 of Y on D conditioning on X |
r2dz.x |
partial R2 of D on Z conditioning on X |
r2yz.dx |
partial R2 of Y on Z conditioning on D and X |
estimate |
unadjusted parameter estimate |
adjusted_estimate |
bias-adjusted parameter estimate |
adjusted_se |
bias-adjusted standard error |
adjusted_lower_CI |
bias-adjusted confidence interval lower boundary |
adjusted_upper_CI |
bias-adjusted confidence interval upper boundary |
Examples
require("sensemakr")
Y <- "peacefactor"
D <- "directlyharmed"
X <- "female"
X_oth <- c("village","age","farmer_dar","herder_dar","pastvoted","hhsize_darfur")
res1 <- bsal(kd=1,ky=1,alpha=0.05,data=darfur,outcome=Y,treatment=D,bnch_reg=X,other_reg=X_oth)
compute max(kD) and max(kY) for partial R2-based analysis without conditioning on treatment
Description
compute max(kD) and max(kY) for partial R2-based analysis without conditioning on treatment
Usage
kdkyrngpr2ncd(data, outcome, treatment, bnch_reg, other_reg = NULL)
Arguments
data |
data frame for analysis |
outcome |
name of outcome variable |
treatment |
name of treatment variable |
bnch_reg |
name(s) of benchmark covariate(s) |
other_reg |
name(s) of other covariates |
Value
a data frame with 2 columns and 1 row:
kd_high |
max(kD), a scalar |
ky_high |
max(kY), a scalar |
Examples
require("sensemakr")
Y <- "peacefactor"
D <- "directlyharmed"
X <- "female"
X_oth <- c("village","age","farmer_dar","herder_dar","pastvoted","hhsize_darfur")
r1 <- kdkyrngpr2ncd(data=darfur,outcome=Y,treatment=D,bnch_reg=X,other_reg=X_oth)
compute max(kD) and max(kY) for total R2-based analysis
Description
compute max(kD) and max(kY) for total R2-based analysis
Usage
kdkyrngtr2(data, outcome, treatment, bnch_reg, other_reg = NULL)
Arguments
data |
data frame for analysis |
outcome |
name of outcome variable |
treatment |
name of treatment variable |
bnch_reg |
name(s) of benchmark covariate(s) |
other_reg |
name(s) of other covariates |
Value
a data frame with 2 columns and 1 row:
kd_high |
max(kD), a scalar |
ky_high |
max(kY), a scalar |
Examples
require("sensemakr")
Y <- "peacefactor"
D <- "directlyharmed"
X <- "female"
X_oth <- c("village","age","farmer_dar","herder_dar","pastvoted","hhsize_darfur")
r1 <- kdkyrngtr2(data=darfur,outcome=Y,treatment=D,bnch_reg=X,other_reg=X_oth)
quasi-triangular probability distribution function
Description
quasi-triangular probability distribution function
Usage
linvx(x, xvec, k)
Arguments
x |
point (scalar) at which pdf is evaluated |
xvec |
vector of all possible x values |
k |
mode and median of the distribution |
Value
the value (scalar) of the pdf at x
Examples
xfull <- runif(n=100,min=0,max=10)
xpoint <- 5
xmod <- 2
res_pdf <- linvx(x=xpoint,xvec=xfull,k=xmod)
bias and std error for (kd,ky) using partial R2-based analysis without conditioning on treatment
Description
bias and std error for (kd,ky) using partial R2-based analysis without conditioning on treatment
Usage
pr2ncdbias(kd, ky, alpha, data, outcome, treatment, bnch_reg, other_reg = NULL)
Arguments
kd |
sensitivity parameter kD (scalar) |
ky |
sensitivity parameter kY (scalar) |
alpha |
significance level for hypothesis test (e.g. 0.05) |
data |
data frame for analysis |
outcome |
name of outcome variable |
treatment |
name of treatment variable |
bnch_reg |
name(s) of benchmark covariate(s) |
other_reg |
name(s) of other covariate(s) |
Value
a list with the following elements:
adjestp |
Adj std error when unadj estimate>0 |
adjestn |
Adj std error when unadj estimate<0 |
cilbp |
Adj lower boundary of conf int when unadj estimate>0 |
ciubp |
Adj upper boundary of conf int when unadj estimate>0 |
cilbn |
Adj lower boundary of conf int when unadj estimate<0 |
ciubn |
Adj upper boundary of conf int when unadj estimate<0 |
Examples
require("sensemakr")
Y <- "peacefactor"
D <- "directlyharmed"
X <- "female"
X_oth <- c("village","age","farmer_dar","herder_dar","pastvoted","hhsize_darfur")
res4<-pr2ncdbias(kd=1,ky=1,alpha=0.05,data=darfur,outcome=Y,treatment=D,bnch_reg=X,other_reg=X_oth)
probability of conclusion being overturned using partial R2-based analysis without conditioning on treatment
Description
probability of conclusion being overturned using partial R2-based analysis without conditioning on treatment
Usage
salpr2ncd(
alpha,
data,
outcome,
treatment,
bnch_reg,
other_reg,
N,
maxkd = NULL,
maxky = NULL,
k_kd = 1,
k_ky = 1
)
Arguments
alpha |
significance level (scalar) for hypothesis test (e.g. 0.05) |
data |
data frame for analysis |
outcome |
name of outcome variable |
treatment |
name of treatment variable |
bnch_reg |
name(s) of benchmark covariate(s) |
other_reg |
name(s) of other covariate(s) |
N |
number of points on grid = N^2 |
maxkd |
max of sensitivity parameter kD |
maxky |
max of sensitivity parameter kY |
k_kd |
mode (and median) of sensitivity parameter kD |
k_ky |
mode (and median) of sensitivity parameter kY |
Value
list with the following elements:
dataplot |
data set used for contour plot |
kdmax |
max of sensitivity parameter kD |
kymax |
max of sensitivity parameter kY |
frac_prob |
prob of conclusion being overturned (unwt) |
frac_prob_wt |
prob of conclusion being overturned (wt) |
frac_prob_rest |
prob of conclusion being overturned (unwt, rest) |
frac_prob_rest_wt |
prob of conclusion being overturned (wt, rest) |
Examples
require("sensemakr")
Y <- "peacefactor"
D <- "directlyharmed"
X <- "female"
X_oth <- c("village","age","farmer_dar","herder_dar","pastvoted","hhsize_darfur")
darfur1 <- dplyr::slice_sample(darfur, prop=0.25)
res4 <- salpr2ncd(alpha=0.05,data=darfur1,outcome=Y,treatment=D,bnch_reg=X,other_reg=X_oth,N=500)
probability of conclusion being overturned using total R2-based analysis
Description
probability of conclusion being overturned using total R2-based analysis
Usage
saltr2(
alpha,
data,
outcome,
treatment,
bnch_reg,
other_reg,
N,
maxkd = NULL,
maxky = NULL,
k_kd = 1,
k_ky = 1
)
Arguments
alpha |
significance level for hypothesis test (e.g. 0.05) |
data |
data frame for analysis |
outcome |
name of outcome variable |
treatment |
name of treatment variable |
bnch_reg |
name(s) of benchmark covariate(s) |
other_reg |
name(s) of other covariate(s) |
N |
number of points on grid = N^2 |
maxkd |
max of sensitivity parameter kD |
maxky |
max of sensitivity parameter kY |
k_kd |
mode (and median) of sensitivity parameter kD |
k_ky |
mode (and median) of sensitivity parameter kY |
Value
list with the following elements:
dataplot |
data set used for contour plot |
kdmax |
max of sensitivity parameter kD |
kymax |
max of sensitivity parameter kY |
frac_prob |
prob of conclusion being overturned (unwt) |
frac_prob_wt |
prob of conclusion being overturned (wt) |
frac_prob_rest |
prob of conclusion being overturned (unwt, rest) |
frac_prob_rest_wt |
prob of conclusion being overturned (wt, rest) |
Examples
require("sensemakr")
Y <- "peacefactor"
D <- "directlyharmed"
X <- "female"
X_oth <- c("village","age","farmer_dar","herder_dar","pastvoted","hhsize_darfur")
darfur1 <- dplyr::slice_sample(darfur, prop=0.25)
res3 <- saltr2(alpha=0.05,data=darfur1,outcome=Y,treatment=D,bnch_reg=X,other_reg=X_oth,N=500)
bias and std error for (kd,ky) using total R2-based analysis
Description
bias and std error for (kd,ky) using total R2-based analysis
Usage
tr2bias(kd, ky, alpha, data, outcome, treatment, bnch_reg, other_reg = NULL)
Arguments
kd |
sensitivity parameter kD (scalar) |
ky |
sensitivity parameter kY (scalar) |
alpha |
significance level for hypothesis test (e.g. 0.05) |
data |
data frame for analysis |
outcome |
name of outcome variable |
treatment |
name of treatment variable |
bnch_reg |
name(s) of benchmark covariate(s) |
other_reg |
name(s) of other covariate(s) |
Value
a list with the following elements:
adjestp |
Adj std error when unadj estimate>0 |
adjestn |
Adj std error when unadj estimate<0 |
cilbp |
Adj lower boundary of conf int when unadj estimate>0 |
ciubp |
Adj upper boundary of conf int when unadj estimate>0 |
cilbn |
Adj lower boundary of conf int when unadj estimate<0 |
ciubn |
Adj upper boundary of conf int when unadj estimate<0 |
Examples
require("sensemakr")
Y <- "peacefactor"
D <- "directlyharmed"
X <- "female"
X_oth <- c("village","age","farmer_dar","herder_dar","pastvoted","hhsize_darfur")
res2 <- tr2bias(kd=1,ky=1,alpha=0.05,data=darfur,outcome=Y,treatment=D,bnch_reg=X,other_reg=X_oth)