Learn R Programming

fixest (version 0.1.2)

esttex: Facility to export the results of multiple fixest estimations in a Latex table.

Description

This function aggregates the results of multiple estimations and display them in the form of one Latex table whose row names are the variables and the columns contain the coefficients and standard-errors.

Usage

esttex(..., se = c("standard", "white", "cluster", "twoway", "threeway",
  "fourway"), dof = TRUE, cluster, digits = 4, pseudo = TRUE, title,
  sdBelow = TRUE, drop, order, dict = getFixest_dict(), file,
  replace = FALSE, convergence, signifCode = c(`***` = 0.01, `**` =
  0.05, `*` = 0.1), label, aic = FALSE, sqCor = FALSE, subtitles,
  fixef_sizes = FALSE, bic = TRUE, loglik = FALSE,
  yesNoFixef = c("Yes", "No"), keepFactors = TRUE, family,
  powerBelow = -5)

Arguments

...

Used to capture different fixest objects (obtained with femlm, feols or feglm). Note that any other type of element is discarded. Note that you can give a list of fixest objects.

se

Character scalar. Which kind of standard error should be computed: “standard”, “White”, “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.

dof

Logical, default is TRUE. Should there be a degree of freedom correction to the standard errors of the coefficients?

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 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).

digits

Integer, default is 4. The number of digits to be displayed.

pseudo

Logical, default is TRUE. Should the pseudo R2 be displayed?

title

Character scalar. The title of the Latex table.

sdBelow

Logical, default is TRUE. Should the standard-errors be displayed below the coefficients?

drop

Character vector. This element is used if some variables are not to be displayed. This should be a regular expression (see regex help for more info). There can be more than one regular expression. Each variable satisfying the regular expression will be discarded.

order

Character vector. This element is used if the user wants the variables to be ordered in a certain way. This should be a regular expression (see regex help for more info). There can be more than one regular expression. The variables satisfying the first regular expression will be placed first, then the order follows the sequence of regular expressions.

dict

A named character vector. It changes the original variable names to the ones contained in the dict. E.g. to change the variables named a and b3 to (resp.) “$log(a)$” and to “$bonus^3$”, use dict=c(a="$log(a)$",b3="$bonus^3$"). By default it is equal to getFixest_dict(), a default dictionary can be set with setFixest_dict.

file

A character scalar. If provided, the Latex table will be saved in a file whose path is file.

replace

Logical, default is FALSE. Only used if option file is used. Should the Latex table be written in a new file that replaces any existing file?

convergence

Logical, default is missing. Should the convergence state of the algorithm be displayed? By default, convergence information is displayed if at least one model did not converge.

signifCode

Named numeric vector, used to provide the significance codes with respect to the p-value of the coefficients. Default is c("***"=0.01, "**"=0.05, "*"=0.10).

label

Character scalar. The label of the Latex table.

aic

Logical, default is FALSE. Should the AIC be displayed?

sqCor

Logical, default is FALSE. Should the squared correlation be displayed?

subtitles

Character vector of the same length as the number of models to be displayed. If provided, subtitles are added underneath the dependent variable name.

fixef_sizes

Logical, default is FALSE. If TRUE and fixed-effects were used in the models, then the number "individuals" per fixed-effect dimension is also displayed.

bic

Logical, default is TRUE.Should the BIC be reported?

loglik

Logical, default is TRUE. Should the log-likelihood be reported?

yesNoFixef

A character vector of length 2. Default is c("Yes", "No"). This is the message displayed when a given cluster is (or is not) included in a regression.

keepFactors

Logical, default is TRUE. If FALSE, then factor variables are displayed as fixed-effects and no coefficient is shown.

family

A logical, default is missing. Whether to display the families of the models. By default this line is displayed when at least two models are from different families.

powerBelow

Integer, default is -5. A coefficient whose value is below 10**(powerBelow+1) is written with a power in Latex. For example 0.0000456 would be written 4.56$\times 10^{-5}$ by default. Setting powerBelow = -6 would lead to 0.00004 in Latex.

Value

There is nothing returned, the result is only displayed on the console or saved in a file.

See Also

See also the main estimation functions femlm, feols or feglm. Use summary.fixest to see the results with the appropriate standard-errors, fixef.fixest to extract the cluster coefficients, and the functions esttable and esttex to visualize the results of multiple estimations.

Examples

Run this code
# NOT RUN {
# two fitted models with different expl. variables:
res1 = femlm(Sepal.Length ~ Sepal.Width + Petal.Length +
             Petal.Width | Species, iris)
res2 = femlm(Sepal.Length ~ Petal.Width | Species, iris)

# We export the three results in one Latex table,
# with clustered standard-errors:
esttex(res1, res2, se = "cluster")

# Changing the names & significance codes
esttex(res1, res2, dict = c(Sepal.Length = "The sepal length", Sepal.Width = "SW"),
        signifCode = c("**" = 0.1, "*" = 0.2, "n.s."=1))

# }

Run the code above in your browser using DataLab