Learn R Programming

stargazer (version 2.0.1)

stargazer: stargazer

Description

The stargazer command produces LaTeX code for well-formatted tables that hold regression analysis results from several models side-by-side, as well as summary statistics. It supports model objects from lm, glm, svyglm, plm, betareg, gee, gam, polr, survreg, coxph, tobit (AER), ivreg (AER), zeroinfl (pscl), hurdle (pscl), multinom (nnet) as well as from the implementation of these in zelig. It also supports the following zelig models for social network analysis: "cloglog.net", "gamma.net", "probit.net" and "logit.net".

Usage

stargazer(  ..., 
            title = "", style = "default", summary = TRUE,
            covariate.labels = NULL, dep.var.labels = NULL,
            align = FALSE, decimal.mark = NULL,
            digit.separate = NULL, digit.separator = NULL,
            digits = NULL, digits.extra = NULL, initial.zero = NULL, intercept.top = NULL, 
            model.names = NULL, model.numbers = NULL, 
            notes = NULL, notes.align = NULL, notes.label = NULL, 
            omit = NULL, omit.labels = NULL, omit.stat = NULL, omit.yes.no = c("Yes", "No"), 
            ord.intercepts = FALSE, star.char = NULL, star.cutoffs = NULL, zero.component = FALSE,
            nobs = TRUE, mean.sd = TRUE, min.max = TRUE, median = FALSE, iqr = FALSE )

Arguments

...
one or more model objects (for regression analysis tables) or data frames (for summary statistics, or direct output of content).
title
character string vector with titles for the tables.
style
character string that specifies what style, typically designed to resemble an existing academic journal, should be used in producing the tables. This argument is not case-sensitive. See list of supported st
summary
a logical value indicating whether the package should output a summary statistics table when given a data frame. If FALSE, the package will instead output the contents of the data frame.
covariate.labels
a character string vector of labels for covariates in regression tables. A value of NA for any element means that stargazer will print the corresponding variable name. In the default case of NULL, variable names are
dep.var.labels
a character string vector of labels for the dependent variables in regression tables. A value of NA for any element means that stargazer will print the corresponding variable name. In the default case of NULL, variab
align
a logical value indicating whether numerical values in the same column should be aligned at the decimal mark. Requires \usepackage{dcolumn} in LaTeX preamble.
decimal.mark
character string that will serve as the decimal mark. For instance, the string "," will represent decimal commas, while "." means tables will use decimal points.
digit.separate
a numerical vector that indicates where digit separators should be placed. The first element of the vector indicates the number of digits (counted from the decimal mark to the left) that will be separated. The second element indicates the number of digits
digit.separator
character string that will serve as the digit (e.g., thousands) separator. Commonly used strings include "," for a comma separator, "" for a single space separator, and "" for no separation.
digits
integer that indicates how many decimal places should be used.
digits.extra
integer indicating the maximum number of additional decimal places to be used if a number, rounded to digits decimal places, is equal to zero.
initial.zero
a logical value indicating whether an initial zero should be printed before the decimal mark if a number is between 0 and 1.
intercept.top
a logical value indicating whether the intercept (or constant) coefficients should be on top, rather than on the bottom, of the table.
model.names
a logical value indicating whether model names should be included in the table.
model.numbers
a logical value indicating whether models should be numbered. No number is used whenever a regression table includes only one model.
notes
a character string vector containing notes to be included below the table. The character strings can include special substrings that will be replaced by the corresponding cutoffs for statistical significance 'stars': [*], [**], a
notes.align
a character string that specifies how notes should be aligned under the table. One of three strings can be used: "l" for left alignment, "r" for right alignment, and "c" for centering. This argument is not case-sensi
notes.label
a character string containing a label for the notes section of the table.
omit
a vector of regular expressions that specifies which of the explanatory variables should be omitted from presentation in the table. This argument might be used, for instance, to exclude fixed effects dummies from being presented. The default value of
omit.labels
a character string vector of labels that correspond to each of the regular expressions in omit, and that will be used in a sub-table that indicates whether variables have been omitted from a given model. omit and omit.label
omit.stat
a character string vector that specifies which statistics should be omitted from regression table output. For instance omit = c("ll","rsq") will omit the log-likelihood and the R squared statistics. See the
omit.yes.no
a character string vector of length 2 that contains the 'yes' and 'no' strings to indicate whether, in any specific model, variables were omitted from the table, as specified by "omit".
ord.intercepts
a logical value indicating whether intercepts for models with ordered dependent variables (such as ordered probit, or ordered logit) are included in the table.
star.char
character string to be used as the 'star' to denote statistical significance.
star.cutoffs
a numeric vector with a length of at least 1 and at most 3 that indicates the statistical signficance cutoffs for one, two and three 'stars,' respectively. For elements with NA values, the corresponding 'star' will n
zero.component
a logical value indicating whether to report coefficients for the zero component of zeroinfl and hurdle estimation results. If FALSE, the count component is displayed.
nobs
a logical value that toggles whether the number of observations (N) for each variable is shown in summary statistics tables.
mean.sd
a logical value that toggles whether variable means and standard deviations are shown in summary statistics tables.
min.max
a logical value that toggles whether variable minima and maxima are shown in summary statistics tables.
median
a logical value that toggles whether variable medians are shown in summary statistics tables.
iqr
a logical value that toggles whether the 25th and 75th percentiles for each variable are shown in summary statistics tables. ('iqr' stands for interquartile range.)

Value

  • stargazer uses cat() to output LaTeX code for the table. To allow for further processing of this output, stargazer also returns the same output invisibly as a character string vector. You can include the produced tables in your paper by inserting stargazer output into your publication's TeX source.

Acknowledgments

I would like to thank everyone who has tested this package, or provided useful comments and suggestions. Please see stargazer package acknowledgments.

Please cite as:

Marek Hlavac (2013). stargazer: LaTeX code for well-formatted regression and summary statistics tables. R package version 2.0.1. http://CRAN.R-project.org/package=stargazer

Details

Arguments with a value of NULL will use the default settings of the requested style.

See Also

Several packages by other authors provide functionality similar to that of stargazer. These include xtable by David B. Dahl and apsrtable by Michael Malecki.

Examples

Run this code
## create summary statistics table based for 'attitude' data frame
stargazer(attitude)

## list the content of the data frame 'attitude'
stargazer(attitude, summary=FALSE)

## estimate and report results of 3 OLS models
m1 <- lm(rating ~ complaints + privileges + learning + raises + critical, data=attitude)
m2 <- lm(rating ~ complaints + privileges + learning, data=attitude)
m3 <- lm(rating ~ learning + critical + advance, data=attitude)

stargazer(m1, m2, m3)

Run the code above in your browser using DataLab