Skip to contents

Series of methods to extract the coefficients table or its sub-components from a fixest_multi objects (i.e. the outcome of multiple estimations).

Usage

# S3 method for fixest_multi
coeftable(
  object,
  vcov = NULL,
  keep = NULL,
  drop = NULL,
  order = NULL,
  long = FALSE,
  wide = FALSE,
  ...
)

# S3 method for fixest_multi
se(
  object,
  vcov = NULL,
  keep = NULL,
  drop = NULL,
  order = NULL,
  long = FALSE,
  ...
)

# S3 method for fixest_multi
tstat(
  object,
  vcov = NULL,
  keep = NULL,
  drop = NULL,
  order = NULL,
  long = FALSE,
  ...
)

# S3 method for fixest_multi
pvalue(
  object,
  vcov = NULL,
  keep = NULL,
  drop = NULL,
  order = NULL,
  long = FALSE,
  ...
)

Arguments

object

A fixest_multi object, coming from a fixest multiple estimation.

vcov

A function to be used to compute the standard-errors of each fixest object. You can pass extra arguments to this function using the argument .vcov_args. See the example.

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 argument dict). Example: you have the variable x1 to x55 and want to display only x1 to x9, then you could use keep = "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 argument dict). Example: you have the variable x1 to x55 and want to display only x1 to x9, then you could use drop = "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 argument dict). Example: you have the following variables: month1 to month6, then x1 to x5, then year1 to year6. 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.

long

Logical scalar, default is FALSE. If TRUE, then all the information is stacked, with two columns containing the information: "param" and "value". The column param contains the values coef/se/tstat/pvalue.

wide

A logical scalar, default is FALSE. If TRUE, then a list is returned: the elements of the list are coef/se/tstat/pvalue. Each element of the list is a wide table with a column per coefficient.

...

Other arguments to be passed to summary.fixest.

Value

It returns a data.frame containing the coefficients tables (or just the se/pvalue/tstat) along with the information on which model was estimated.

If wide = TRUE, then a list is returned. The elements of the list are coef/se/tstat/pvalue. Each element of the list is a wide table with a column per coefficient.

If long = TRUE, then all the information is stacked. This removes the 4 columns containing the coefficient estimates to the p-values, and replace them with two new columns: "param" and "value". The column param contains the values coef/se/tstat/pvalue, and the column values the associated numerical information.

Functions

  • se(fixest_multi): Extracts the standard-errors from fixest_multi estimations

  • tstat(fixest_multi): Extracts the t-stats from fixest_multi estimations

  • pvalue(fixest_multi): Extracts the p-values from fixest_multi estimations

Examples


base = setNames(iris, c("y", "x1", "x2", "x3", "species"))
est_multi = feols(y ~ csw(x.[,1:3]), base, split = ~species)

