Tidy summarizes information about the components of a model. A model component might be a single term in a regression, a single hypothesis, a cluster, or a class. Exactly what tidy considers to be a model component varies cross models but is usually self-evident. If a model has several distinct types of components, you will need to specify which components to return.

# S3 method for felm
tidy(x, conf.int = FALSE, conf.level = 0.95, fe = FALSE, robust = FALSE, ...)

Arguments

x

A felm object returned from lfe::felm().

conf.int

Logical indicating whether or not to include a confidence interval in the tidied output. Defaults to FALSE.

conf.level

The confidence level to use for the confidence interval if conf.int = TRUE. Must be strictly greater than 0 and less than 1. Defaults to 0.95, which corresponds to a 95 percent confidence interval.

fe

Logical indicating whether or not to include estimates of fixed effects. Defaults to FALSE.

robust

Logical indicating robust or clustered SEs should be used. See lfe::summary.felm for details. Defaults to FALSE.

...

Additional arguments. Not used. Needed to match generic signature only. Cautionary note: Misspelled arguments will be absorbed in ..., where they will be ignored. If the misspelled argument has a default value, the default value will be used. For example, if you pass conf.lvel = 0.9, all computation will proceed using conf.level = 0.95. Additionally, if you pass newdata = my_tibble to an augment() method that does not accept a newdata argument, it will use the default value for the data argument.

See also

tidy(), lfe::felm()

Other felm tidiers: augment.felm()

Value

A tibble::tibble() with columns:

conf.high

Upper bound on the confidence interval for the estimate.

conf.low

Lower bound on the confidence interval for the estimate.

estimate

The estimated value of the regression term.

p.value

The two-sided p-value associated with the observed statistic.

statistic

The value of a T-statistic to use in a hypothesis that the regression term is non-zero.

std.error

The standard error of the regression term.

term

The name of the regression term.

Examples

library(lfe) 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)
#> # A tibble: 2 x 5 #> term estimate std.error statistic p.value #> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 (Intercept) 467859. 61258. 7.64 1.49e-11 #> 2 v3 98.7 1035. 0.0954 9.24e- 1
augment(result_felm)
#> # A tibble: 100 x 4 #> v2 v3 .fitted[,"v2"] .resid[,"v2"] #> <int> <dbl> <dbl> <dbl> #> 1 638177 54.7 473257. 164920. #> 2 282741 58.7 473656. -190915. #> 3 569992 58.3 473610. 96382. #> 4 435417 41.8 471982. -36565. #> 5 289325 45.8 472378. -183053. #> 6 100010 4.21 468275. -368265. #> 7 949382 80.1 475768. 473614. #> 8 457661 37.4 471552. -13891. #> 9 539312 78.2 475575. 63737. #> 10 8949 66.7 474438. -465489. #> # … with 90 more rows
result_felm <- felm(v2~v3|id+v1, DT) tidy(result_felm, fe = TRUE)
#> # A tibble: 11 x 7 #> term estimate std.error statistic p.value N comp #> <chr> <dbl> <dbl> <dbl> <dbl> <int> <dbl> #> 1 v3 849. 1124. 0.755 0.452 NA NA #> 2 id.1 444564. 109308. 4.07 0.000553 21 1 #> 3 id.2 416048. 108928. 3.82 0.00107 20 1 #> 4 id.3 476088. 105216. 4.52 0.000152 23 1 #> 5 id.4 377947. 117362. 3.22 0.00502 17 1 #> 6 id.5 415149. 117061. 3.55 0.00216 19 1 #> 7 v1.1 0 0 NaN NaN 25 1 #> 8 v1.2 28466. 81280. 0.350 0.730 20 1 #> 9 v1.3 61511. 105015. 0.586 0.567 14 1 #> 10 v1.4 -134391. 88261. -1.52 1.85 17 1 #> 11 v1.5 36990. 88533. 0.418 0.680 24 1
tidy(result_felm, robust = TRUE)
#> # A tibble: 1 x 5 #> term estimate std.error statistic p.value #> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 v3 849. 1131. 0.750 0.455
augment(result_felm)
#> # A tibble: 100 x 6 #> v2 v3 id v1 .fitted[,"v2"] .resid[,"v2"] #> <int> <dbl> <int> <int> <dbl> <dbl> #> 1 638177 54.7 3 5 559497. 78680. #> 2 282741 58.7 3 3 587449. -304708. #> 3 569992 58.3 2 1 465497. 104495. #> 4 435417 41.8 2 2 479965. -44548. #> 5 289325 45.8 3 1 514946. -225621. #> 6 100010 4.21 5 2 447188. -347178. #> 7 949382 80.1 4 5 482944. 466438. #> 8 457661 37.4 1 3 537826. -80165. #> 9 539312 78.2 2 4 348000. 191312. #> 10 8949 66.7 3 4 398271. -389322. #> # … with 90 more rows
v1 <- DT$v1 v2 <- DT$v2 v3 <- DT$v3 id <- DT$id result_felm <- felm(v2~v3|id+v1) tidy(result_felm)
#> # A tibble: 1 x 5 #> term estimate std.error statistic p.value #> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 v3 849. 1124. 0.755 0.452
augment(result_felm)
#> # A tibble: 100 x 6 #> v2 v3 id v1 .fitted[,"v2"] .resid[,"v2"] #> <int> <dbl> <int> <int> <dbl> <dbl> #> 1 638177 54.7 3 5 559497. 78680. #> 2 282741 58.7 3 3 587449. -304708. #> 3 569992 58.3 2 1 465497. 104495. #> 4 435417 41.8 2 2 479965. -44548. #> 5 289325 45.8 3 1 514946. -225621. #> 6 100010 4.21 5 2 447188. -347178. #> 7 949382 80.1 4 5 482944. 466438. #> 8 457661 37.4 1 3 537826. -80165. #> 9 539312 78.2 2 4 348000. 191312. #> 10 8949 66.7 3 4 398271. -389322. #> # … with 90 more rows
glance(result_felm)
#> # A tibble: 1 x 8 #> r.squared adj.r.squared sigma statistic p.value df df.residual nobs #> <dbl> <dbl> <dbl> <dbl> <dbl> <int> <int> <int> #> 1 0.0527 -0.0421 314086. 0.556 0.829 90 90 100