binscatter: Make a binscatter plot, allowing for formulas and fixed...

Description Usage Arguments Details See Also Examples

View source: R/binscatter.r

Description

This is a convenience wrapper around lfe::felm() and binsreg::binsreg(), because I want the ease of Stata's binscatter.

Usage

1

Arguments

formula

A formula to estimate, of the form y ~ x1 + x2 | fe1 + fe2

data

Data to use

x

Independent variable of interest. May be a vector (as in binsreg()) or the name of a varaible in data. If omitted, the first x variable in the formula is used.

...

Other arguments passed to binsreg

weights

Optional vector of weights. Interpretation is the same as lm().

Details

Important note: The standard errors here will not account for the fixed effects. This function is useful for plots, and is not recommended for inference.

See Also

binsreg::binsreg(), lfe::felm()

Examples

1
2
3
4
5
if (requireNamespace("binsreg", quietly=TRUE)) {
  res <- binscatter(Sepal.Length ~ Sepal.Width + Petal.Length | Species, iris)
  print(res$bins_plot)
  res <- binscatter(Sepal.Length ~ Sepal.Width + Petal.Length | Species, iris, x="Petal.Length")
}

karldw/kdw.junk documentation built on Sept. 8, 2021, 9:30 p.m.