Gets the degrees of freedom of a fixest estimation
Simple utility to extract the degrees of freedom from a fixest
estimation.
degrees_freedom( x, type, vars = NULL, vcov = NULL, se = NULL, cluster = NULL, ssc = NULL, stage = 2 )
x |
A |
type |
Character scalar, equal to "k", "resid", "t". If "k", then the number of regressors is returned. If "resid", then it is the "residuals degree of freedom", i.e. the number of observations minus the number of regressors. If "t", it is the degrees of freedom used in the t-test. Note that these values are affected by how the VCOV of |
vars |
A vector of variable names, of the regressors. This is optional. If provided, then |
vcov |
Versatile argument to specify the VCOV. In general, it is either a character scalar equal to a VCOV type, either a formula of the form: |
se |
Character scalar. Which kind of standard error should be computed: “standard”, “hetero”, “cluster”, “twoway”, “threeway” or “fourway”? By default if there are clusters in the estimation: |
cluster |
Tells how to cluster the standard-errors (if clustering is requested). Can be either a list of vectors, a character vector of variable names, a formula or an integer vector. Assume we want to perform 2-way clustering over |
ssc |
An object of class |
stage |
Either 1 or 2. Only concerns IV regressions, which stage to look at. |
# First: an estimation base = iris names(base) = c("y", "x1", "x2", "x3", "species") est = feols(y ~ x1 + x2 | species, base) # "Normal" standard-errors (SE) est_standard = summary(est, se = "st") # Clustered SEs est_clustered = summary(est, se = "clu") # The different degrees of freedom # => different type 1 DoF (because of the clustering) degrees_freedom(est_standard, type = "k") degrees_freedom(est_clustered, type = "k") # fixed-effects are excluded # => different type 2 DoF (because of the clustering) degrees_freedom(est_standard, type = "resid") # => equivalent to the df.residual from lm degrees_freedom(est_clustered, type = "resid")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.