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 modeling function. This includes the name of the modeling function or any arguments passed to the modeling 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.

Glance returns the same number of columns regardless of whether the model matrix is rank-deficient or not. If so, entries in columns that no longer have a well-defined value are filled in with an NA of the appropriate type.

# 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.level = 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) # Use built-in "airquality" dataset head(airquality)
#> Ozone Solar.R Wind Temp Month Day #> 1 41 190 7.4 67 5 1 #> 2 36 118 8.0 72 5 2 #> 3 12 149 12.6 74 5 3 #> 4 18 313 11.5 62 5 4 #> 5 NA NA 14.3 56 5 5 #> 6 28 NA 14.9 66 5 6
# No FEs; same as lm() est0 <- felm(Ozone ~ Temp + Wind + Solar.R, airquality) tidy(est0)
#> # A tibble: 4 x 5 #> term estimate std.error statistic p.value #> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 (Intercept) -64.3 23.1 -2.79 0.00623 #> 2 Temp 1.65 0.254 6.52 0.00000000242 #> 3 Wind -3.33 0.654 -5.09 0.00000152 #> 4 Solar.R 0.0598 0.0232 2.58 0.0112
augment(est0)
#> # A tibble: 111 x 7 #> .rownames Ozone Temp Wind Solar.R .fitted .resid #> <chr> <int> <int> <dbl> <int> <dbl> <dbl> #> 1 1 41 67 7.4 190 33.0 7.95 #> 2 2 36 72 8 118 35.0 1.00 #> 3 3 12 74 12.6 149 24.8 -12.8 #> 4 4 18 62 11.5 313 18.5 -0.475 #> 5 7 23 65 8.6 299 32.3 -9.26 #> 6 8 19 59 13.8 99 -6.95 25.9 #> 7 9 8 61 20.1 19 -29.4 37.4 #> 8 12 16 69 9.7 256 32.6 -16.6 #> 9 13 11 66 9.2 290 31.4 -20.4 #> 10 14 14 68 10.9 274 28.1 -14.1 #> # … with 101 more rows
# Add month fixed effects est1 <- felm(Ozone ~ Temp + Wind + Solar.R | Month, airquality) tidy(est1)
#> # A tibble: 3 x 5 #> term estimate std.error statistic p.value #> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 Temp 1.88 0.341 5.50 0.000000274 #> 2 Wind -3.11 0.660 -4.71 0.00000778 #> 3 Solar.R 0.0522 0.0237 2.21 0.0296
tidy(est1, fe = TRUE)
#> # A tibble: 8 x 7 #> term estimate std.error statistic p.value N comp #> <chr> <dbl> <dbl> <dbl> <dbl> <int> <dbl> #> 1 Temp 1.88 0.341 5.50 0.000000274 NA NA #> 2 Wind -3.11 0.660 -4.71 0.00000778 NA NA #> 3 Solar.R 0.0522 0.0237 2.21 0.0296 NA NA #> 4 Month.5 -74.2 4.23 -17.5 2.00 24 1 #> 5 Month.6 -89.0 6.91 -12.9 2.00 9 1 #> 6 Month.7 -83.0 4.06 -20.4 2 26 1 #> 7 Month.8 -78.4 4.32 -18.2 2.00 23 1 #> 8 Month.9 -90.2 3.85 -23.4 2 29 1
augment(est1)
#> # A tibble: 111 x 8 #> .rownames Ozone Temp Wind Solar.R Month .fitted .resid #> <chr> <int> <int> <dbl> <int> <int> <dbl> <dbl> #> 1 1 41 67 7.4 190 5 38.3 2.69 #> 2 2 36 72 8 118 5 42.1 -6.07 #> 3 3 12 74 12.6 149 5 33.1 -21.1 #> 4 4 18 62 11.5 313 5 22.6 -4.62 #> 5 7 23 65 8.6 299 5 36.5 -13.5 #> 6 8 19 59 13.8 99 5 -1.33 20.3 #> 7 9 8 61 20.1 19 5 -21.3 29.3 #> 8 12 16 69 9.7 256 5 38.4 -22.4 #> 9 13 11 66 9.2 290 5 36.1 -25.1 #> 10 14 14 68 10.9 274 5 33.7 -19.7 #> # … with 101 more rows
glance(est1)
#> # A tibble: 1 x 8 #> r.squared adj.r.squared sigma statistic p.value df df.residual nobs #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <int> #> 1 0.637 0.612 20.7 25.8 4.57e-20 103 103 111
# The "se.type" argument can be used to switch out different standard errors # types on the fly. In turn, this can be useful exploring the effect of # different error structures on model inference. tidy(est1, se.type = "iid")
#> # A tibble: 3 x 5 #> term estimate std.error statistic p.value #> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 Temp 1.88 0.341 5.50 0.000000274 #> 2 Wind -3.11 0.660 -4.71 0.00000778 #> 3 Solar.R 0.0522 0.0237 2.21 0.0296
tidy(est1, se.type = "robust")
#> # A tibble: 3 x 5 #> term estimate std.error statistic p.value #> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 Temp 1.88 0.344 5.45 0.000000344 #> 2 Wind -3.11 0.903 -3.44 0.000834 #> 3 Solar.R 0.0522 0.0226 2.31 0.0227
# Add clustered SEs (also by month) est2 <- felm(Ozone ~ Temp + Wind + Solar.R | Month | 0 | Month, airquality) tidy(est2, conf.int = TRUE)
#> # A tibble: 3 x 7 #> term estimate std.error statistic p.value conf.low conf.high #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 Temp 1.88 0.182 10.3 0.000497 1.37 2.38 #> 2 Wind -3.11 1.31 -2.38 0.0760 -6.74 0.518 #> 3 Solar.R 0.0522 0.0408 1.28 0.270 -0.0611 0.166
tidy(est2, conf.int = TRUE, se.type = "cluster")
#> # A tibble: 3 x 7 #> term estimate std.error statistic p.value conf.low conf.high #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 Temp 1.88 0.182 10.3 0.000497 1.37 2.38 #> 2 Wind -3.11 1.31 -2.38 0.0760 -6.74 0.518 #> 3 Solar.R 0.0522 0.0408 1.28 0.270 -0.0611 0.166
tidy(est2, conf.int = TRUE, se.type = "robust")
#> # A tibble: 3 x 7 #> term estimate std.error statistic p.value conf.low conf.high #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 Temp 1.88 0.344 5.45 0.00550 0.920 2.83 #> 2 Wind -3.11 0.903 -3.44 0.0262 -5.62 -0.602 #> 3 Solar.R 0.0522 0.0226 2.31 0.0817 -0.0104 0.115
tidy(est2, conf.int = TRUE, se.type = "iid")
#> # A tibble: 3 x 7 #> term estimate std.error statistic p.value conf.low conf.high #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 Temp 1.88 0.341 5.50 0.00532 0.929 2.82 #> 2 Wind -3.11 0.660 -4.71 0.00924 -4.94 -1.28 #> 3 Solar.R 0.0522 0.0237 2.21 0.0920 -0.0135 0.118