- ...
Used to capture different fixest
estimation 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.
- vcov
Versatile argument to specify the VCOV. In general, it is either a character scalar equal to a VCOV type, either a formula of the form: vcov_type ~ variables
. The VCOV types implemented are: "iid", "hetero" (or "HC1"), "cluster", "twoway", "NW" (or "newey_west"), "DK" (or "driscoll_kraay"), and "conley". It also accepts object from vcov_cluster
, vcov_NW
, NW
, vcov_DK
, DK
, vcov_conley
and conley
. It also accepts covariance matrices computed externally. Finally it accepts functions to compute the covariances. See the vcov
documentation in the vignette.
- stage
Can be equal to 2
(default), 1
, 1:2
or 2:1
. Only used if the object is an IV estimation: defines the stage to which summary
should be applied. If stage = 1
and there are multiple endogenous regressors or if stage
is of length 2, then an object of class fixest_multi
is returned.
- agg
A character scalar describing the variable names to be aggregated, it is pattern-based. For sunab
estimations, the following keywords work: "att", "period", "cohort" and FALSE
(to have full disaggregation). All variables that match the pattern will be aggregated. It must be of the form "(root)"
, the parentheses must be there and the resulting variable name will be "root"
. You can add another root with parentheses: "(root1)regex(root2)"
, in which case the resulting name is "root1::root2"
. To name the resulting variable differently you can pass a named vector: c("name" = "pattern")
or c("name" = "pattern(root2)")
. It's a bit intricate sorry, please see the examples.
- se
Character scalar. Which kind of standard error should be computed: “standard”, “hetero”, “cluster”, “twoway”, “threeway” or “fourway”? By default if there are clusters in the estimation: se = "cluster"
, otherwise se = "iid"
. Note that this argument is deprecated, you should use vcov
instead.
- ssc
An object of class ssc.type
obtained with the function ssc
. Represents how the degree of freedom correction should be done.You must use the function ssc
for this argument. The arguments and defaults of the function ssc
are: adj = TRUE
, fixef.K="nested"
, cluster.adj = TRUE
, cluster.df = "min"
, t.df = "min"
, fixef.force_exact=FALSE)
. See the help of the function ssc
for details.
- 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")]
, cluster = c("var1", "var2")
, cluster = ~var1+var2
. If the two variables were used as fixed-effects in the estimation, you can leave it blank with vcov = "twoway"
(assuming var1
[resp. var2
] was the 1st [resp. 2nd] fixed-effect). You can interact two variables using ^
with the following syntax: cluster = ~var1^var2
or cluster = "var1^var2"
.
- .vcov
A function to be used to compute the standard-errors of each fixest object. You can pass extra arguments to this function using the argument .vcov_args
. See the example.
- .vcov_args
A list containing arguments to be passed to the function .vcov
.
- digits
Integer or character scalar. Default is 4 and represents the number of significant digits to be displayed for the coefficients and standard-errors. To apply rounding instead of significance use, e.g., digits = "r3"
which will round at the first 3 decimals. If character, it must be of the form "rd"
or "sd"
with d
a digit (r
is for round and s
is for significance). For the number of digits for the fit statistics, use digits.stats
. Note that when significance is used it does not exactly display the number of significant digits: see details for its exact meaning.
- digits.stats
Integer or character scalar. Default is 5 and represents the number of significant digits to be displayed for the fit statistics. To apply rounding instead of significance use, e.g., digits = "r3"
which will round at the first 3 decimals. If character, it must be of the form "rd"
or "sd"
with d
a digit (r
is for round and s
is for significance). Note that when significance is used it does not exactly display the number of significant digits: see details for its exact meaning.
- tex
Logical: whether the results should be a data.frame or a Latex table. By default, this argument is TRUE
if the argument file
(used for exportation) is not missing; it is equal to FALSE
otherwise.
- fitstat
A character vector or a one sided formula (both with only lowercase letters). A vector listing which fit statistics to display. The valid types are 'n', 'll', 'aic', 'bic' and r2 types like 'r2', 'pr2', 'war2', etc (see all valid types in r2
). Also accepts valid types from the function fitstat
. The default value depends on the models to display. Example of use: fitstat=c('n', 'cor2', 'ar2', 'war2')
, or fitstat=~n+cor2+ar2+war2
using a formula. You can use the dot to refer to default values: ~ . + ll
would add the log-likelihood to the default fit statistics.
- title
(Tex only.) Character scalar. The title of the Latex table.
- coefstat
One of "se"
(default), "tstat"
or "confint"
. The statistic to report for each coefficient: the standard-error, the t-statistics or the confidence interval. You can adjust the confidence interval with the argument ci
.
- ci
Level of the confidence interval, defaults to 0.95
. Only used if coefstat = confint
.
- se.row
Logical scalar, default is NULL
. Whether should be displayed the row with the type of standard-error for each model. When tex = FALSE
, the default is TRUE
. When tex = FALSE
, the row is showed only when there is a table-footer and the types of standard-errors differ across models.
- se.below
Logical or NULL
(default). Should the standard-errors be displayed below the coefficients? If NULL
, then this is TRUE
for Latex and FALSE
otherwise.
- keep
Character vector. This element is used to display only a subset of variables. This should be a vector of regular expressions (see base::regex
help for more info). Each variable satisfying any of the regular expressions will be kept. This argument is applied post aliasing (see argument dict
). Example: you have the variable x1
to x55
and want to display only x1
to x9
, then you could use keep = "x[[:digit:]]$"
. If the first character is an exclamation mark, the effect is reversed (e.g. keep = "!Intercept" means: every variable that does not contain “Intercept” is kept). See details.
- drop
Character vector. This element is used if some variables are not to be displayed. This should be a vector of regular expressions (see base::regex
help for more info). Each variable satisfying any of the regular expressions will be discarded. This argument is applied post aliasing (see argument dict
). Example: you have the variable x1
to x55
and want to display only x1
to x9
, then you could use drop = "x[[:digit:]]{2}
". If the first character is an exclamation mark, the effect is reversed (e.g. drop = "!Intercept" means: every variable that does not contain “Intercept” is dropped). See details.
- order
Character vector. This element is used if the user wants the variables to be ordered in a certain way. This should be a vector of regular expressions (see base::regex
help for more info). The variables satisfying the first regular expression will be placed first, then the order follows the sequence of regular expressions. This argument is applied post aliasing (see argument dict
). Example: you have the following variables: month1
to month6
, then x1
to x5
, then year1
to year6
. If you want to display first the x's, then the years, then the months you could use: order = c("x", "year")
. If the first character is an exclamation mark, the effect is reversed (e.g. order = "!Intercept" means: every variable that does not contain “Intercept” goes first). See details.
- dict
A named character vector or a logical scalar. It changes the original variable names to the ones contained in the dict
ionary. 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 which can be set with setFixest_dict
. You can use dict = FALSE
to disable it. By default dict
modifies the entries in the global dictionary, to disable this behavior, use "reset" as the first element (ex: dict=c("reset", mpg="Miles per gallon")
).
- file
A character scalar. If provided, the Latex (or data frame) table will be saved in a file whose path is file
. If you provide this argument, then a Latex table will be exported, to export a regular data.frame
, use argument tex = FALSE
.
- replace
Logical, default is FALSE
. Only used if option file
is used. Should the exported 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.
- 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)
for a Latex table and c("***"=0.001, "**"=0.01, "*"=0.05, "."=0.10)
for a data.frame (to conform with R's default). 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)
.
- label
(Tex only.) Character scalar. The label of the Latex table.
- float
(Tex only.) Logical. By default, if the argument title
or label
is provided, it is set to TRUE
. Otherwise, it is set to FALSE
.
- headers
Character vector or list. Adds one or more header lines in the table. A header line can be represented by a character vector or a named list of numbers where the names are the cell values and the numbers are the span. Example: headers=list("M"=2, "F"=3)
will create a row with 2 times "M" and three time "F" (this is identical to headers=rep(c("M", "F"), c(2, 3))
). You can stack header lines within a list, in that case the list names will be displayed in the leftmost cell. Example: headers=list(Gender=list("M"=2, "F"=3), Country="US"
will create two header lines. When tex = TRUE
, you can add a rule to separate groups by using ":_:"
somewhere in the row name (ex: headers=list(":_:Gender"=list("M"=2, "F"=3))
. You can monitor the placement by inserting a special character in the row name: "^" means at the top, "-" means in the middle (default) and "_" means at the bottom. Example: headers=list("_Country"="US")
will add the country row as the very last header row (after the model row). Finally, you can use the special value "auto" to include automatic headers when the data contains split sample estimations. By default it is equal to list("auto")
. You can use .()
instead of list()
.
- fixef_sizes
(Tex only.) Logical, default is FALSE
. If TRUE
and fixed-effects were used in the models, then the number of "units" per fixed-effect dimension is also displayed.
- fixef_sizes.simplify
Logical, default is TRUE
. Only used if fixef_sizes = TRUE
. If TRUE
, the fixed-effects sizes will be displayed in parentheses instead of in a separate line if there is no ambiguity (i.e. if the size is constant across models).
- keepFactors
Logical, default is TRUE
. If FALSE
, then factor variables are displayed as fixed-effects and no coefficient is shown.
- family
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
(Tex only.) 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.
- interaction.combine
Character scalar, defaults to " $\\times$ "
for Tex and to " = "
otherwise. 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
.
- interaction.order
Character vector of regular expressions. Only affects variables that are interacted like x1 and x2 in feols(y ~ x1*x2, data)
. You can change the order in which the interacted variables are displayed: e.g. interaction.order = "x2"
would lead to "x1 x x2" instead of "x1 x x2". Please look at the argument 'order' and the dedicated section in the help page for more information.
- i.equal
Character scalar, defaults to " $=$ "
when tex = TRUE
and " = "
otherwise. 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
.
- depvar
Logical, default is TRUE
. Whether a first line containing the dependent variables should be shown.
- style.tex
An object created by the function style.tex
. It represents the style of the Latex table, see the documentation of style.tex
.
- style.df
An object created by the function style.df
It represents the style of the data frame returned (if tex = FALSE
), see the documentation of style.df
.
- notes
(Tex only.) Character vector. If provided, a "notes"
section will be added at the end right after the end of the table, containing the text of this argument. If it is a vector, it will be collapsed with new lines. If tpt = TRUE
, the behavior is different: each element of the vector is an item. If the first element of the vector starts with "@"
, then it will be included verbatim, and in case of tpt = TRUE
, right before the first item. If that element is provided, it will replace the value defined in style.tex(notes.intro)
or style.tex(notes.tpt.intro)
.
- group
A list. The list elements should be vectors of regular expressions. For each elements of this list: A new line in the table is created, all variables that are matched by the regular expressions are discarded (same effect as the argument drop
) and TRUE
or FALSE
will appear in the model cell, depending on whether some of the previous variables were found in the model. Example: group=list("Controls: personal traits"=c("gender", "height", "weight"))
will create an new line with "Controls: personal traits"
in the leftmost cell, all three variables gender, height and weight are discarded, TRUE
appearing in each model containing at least one of the three variables (the style of TRUE
/FALSE
is governed by the argument yesNo
). You can control the placement of the new row by using 1 or 2 special characters at the start of the row name. The meaning of these special characters are: 1) "^"
: coef., "-"
: fixed-effect, "_"
: stats, section; 2) "^"
: 1st, "_"
: last, row. For example: group=list("_^Controls"=stuff)
will place the line at the top of the 'stats' section, and using group=list("^_Controls"=stuff)
will make the row appear at the bottom of the coefficients section. For details, see the dedicated section.
- extralines
A vector, a list or a one sided formula. The list elements should be either a vector representing the value of each cell, a list of the form list("item1" = #item1, "item2" = #item2, etc)
, or a function. This argument can be many things, please have a look at the dedicated help section; a simplified description follows. For each elements of this list: A new line in the table is created, the list name being the row name and the vector being the content of the cells. Example: extralines=list("Sub-sample"=c("<20 yo", "all", ">50 yo"))
will create an new line with "Sub-sample"
in the leftmost cell, the vector filling the content of the cells for the three models. You can control the placement of the new row by using 1 or 2 special characters at the start of the row name. The meaning of these special characters are: 1) "^"
: coef., "-"
: fixed-effect, "_"
: stats, section; 2) "^"
: 1st, "_"
: last, row. For example: extralines=list("__Controls"=stuff)
will place the line at the bottom of the stats section, and using extralines=list("^^Controls"=stuff)
will make the row appear at the top of the 'coefficients' section. For details, see the dedicated section. You can use .()
instead of list()
.
- fixef.group
Logical scalar or list (default is NULL
). If equal to TRUE
, then all fixed-effects always appearing jointly in models will be grouped in one row. If a list, its elements must be character vectors of regular expressions and the list names will be the row names. For ex. fixef.group=list("Dates fixed-effects"="Month|Day")
will remove the "Month"
and "Day"
fixed effects from the display and replace them with a single row named "Dates fixed-effects". You can monitor the placement of the new row with two special characters telling where to place the row within a section: first in which section it should appear: "^"
(coef.), "-"
(fixed-effects), or "_"
(stat.) section; then whether the row should be "^"
(first), or "_"
(last). These two special characters must appear first in the row names. Please see the dedicated section
- placement
(Tex only.) Character string giving the position of the float in Latex. Default is "htbp". It must consist of only the characters 'h', 't', 'b', 'p', 'H' and '!'. Reminder: h: here; t: top; b: bottom; p: float page; H: definitely here; !: prevents Latex to look for other positions. Note that it can be equal to the empty string (and you'll get the default placement).
- drop.section
Character vector which can be of length 0 (i.e. equal to NULL
). Can contain the values "coef", "fixef", "slopes" or "stats". It would drop, respectively, the coefficients section, fixed-effects section, the variables with varying slopes section or the fit statistics section.
- poly_dict
Character vector, default is c("", " square", " cube")
. When raw polynomials (x^2
, etc) are used, the variables are automatically renamed and poly_dict
rules the display of the power. For powers greater than the number of elements of the vector, the value displayed is $^{pow}$
in Latex and ^ pow
in the R console.
- postprocess.tex
A function that will postprocess the character vector defining the latex table. Only when tex = TRUE
. By default it is equal to NULL
, meaning that there is no postprocessing. When tex = FALSE
, see the argument postprocess.df
. See details.
- postprocess.df
A function that will postprocess.tex the resulting data.frame. Only when tex = FALSE
. By default it is equal to NULL
, meaning that there is no postprocessing. When tex = TRUE
, see the argument postprocess.tex
.
- 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).
- fit_format
Character scalar, default is "__var__"
. Only used in the presence of IVs. By default the endogenous regressors are named fit_varname
in the second stage. The format of the endogenous regressor to appear in the table is governed by fit_format
. For instance, by default, the prefix "fit_"
is removed, leading to only varname
to appear. If fit_format = "$\\\\hat{__var__$"}
, then "$\\hat{varname$"}
will appear in the table.
- coef.just
(DF only.) Either "."
, "("
, "l"
, "c"
or "r"
, default is NULL
. How the coefficients should be justified. If NULL
then they are right aligned if se.below = FALSE
and aligned to the dot if se.below = TRUE
. The keywords stand respectively for dot-, parenthesis-, left-, center- and right-aligned.
- tabular
(Tex only.) Character scalar equal to "normal" (default), "*"
or "X"
. Represents the type of tabular environment to use: either tabular
, tabular*
or tabularx
.
- highlight
List containing coefficients to highlight. Highlighting is of the form .("options1" = "coefs1", "options2" = "coefs2", etc)
.
The coefficients to be highlighted can be written in three forms: 1) row, eg "x1"
will highlight the full row of the variable x1
; 2) cells, use '@'
after the coefficient name to give the column, it accepts ranges, eg "x1@2, 4-6, 8"
will highlight only the columns 2, 4, 5, 6, and 8 of the variable x1
; 3) range, by giving the top-left and bottom-right values separated with a semi-colon, eg "x1@2 ; x3@5"
will highlight from the column 2 of x1
to the 5th column of x3
. Coefficient names are partially matched, use a '%'
first to refer to the original name (before dictionary) and use '@'
first to use a regular expression. You can add a vector of row/cell/range.
The options are a comma-separated list of items. By default the highlighting is done with a frame (a thick box) around the coefficient, use 'rowcol'
to highlight with a row color instead. Here are the other options: 'se'
to highlight the standard-errors too; 'square'
to have a square box (instead of rounded); 'thick1'
to 'thick6'
to monitor the width of the box; 'sep0'
to 'sep9'
to monitor the inner spacing. Finally the remaining option is the color: simply add an R color (it must be a valid R color!). You can use "color!alpha"
with "alpha" a number between 0 to 100 to change the alpha channel of the color.
- coef.style
Named list containing styles to be applied to the coefficients. It must be of the form .("style1" = "coefs1", "style2" = "coefs2", etc)
. The style must contain the string ":coef:"
(or ":coef_se:"
to style both the coefficient and its standard-error). The string :coef:
will be replaced verbatim by the coefficient value. For example use "\\textbf{:coef:}"
to put the coefficient in bold. Note that markdown markup is enabled so "**:coef:**"
would also put it in bold. The coefficients to be styled can be written in three forms: 1) row, eg "x1"
will style the full row of the variable x1
; 2) cells, use '@'
after the coefficient name to give the column, it accepts ranges, eg "x1@2, 4-6, 8"
will style only the columns 2, 4, 5, 6, and 8 of the variable x1
; 3) range, by giving the top-left and bottom-right values separated with a semi-colon, eg "x1@2 ; x3@5"
will style from the column 2 of x1
to the 5th column of x3
. Coefficient names are partially matched, use a '%'
first to refer to the original name (before dictionary) and use '@'
first to use a regular expression. You can add a vector of row/cell/range.
- meta
(Tex only.) A one-sided formula that shall contain the following elements: date or time, sys, author, comment and call. Default is NULL
. This argument is a shortcut to controlling the meta information that can be displayed in comments before the table. Typically if the element is in the formula, it means that the argument will be equal to TRUE
. Example: meta = ~time+call
is equivalent to meta.time = TRUE
and meta.call = TRUE
. The "author" and "comment" elements are a bit special. Using meta = ~author("Mark")
is equivalent to meta.author = "Mark"
while meta=~author
is equiv. to meta.author = TRUE
. The "comment" must be used with a character string inside: meta = ~comment("this is a comment")
. The order in the formula controls the order of appearance of the meta elements. It also has precedence over the meta.XX
arguments.
- meta.time
(Tex only.) Either a logical scalar (default is FALSE
) or "time" or "date". Whether to include the time (if TRUE
or "time") or the date (if "date") of creation of the table in a comment right before the table.
- meta.author
(Tex only.) A logical scalar (default is FALSE
) or a character vector. If TRUE
then the identity of the author (deduced from the system user in Sys.info()
) is inserted in a comment right before the table. If a character vector, then it should contain author names that will be inserted as comments before the table, prefixed with "Created by:"
. For free-form comments see the argument meta.comment
.
- meta.sys
(Tex only.) A logical scalar, default is FALSE
. Whether to include system information (from Sys.info()
) in a comment right before the table.
- meta.call
(Tex only.) Logical scalar, default is FALSE
. If TRUE
then the call to the function is inserted right before the table in a comment.
- meta.comment
(Tex only.) A character vector containing free-form comments to be inserted right before the table.
- view
Logical, default is FALSE
. If TRUE
, then the table generated in Latex by etable
and then is displayed in the viewer pane. Note that for this option to work you need i) pdflatex, ii) imagemagick and iii) ghostscript. All three software must be installed and on the path.
- export
Character scalar giving the path to a PNG file to be created, default is NULL
. If provided, the Latex table will be converted to PNG and copied to the export
location. Note that for this option to work you need a working distribution of pdflatex
, imagemagick
and ghostscript
.
- markdown
Character scalar giving the location of a directory, or a logical scalar. Default is NULL
. This argument only works in Rmarkdown documents, when knitting the document. If provided: two behaviors depending on context. A) if the output document is Latex, the table is exported in Latex. B) if the output document is not Latex, the table will be exported to PNG at the desired location and inserted in the document via a markdown link. If equal to TRUE
, the default location of the PNGs is a temporary folder for R > 4.0.0
, or to "images/etable/"
for earlier versions.
- page.width
Character scalar equal to 'fit'
(default), 'a4'
or 'us'
; or a single Latex measure (like '17cm'
) or a double one (like "21, 2cm"
). Only used when the Latex table is to be viewed (view = TRUE
), exported (export != NULL
) or displayed in Rmarkdown (markdown != NULL
). It represents the text width of the page in which the Latex table will be inserted. By default, 'fit'
, the page fits exactly the table (i.e. text width = table width). If 'a4'
or 'us'
, two times 2cm is removed from the page width to account for margins. Providing a page width and a margin width, like in "17in, 1in"
, enables a correct display of the argument adjustbox
. Note that the margin width represent the width of a single side margin (and hence will be doubled).
- div.class
Character scalar, default is "etable"
. Only used in Rmarkdown documents when markdown = TRUE
. The table in an image format is embedded in a <div>
container, and that container is of class div.class
.
- view.cache
Logical, default is FALSE
. Only used when view = TRUE
. Whether the PNGs of the tables should be cached.
- reset
(setFixest_etable
only.) Logical, default is FALSE
. If TRUE
, this will reset all the default values that were already set by the user in previous calls.
- save
Either a logical or equal to "reset"
. Default is FALSE
. If TRUE
then the value is set permanently at the project level, this means that if you restart R, you will still obtain the previously saved defaults. This is done by writing in the ".Renviron"
file, located in the project's working directory, hence we must have write permission there for this to work, and only works with Rstudio. If equal to "reset", the default at the project level is erased. Since there is writing in a file involved, permission is asked to the user.
- x
An object returned by etable
.
- type
Character scalar equal to 'pdflatex' (default), 'magick', 'dir' or 'tex'. Which log file to report; if 'tex', the full source code of the tex file is returned, if 'dir': the directory of the log files is returned.