Default method to extracts the coefficients table and its sub-components from an estimation.
Usage
# S3 method for default
coeftable(object, keep, drop, order, ...)
# S3 method for default
se(object, keep, drop, order, ...)
# S3 method for default
tstat(object, keep, drop, order, ...)
# S3 method for default
pvalue(object, keep, drop, order, ...)
# S3 method for matrix
se(object, keep, drop, order, ...)
Arguments
- object
The result of an estimation (a fitted model object). Note that this function is made to work with
fixest
objects so it may not work for the specific model you provide.- keep
Character vector. This element is used to display only a subset of variables. This should be a vector of regular expressions (see
base::regex
help for more info). Each variable satisfying any of the regular expressions will be kept. This argument is applied post aliasing (see argumentdict
). Example: you have the variablex1
tox55
and want to display onlyx1
tox9
, then you could usekeep = "x[[:digit:]]$"
. If the first character is an exclamation mark, the effect is reversed (e.g. keep = "!Intercept" means: every variable that does not contain “Intercept” is kept). See details.- drop
Character vector. This element is used if some variables are not to be displayed. This should be a vector of regular expressions (see
base::regex
help for more info). Each variable satisfying any of the regular expressions will be discarded. This argument is applied post aliasing (see argumentdict
). Example: you have the variablex1
tox55
and want to display onlyx1
tox9
, then you could usedrop = "x[[:digit:]]{2}
". If the first character is an exclamation mark, the effect is reversed (e.g. drop = "!Intercept" means: every variable that does not contain “Intercept” is dropped). See details.- order
Character vector. This element is used if the user wants the variables to be ordered in a certain way. This should be a vector of regular expressions (see
base::regex
help for more info). The variables satisfying the first regular expression will be placed first, then the order follows the sequence of regular expressions. This argument is applied post aliasing (see argumentdict
). Example: you have the following variables:month1
tomonth6
, thenx1
tox5
, thenyear1
toyear6
. If you want to display first the x's, then the years, then the months you could use:order = c("x", "year")
. If the first character is an exclamation mark, the effect is reversed (e.g. order = "!Intercept" means: every variable that does not contain “Intercept” goes first). See details.- ...
Other arguments that will be passed to
summary
.First the method summary is applied if needed, then the coefficients table is extracted from its output.
The default method is very naive and hopes that the resulting coefficients table contained in the summary of the fitted model is well formed: this assumption is very often wrong. Anyway, there is no development intended since the coeftable/se/pvalue/tstat series of methods is only intended to work well with
fixest
objects. To extract the coefficients table from fitted models in a general way, it's better to use tidy from broom.
Functions
se(default)
: Extracts the standard-errors from an estimationtstat(default)
: Extracts the standard-errors from an estimationpvalue(default)
: Extracts the p-values from an estimationse(matrix)
: Extracts the standard-errors from a VCOV matrix
Examples
# NOTA: This function is really made to handle fixest objects
# The default methods works for simple structures, but you'd be
# likely better off with broom::tidy for other models
est = lm(mpg ~ cyl, mtcars)
coeftable(est)
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 37.88458 2.0738436 18.267808 8.369155e-18
#> cyl -2.87579 0.3224089 -8.919699 6.112687e-10
se(est)
#> (Intercept) cyl
#> 2.0738436 0.3224089