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.

coeftable( object, vcov = NULL, ssc = NULL, cluster = NULL, keep, drop, order, ... ) pvalue(object, vcov = NULL, ssc = NULL, cluster = NULL, keep, drop, order, ...) tstat(object, vcov = NULL, ssc = NULL, cluster = NULL, keep, drop, order, ...) se(object, vcov = NULL, ssc = NULL, cluster = NULL, keep, drop, order, ...)

object | An estimation. For example obtained from |
---|---|

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: |

ssc | An object of class |

cluster | [Fixest specific.] 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 |

drop | Character vector. This element is used if some variables are not to be displayed. This should be a vector of regular expressions (see |

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 |

... | Other arguments to be passed to |

se | [Fixest specific.] Character scalar. Which kind of standard error should be computed: “iid”, “hetero”, “cluster”, “twoway”, “threeway” or “fourway”? By default if there are fixed-effects in the estimation: |

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.

This set of functions is primarily constructed for `fixest`

estimations. Although it can work for non-`fixest`

estimations, support for exotic estimation procedures that do not report standardized coefficient tables is highly limited.

`pvalue`

: Extracts the p-value of an estimation`tstat`

: Extracts the t-statistics of an estimation`se`

: Extracts the standard-error of an estimation

# Some data and estimation data(trade) est = fepois(Euros ~ log(dist_km) | Origin^Product + Year, trade) # # Coeftable/se/tstat/pvalue # # Default is clustering along Origin^Product coeftable(est) #> Estimate Std. Error t value Pr(>|t|) #> log(dist_km) -1.023957 0.04728994 -21.65275 5.725404e-104 #> attr(,"type") #> [1] "Clustered (Origin^Product)" se(est) #> log(dist_km) #> 0.04728994 tstat(est) #> log(dist_km) #> -21.65275 pvalue(est) #> log(dist_km) #> 5.725404e-104 # Now with two-way clustered standard-errors # and using coeftable() coeftable(est, cluster = ~Origin + Product) #> Estimate Std. Error t value Pr(>|t|) #> log(dist_km) -1.023957 0.0906375 -11.29728 1.35342e-29 #> attr(,"type") #> [1] "Clustered (Origin & Product)" se(est, cluster = ~Origin + Product) #> log(dist_km) #> 0.0906375 pvalue(est, cluster = ~Origin + Product) #> log(dist_km) #> 1.35342e-29 tstat(est, cluster = ~Origin + Product) #> log(dist_km) #> -11.29728 # Or you can cluster only once: est_sum = summary(est, cluster = ~Origin + Product) coeftable(est_sum) #> Estimate Std. Error t value Pr(>|t|) #> log(dist_km) -1.023957 0.0906375 -11.29728 1.35342e-29 #> attr(,"type") #> [1] "Clustered (Origin & Product)" se(est_sum) #> log(dist_km) #> 0.0906375 tstat(est_sum) #> log(dist_km) #> -11.29728 pvalue(est_sum) #> log(dist_km) #> 1.35342e-29 # 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") #> x1 #> 7.960735 coeftable(est_iv, keep = "x1|Int") #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) 2.438955 0.25349903 9.621160 2.688392e-17 #> x1 0.559183 0.07024264 7.960735 4.261663e-13 coeftable(est_iv, order = "!Int") #> Estimate Std. Error t value Pr(>|t|) #> fit_x2 0.4509765 0.01794806 25.126759 4.556383e-55 #> x1 0.5591830 0.07024264 7.960735 4.261663e-13 #> (Intercept) 2.4389548 0.25349903 9.621160 2.688392e-17