Description Usage Arguments Details Value References Examples
View source: R/robomit_functions.R
Provides the mean and confidence intervals of estimated bootstrapped beta*s, i.e., the bias-adjusted treatment effects (or correlations) (following Oster 2019).
1 2 |
y |
Name of the dependent variable (as string). |
x |
Name of the independent treatment variable (i.e., variable of interest; as string). |
con |
Name of related control variables. Provided as string in the format: "w + z +...". |
m |
Name of unrelated control variables (m; see Oster 2019; as string; default is m = "none"). |
w |
weights (only for weighted estimations). Warning: For weighted panel models R can report different R-square than Stata, leading deviation between R and Stata results. |
id |
Name of the individual id variable (e.g. firm or farm; as string). Only applicable for fixed effect panel models. |
time |
Name of the time id variable (e.g. year or month; as string). Only applicable for fixed effect panel models. |
delta |
delta for which beta*s should be estimated (default is delta = 1). |
R2max |
Maximum R-square for which beta*s should be estimated. |
sim |
Number of simulations. |
obs |
Number of draws per simulation. |
rep |
Bootstrapping either with (= TRUE) or without (= FALSE) replacement |
CI |
Confidence intervals, indicated as vector. Can be and/or 90, 95, 99. |
type |
Model type (either lm or plm; as string). |
useed |
User defined seed. |
data |
Dataset. |
Provides the mean and confidence intervals of estimated bootstrapped beta*s, i.e., the bias-adjusted treatment effects (or correlations) (following Oster 2019). Bootstrapping can either be done with or without replacement. The function supports linear cross-sectional (see lm objects in R) and fixed effect panel (see plm objects in R) models.
Returns tibble object, which includes the mean and confidence intervals of estimated bootstrapped beta*s.
Oster, E. (2019). Unobservable Selection and Coefficient Stability: Theory and Evidence. Journal of Business & Economic Statistics, 37, 187-204.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # load data, e.g. the in-build mtcars dataset
data("mtcars")
data_oster <- mtcars
# preview of data
head(data_oster)
# load robomit
require(robomit)
# compute the mean and confidence intervals of estimated bootstrapped beta*s
o_beta_boot_inf(y = "mpg", # dependent variable
x = "wt", # independent treatment variable
con = "hp + qsec", # related control variables
delta = 1, # delta
R2max = 0.9, # maximum R-square
sim = 100, # number of simulations
obs = 30, # draws per simulation
rep = FALSE, # bootstrapping with or without replacement
CI = c(90,95,99), # confidence intervals
type = "lm", # model type
useed = 123, # seed
data = data_oster) # dataset
|
mpg cyl disp hp drat wt qsec vs am gear carb
Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
# A tibble: 13 x 2
Name Value
<chr> <dbl>
1 Beta* (mean) -1.90
2 CI_90_low -3.34
3 CI_90_high -0.456
4 CI_95_low -3.62
5 CI_95_high -0.180
6 CI_99_low -4.16
7 CI_99_high 0.364
8 Simulations 100
9 Observations 30
10 Max R-square 0.9
11 Delta (defined) 1
12 Model: lm NA
13 Replacement: FALSE NA
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.