Description Usage Arguments Details Value Author(s) See Also Examples
Interfaces to lfe
functions that can be used
in a pipeline implemented by magrittr
.
1 |
data |
data frame, tibble, list, ... |
... |
Other arguments passed to the corresponding interfaced function. |
Interfaces call their corresponding interfaced function.
Object returned by interfaced function.
Roberto Bertolusso
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ## Not run:
library(intubate)
library(magrittr)
library(lfe)
oldopts <- options(lfe.threads=1)
set.seed(123)
## create covariates
x <- rnorm(1000)
x2 <- rnorm(length(x))
## individual and firm
id <- factor(sample(20,length(x),replace=TRUE))
firm <- factor(sample(13,length(x),replace=TRUE))
## effects for them
id.eff <- rnorm(nlevels(id))
firm.eff <- rnorm(nlevels(firm))
## left hand side
u <- rnorm(length(x))
y <- x + 0.5*x2 + id.eff[id] + firm.eff[firm] + u
data <- data.frame(x = x, x2 = x2, id = id,
firm = firm, u = u, y = y)
## Original function to interface
est <- felm(y ~ x + x2 | id + firm, data)
summary(est)
## The interface reverses the order of data and formula
est <- ntbt_felm(data, y ~ x + x2 | id + firm)
summary(est)
## so it can be used easily in a pipeline.
data %>%
ntbt_felm(y ~ x + x2 | id + firm) %>%
summary()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.