R: Obtain various statistics from an estimation

coeftable {fixest} | R Documentation

## Obtain various statistics from an estimation

### Description

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.

### Usage

    coeftable(object, se, cluster, ...)

    ctable(object, se, cluster, ...)

    pvalue(object, se, cluster, ...)

    tstat(object, se, cluster, ...)

    se(object, se, cluster, ...)

### Arguments

`object` | An estimation. For example obtained from `feols`.
`se` | [Fixest specific.] 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: `se = "cluster"`, otherwise `se = "standard"`. Note that this argument can be implicitly deduced from the argument `cluster`.
`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 `var1` and `var2` contained in the data.frame `base` used for the estimation. All the following `cluster` arguments are valid and do the same thing: `cluster = base[, c("var1, "var2")]}, \code{cluster = c("var1, "var2")`, `cluster = ~var1+var2`. If the two variables were used as clusters in the estimation, you could further use `cluster = 1:2` or leave it blank with `se = "twoway"` (assuming `var1` [resp. `var2`] was the 1st [res. 2nd] cluster).
`...` | Other arguments to be passed to `summary`.

### Details

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.

### Value

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.

### Functions

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

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

- `se`: Extracts the standard-error of an estimation

### Examples

    # 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)
    se(est)
    tstat(est)
    pvalue(est)

    # Now with two-way clustered standard-errors
    #  and using ctable(), the alias to coeftable()

    ctable(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:
    est_sum = summary(est, cluster = ~Origin + Product)
    ctable(est_sum)
    se(est_sum)
    tstat(est_sum)
    pvalue(est_sum)

[Package fixest version 0.8.4 Index]