stargazer command produces LaTeX code and ASCII text for well-formatted tables that hold regression analysis results from several models side-by-side. It can also output summary statistics and data frame content. stargazer supports model objects from aftreg (eha), betareg (betareg), binaryChoice (sampleSelection), bj (rms), brglm (brglm), coeftest (lmtest), coxph (survival), coxreg (eha), clm (ordinal), clogit (survival), cph (rms), dynlm (dynlm), ergm (ergm), errorsarlm (spdep), gam (mgcv), gee (gee), glm (stats), Glm (rms), glmer (lme4), gls (nlme), Gls (rms), gmm (gmm), heckit (sampleSelection), hurdle (pscl), ivreg (AER), lagarlm (spdep), lm (stats), lmer (lme4), lmrob (robustbase), lrm (rms), maBina (erer), mclogit (mclogit), mlogit (mlogit), mlreg (eha), multinom (nnet), nlmer (lme4), ols (rms), phreg (eha), plm (plm), pmg (plm), polr (MASS), psm (rms), rem.dyad (relevent), rlm (MASS), rq (quantreg), Rq (rms), probit (sampleSelection), selection (sampleSelection), svyglm (survey), survreg (survival), tobit (AER), weibreg (eha), zeroinfl (pscl), as well as from the implementation of these in zelig. It also supports the following zelig models: "relogit", "cloglog.net", "gamma.net", "probit.net" and "logit.net".stargazer( ...,
type = "latex", title = "", style = "default",
summary = TRUE, out = NULL,
column.labels = NULL, column.separate = NULL,
covariate.labels = NULL, dep.var.caption = NULL,
dep.var.labels = NULL, dep.var.labels.include = TRUE,
align = FALSE,
coef = NULL, se = NULL, t = NULL, p = NULL,
t.auto = TRUE, p.auto = TRUE,
ci = FALSE, ci.custom = NULL,
ci.level = 0.95, ci.separator = NULL,
apply.coef = NULL, apply.se = NULL,
apply.t = NULL, apply.p = NULL, apply.ci = NULL,
column.sep.width = "5pt",
decimal.mark = NULL, digit.separate = NULL,
digit.separator = NULL,
digits = NULL, digits.extra = NULL,
float = TRUE, float.env="table",
font.size = NULL, header = TRUE,
initial.zero = NULL,
intercept.bottom = TRUE, intercept.top = FALSE,
keep = NULL, keep.stat = NULL,
label = "", model.names = NULL, model.numbers = NULL,
no.space = NULL,
notes = NULL, notes.align = NULL,
notes.append = TRUE, notes.label = NULL,
omit = NULL, omit.labels = NULL,
omit.stat = NULL, omit.yes.no = c("Yes", "No"),
order = NULL, ord.intercepts = FALSE, perl = FALSE,
rq.se = "nid", selection.equation = FALSE,
single.row = FALSE,
star.char = NULL, star.cutoffs = NULL,
suppress.errors = FALSE, table.placement = "!htbp",
zero.component = FALSE, summary.logical = TRUE,
nobs = TRUE, mean.sd = TRUE, min.max = TRUE,
median = FALSE, iqr = FALSE )"latex" (default) for LaTeX code and "text" for ASCII text output.FALSE, the package will instead output the contents of the data frame.type argumecolumn.separate.column.labels should be laid out across regression table columns. A value of c(2, 1, 3), for instance, will apply the first label to the two first columns, the second label to the third column,NA for any element means that stargazer will print the corresponding variable name. In the default case of NULL, variable names are printedNULL denotes the default caption for the chosen style. An empty string (i.e., "") will lead stargazer tNA for any element means that stargazer will print the corresponding variable name. In the default case of NULL, variable name\usepackage{dcolumn} in LaTeX preamble.NULL vector indicates that, focoef.coef and se, test statistics are matched to covariates by their element names.stargazer should calculate the test statistics (i.e., the z-scores) automatically if coefficients or standard errors are supplied by the user (from arguments coef and se) or modstargazer should calculate the p-values, using the standard normal distribution, if coefficients or standard errors are supplied by the user (from arguments coef and se) or modistargazer should, in regression tables, replace standard errors by confidence intervals. If the value is NA or unspecified, then the value from the last preceding specifieci is set to TRUE. By default, stargazer will report 95 percent confidence intervals. If the value "5pt"."," will represent decimal commas, while "." means tables will use decimal points."," for a comma separator, "" for a single space separator, and "" for no separation.NA indicates that no rounding should be done at all, and that all available decimal places should be reported.digits decimal places, is equal to zero.\begin{table} and \end{table}).float is set to TRUE). Possible values are "table" (default), "table*" and "sidewaystable""tiny", "scriptsize", "footnotesize", "small", "normalsize", "large", keep.stat = c("n","ll") will produce a table that only includes statistics for the number of observations and log likelihood. See t\label{} TeX markers for the tables.[*], [**], and "l" for left alignment, "r" for right alignment, and "c" for centering. This argument is not case-sensinotes should be appended to the standard note(s) associated with the table's style (typically an explanation of significance cutoffs). If the argument's value is set to FALSE, tomit, and that will be used in a sub-table that indicates whether variables have been omitted from a given model. omit and omit.labelsomit.stat = c("ll","rsq") will omit the log-likelihood and the R-squared statistics. See the "omit".FALSE, the package will assume the default extended regular expressions.rq (quantile regression) objects. Possible values are "iid", "nid", "ker" and "boot".no.space is automatically set to TRUETRUE) or the outcome equation (default) will be reported for heckit and selection models from the package sampleSelection.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 nstargazer should suppress the output of its error messages."h", "t","b", "p", "!", "H"} that determines the table placement in its LaTeX floating environment.zero component of zeroinfl and hurdle estimation results. If FALSE, the count component is displayed.FALSE) and 1 (TRUE).stargazer uses cat() to output LaTeX code or ASCII text for the table. To allow for further processing of this output, stargazer also returns the same output invisibly as a character vector. You can include the produced tables in your paper by inserting stargazer LaTeX output into your publication's TeX source. Alternatively, you can use the out argument to save the output in a .tex or .txt file.stargazer.NULL will use the default settings of the requested style.## create summary statistics table 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")
## report ASCII text for a table with 90 percent confidence
## intervals reported on the same row as coefficients
## and omitting F statistics and the residual standard error
stargazer(linear.1, linear.2, probit.model, type="text",
title="Regression Results", single.row=TRUE,
ci=TRUE, ci.level=0.9, omit.stat=c("f", "ser"))
### re-order the models and only keep explanatory
### variables that contain "complaints", "learning",
### "raises" and "critical"; report these with standard
### errors, and put "learning" and "raises" before
### the other explanatory variables; of the summary
### statistics, only keep the number of observations
stargazer(probit.model, linear.1, linear.2, type="text",
keep=c("complaints","learning","raises","critical"),
keep.stat="n", order=c("learning", "raises"))
### apply a function to the coefficients and standard errors
### that will multiply them by ten; you can think of this
### as a change in units
multiply.by.10 <- function(x) (x * 10)
stargazer(probit.model, linear.1, linear.2,
apply.coef=multiply.by.10, apply.se=multiply.by.10)Run the code above in your browser using DataLab