Skip to contents

This function is used to create extralines (which is an argument of etable) macros that can be easily summoned in etable.

Usage

extralines_register(type, fun, alias)

Arguments

type

A character scalar giving the type-name.

fun

A function to be applied to a fixest estimation. It must return a scalar.

alias

A character scalar. This is the alias to be used in lieu of the type name to form the row name.

Details

You can register as many macros as you wish, the only constraint is that the type name should not conflict with a fitstat type name.

Examples



# We register a function computing the standard-deviation of the dependent variable
my_fun = function(x) sd(model.matrix(x, type = "lhs"))
extralines_register("sdy", my_fun, "SD(y)")

# An estimation
data(iris)
est = feols(Petal.Length ~ Sepal.Length | Species, iris)

# Now we can easily create a row with the SD of y.
# We just "summon" it in a one-sided formula
etable(est, extralines = ~ sdy)
#>                                est
#> Dependent Var.:       Petal.Length
#>                                   
#> Sepal.Length    0.6321*** (0.0453)
#> SD(y)                        1.765
#> Fixed-Effects:  ------------------
#> Species                        Yes
#> _______________ __________________
#> S.E. type                      IID
#> Observations                   150
#> R2                         0.97489
#> Within R2                  0.57178
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

# We can change the alias on the fly:
etable(est, extralines = list("_Standard deviation of the dep. var." = ~ sdy))
#>                                                    est
#> Dependent Var.:                           Petal.Length
#>                                                       
#> Sepal.Length                        0.6321*** (0.0453)
#> Fixed-Effects:                      ------------------
#> Species                                            Yes
#> _______________                     __________________
#> S.E. type                                          IID
#> Observations                                       150
#> R2                                             0.97489
#> Within R2                                      0.57178
#> Standard deviation of the dep. var.              1.765
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1