Perform a Donut FE analysis
donut_analysis.Rd
Performs a single FE-models with a given data set. The independent variable and the population can be adjusted.
Usage
donut_analysis(
dist,
ds,
dep_var,
indep_vars,
weights = NULL,
fe = "id",
dist_var = "dist_km",
se = "cluster",
bootstrap = FALSE,
B = 9999,
lat = "lat",
lon = "lon",
excl_largest_fe = 0,
excl_inner_r = 0,
treatment_label = "Lives close to landfill",
...
)
Arguments
- dist
A vector with two distances: the inner and the outer. The inner distance refers to the maximum distance for treatment. The outer distance refers to the overall population: it is the cut-off value.
- ds
The dataset.
- dep_var
The dependent variable in the regression
- indep_vars
a character vector of independent variables. Must be part of
ds
.- weights
a numeric vector for weights. Must be part of
ds
.- fe
a character vector of Fixed Effects variables. Must be part of
ds
.- dist_var
A character referring to the distance parameter. Defaults to
dist_km
.- se
is a character, defaulting to
cluster
. It shows how to adjust standard errors: By clustering them by thefe
param (cluster
), no adjustment, (basic
), or with Conley (conley
). All regressions rely onfixest
.- bootstrap
a boolean: should the standard errors for
dist
be bootstrapped?- B
the number of bootstraps
- lat
Latitude; needed for
conley
-standard errors- lon
Longitude; needed for
conley
-standard errors- excl_largest_fe
Numeric: how many of the FE with the largest number of observations should be excluded? Defaults to
0
.- excl_inner_r
Numeric. If the observations that are closest to the
fe
should be omitted: in which radius should they be omitted? Defaults to0
.- treatment_label
Character. The label for the treatment variable created for the combination of inner and outer radius. Defaults to "Lives close to landfill"
- ...
Additional arguments
Value
A single donut_model
object with class fixest
.
The donut_model
has additional list element which contain
the inner and outer radii and additional info.
It can be plotted with the plot_significance
function, and showed as table
with donut_summary
.
Examples
data(donut_data)
model1 <-
donut_analysis(dist = c(5, 20),
ds = donut_data,
dep_var = "wealth_index",
indep_vars = "age",
fe = "id")
model2 <-
donut_analysis(dist = c(8, 50),
ds = donut_data,
dep_var = "wealth_index",
indep_vars = c("age", "male"),
fe = "id",
dist_var = "dist_km",
excl_largest_fe = 2,
excl_inner_r = 1)
model_basic <-
donut_analysis(dist = c(8, 50),
ds = donut_data,
dep_var = "wealth_index",
indep_vars = c("age", "male"),
fe = "id",
dist_var = "dist_km",
se = "basic")