felm_tidiers {broom} | R Documentation |
These methods tidy the coefficients of a linear model with multiple group fixed effects
## S3 method for class 'felm' tidy(x, conf.int = FALSE, conf.level = 0.95, fe = FALSE, fe.error = fe, ...) ## S3 method for class 'felm' augment(x, data = NULL, ...) ## S3 method for class 'felm' glance(x, ...)
x |
felm object |
conf.int |
whether to include a confidence interval |
conf.level |
confidence level of the interval, used only if
|
fe |
whether to include estimates of fixed effects |
fe.error |
whether to include standard error of fixed effects |
... |
extra arguments (not used) |
data |
Original data, defaults to extracting it from the model |
If conf.int=TRUE
, the confidence interval is computed
All tidying methods return a data.frame without rownames, whose structure depends on the method chosen.
tidy.felm
returns one row for each coefficient. If fe=TRUE
, it also includes rows for for fixed effects estimates.
There are five columns:
term |
The term in the linear model being estimated and tested |
estimate |
The estimated coefficient |
std.error |
The standard error from the linear model |
statistic |
t-statistic |
p.value |
two-sided p-value |
If cont.int=TRUE
, it also includes columns for conf.low
and conf.high
, computed with confint
.
augment.felm
returns one row for each observation, with multiple columns added to the original data:
.fitted |
Fitted values of model |
.resid |
Residuals |
If fixed effect are present,
.comp |
Connected component |
.fe_ |
Fixed effects (as many columns as factors) |
glance.lm
returns a one-row data.frame with the columns
r.squared |
The percent of variance explained by the model |
adj.r.squared |
r.squared adjusted based on the degrees of freedom |
sigma |
The square root of the estimated residual variance |
statistic |
F-statistic |
p.value |
p-value from the F test |
df |
Degrees of freedom used by the coefficients |
df.residual |
residual degrees of freedom |
if (require("lfe", quietly = TRUE)) { N=1e2 DT <- data.frame( id = sample(5, N, TRUE), v1 = sample(5, N, TRUE), v2 = sample(1e6, N, TRUE), v3 = sample(round(runif(100,max=100),4), N, TRUE), v4 = sample(round(runif(100,max=100),4), N, TRUE) ) result_felm <- felm(v2~v3, DT) tidy(result_felm) augment(result_felm) result_felm <- felm(v2~v3|id+v1, DT) tidy(result_felm, fe = TRUE) augment(result_felm) v1<-DT$v1 v2 <- DT$v2 v3 <- DT$v3 id <- DT$id result_felm <- felm(v2~v3|id+v1) tidy(result_felm) augment(result_felm) glance(result_felm) }