# we get all the coefficient tables at once
coeftable(est_multi)
#>    id sample.var     sample          rhs coefficient   Estimate Std. Error
#> 1   1    species     setosa           x1 (Intercept)  2.6390012 0.31001431
#> 2   1    species     setosa           x1          x1  0.6904897 0.08989888
#> 3   2    species     setosa      x1 + x2 (Intercept)  2.3037382 0.38529423
#> 4   2    species     setosa      x1 + x2          x1  0.6674162 0.09035581
#> 5   2    species     setosa      x1 + x2          x2  0.2834193 0.19722377
#> 6   3    species     setosa x1 + x2 + x3 (Intercept)  2.3518898 0.39286751
#> 7   3    species     setosa x1 + x2 + x3          x1  0.6548350 0.09244742
#> 8   3    species     setosa x1 + x2 + x3          x2  0.2375602 0.20801921
#> 9   3    species     setosa x1 + x2 + x3          x3  0.2521257 0.34686362
#> 10  4    species versicolor           x1 (Intercept)  3.5397347 0.56287357
#> 11  4    species versicolor           x1          x1  0.8650777 0.20193757
#> 12  5    species versicolor      x1 + x2 (Intercept)  2.1164314 0.49425559
#> 13  5    species versicolor      x1 + x2          x1  0.2476422 0.18683892
#> 14  5    species versicolor      x1 + x2          x2  0.7355868 0.12476776
#> 15  6    species versicolor x1 + x2 + x3 (Intercept)  1.8955395 0.50705524
#> 16  6    species versicolor x1 + x2 + x3          x1  0.3868576 0.20454490
#> 17  6    species versicolor x1 + x2 + x3          x2  0.9083370 0.16543248
#> 18  6    species versicolor x1 + x2 + x3          x3 -0.6792238 0.43538206
#> 19  7    species  virginica           x1 (Intercept)  3.9068365 0.75706053
#> 20  7    species  virginica           x1          x1  0.9015345 0.25310551
#> 21  8    species  virginica      x1 + x2 (Intercept)  0.6247824 0.52486745
#> 22  8    species  virginica      x1 + x2          x1  0.2599540 0.15333757
#> 23  8    species  virginica      x1 + x2          x2  0.9348189 0.08960197
#> 24  9    species  virginica x1 + x2 + x3 (Intercept)  0.6998830 0.53360089
#> 25  9    species  virginica x1 + x2 + x3          x1  0.3303370 0.17432873
#> 26  9    species  virginica x1 + x2 + x3          x2  0.9455356 0.09072204
#> 27  9    species  virginica x1 + x2 + x3          x3 -0.1697527 0.19807243
#>       t value     Pr(>|t|)
#> 1   8.5125144 3.742438e-11
#> 2   7.6807376 6.709843e-10
#> 3   5.9791662 2.894273e-07
#> 4   7.3865333 2.125173e-09
#> 5   1.4370442 1.573296e-01
#> 6   5.9864707 3.034183e-07
#> 7   7.0833236 6.834434e-09
#> 8   1.1420107 2.593594e-01
#> 9   0.7268727 4.709870e-01
#> 10  6.2886852 9.069049e-08
#> 11  4.2838870 8.771860e-05
#> 12  4.2820586 9.063960e-05
#> 13  1.3254313 1.914351e-01
#> 14  5.8956480 3.870715e-07
#> 15  3.7383295 5.112246e-04
#> 16  1.8913091 6.488965e-02
#> 17  5.4906811 1.666695e-06
#> 18 -1.5600639 1.255990e-01
#> 19  5.1605338 4.656345e-06
#> 20  3.5618920 8.434625e-04
#> 21  1.1903622 2.398819e-01
#> 22  1.6953052 9.663372e-02
#> 23 10.4330175 8.009442e-14
#> 24  1.3116227 1.961563e-01
#> 25  1.8949086 6.439972e-02
#> 26 10.4223360 1.074269e-13
#> 27 -0.8570233 3.958750e-01

# Now just the standard-errors
se(est_multi)
#>   id sample.var     sample          rhs (Intercept)         x1         x2
#> 1  1    species     setosa           x1   0.3100143 0.08989888         NA
#> 2  2    species     setosa      x1 + x2   0.3852942 0.09035581 0.19722377
#> 3  3    species     setosa x1 + x2 + x3   0.3928675 0.09244742 0.20801921
#> 4  4    species versicolor           x1   0.5628736 0.20193757         NA
#> 5  5    species versicolor      x1 + x2   0.4942556 0.18683892 0.12476776
#> 6  6    species versicolor x1 + x2 + x3   0.5070552 0.20454490 0.16543248
#> 7  7    species  virginica           x1   0.7570605 0.25310551         NA
#> 8  8    species  virginica      x1 + x2   0.5248675 0.15333757 0.08960197
#> 9  9    species  virginica x1 + x2 + x3   0.5336009 0.17432873 0.09072204
#>          x3
#> 1        NA
#> 2        NA
#> 3 0.3468636
#> 4        NA
#> 5        NA
#> 6 0.4353821
#> 7        NA
#> 8        NA
#> 9 0.1980724

