Description Usage Arguments Details Value
View source: R/create_stability_plot.R
stability_plot
is used to quickly produce a plot showing the stability of the OLS estimate
of the explanatory variable rhs
on the outcome variable lhs
under combinations
of a given set of controls. Fixed effects, clustering, weights, and instrumental
variables are supported. stability_plot
is a wrapper for the five steps of the
starbility
pipeline; see the advanced usage vignette for details.
1 | stability_plot(data, lhs, rhs, perm, ...)
|
data |
A dataframe containing the variables in the model will be estimated. |
lhs |
A string indicating the name of the outcome variable in |
rhs |
A string indicating the name of the explanatory variable for which coefficient estimates will be plotted. |
perm |
A named dictionary in which values correspond to the sets of variables that should be iterated upon to produce the stability plot and names correspond to the names of these sets of variables that should be displayed in the plot. |
base |
Optional. A named dictionary in which values correspond to the sets of variables that should always be included in the model in all specifications and names correspond to the names of these sets of variables that should be displayed in the plot. |
perm_fe |
Optional. A named dictionary in which values correspond to the sets of fixed effects
that should be iterated upon to produce the stability plot and names correspond to the names
of these sets of variables that should be displayed in the plot. Functionally, these operate
identically to |
nonperm_fe |
Optional. A named dictionary in which values correspond to fixed effects that should be
iterated upon to produce the stability plot and names correspond to the names of these
sets of fixed effects that should be displayed in the plot. These fixed effects are included
sequentially in the plot, one at a time – i.e. combinations of |
fe_always |
Optional. A logical scalar. If one or more sets of fixed effects are
specified in |
sort |
A string specifying how models should be sorted by coefficient value. The default is
|
model |
Optional. A function that takes at least three arguments: |
iv |
Optional. A string indicating the variables which should be used to instrument |
cluster |
A string indicating the name of the variable by which standard errors should be clustered. Defaults to no clustering. |
weights |
A string indicating the name of the variable containing weights. Defaults to equal weighting. |
run_to |
A numeric scalar indicating at which step the |
point_size |
A numeric scalar indicating the size of the points indicating coefficient estimates. Defaults to 1. |
error_geom |
A string indicating the type of geom that should be used to indicate confidence
intervals on coefficient estimates. Currently supported are |
error_alpha |
A numeric scalar indicating the alpha of the error geom. Defaults to 0.2. |
coef_ylim |
A numeric vector of length two indicating the minimum and maximum values of the
y-axis in the coefficient plot. If not specified, uses |
coef_ylabel |
A string specifying the y-axis label on the coefficient panel. Defaults to 'Coefficient estimate'. |
control_geom |
A string indicating the geom that should be used to indicate the presence of
controls. Currently supported are |
control_spacing |
A string indicating how large the geoms indicating the presence of controls
should be. For |
control_text_size |
A numeric scalar indicating how large the control name text should be. Defaults to 9. |
trim_top |
A numeric scalar indicating how close the bottom panel (displaying presence of controls) should be to the top panel (displaying presence of coefficients). Useful when dealing with large CIs. |
rel_height |
A numeric scalar. Height of the control plot relative to the coefficient plot. |
Each row of the bottom panel of the plot corresponds to a single variable set. A variable set can contain one or more individual variables. To include multiple variables in a single set, specify them in a single string, separated by '+'.
If run_to
is left blank (default), returns a cowplot
grid containing both
panels. Else, returns the output of the function
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.