Summary of a fixest object. Computes different types of standard errors.
This function is similar to print.fixest
. It provides the table of coefficients along with other information on the fit of the estimation. It can compute different types of standard errors. The new variance covariance matrix is an object returned.
## S3 method for class 'fixest' summary( object, vcov = NULL, cluster = NULL, ssc = NULL, .vcov = NULL, stage = NULL, lean = FALSE, agg = NULL, forceCovariance = FALSE, se = NULL, keepBounded = FALSE, n = 1000, nthreads = getFixest_nthreads(), ... ) ## S3 method for class 'fixest_list' summary( object, se, cluster, ssc = getFixest_ssc(), .vcov, stage = 2, lean = FALSE, n, ... )
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: |
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 |
.vcov |
A user provided covariance matrix or a function computing this matrix. If a matrix, it must be a square matrix of the same number of rows as the number of variables estimated. If a function, it must return the previously mentioned matrix. |
stage |
Can be equal to |
lean |
Logical, default is |
agg |
A character scalar describing the variable names to be aggregated, it is pattern-based. All variables that match the pattern will be aggregated. It must be of the form |
forceCovariance |
(Advanced users.) Logical, default is |
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: |
keepBounded |
(Advanced users – |
n |
Integer, default is 1000. Number of coefficients to display when the print method is used. |
nthreads |
The number of threads. Can be: a) an integer lower than, or equal to, the maximum number of threads; b) 0: meaning all available threads will be used; c) a number strictly between 0 and 1 which represents the fraction of all threads to use. The default is to use 50% of all threads. You can set permanently the number of threads used within this package using the function |
... |
Only used if the argument |
It returns a fixest
object with:
cov.scaled |
The new variance-covariance matrix (computed according to the argument |
se |
The new standard-errors (computed according to the argument |
coeftable |
The table of coefficients with the new standard errors. |
The VCOVs from sandwich
can be used with feols
, feglm
and fepois
estimations. If you want to have a sandwich
VCOV when using summary.fixest
, you can use the argument vcov
to specify the VCOV function to use (see examples).
Note that if you do so and you use a formula in the cluster
argument, an innocuous warning can pop up if you used several non-numeric fixed-effects in the estimation (this is due to the function expand.model.frame
used in sandwich
).
Laurent Berge
See also the main estimation functions femlm
, feols
or feglm
. Use fixef.fixest
to extract the fixed-effects coefficients, and the function etable
to visualize the results of multiple estimations.
# Load trade data data(trade) # We estimate the effect of distance on trade (with 3 fixed-effects) est_pois = fepois(Euros ~ log(dist_km)|Origin+Destination+Product, trade) # Comparing different types of standard errors sum_standard = summary(est_pois, vcov = "iid") sum_hetero = summary(est_pois, vcov = "hetero") sum_oneway = summary(est_pois, vcov = "cluster") sum_twoway = summary(est_pois, vcov = "twoway") etable(sum_standard, sum_hetero, sum_oneway, sum_twoway) # Alternative ways to cluster the SE: summary(est_pois, vcov = cluster ~ Product + Origin) summary(est_pois, vcov = ~Product + Origin) summary(est_pois, cluster = ~Product + Origin) # You can interact the clustering variables "live" using the var1 ^ var2 syntax.#' summary(est_pois, vcov = ~Destination^Product) # # Newey-West and Driscoll-Kraay SEs # data(base_did) # Simple estimation on a panel est = feols(y ~ x1, base_did) # -- # Newey-West # Use the syntax NW ~ unit + time summary(est, NW ~ id + period) # Now take a lag of 3: summary(est, NW(3) ~ id + period) # -- # Driscoll-Kraay # Use the syntax DK ~ time summary(est, DK ~ period) # Now take a lag of 3: summary(est, DK(3) ~ period) #-- # Implicit deductions # When the estimation is done with a panel.id, you don't need to # specify these values. est_panel = feols(y ~ x1, base_did, panel.id = ~id + period) # Both methods, NM and DK, now work automatically summary(est_panel, "NW") summary(est_panel, "DK") # # VCOVs robust to spatial correlation # data(quakes) est_geo = feols(depth ~ mag, quakes) # -- # Conley # Use the syntax: conley(cutoff) ~ lat + lon # with lat/lon the latitude/longitude variable names in the data set summary(est_geo, conley(100) ~ lat + long) # Change the cutoff, and how the distance is computed summary(est_geo, conley(200, distance = "spherical") ~ lat + long) # -- # Implicit deduction # By default the latitude and longitude are directly fetched in the data based # on pattern matching. So you don't have to specify them. # Further an automatic cutoff is computed by default. # The following works summary(est_geo, "conley") # # Compatibility with sandwich # # You can use the VOCVs from sandwich by using the argument .vcov: library(sandwich) summary(est_pois, .vcov = vcovCL, cluster = trade[, c("Destination", "Product")])
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.