Glance accepts a model object and returns a tibble::tibble() with exactly one row of model summaries. The summaries are typically goodness of fit measures, p-values for hypothesis tests on residuals, or model convergence information.

Glance never returns information from the original call to the modelling function. This includes the name of the modelling function or any arguments passed to the modelling function.

Glance does not calculate summary measures. Rather, it farms out these computations to appropriate methods and gathers the results together. Sometimes a goodness of fit measure will be undefined. In these cases the measure will be reported as NA.

# S3 method for felm
glance(x, ...)

Arguments

x

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

...

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.

Value

A tibble::tibble() with exactly one row and columns:

adj.r.squared

Adjusted R squared statistic, which is like the R squared statistic except taking degrees of freedom into account.

df

Degrees of freedom used by the model.

df.residual

Residual degrees of freedom.

nobs

Number of observations used.

p.value

P-value corresponding to the test statistic.

r.squared

R squared statistic, or the percent of variation explained by the model. Also known as the coefficient of determination.

sigma

Estimated standard error of the residuals.

statistic

Test statistic.

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