This function describes the style of Latex tables to be exported with the function etable.
style.tex(
main = "base",
depvar.title,
model.title,
model.format,
line.top,
line.bottom,
var.title,
fixef.title,
fixef.prefix,
fixef.suffix,
fixef.where,
slopes.title,
slopes.format,
fixef_sizes.prefix,
fixef_sizes.suffix,
stats.title,
notes.intro,
notes.tpt.intro,
tablefoot,
tablefoot.value,
yesNo,
tabular = "normal",
depvar.style,
no_border,
caption.after,
rules_width,
signif.code,
tpt,
arraystretch,
adjustbox = NULL,
fontsize,
interaction.combine = " $\\times$ ",
i.equal = " $=$ "
)Either "base", "aer" or "qje". Defines the basic style to start from. The styles "aer" and "qje" are almost identical and only differ on the top/bottom lines.
A character scalar. The title of the line of the dependent variables
(defaults to "Dependent variable(s):" if main = "base" (the 's' appears only if just one
variable) and to "" if main = "aer").
A character scalar. The title of the line of the models (defaults to
"Model:" if main = "base" and to "" if main = "aer").
A character scalar. The value to appear on top of each column. It defaults
to "(1)". Note that 1, i, I, a and A are special characters: if found, their values will be
automatically incremented across columns.
A character scalar equal to "simple", "double", or anything else. The line
at the top of the table (defaults to "double" if main = "base" and to "simple" if
main = "aer"). "simple" is equivalent to "\\toprule", and "double" to
"\\tabularnewline \\midrule \\midrule".
A character scalar equal to "simple", "double", or anything else. The
line at the bottom of the table (defaults to "double" if main = "base" and to "simple"
if main = "aer"). "simple" is equivalent to "\\bottomrule", and "double" to
"\\midrule \\midrule & \\tabularnewline".
A character scalar. The title line appearing before the variables (defaults to
"\\midrule \\emph{Variables}" if main = "base" and to "\\midrule" if main = "aer").
Note that the behavior of var.title = " " (a space) is different from var.title = ""
(the empty string): in the first case you will get an empty row, while in the second case
you get no empty row. To get a line without an empty row, use "\\midrule" (and not
"\\midrule "!–the space!).
A character scalar. The title line appearing before the fixed-effects
(defaults to "\\midrule \\emph{Fixed-effects}" if main = "base" and to " " if
main = "aer"). Note that the behavior of fixef.title = " " (a space) is different from
fixef.title = "" (the empty string): in the first case you will get an empty row, while in the
second case you get no empty row. To get a line without an empty row, use "\\midrule"
(and not "\\midrule "!–the space!).
A prefix to add to the fixed-effects names. Defaults to ""
(i.e. no prefix).
A suffix to add to the fixed-effects names. Defaults to "" if
main = "base") and to "fixed-effects" if main = "aer").
Either "var" or "stats". Where to place the fixed-effects lines?
Defaults to "var", i.e. just after the variables, if main = "base") and to
"stats", i.e. just after the statistics, if main = "aer").
A character scalar. The title line appearing before the variables with
varying slopes (defaults to "\\midrule \\emph{Varying Slopes}" if main = "base"
and to "" if main = "aer"). Note that the behavior of slopes.title = " " (a space)
is different from slopes.title = "" (the empty string): in the first case you will get
an empty row, while in the second case you get no empty row. To get a line without an
empty row, use "\\midrule" (and not "\\midrule "!–the space!).
Character scalar representing the format of the slope variable name.
There are two special characters: "var" and "slope", placeholers for the variable
and slope names. Defaults to "__var__ (__slope__)" if main = "base") and
to "__var__ $\\times $ __slope__" if main = "aer").
A prefix to add to the fixed-effects names. Defaults to "# ".
A suffix to add to the fixed-effects names. Defaults
to "" (i.e. no suffix).
A character scalar. The title line appearing before the statistics
(defaults to "\\midrule \\emph{Fit statistics"} if main = "base" and to " "
if main = "aer"). Note that the behavior of stats.title = " " (a space) is different
from stats.title = "" (the empty string): in the first case you will get an empty row,
while in the second case you get no empty row. To get a line without an empty row,
use "\\midrule" (and not "\\midrule "!–the space!).
A character scalar. Some tex code appearing just before the notes,
defaults to "\\par \\raggedright \n".
Character scalar. Only used if tpt = TRUE, it is some tex code that is
passed before any threeparttable item (can be used for, typically, the font size). Default is
the empty string.
A logical scalar. Whether or not to display a footer within the table.
Defaults to TRUE if main = "base") and FALSE if main = "aer").
A character scalar. The notes to be displayed in the footer.
Defaults to "default" if main = "base", which leads to custom footers informing on
the type of standard-error and significance codes, depending on the estimations.
A character vector of length 1 or 2. Defaults to "Yes" if main = "base"
and to "$\\checkmark$" if main = "aer" (from package amssymb). This is the message
displayed when a given fixed-effect is (or is not) included in a regression.
If yesNo is of length 1, then the second element is the empty string.
(Tex only.) Character scalar equal to "normal" (default), "*" or "X".
Represents the type of tabular environment to use: either tabular, tabular* or tabularx.
Character scalar equal to either " " (default), "*" (italic), "**"
(bold), "***" (italic-bold). How the name of the dependent variable should be displayed.
Logical, default is FALSE. Whether to remove any side border to the table (typically adds @\{\ to the sides of the tabular).
Character scalar. Tex code that will be placed right after the caption.
Defaults to "" for main = "base" and "\\medskip" for main = "aer".
Character vector of length 1 or 2. This vector gives the width of the
booktabs rules: the first element the heavy-width, the second element the light-width. NA
values mean no modification. If of length 1, only the heavy rules are modified. The width are in
Latex units (ex: "0.1 em", etc).
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). To suppress
the significance codes, use signif.code=NA or signif.code=NULL. Can also be equal to
"letters", then the default becomes c("a"=0.01, "b"=0.05, "c"=0.10).
(Tex only.) Logical scalar, default is FALSE. Whether to use the threeparttable
environment. If so, the notes will be integrated into the tablenotes environment.
(Tex only.) A numeric scalar, default is NULL. If provided,
the command \\renewcommand*{\\arraystretch{x}} is inserted, replacing x by the value of
arraystretch. The changes are specific to the current table and do not affect the rest of the
document.
(Tex only.) A logical, numeric or character scalar, default is NULL. If not
NULL, the table is inserted within the adjustbox environment. By default the options are
width = 1\\textwidth, center (if TRUE). A numeric value changes the value before
\\textwidth. You can also add a character of the form "x tw" or "x th" with x a number
and where tw (th) stands for text-width (text-height). Finally any other character value is
passed verbatim as an adjustbox option.
(Tex only.) A character scalar, default is NULL. Can be equal to tiny,
scriptsize, footnotesize, small, normalsize, large, or Large. The change affect the
table only (and not the rest of the document).
Character scalar, defaults to " $\\times$ ". When the estimation
contains interactions, then the variables names (after aliasing) are combined with this
argument. For example: if dict = c(x1="Wind", x2="Rain") and you have the following
interaction x1:x2, then it will be renamed (by default) Wind $\\times$ Rain – using
interaction.combine = "*" would lead to Wind*Rain.
Character scalar, defaults to " $=$ ". Only affects factor variables created
with the function i, tells how the variable should be linked to its value. For example if
you have the Species factor from the iris data set, by default the display of the variable is
Species $=$ Setosa, etc. If i.equal = ": " the display becomes Species: Setosa.
Returns a list containing the style parameters.
The \\checkmark command, used in the "aer" style (in argument yesNo), is in the
amssymb package.
The commands \\toprule, \\midrule and \\bottomrule are in the booktabs package.
You can set the width of the top/bottom rules with \\setlength\\heavyrulewidth\{wd\},
and of the midrule with \\setlength\\lightrulewidth\{wd\}.
Note that all titles (depvar.title, depvar.title, etc) are not escaped, so they
must be valid Latex expressions.
# Multiple estimations => see details in feols
aq = airquality
est = feols(c(Ozone, Solar.R) ~
Wind + csw(Temp, Temp^2, Temp^3) | Month + Day,
data = aq)
# Playing a bit with the styles
etable(est, tex = TRUE)
#> \begingroup
#> \centering
#> \begin{tabular}{lcccccc}
#> \tabularnewline \midrule \midrule
#> Dependent Variables: & \multicolumn{3}{c}{Ozone} & \multicolumn{3}{c}{Solar.R}\\
#> Model: & (1) & (2) & (3) & (4) & (5) & (6)\\
#> \midrule
#> \emph{Variables}\\
#> Wind & -2.693$^{**}$ & -2.630$^{**}$ & -2.850$^{**}$ & 3.031 & 3.181 & 3.943\\
#> & (0.8511) & (0.8595) & (0.8199) & (1.840) & (1.921) & (2.466)\\
#> Temp & 2.373$^{***}$ & -4.009 & -63.53$^{*}$ & 4.787$^{*}$ & 17.80$^{*}$ & 234.4\\
#> & (0.2324) & (3.407) & (27.57) & (2.086) & (7.057) & (152.4)\\
#> Temp square & & 0.0407 & 0.8215$^{*}$ & & -0.0824 & -2.933\\
#> & & (0.0212) & (0.3741) & & (0.0443) & (1.969)\\
#> Temp cube & & & -0.0034 & & & 0.0124\\
#> & & & (0.0017) & & & (0.0084)\\
#> \midrule
#> \emph{Fixed-effects}\\
#> Month & Yes & Yes & Yes & Yes & Yes & Yes\\
#> Day & Yes & Yes & Yes & Yes & Yes & Yes\\
#> \midrule
#> \emph{Fit statistics}\\
#> Observations & 115 & 115 & 115 & 146 & 146 & 146\\
#> R$^2$ & 0.78654 & 0.79702 & 0.80454 & 0.30641 & 0.31252 & 0.32651\\
#> Within R$^2$ & 0.55271 & 0.57466 & 0.59040 & 0.08937 & 0.09740 & 0.11577\\
#> \midrule \midrule
#> \multicolumn{7}{l}{\emph{Clustered (Month) standard-errors in parentheses}}\\
#> \multicolumn{7}{l}{\emph{Signif. Codes: ***: 0.01, **: 0.05, *: 0.1}}\\
#> \end{tabular}
#> \par\endgroup
etable(est, tex = TRUE, style.tex = style.tex("aer"))
#> \begingroup
#> \centering
#> \begin{tabular}{lcccccc}
#> \toprule
#> & \multicolumn{3}{c}{Ozone} & \multicolumn{3}{c}{Solar.R}\\
#> & (1) & (2) & (3) & (4) & (5) & (6)\\
#> \midrule
#> Wind & -2.693$^{**}$ & -2.630$^{**}$ & -2.850$^{**}$ & 3.031 & 3.181 & 3.943\\
#> & (0.8511) & (0.8595) & (0.8199) & (1.840) & (1.921) & (2.466)\\
#> Temp & 2.373$^{***}$ & -4.009 & -63.53$^{*}$ & 4.787$^{*}$ & 17.80$^{*}$ & 234.4\\
#> & (0.2324) & (3.407) & (27.57) & (2.086) & (7.057) & (152.4)\\
#> Temp square & & 0.0407 & 0.8215$^{*}$ & & -0.0824 & -2.933\\
#> & & (0.0212) & (0.3741) & & (0.0443) & (1.969)\\
#> Temp cube & & & -0.0034 & & & 0.0124\\
#> & & & (0.0017) & & & (0.0084)\\
#> \\
#> Observations & 115 & 115 & 115 & 146 & 146 & 146\\
#> R$^2$ & 0.78654 & 0.79702 & 0.80454 & 0.30641 & 0.31252 & 0.32651\\
#> Within R$^2$ & 0.55271 & 0.57466 & 0.59040 & 0.08937 & 0.09740 & 0.11577\\
#> \\
#> Month fixed effects & $\checkmark$ & $\checkmark$ & $\checkmark$ & $\checkmark$ & $\checkmark$ & $\checkmark$\\
#> Day fixed effects & $\checkmark$ & $\checkmark$ & $\checkmark$ & $\checkmark$ & $\checkmark$ & $\checkmark$\\
#> \bottomrule
#> \end{tabular}
#> \par\endgroup
etable(est, tex = TRUE, style.tex = style.tex("aer",
var.title = "\\emph{Expl. Vars.}",
model.format = "[i]",
yesNo = "x",
tabular = "*"))
#> \begingroup
#> \centering
#> \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lcccccc}
#> \toprule
#> & \multicolumn{3}{c}{Ozone} & \multicolumn{3}{c}{Solar.R}\\
#> & [i] & [ii] & [iii] & [iv] & [v] & [vi]\\
#> \emph{Expl. Vars.}\\
#> Wind & -2.693$^{**}$ & -2.630$^{**}$ & -2.850$^{**}$ & 3.031 & 3.181 & 3.943\\
#> & (0.8511) & (0.8595) & (0.8199) & (1.840) & (1.921) & (2.466)\\
#> Temp & 2.373$^{***}$ & -4.009 & -63.53$^{*}$ & 4.787$^{*}$ & 17.80$^{*}$ & 234.4\\
#> & (0.2324) & (3.407) & (27.57) & (2.086) & (7.057) & (152.4)\\
#> Temp square & & 0.0407 & 0.8215$^{*}$ & & -0.0824 & -2.933\\
#> & & (0.0212) & (0.3741) & & (0.0443) & (1.969)\\
#> Temp cube & & & -0.0034 & & & 0.0124\\
#> & & & (0.0017) & & & (0.0084)\\
#> \\
#> Observations & 115 & 115 & 115 & 146 & 146 & 146\\
#> R$^2$ & 0.78654 & 0.79702 & 0.80454 & 0.30641 & 0.31252 & 0.32651\\
#> Within R$^2$ & 0.55271 & 0.57466 & 0.59040 & 0.08937 & 0.09740 & 0.11577\\
#> \\
#> Month fixed effects & x & x & x & x & x & x\\
#> Day fixed effects & x & x & x & x & x & x\\
#> \bottomrule
#> \end{tabular*}
#> \par\endgroup