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 = " $=$ "
)

Arguments

main

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.

depvar.title

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

model.title

A character scalar. The title of the line of the models (defaults to "Model:" if main = "base" and to "" if main = "aer").

model.format

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.

line.top

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

line.bottom

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

var.title

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

fixef.title

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

fixef.prefix

A prefix to add to the fixed-effects names. Defaults to "" (i.e. no prefix).

fixef.suffix

A suffix to add to the fixed-effects names. Defaults to "" if main = "base") and to "fixed-effects" if main = "aer").

fixef.where

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

slopes.title

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

slopes.format

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

fixef_sizes.prefix

A prefix to add to the fixed-effects names. Defaults to "# ".

fixef_sizes.suffix

A suffix to add to the fixed-effects names. Defaults to "" (i.e. no suffix).

stats.title

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

notes.intro

A character scalar. Some tex code appearing just before the notes, defaults to "\par \raggedright \n".

notes.tpt.intro

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.

tablefoot

A logical scalar. Whether or not to display a footer within the table. Defaults to TRUE if main = "aer") and FALSE if main = "aer").

tablefoot.value

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.

yesNo

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.

tabular

(Tex only.) Character scalar equal to "normal" (default), "*" or "X". Represents the type of tabular environment to use: either tabular, tabular* or tabularx.

depvar.style

Character scalar equal to either " " (default), "*" (italic), "**" (bold), "***" (italic-bold). How the name of the dependent variable should be displayed.

no_border

Logical, default is FALSE. Whether to remove any side border to the table (typically adds @{} to the sides of the tabular).

caption.after

Character scalar. Tex code that will be placed right after the caption. Defaults to "" for main = "base" and "\medskip" for main = "aer".

rules_width

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

signif.code

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

tpt

(Tex only.) Logical scalar, default is FALSE. Whether to use the threeparttable environment. If so, the notes will be integrated into the tablenotes environment.

arraystretch

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

adjustbox

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

fontsize

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

interaction.combine

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.

i.equal

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.

Value

Returns a list containing the style parameters.

Details

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.

See also

Examples


# 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.8076)       & (0.8449)       & (0.9134)       & (3.316)       & (3.278)  & (3.172)\\   
#>    Temp         & 2.373$^{***}$  & -4.009         & -63.53$^{*}$   & 4.787$^{***}$ & 17.80    & 234.4$^{**}$\\   
#>                 & (0.1858)       & (4.333)        & (33.38)        & (1.459)       & (12.77)  & (101.3)\\   
#>    Temp square  &                & 0.0407         & 0.8215$^{*}$   &               & -0.0824  & -2.933$^{**}$\\   
#>                 &                & (0.0277)       & (0.4496)       &               & (0.0762) & (1.322)\\   
#>    Temp cube    &                &                & -0.0034        &               &          & 0.0124$^{**}$\\   
#>                 &                &                & (0.0020)       &               &          & (0.0057)\\   
#>    \midrule
#>    \emph{Fixed-effects}\\
#>    Month        & Yes            & Yes            & Yes            & Yes           & Yes      & Yes\\  
#>    Day          & Yes            & Yes            & Yes            & Yes           & Yes      & Yes\\  
#>    \midrule
#>    \emph{Fit statistics}\\
#>    Observations & 116            & 116            & 116            & 146           & 146      & 146\\  
#>    R$^2$        & 0.78671        & 0.79718        & 0.80469        & 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.8076)       & (0.8449)       & (0.9134)       & (3.316)       & (3.278)       & (3.172)\\   
#>    Temp                & 2.373$^{***}$  & -4.009         & -63.53$^{*}$   & 4.787$^{***}$ & 17.80         & 234.4$^{**}$\\   
#>                        & (0.1858)       & (4.333)        & (33.38)        & (1.459)       & (12.77)       & (101.3)\\   
#>    Temp square         &                & 0.0407         & 0.8215$^{*}$   &               & -0.0824       & -2.933$^{**}$\\   
#>                        &                & (0.0277)       & (0.4496)       &               & (0.0762)      & (1.322)\\   
#>    Temp cube           &                &                & -0.0034        &               &               & 0.0124$^{**}$\\   
#>                        &                &                & (0.0020)       &               &               & (0.0057)\\   
#>     \\
#>    Observations        & 116            & 116            & 116            & 146           & 146           & 146\\  
#>    R$^2$               & 0.78671        & 0.79718        & 0.80469        & 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.8076)       & (0.8449)       & (0.9134)       & (3.316)       & (3.278)  & (3.172)\\   
#>    Temp                & 2.373$^{***}$  & -4.009         & -63.53$^{*}$   & 4.787$^{***}$ & 17.80    & 234.4$^{**}$\\   
#>                        & (0.1858)       & (4.333)        & (33.38)        & (1.459)       & (12.77)  & (101.3)\\   
#>    Temp square         &                & 0.0407         & 0.8215$^{*}$   &               & -0.0824  & -2.933$^{**}$\\   
#>                        &                & (0.0277)       & (0.4496)       &               & (0.0762) & (1.322)\\   
#>    Temp cube           &                &                & -0.0034        &               &          & 0.0124$^{**}$\\   
#>                        &                &                & (0.0020)       &               &          & (0.0057)\\   
#>     \\
#>    Observations        & 116            & 116            & 116            & 146           & 146      & 146\\  
#>    R$^2$               & 0.78671        & 0.79718        & 0.80469        & 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