broom (version 0.3.7)

felm_tidiers: Tidying methods for models with multiple group fixed effects

Description

These methods tidy the coefficients of a linear model with multiple group fixed effects

Usage

## 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, ...)

Arguments

x
felm object
conf.int
whether to include a confidence interval
conf.level
confidence level of the interval, used only if conf.int=TRUE
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

Value

  • 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:

  • termThe term in the linear model being estimated and tested
  • estimateThe estimated coefficient
  • std.errorThe standard error from the linear model
  • statistict-statistic
  • p.valuetwo-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:

  • .fittedFitted values of model
  • .residResiduals
  • If fixed effect are present,
  • .compConnected component
  • .fe_Fixed effects (as many columns as factors)
  • glance.lm returns a one-row data.frame with the columns
  • r.squaredThe percent of variance explained by the model
  • adj.r.squaredr.squared adjusted based on the degrees of freedom
  • sigmaThe square root of the estimated residual variance
  • statisticF-statistic
  • p.valuep-value from the F test
  • dfDegrees of freedom used by the coefficients
  • df.residualresidual degrees of freedom

Details

If conf.int=TRUE, the confidence interval is computed

Examples

Run this code
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)
}

Run the code above in your browser using DataLab