Learn R Programming

stargazer (version 3.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 betareg (betareg), coxph (survival), clm (ordinal), clogit (survival), ergm (ergm), gam (mgcv), gee (gee), glm (stats), glmer (lme4), gls (nlme), hurdle (pscl), ivreg (AER), lm (stats), lmer (lme4), lmrob (robustbase), multinom (nnet), nlmer (lme4), plm (plm), pmg (plm), polr (MASS), rlm (MASS), svyglm (survey), survreg (survival), tobit (AER), zeroinfl (pscl), 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,
            coef = NULL, se = NULL, t = NULL, p = NULL,
            t.auto = TRUE, p.auto = TRUE,
            decimal.mark = NULL, digit.separate = NULL, digit.separator = NULL,
            digits = NULL, digits.extra = NULL, initial.zero = NULL, intercept.top = NULL, 
            label = "", 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,
            summary.logical = TRUE,
            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.
coef
a list of numerical vectors that will replace the default coefficient values for each model. Element names will be used to match coefficients to individual covariates, and should therefore match covariate names. A NULL vector indicates that,
se
a list of numerical vectors that will replace the default coefficient values for each model. Behaves exactly like the argument coef.
t
a list of numerical vectors that will replace the default test statistics (e.g., t-scores, or z-scores) for each model. Like coef and se, test statistics are matched to covariates by their element names.
p
a list of numerical vectors that will replace the default p-values for each model. Matched by element names. These will form the basis of decisions about significance stars.
t.auto
a logical value that indicates whether stargazer should calculate the test statistics (i.e., the z-scores) automatically if standard errors are supplied by the user (from argument se). If FALSE, the package will use
p.auto
a logical value that indicates whether stargazer should calculate the p-values, using the standard normal distribution, standard errors are supplied by the user (from argument se). If FALSE, the package will use mode
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. A value of NA indicates that no rounding should be done at all, and that all available decimal places should be reported.
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.
label
a character string containing the \label{} TeX markers for the tables.
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.
summary.logical
a logical value indicating whether logical variables should be reported in summary statistics table. If so, they will be treated as if they had values of 0 (corresponding to FALSE) and 1 (TRUE).
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 and New Features

I would like to thank everyone who has tested this package, or provided useful comments and suggestions. Please see stargazer package acknowledgments. See stargazer news for a list of new models and features in each release of stargazer.

Please cite as:

Hlavac, Marek (2013). stargazer: LaTeX code for well-formatted regression and summary statistics tables. R package version 3.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.

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)

##  2 OLS models
linear.1 <- lm(rating ~ complaints + privileges + learning + raises + critical, data=attitude)
linear.2 <- lm(rating ~ complaints + privileges + learning, data=attitude)

## create an indicator dependent variable, and run a probit model
 
attitude$high.rating <- (attitude$rating > 70)
probit.model <- glm(high.rating ~ learning + critical + advance, data=attitude, family = binomial(link = "probit"))
 
stargazer(linear.1, linear.2, probit.model, title="Regression Results")

Run the code above in your browser using DataLab