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 styles.
- 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
NAfor any element means thatstargazerwill print the corresponding variable name. In the default case ofNULL, variable names are printed. - dep.var.labels
- a character string vector of labels for the dependent variables in regression tables. A value of
NAfor any element means thatstargazerwill print the corresponding variable name. In the default case ofNULL, variable names are printed. - 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
NULLvector indicates that, for a given model, the default set of coefficients should be used. By contrast, anNAvector means that all of the model's coefficients should be left blank. - 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
coefandse, 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
stargazershould calculate the test statistics (i.e., the z-scores) automatically if standard errors are supplied by the user (from argumentse). IfFALSE, the package will use model's default values iftisNULL. - p.auto
- a logical value that indicates whether
stargazershould calculate the p-values, using the standard normal distribution, standard errors are supplied by the user (from argumentse). IfFALSE, the package will use model's default values ifpisNULL. - 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 that will be separated from that 'first' separator, and so on. A value of
3corresponds to a thousands separator, while a value ofindicates no separation. Alternatively,digit.separatecan be one of the following character strings:"lakh"(equivalent toc(4,3)),"china"or"japan"(both equivalent to a value of4). - 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
NAindicates 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
digitsdecimal 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':
[*],[**], and[***]will be replaced by the cutoffs, in percentage terms, for one, two and three 'stars,' respectively (e.g., 10, 5, and 1). Similarly,[0.*],[0.**]and[0.***]will be replaced by the numerical value of cutoffs for one, two and three 'stars' (e.g., 0.1, 0.05, and 0.01).[.*],[.**]and[.***]will omit the leading zeros (e.g., .1, .05, .01). - 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-sensitive. - 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
NULLmeans that no variables will be excluded. - 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.omitandomit.labelsmust be equal in length. - 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 list of statistic codes. This argument is not case-sensitive. - 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
1and at most3that indicates the statistical signficance cutoffs for one, two and three 'stars,' respectively. For elements withNAvalues, the corresponding 'star' will not be used. - zero.component
- a logical value indicating whether to report coefficients for the
zerocomponent ofzeroinflandhurdleestimation results. IfFALSE, thecountcomponent 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.)
Details
Arguments with a value of NULL will use the default settings of the requested style.
Values
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
Examples
## 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")
Documentation reproduced from package stargazer, version 3.0.1. License: GPL (>= 2)
