| coeftable.fixest | R Documentation |
Set of functions to directly extract some commonly used statistics, like the p-value or
the table of coefficients, from estimations. This was first implemented for
fixest estimations, but has some support for other models.
## S3 method for class 'fixest'
coeftable(
object,
vcov = NULL,
ssc = NULL,
cluster = NULL,
keep = NULL,
drop = NULL,
order = NULL,
list = FALSE,
...
)
## S3 method for class 'fixest'
se(
object,
vcov = NULL,
ssc = NULL,
cluster = NULL,
keep = NULL,
drop = NULL,
order = NULL,
...
)
## S3 method for class 'fixest'
tstat(
object,
vcov = NULL,
ssc = NULL,
cluster = NULL,
keep = NULL,
drop = NULL,
order = NULL,
...
)
## S3 method for class 'fixest'
pvalue(
object,
vcov = NULL,
ssc = NULL,
cluster = NULL,
keep = NULL,
drop = NULL,
order = NULL,
...
)
object |
A |
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:
vcov_type ~ variables. The VCOV types implemented are: "iid", "hetero" (or "HC1"),
"cluster", "twoway", "NW" (or "newey_west"), "DK" (or "driscoll_kraay"), and "conley".
It also accepts object from vcov_cluster, vcov_NW, NW, vcov_DK, DK, vcov_conley and conley.
It also accepts covariance matrices computed externally.
Finally it accepts functions to compute the covariances.
See the vcov documentation in the vignette.
You can pass several VCOVs (as above) if you nest them into a list.
If the number of VCOVs equals the number of models, eahc VCOV is mapped to the appropriate model.
If there is one model and several VCOVs, or if the first element of the list is equal to
|
ssc |
An object of class |
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 |
keep |
Character vector. This element is used to display only a subset of variables. This
should be a vector of regular expressions (see Example: you have the variable |
drop |
Character vector. This element is used if some variables are not to be displayed.
This should be a vector of regular expressions (see Example: you have the variable |
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 Example: you have the following variables: |
list |
Logical, default is |
... |
Other arguments to be passed to |
This set of tiny functions is primarily constructed for fixest estimations.
Returns a table of coefficients, with in rows the variables and four columns: the estimate, the standard-error, the t-statistic and the p-value.
If list = TRUE then a nested list is returned, the first layer is accessed with
the coefficients names; the second layer with the following values:
coef, se, tstat, pvalue. For example, with res = coeftable(est, list = TRUE)
you can access the SE of the coefficient x1 with res$x1$se; and its
coefficient with res$x1$coef, etc.
se(fixest): Extracts the standard-error of an estimation
tstat(fixest): Extracts the t-statistics of an estimation
pvalue(fixest): Extracts the p-value of an estimation
# Some data and estimation
data(trade)
est = fepois(Euros ~ log(dist_km) | Origin^Product + Year, trade)
#
# Coeftable/se/tstat/pvalue
#
coeftable(est)
se(est)
tstat(est)
pvalue(est)
# Now with two-way clustered standard-errors
# and using coeftable()
coeftable(est, cluster = ~Origin + Product)
se(est, cluster = ~Origin + Product)
pvalue(est, cluster = ~Origin + Product)
tstat(est, cluster = ~Origin + Product)
# Or you can cluster only once using summary:
est_sum = summary(est, cluster = ~Origin + Product)
coeftable(est_sum)
se(est_sum)
tstat(est_sum)
pvalue(est_sum)
# You can use the arguments keep, drop, order
# to rearrange the results
base = iris
names(base) = c("y", "x1", "x2", "x3", "species")
est_iv = feols(y ~ x1 | x2 ~ x3, base)
tstat(est_iv, keep = "x1")
coeftable(est_iv, keep = "x1|Int")
coeftable(est_iv, order = "!Int")
#
# Using lists
#
# Returning the coefficients table as a list can be useful for quick
# reference in markdown documents.
# Note that the "(Intercept)" is renamed into "constant"
res = coeftable(est_iv, list = TRUE)
# coefficient of the constant:
res$constant$coef
# pvalue of x1
res$x1$pvalue
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.