Title: Scatter Plot After Residualizing Using 'fixest' Package
Version: 0.3.0
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>.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.1
Imports: data.table, fixest, tinyplot
Suggests: ggplot2
NeedsCompilation: no
Packaged: 2024-06-24 12:48:39 UTC; kylebutts
Author: Kyle Butts ORCID iD [aut, cre]
Maintainer: Kyle Butts <kbutts@uark.edu>
Repository: CRAN
Date/Publication: 2024-06-24 13:30:02 UTC

Break apart formula (from right to left) based on a symbole (~ or |)

Description

Break apart formula (from right to left) based on a symbole (~ or |)

Usage

fml_breaker(fml, op)

Arguments

fml

Formula following fixest syntax.

op

String. Either ~ or |

Value

list of symbol or language from right to left that are split at each occurence of op.


FWL Plot

Description

This function creates a bivariate plot of y and x after residualizing over a set of covariates w.

Usage

fwl_plot(fml, data, ggplot = FALSE, n_sample = 1000, alpha = 0.5, ...)

fwlplot(fml, data, ggplot = FALSE, n_sample = 1000, alpha = 0.5, ...)

Arguments

fml

Of the form y ~ x + covs | fes following the fixest formula syntax. The x variable you want plotted should come first.

data

A dataframe object that contains the variables in fml.

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 fixest::feols.

Value

Either NULL if ggplot = FALSE or a ggplot object if ggplot = TRUE. In either case, plots the figure.

Examples


fwl_plot(mpg ~ hp + wt | cyl, mtcars)



Split formula into terms

Description

Split formula into terms

Usage

get_fml_parts(formula, parts_as_formula = FALSE)

Arguments

formula

Full formula following fixest syntax: y ~ W | W_FE | T ~ Z | Z_FE.

parts_as_formula

Logical. If TRUE, then each part will be a right-hand side formula. Default is FALSE

Value

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