# wide = TRUE => leads toa  list of wide tables
coeftable(est_multi, wide = TRUE)
#> $coef
#>   id sample.var     sample          rhs (Intercept)        x1        x2
#> 1  1    species     setosa           x1   2.6390012 0.6904897        NA
#> 2  2    species     setosa      x1 + x2   2.3037382 0.6674162 0.2834193
#> 3  3    species     setosa x1 + x2 + x3   2.3518898 0.6548350 0.2375602
#> 4  4    species versicolor           x1   3.5397347 0.8650777        NA
#> 5  5    species versicolor      x1 + x2   2.1164314 0.2476422 0.7355868
#> 6  6    species versicolor x1 + x2 + x3   1.8955395 0.3868576 0.9083370
#> 7  7    species  virginica           x1   3.9068365 0.9015345        NA
#> 8  8    species  virginica      x1 + x2   0.6247824 0.2599540 0.9348189
#> 9  9    species  virginica x1 + x2 + x3   0.6998830 0.3303370 0.9455356
#>           x3
#> 1         NA
#> 2         NA
#> 3  0.2521257
#> 4         NA
#> 5         NA
#> 6 -0.6792238
#> 7         NA
#> 8         NA
#> 9 -0.1697527
#> 
#> $se
#>   id sample.var     sample          rhs (Intercept)         x1         x2
#> 1  1    species     setosa           x1   0.3100143 0.08989888         NA
#> 2  2    species     setosa      x1 + x2   0.3852942 0.09035581 0.19722377
#> 3  3    species     setosa x1 + x2 + x3   0.3928675 0.09244742 0.20801921
#> 4  4    species versicolor           x1   0.5628736 0.20193757         NA
#> 5  5    species versicolor      x1 + x2   0.4942556 0.18683892 0.12476776
#> 6  6    species versicolor x1 + x2 + x3   0.5070552 0.20454490 0.16543248
#> 7  7    species  virginica           x1   0.7570605 0.25310551         NA
#> 8  8    species  virginica      x1 + x2   0.5248675 0.15333757 0.08960197
#> 9  9    species  virginica x1 + x2 + x3   0.5336009 0.17432873 0.09072204
#>          x3
#> 1        NA
#> 2        NA
#> 3 0.3468636
#> 4        NA
#> 5        NA
#> 6 0.4353821
#> 7        NA
#> 8        NA
#> 9 0.1980724
#> 
#> $tstat
#>   id sample.var     sample          rhs (Intercept)       x1        x2
#> 1  1    species     setosa           x1    8.512514 7.680738        NA
#> 2  2    species     setosa      x1 + x2    5.979166 7.386533  1.437044
#> 3  3    species     setosa x1 + x2 + x3    5.986471 7.083324  1.142011
#> 4  4    species versicolor           x1    6.288685 4.283887        NA
#> 5  5    species versicolor      x1 + x2    4.282059 1.325431  5.895648
#> 6  6    species versicolor x1 + x2 + x3    3.738329 1.891309  5.490681
#> 7  7    species  virginica           x1    5.160534 3.561892        NA
#> 8  8    species  virginica      x1 + x2    1.190362 1.695305 10.433017
#> 9  9    species  virginica x1 + x2 + x3    1.311623 1.894909 10.422336
#>           x3
#> 1         NA
#> 2         NA
#> 3  0.7268727
#> 4         NA
#> 5         NA
#> 6 -1.5600639
#> 7         NA
#> 8         NA
#> 9 -0.8570233
#> 
#> $pvalue
#>   id sample.var     sample          rhs  (Intercept)           x1           x2
#> 1  1    species     setosa           x1 3.742438e-11 6.709843e-10           NA
#> 2  2    species     setosa      x1 + x2 2.894273e-07 2.125173e-09 1.573296e-01
#> 3  3    species     setosa x1 + x2 + x3 3.034183e-07 6.834434e-09 2.593594e-01
#> 4  4    species versicolor           x1 9.069049e-08 8.771860e-05           NA
#> 5  5    species versicolor      x1 + x2 9.063960e-05 1.914351e-01 3.870715e-07
#> 6  6    species versicolor x1 + x2 + x3 5.112246e-04 6.488965e-02 1.666695e-06
#> 7  7    species  virginica           x1 4.656345e-06 8.434625e-04           NA
#> 8  8    species  virginica      x1 + x2 2.398819e-01 9.663372e-02 8.009442e-14
#> 9  9    species  virginica x1 + x2 + x3 1.961563e-01 6.439972e-02 1.074269e-13
#>         x3
#> 1       NA
#> 2       NA
#> 3 0.470987
#> 4       NA
#> 5       NA
#> 6 0.125599
#> 7       NA
#> 8       NA
#> 9 0.395875
#> 

