Description Usage Arguments Details Value References Examples
View source: R/robomit_functions.R
Estimates bootstrapped deltas*, i.e. the degree of selection on unobservables relative to observables that would be necessary to explain away the result, 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. |
beta |
Beta for which delta* should be estimated (default is beta = 0). |
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. |
type |
Model type (either lm or plm; as string). |
useed |
Seed number defined by user. |
data |
Data. |
Estimates bootstrapped deltas*, i.e. the degree of selection on unobservables relative to observables that would be necessary to explain away the result, 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 deltas*.
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 | # 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 bootstrapped deltas*
o_delta_boot(y = "mpg", # define the dependent variable name
x = "wt", # define the main independent variable name
con = "hp + qsec", # other control variables
beta = 0, # define beta. This is usually set to 0
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
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.