Description Usage Arguments Details Value References Examples
View source: R/robomit_functions.R
Estimates and provides confidence intervals of bootstrapped betas*, i.e. the estimated bias-adjusted treatment effects, following Oster (2019).
1 2 |
y |
Name of the dependent variable (as string). |
x |
Name of the independent variable of interest (treatment variable; as string). |
con |
Name of the other control variables. Provided as string in the format: "w + z +...". |
id |
Name of the individual id variable (e.g. firm or farm; as string). Only applicable for fixed effect models. |
time |
Name of the time variable (e.g. year or month; as string). Only applicable for fixed effect models. |
delta |
Delta for which beta* should be estimated (default is delta = 1). |
R2max |
Max R-square for which beta* 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 |
Seed number defined by user. |
data |
Data. |
Estimates mean and provides confidence intervals of bootstrapped betas*, i.e. the estimated bias-adjusted treatment effects, following Oster (2019). Bootstrapping can either be done with or without replacement. The function supports linear cross sectional (see lm objects in R) and panel fixed effect (see plm objects in R) models.
Returns tibble object. Including bootstrapped betas* and confidence intervals.
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)
# estimate and visualize bootstrapped deltas*
o_beta_boot_inf(y = "mpg", # define the dependent variable name
x = "wt", # define the main independent variable name
con = "hp + qsec", # other control variables
delta = 0, # define delta. This is usually set to 1
R2max = 0.9, # define the max R-square.
sim = 100, # define number of simulations
obs = 30, # define number of drawn observations per simulation
rep = FALSE, # define if bootstrapping is with or without replacement
CI = c(90,95,99), # define confidence intervals.
type = "lm", # define model type
useed = 123, # define seed
data = data_oster) # define dataset
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.