# long = TRUE, all the information is stacked
coeftable(est_multi, long = TRUE)
#>     id sample.var     sample          rhs coefficient  param         value
#> 1    1    species     setosa           x1 (Intercept)   coef  2.639001e+00
#> 2    1    species     setosa           x1 (Intercept)     se  3.100143e-01
#> 3    1    species     setosa           x1 (Intercept)  tstat  8.512514e+00
#> 4    1    species     setosa           x1 (Intercept) pvalue  3.742438e-11
#> 5    1    species     setosa           x1          x1   coef  6.904897e-01
#> 6    1    species     setosa           x1          x1     se  8.989888e-02
#> 7    1    species     setosa           x1          x1  tstat  7.680738e+00
#> 8    1    species     setosa           x1          x1 pvalue  6.709843e-10
#> 9    2    species     setosa      x1 + x2 (Intercept)   coef  2.303738e+00
#> 10   2    species     setosa      x1 + x2 (Intercept)     se  3.852942e-01
#> 11   2    species     setosa      x1 + x2 (Intercept)  tstat  5.979166e+00
#> 12   2    species     setosa      x1 + x2 (Intercept) pvalue  2.894273e-07
#> 13   2    species     setosa      x1 + x2          x1   coef  6.674162e-01
#> 14   2    species     setosa      x1 + x2          x1     se  9.035581e-02
#> 15   2    species     setosa      x1 + x2          x1  tstat  7.386533e+00
#> 16   2    species     setosa      x1 + x2          x1 pvalue  2.125173e-09
#> 17   2    species     setosa      x1 + x2          x2   coef  2.834193e-01
#> 18   2    species     setosa      x1 + x2          x2     se  1.972238e-01
#> 19   2    species     setosa      x1 + x2          x2  tstat  1.437044e+00
#> 20   2    species     setosa      x1 + x2          x2 pvalue  1.573296e-01
#> 21   3    species     setosa x1 + x2 + x3 (Intercept)   coef  2.351890e+00
#> 22   3    species     setosa x1 + x2 + x3 (Intercept)     se  3.928675e-01
#> 23   3    species     setosa x1 + x2 + x3 (Intercept)  tstat  5.986471e+00
#> 24   3    species     setosa x1 + x2 + x3 (Intercept) pvalue  3.034183e-07
#> 25   3    species     setosa x1 + x2 + x3          x1   coef  6.548350e-01
#> 26   3    species     setosa x1 + x2 + x3          x1     se  9.244742e-02
#> 27   3    species     setosa x1 + x2 + x3          x1  tstat  7.083324e+00
#> 28   3    species     setosa x1 + x2 + x3          x1 pvalue  6.834434e-09
#> 29   3    species     setosa x1 + x2 + x3          x2   coef  2.375602e-01
#> 30   3    species     setosa x1 + x2 + x3          x2     se  2.080192e-01
#> 31   3    species     setosa x1 + x2 + x3          x2  tstat  1.142011e+00
#> 32   3    species     setosa x1 + x2 + x3          x2 pvalue  2.593594e-01
#> 33   3    species     setosa x1 + x2 + x3          x3   coef  2.521257e-01
#> 34   3    species     setosa x1 + x2 + x3          x3     se  3.468636e-01
#> 35   3    species     setosa x1 + x2 + x3          x3  tstat  7.268727e-01
#> 36   3    species     setosa x1 + x2 + x3          x3 pvalue  4.709870e-01
#> 37   4    species versicolor           x1 (Intercept)   coef  3.539735e+00
#> 38   4    species versicolor           x1 (Intercept)     se  5.628736e-01
#> 39   4    species versicolor           x1 (Intercept)  tstat  6.288685e+00
#> 40   4    species versicolor           x1 (Intercept) pvalue  9.069049e-08
#> 41   4    species versicolor           x1          x1   coef  8.650777e-01
#> 42   4    species versicolor           x1          x1     se  2.019376e-01
#> 43   4    species versicolor           x1          x1  tstat  4.283887e+00
#> 44   4    species versicolor           x1          x1 pvalue  8.771860e-05
#> 45   5    species versicolor      x1 + x2 (Intercept)   coef  2.116431e+00
#> 46   5    species versicolor      x1 + x2 (Intercept)     se  4.942556e-01
#> 47   5    species versicolor      x1 + x2 (Intercept)  tstat  4.282059e+00
#> 48   5    species versicolor      x1 + x2 (Intercept) pvalue  9.063960e-05
#> 49   5    species versicolor      x1 + x2          x1   coef  2.476422e-01
#> 50   5    species versicolor      x1 + x2          x1     se  1.868389e-01
#> 51   5    species versicolor      x1 + x2          x1  tstat  1.325431e+00
#> 52   5    species versicolor      x1 + x2          x1 pvalue  1.914351e-01
#> 53   5    species versicolor      x1 + x2          x2   coef  7.355868e-01
#> 54   5    species versicolor      x1 + x2          x2     se  1.247678e-01
#> 55   5    species versicolor      x1 + x2          x2  tstat  5.895648e+00
#> 56   5    species versicolor      x1 + x2          x2 pvalue  3.870715e-07
#> 57   6    species versicolor x1 + x2 + x3 (Intercept)   coef  1.895540e+00
#> 58   6    species versicolor x1 + x2 + x3 (Intercept)     se  5.070552e-01
#> 59   6    species versicolor x1 + x2 + x3 (Intercept)  tstat  3.738329e+00
#> 60   6    species versicolor x1 + x2 + x3 (Intercept) pvalue  5.112246e-04
#> 61   6    species versicolor x1 + x2 + x3          x1   coef  3.868576e-01
#> 62   6    species versicolor x1 + x2 + x3          x1     se  2.045449e-01
#> 63   6    species versicolor x1 + x2 + x3          x1  tstat  1.891309e+00
#> 64   6    species versicolor x1 + x2 + x3          x1 pvalue  6.488965e-02
#> 65   6    species versicolor x1 + x2 + x3          x2   coef  9.083370e-01
#> 66   6    species versicolor x1 + x2 + x3          x2     se  1.654325e-01
#> 67   6    species versicolor x1 + x2 + x3          x2  tstat  5.490681e+00
#> 68   6    species versicolor x1 + x2 + x3          x2 pvalue  1.666695e-06
#> 69   6    species versicolor x1 + x2 + x3          x3   coef -6.792238e-01
#> 70   6    species versicolor x1 + x2 + x3          x3     se  4.353821e-01
#> 71   6    species versicolor x1 + x2 + x3          x3  tstat -1.560064e+00
#> 72   6    species versicolor x1 + x2 + x3          x3 pvalue  1.255990e-01
#> 73   7    species  virginica           x1 (Intercept)   coef  3.906836e+00
#> 74   7    species  virginica           x1 (Intercept)     se  7.570605e-01
#> 75   7    species  virginica           x1 (Intercept)  tstat  5.160534e+00
#> 76   7    species  virginica           x1 (Intercept) pvalue  4.656345e-06
#> 77   7    species  virginica           x1          x1   coef  9.015345e-01
#> 78   7    species  virginica           x1          x1     se  2.531055e-01
#> 79   7    species  virginica           x1          x1  tstat  3.561892e+00
#> 80   7    species  virginica           x1          x1 pvalue  8.434625e-04
#> 81   8    species  virginica      x1 + x2 (Intercept)   coef  6.247824e-01
#> 82   8    species  virginica      x1 + x2 (Intercept)     se  5.248675e-01
#> 83   8    species  virginica      x1 + x2 (Intercept)  tstat  1.190362e+00
#> 84   8    species  virginica      x1 + x2 (Intercept) pvalue  2.398819e-01
#> 85   8    species  virginica      x1 + x2          x1   coef  2.599540e-01
#> 86   8    species  virginica      x1 + x2          x1     se  1.533376e-01
#> 87   8    species  virginica      x1 + x2          x1  tstat  1.695305e+00
#> 88   8    species  virginica      x1 + x2          x1 pvalue  9.663372e-02
#> 89   8    species  virginica      x1 + x2          x2   coef  9.348189e-01
#> 90   8    species  virginica      x1 + x2          x2     se  8.960197e-02
#> 91   8    species  virginica      x1 + x2          x2  tstat  1.043302e+01
#> 92   8    species  virginica      x1 + x2          x2 pvalue  8.009442e-14
#> 93   9    species  virginica x1 + x2 + x3 (Intercept)   coef  6.998830e-01
#> 94   9    species  virginica x1 + x2 + x3 (Intercept)     se  5.336009e-01
#> 95   9    species  virginica x1 + x2 + x3 (Intercept)  tstat  1.311623e+00
#> 96   9    species  virginica x1 + x2 + x3 (Intercept) pvalue  1.961563e-01
#> 97   9    species  virginica x1 + x2 + x3          x1   coef  3.303370e-01
#> 98   9    species  virginica x1 + x2 + x3          x1     se  1.743287e-01
#> 99   9    species  virginica x1 + x2 + x3          x1  tstat  1.894909e+00
#> 100  9    species  virginica x1 + x2 + x3          x1 pvalue  6.439972e-02
#> 101  9    species  virginica x1 + x2 + x3          x2   coef  9.455356e-01
#> 102  9    species  virginica x1 + x2 + x3          x2     se  9.072204e-02
#> 103  9    species  virginica x1 + x2 + x3          x2  tstat  1.042234e+01
#> 104  9    species  virginica x1 + x2 + x3          x2 pvalue  1.074269e-13
#> 105  9    species  virginica x1 + x2 + x3          x3   coef -1.697527e-01
#> 106  9    species  virginica x1 + x2 + x3          x3     se  1.980724e-01
#> 107  9    species  virginica x1 + x2 + x3          x3  tstat -8.570233e-01
#> 108  9    species  virginica x1 + x2 + x3          x3 pvalue  3.958750e-01