Title: | Scatter Plot After Residualizing Using 'fixest' Package |
---|---|
Description: | Creates a scatter plot after residualizing using a set of covariates. The residuals are calculated using the 'fixest' package which allows very fast estimation that scales. Details of the (Yule-)Frisch-Waugh-Lovell theorem is given in Basu (2023) <doi:10.48550/arXiv.2307.00369>. |
Authors: | Kyle Butts [aut, cre] |
Maintainer: | Kyle Butts <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.0 |
Built: | 2024-11-22 06:28:26 UTC |
Source: | CRAN |
~
or |
)Break apart formula (from right to left) based on a symbole (~
or |
)
fml_breaker(fml, op)
fml_breaker(fml, op)
fml |
Formula following |
op |
String. Either |
list of symbol
or language
from right to left that are split at each occurence of op
.
This function creates a bivariate plot of y
and x
after residualizing over a set of covariates w
.
fwl_plot(fml, data, ggplot = FALSE, n_sample = 1000, alpha = 0.5, ...) fwlplot(fml, data, ggplot = FALSE, n_sample = 1000, alpha = 0.5, ...)
fwl_plot(fml, data, ggplot = FALSE, n_sample = 1000, alpha = 0.5, ...) fwlplot(fml, data, ggplot = FALSE, n_sample = 1000, alpha = 0.5, ...)
fml |
Of the form |
data |
A |
ggplot |
Boolean. Default is to use base R plot but if TRUE, use ggplot. |
n_sample |
Numeric. Number of observations to sample for each facet. |
alpha |
Numeric. Alpha transparency of each individual point. If NULL, will plot all rows. |
... |
Additional arguments passed to |
Either NULL if ggplot = FALSE
or a ggplot object if ggplot = TRUE
. In either case, plots the figure.
fwl_plot(mpg ~ hp + wt | cyl, mtcars)
fwl_plot(mpg ~ hp + wt | cyl, mtcars)
Split formula into terms
get_fml_parts(formula, parts_as_formula = FALSE)
get_fml_parts(formula, parts_as_formula = FALSE)
formula |
Full formula following |
parts_as_formula |
Logical. If |
List of expressions/formula for each part of the formula. It will be of type symbol
/language
unless parts_as_formula = TRUE
. Can be used with
fixest::xpd
and the dot bracket syntax to create formula. Any missing
elements will be given a value of NULL
. The list contains the following:
y_fml |
The LHS |
W_lin |
The linear part of the exogenous variables |
W_FE |
The fixed effects part of the exogenous variables |
T_fml |
The endogenous variable |
Z_lin |
The linear part of the instruments |
Z_FE |
The fixed effects part of the instruments |