Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

style.tex

Style definitions for Latex tables


Description

This function describes the style of Latex tables to be exported with the function etable.

Usage

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.title,
  tablefoot,
  tablefoot.title,
  tablefoot.value,
  yesNo,
  tabular = "normal",
  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. The line at the top of the table (defaults to "\tabularnewline\toprule\toprule" if main = "base" and to "\toprule" if main = "aer").

line.bottom

A character scalar. The line at the bottom of the table (defaults to "" if main = "base" and to "\bottomrule" if main = "aer").

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

A character scalar. The title appearing just before the notes, defaults to "\medskip \emph{Notes:} ".

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

A character scalar. Only if tablefoot = TRUE, value to appear before the table footer. Defaults to "\bottomrule\bottomrule" if main = "base".

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

Character scalar equal to "normal" (default), "*" or "X". Represents the type of tabular to export.

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.

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.

Value

Returns a list containing the style parameters.

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)
etable(est, tex = TRUE, style.tex = style.tex("aer"))

etable(est, tex = TRUE, style.tex = style.tex("aer",
                                      var.title = "\\emph{Expl. Vars.}",
                                      model.format = "[i]",
                                      yesNo = "x",
                                      tabular = "*"))

fixest

Fast Fixed-Effects Estimations

v0.10.0
GPL-3
Authors
Laurent Berge [aut, cre], Sebastian Krantz [ctb], Grant McDermott [ctb] (<https://orcid.org/0000-0001-7883-8573>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.