Creates a publication quality result table for regression models. Works with models fitted with lm, glm, as well as lme4.
outreg.RdThis provides "markup" that the user is will copy into a LaTeX document. As of rockchalk 1.8.4, can also create HTML markup. The rockchalk vignette demonstrates use of outreg in Sweave.
Usage
outreg(
modelList,
type = "latex",
modelLabels = NULL,
varLabels = NULL,
tight = TRUE,
centering = c("none", "siunitx", "dcolumn"),
showAIC = FALSE,
float = FALSE,
request,
runFuns,
digits = 3,
alpha = c(0.05, 0.01, 0.001),
SElist = NULL,
PVlist = NULL,
Blist = NULL,
title,
label,
gofNames,
print.results = TRUE,
browse = identical(type, "html") && interactive()
)Arguments
- modelList
A regression model or an R list of regression models. Default model names will be M1, M2, and so forth. User specified names are allowed, such as
list("My Model" = m1, "Her Model" = m2). This is the currently recommended way to supply model lables. This is less error prone than the use of the modelLabels argument.- type
Default = "latex". The alternatives are "html" and "csv"
- modelLabels
This is allowed, but discouraged. A vector of character string variables, one for each element in modelList. Will override the names in modelList.
- varLabels
To beautify the parameter names printed. Must be a named vector in the format c(parmname = "displayName", parmname = "displayName"). Include as many parameters as desired, it is not necessary to supply new labels for all of the parameters.
- tight
Table format. If TRUE, parameter estimates and standard errors are printed in a single column. If FALSE, parameter estimates and standard errors are printed side by side.
- centering
Default is "none", but may be "siunitx" or "dcolumn". No centering has been the only way until this version. User feedback requested. Don't forget to insert usepackage statment in document preamble for siunitx or dcolumn. If user specifies
centering=TRUE, thesiunitxmethod will be used. Thedcolumnapproach assumes that the values reported in the column use fewer than 3 integer places and 3 decimal places. Additional room is allocated for the significance stars.- showAIC
This is a legacy argument, before the
requestargument was created. If TRUE, the AIC estimate is included with the diagnostic values. It has the same effect as described byrequest.- float
Default = FALSE. Include boilerplate for a LaTeX table float, with the tabular markup inside it. Not relevant if type = "html".
- request
Extra information to be retrieved from the summary(model) and displayed. This must be a vector of named arguments, such as c(adj.r.squared = "adj $R^2$", fstatistic = "F"). The name must be a valid name of the output object, the value should be the label the user wants printed in the table. See details.
- runFuns
A list of functions
- digits
Default = 3. How many digits after decimal sign are to be displayed.
- alpha
Default = c(0.05, 0.01, 0.001). I think stars are dumb, but enough people have asked me for more stars that I'm caving in.
- SElist
Optional. Replacement standard errors. Must be a list of named vectors.
outreguses the Rsummaryto retrieve standard errors, but one might instead want to use robust or bootstrapped standard errors. This argument may supply a new SE vector for each fitted regression model, but it is also allowed to supply the SE replacement for just one of the models. The format should belist("A Model Label" = c(0.1, 0.3, 0.4), "Another Model Label" = c(0.4, 0.2, 0.3). On the left, one must use the same names that are used in the modelList argument.- PVlist
Optional. A list of replacement "p values". It must be a list of named vectors, similar in format to SElist. The which the elements are the "p values" that the user wants to use for each model.
- Blist
Optional. This is only needed in the rare case where a model's parameters cannot be discerned from its summary. List must have names for models, and vectors slope coefficient. See discussion of SElist and PVlist.
- title
A LaTeX caption for the table. Not relevant if type = "html".
- label
A string to be used as a LaTeX label in the table to be created. Not relevant if type = "html".
- gofNames
Optional pretty names. R regression summaries use names like "sigma" or "r.squared" that we might want to revise for presentation. I prefer to refer to "sigma" as "RMSE", but perhaps you instead prefer something like
gofnames = c("sigma" = "That Estimate I don't understand", "deviance" = "Another Mystery"). The words that you might replace are "sigma", "r.squared", "deviance", "adj.r.squared", "fstatistic".- print.results
Default TRUE, marked-up table will be displayed in session. If FALSE, same result is returned as an object.
- browse
Display the regression model in a browse? Defaults to TRUE if type = "html"
Details
outreg returns a string vector. It is suggested that users
should save the outreg result and then use cat to save it. That is
myMod <- outreg(m1, ...) cat(myMod, file = "myMod.html") or
cat(myMod, file = "myMod.tex". In version 1.8.66, we write the
html file to a temporary location and display it in a web
browser. Many word processors will not accept a cut-and paste
transfer from the browser, they will, however, be able to open the
html file itself and automatically re-format it in the native
table format.
In version 1.8.111, an argument print.results was introduced.
This is TRUE by default, so the marked-up table is printed into
the session, and it is returned as well. If the function should
run silently (as suggested in the last few versions), include
print.results = TRUE.
The table includes a minimally sufficient (in my opinion) model
summary. It offers parameter estimates, standard errors, and
minimally sufficient goodness of fit. My tastes tend toward
minimal tables, but users request more features, and
outreg's interface hass been generalized to allow
specialized requests. See request and runFuns
arguments.
I don't want to write a separate table function for every
different kind of regression model that exists (how
exhausting). So I've tried to revise outreg() to work with
regression functions that follow the standard R framework. It is
known to work lm and glm, as well as merMod
class from lme4, but it will try to interact with other
kinds of regression models. Those models should have methods
summary(), coef(), vcov() and nobs().
Package writes should provide those, its not my job.
Do you want "robust standard errors"? P values calculated
according to some alternative logic? Go ahead, calculate them in
your code, outreg will now accept them as arguments. As of Version
1.8.4, users can provide their own standard errors and/or p-values
for each model. Thus, if a model answers in the usual way to the
standard R request coef(summary(model)), outreg can work if
users supply standard errors.
About the customizations request. The request
argument supplies a list of names of summary output elements that
are desired. The format is a pair, a value to be retrieved from
summary(model), and a pretty name to be printed for
it. With the lm() regression, for example, one might want
the output of the F test and the adjusted R-square: Include
request = c(adj.r.squared = "adj. $R^2$", "fstatistic" =
"F"). The value on the left is the name of the desired
information in the summary object, while the value on the right is
any valid LaTeX (or HTML) markup that the user desires to
display in the table. request terms that generate a single
numerical value will generally work fine, while requests that ask
for more structured information, such as the F test (including the
2 degrees of freedom values) may work (user feedback needed).
The runFuns argument is inspired by a user request: could
this include the BIC or other summaries that can be easily
calculated? Any R function, such as AIC or BIC,
should work, as long as it returns a single value. This is a
two-part specification, a function name and a pretty label to be
used in printing. For example, runFuns = c("AIC" = "Akaike
Criterion", "BIC" = "Schwartz Criterion", "logLik" = "LL").
About centering with dcolumn or siunitx. It appears now that
results are better with siunitx but dcolumn is more
familiar to users. The user has the duty to make sure that the
document preamble includes the correct package,
\usepackage{dcolumn} or \usepackage{siunitx}.
In this version, I have eliminated the need for the user to
specify document-wide settings for siunitx. All of the
details are explicitly written in the header of each tabular.
It is done that way to more easily allow user customizations.
Note
There are many R packages that can be used to create LaTeX regression tables. memisc, texreg, apsrtable, xtables, and rms are some. This "outreg" version was in use in our labs before we were aware that those packages were in development. It is not intended as a competitor, it is just a slightly different version of the same that is more suited to our needs.
Author
Paul E. Johnson pauljohn@ku.edu
Examples
set.seed(2134234)
dat <- data.frame(x1 = rnorm(100), x2 = rnorm(100))
dat$y1 <- 30 + 5 * rnorm(100) + 3 * dat$x1 + 4 * dat$x2
dat$y2 <- rnorm(100) + 5 * dat$x2
m1 <- lm(y1 ~ x1, data = dat)
m2 <- lm(y1 ~ x2, data = dat)
m3 <- lm(y1 ~ x1 + x2, data = dat)
gm1 <- glm(y1 ~ x1, family = Gamma, data = dat)
outreg(m1, title = "My One Tightly Printed Regression", float = TRUE)
#> \begin{table}
#> \caption{My One Tightly Printed Regression}\label{regrlabl}
#> \begin{tabular}{@{}l*{2}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{M1 }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** \tabularnewline
#> &(0.618)\tabularnewline
#> x1 & 1.546* \tabularnewline
#> &(0.692)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121\tabularnewline
#> $R^2$&0.048\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{2}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
ex1 <- outreg(m1, title = "My One Tightly Printed Regression",
float = TRUE, print.results = FALSE, centering = "siunitx")
## Show markup, Save to file with cat()
cat(ex1)
#> \begin{table}
#> \caption{My One Tightly Printed Regression}\label{regrlabl}
#> \begin{tabular}{@{}l*{1}{S[
#> input-symbols = ( ),
#> group-digits = false,
#> table-number-alignment = center,
#> %table-space-text-pre = (,
#> table-align-text-pre = false,
#> table-align-text-post = false,
#> table-space-text-post = {***},
#> parse-units = false]}@{}}
#> \hline
#> &\multicolumn{1}{c}{M1 }\tabularnewline
#> &\multicolumn{1}{c}{Estimate}\tabularnewline
#> &\multicolumn{1}{c}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** \tabularnewline
#> &(0.618)\tabularnewline
#> x1 & 1.546* \tabularnewline
#> &(0.692)\tabularnewline
#> \hline
#> N&\multicolumn{1}{c}{100} \tabularnewline
#> RMSE&6.121\tabularnewline
#> $R^2$&0.048\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{2}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
## cat(ex1, file = "ex1.tex")
ex2 <- outreg(list("Fingers" = m1), tight = FALSE,
title = "My Only Spread Out Regressions", float = TRUE,
alpha = c(0.05, 0.01, 0.001))
#> \begin{table}
#> \caption{My Only Spread Out Regressions}\label{regrlabl}
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{2}{l}{Fingers }\tabularnewline
#> &\multicolumn{1}{c}{Estimate}&\multicolumn{1}{c}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & (0.618) \tabularnewline
#> x1 & 1.546* & (0.692) \tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100} & \tabularnewline
#> RMSE&6.121\tabularnewline
#> $R^2$&0.048\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
ex3 <- outreg(list("Model A" = m1, "Model B label with Spaces" = m2),
varLabels = list(x1 = "Billie"),
title = "My Two Linear Regressions", request = c(fstatistic = "F"),
print.results = TRUE)
#> \begin{table}
#> \caption{My Two Linear Regressions}\label{regrlabl}
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{Model A } &\multicolumn{1}{l}{Model B label with Spaces }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & 29.774*** \tabularnewline
#> &(0.618)&(0.522)\tabularnewline
#> Billie & 1.546* &\multicolumn{1}{l}{\_ }\tabularnewline
#> &(0.692) &\tabularnewline
#> x2 &\multicolumn{1}{l}{\_ }& 3.413*** \tabularnewline
#> &&(0.512)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121 &5.205\tabularnewline
#> $R^2$&0.048 &0.312\tabularnewline
#> adj $R^2$&0.039 &0.305\tabularnewline
#> F($df_{num}$,$df_{denom}$)&\multicolumn{1}{c}{4.98(1,98)*} &\multicolumn{1}{c}{44.4(1,98)***}\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
cat(ex3)
#> \begin{table}
#> \caption{My Two Linear Regressions}\label{regrlabl}
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{Model A } &\multicolumn{1}{l}{Model B label with Spaces }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & 29.774*** \tabularnewline
#> &(0.618)&(0.522)\tabularnewline
#> Billie & 1.546* &\multicolumn{1}{l}{\_ }\tabularnewline
#> &(0.692) &\tabularnewline
#> x2 &\multicolumn{1}{l}{\_ }& 3.413*** \tabularnewline
#> &&(0.512)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121 &5.205\tabularnewline
#> $R^2$&0.048 &0.312\tabularnewline
#> adj $R^2$&0.039 &0.305\tabularnewline
#> F($df_{num}$,$df_{denom}$)&\multicolumn{1}{c}{4.98(1,98)*} &\multicolumn{1}{c}{44.4(1,98)***}\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
ex4 <- outreg(list("Model A" = m1, "Model B" = m2),
modelLabels = c("Overrides ModelA", "Overrides ModelB"),
varLabels = list(x1 = "Billie"),
title = "Note modelLabels Overrides model names")
#> \begin{table}
#> \caption{Note modelLabels Overrides model names}\label{regrlabl}
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{Overrides ModelA } &\multicolumn{1}{l}{Overrides ModelB }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & 29.774*** \tabularnewline
#> &(0.618)&(0.522)\tabularnewline
#> Billie & 1.546* &\multicolumn{1}{l}{\_ }\tabularnewline
#> &(0.692) &\tabularnewline
#> x2 &\multicolumn{1}{l}{\_ }& 3.413*** \tabularnewline
#> &&(0.512)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121 &5.205\tabularnewline
#> $R^2$&0.048 &0.312\tabularnewline
#> adj $R^2$&0.039 &0.305\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
cat(ex4)
#> \begin{table}
#> \caption{Note modelLabels Overrides model names}\label{regrlabl}
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{Overrides ModelA } &\multicolumn{1}{l}{Overrides ModelB }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & 29.774*** \tabularnewline
#> &(0.618)&(0.522)\tabularnewline
#> Billie & 1.546* &\multicolumn{1}{l}{\_ }\tabularnewline
#> &(0.692) &\tabularnewline
#> x2 &\multicolumn{1}{l}{\_ }& 3.413*** \tabularnewline
#> &&(0.512)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121 &5.205\tabularnewline
#> $R^2$&0.048 &0.312\tabularnewline
#> adj $R^2$&0.039 &0.305\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
##'
ex5 <- outreg(list("Whichever" = m1, "Whatever" = m2),
title = "Still have showAIC argument, as in previous versions",
showAIC = TRUE, float = TRUE, centering = "siunitx")
#> \begin{table}
#> \caption{Still have showAIC argument, as in previous versions}\label{regrlabl}
#> \begin{tabular}{@{}l*{2}{S[
#> input-symbols = ( ),
#> group-digits = false,
#> table-number-alignment = center,
#> %table-space-text-pre = (,
#> table-align-text-pre = false,
#> table-align-text-post = false,
#> table-space-text-post = {***},
#> parse-units = false]}@{}}
#> \hline
#> &\multicolumn{1}{c}{Whichever } &\multicolumn{1}{c}{Whatever }\tabularnewline
#> &\multicolumn{1}{c}{Estimate}&\multicolumn{1}{c}{Estimate}\tabularnewline
#> &\multicolumn{1}{c}{(S.E.)}&\multicolumn{1}{c}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & 29.774*** \tabularnewline
#> &(0.618)&(0.522)\tabularnewline
#> x1 & 1.546* &\multicolumn{1}{c}{\_ }\tabularnewline
#> &(0.692) &\tabularnewline
#> x2 &\multicolumn{1}{c}{\_ }& 3.413*** \tabularnewline
#> &&(0.512)\tabularnewline
#> \hline
#> N&\multicolumn{1}{c}{100}&\multicolumn{1}{c}{100} \tabularnewline
#> RMSE&6.121 &5.205\tabularnewline
#> $R^2$&0.048 &0.312\tabularnewline
#> adj $R^2$&0.039 &0.305\tabularnewline
#> AIC&650.109 &617.694\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
ex5s <- outreg(list("Whichever" = m1, "Whatever" = m2),
title = "Still have showAIC argument, as in previous versions",
showAIC = TRUE, float = TRUE, centering = "siunitx")
#> \begin{table}
#> \caption{Still have showAIC argument, as in previous versions}\label{regrlabl}
#> \begin{tabular}{@{}l*{2}{S[
#> input-symbols = ( ),
#> group-digits = false,
#> table-number-alignment = center,
#> %table-space-text-pre = (,
#> table-align-text-pre = false,
#> table-align-text-post = false,
#> table-space-text-post = {***},
#> parse-units = false]}@{}}
#> \hline
#> &\multicolumn{1}{c}{Whichever } &\multicolumn{1}{c}{Whatever }\tabularnewline
#> &\multicolumn{1}{c}{Estimate}&\multicolumn{1}{c}{Estimate}\tabularnewline
#> &\multicolumn{1}{c}{(S.E.)}&\multicolumn{1}{c}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & 29.774*** \tabularnewline
#> &(0.618)&(0.522)\tabularnewline
#> x1 & 1.546* &\multicolumn{1}{c}{\_ }\tabularnewline
#> &(0.692) &\tabularnewline
#> x2 &\multicolumn{1}{c}{\_ }& 3.413*** \tabularnewline
#> &&(0.512)\tabularnewline
#> \hline
#> N&\multicolumn{1}{c}{100}&\multicolumn{1}{c}{100} \tabularnewline
#> RMSE&6.121 &5.205\tabularnewline
#> $R^2$&0.048 &0.312\tabularnewline
#> adj $R^2$&0.039 &0.305\tabularnewline
#> AIC&650.109 &617.694\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
# \donttest{
## Launches HTML browse
ex5html <- outreg(list("Whichever" = m1, "Whatever" = m2),
title = "Still have showAIC argument, as in previous versions",
showAIC = TRUE, type = "html")
#> <table>
#>
#> <tr><td></td> <td colspan = '1'; align = 'left'>Whichever </td> <td colspan = '1'; align = 'left'>Whatever </td></tr>
#> <tr><td></td><td colspan = '1'; align = 'left'>Estimate</td><td colspan = '1'; align = 'left'>Estimate</td></tr>
#> <tr><td></td><td colspan = '1'; align = 'left'>(S.E.)</td><td colspan = '1'; align = 'left'>(S.E.)</td></tr>
#> <tr><td style="border-bottom: solid thin black; border-collapse:collapse;"></td><td style="border-bottom: solid thin black; border-collapse:collapse;"></td><td style="border-bottom: solid thin black; border-collapse:collapse;"></td></tr>
#> <tr><td> (Intercept) </td><td> 30.245*** </td><td> 29.774*** </td></tr>
#> <tr><td></td><td>(0.618)</td><td>(0.522)</td></tr>
#> <tr><td> x1 </td><td> 1.546* </td><td colspan = '1'; align = 'left'>_ </td></tr>
#> <tr><td></td><td>(0.692)</td> <td></td></tr>
#> <tr><td> x2 </td><td colspan = '1'; align = 'left'>_ </td><td> 3.413*** </td></tr>
#> <tr><td></td> <td></td><td>(0.512)</td></tr>
#>
#> <tr><td style="border-bottom: solid thin black; border-collapse:collapse;"></td><td style="border-bottom: solid thin black; border-collapse:collapse;"></td><td style="border-bottom: solid thin black; border-collapse:collapse;"></td></tr>
#> <tr><td>N</td><td colspan = '1'; align = 'left'>100</td><td colspan = '1'; align = 'left'>100</td> </tr>
#> <tr><td>RMSE</td><td>6.121</td> <td>5.205</td></tr>
#> <tr><td>R<sup>2</sup></td><td>0.048</td> <td>0.312</td></tr>
#> <tr><td>adj R<sup>2</sup></td><td>0.039</td> <td>0.305</td></tr>
#> <tr><td>AIC</td><td>650.109</td> <td>617.694</td></tr>
#> <tr style="height:5px;"><td colspan='3' style="border-bottom:double thin black;"> </td></tr>
#>
#> <tr>
#> <td colspan="3">* <it>p</it> ≤0.05** <it>p</it> ≤0.01*** <it>p</it> ≤0.001</tr>
#> </table>
## Could instead, make a file:
## fn <- "some_name_you_choose.html"
## cat(ex5html, file = fn)
## browseURL(fn)
## Open that HTML file in LibreOffice or MS Word
# }
ex6 <- outreg(list("Whatever" = m1, "Whatever" =m2),
title = "Another way to get AIC output",
runFuns = c("AIC" = "Akaike IC"))
#> \begin{table}
#> \caption{Another way to get AIC output}\label{regrlabl}
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{Whatever } &\multicolumn{1}{l}{Whatever }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & 30.245*** \tabularnewline
#> &(0.618)&(0.618)\tabularnewline
#> x1 & 1.546* & 1.546* \tabularnewline
#> &(0.692)&(0.692)\tabularnewline
#> x2 &\multicolumn{1}{l}{\_ }&\multicolumn{1}{l}{\_ }\tabularnewline
#> & &\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121 &5.205\tabularnewline
#> $R^2$&0.048 &0.312\tabularnewline
#> adj $R^2$&0.039 &0.305\tabularnewline
#> Akaike IC&\multicolumn{1}{c}{650.11} &\multicolumn{1}{c}{617.69}\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
cat(ex6)
#> \begin{table}
#> \caption{Another way to get AIC output}\label{regrlabl}
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{Whatever } &\multicolumn{1}{l}{Whatever }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & 30.245*** \tabularnewline
#> &(0.618)&(0.618)\tabularnewline
#> x1 & 1.546* & 1.546* \tabularnewline
#> &(0.692)&(0.692)\tabularnewline
#> x2 &\multicolumn{1}{l}{\_ }&\multicolumn{1}{l}{\_ }\tabularnewline
#> & &\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121 &5.205\tabularnewline
#> $R^2$&0.048 &0.312\tabularnewline
#> adj $R^2$&0.039 &0.305\tabularnewline
#> Akaike IC&\multicolumn{1}{c}{650.11} &\multicolumn{1}{c}{617.69}\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
ex7 <- outreg(list("Amod" = m1, "Bmod" = m2, "Gmod" = m3),
title = "My Three Linear Regressions", float = FALSE)
#> \begin{table}
#> \caption{My Three Linear Regressions}\label{regrlabl}
#> \begin{tabular}{@{}l*{4}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{Amod } &\multicolumn{1}{l}{Bmod } &\multicolumn{1}{l}{Gmod }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & 29.774*** & 30.013*** \tabularnewline
#> &(0.618)&(0.522)&(0.490)\tabularnewline
#> x1 & 1.546* &\multicolumn{1}{l}{\_ }& 2.217*** \tabularnewline
#> &(0.692) &&(0.555)\tabularnewline
#> x2 &\multicolumn{1}{l}{\_ }& 3.413*** & 3.717*** \tabularnewline
#> &&(0.512)&(0.483)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121 &5.205 &4.849\tabularnewline
#> $R^2$&0.048 &0.312 &0.409\tabularnewline
#> adj $R^2$&0.039 &0.305 &0.397\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{4}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
cat(ex7)
#> \begin{table}
#> \caption{My Three Linear Regressions}\label{regrlabl}
#> \begin{tabular}{@{}l*{4}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{Amod } &\multicolumn{1}{l}{Bmod } &\multicolumn{1}{l}{Gmod }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & 29.774*** & 30.013*** \tabularnewline
#> &(0.618)&(0.522)&(0.490)\tabularnewline
#> x1 & 1.546* &\multicolumn{1}{l}{\_ }& 2.217*** \tabularnewline
#> &(0.692) &&(0.555)\tabularnewline
#> x2 &\multicolumn{1}{l}{\_ }& 3.413*** & 3.717*** \tabularnewline
#> &&(0.512)&(0.483)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121 &5.205 &4.849\tabularnewline
#> $R^2$&0.048 &0.312 &0.409\tabularnewline
#> adj $R^2$&0.039 &0.305 &0.397\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{4}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
## A new feature in 1.85 is ability to provide vectors of beta estimates
## standard errors, and p values if desired.
## Suppose you have robust standard errors!
if (require(car)){
newSE <- sqrt(diag(car::hccm(m3)))
ex8 <- outreg(list("Model A" = m1, "Model B" = m2, "Model C" = m3, "Model C w Robust SE" = m3),
SElist= list("Model C w Robust SE" = newSE))
cat(ex8)
}
#> Loading required package: car
#> Warning: there is no package called ‘car’
ex11 <- outreg(list("I Love Long Titles" = m1,
"Prefer Brevity" = m2,
"Short" = m3), tight = FALSE, float = FALSE)
#> \begin{tabular}{@{}l*{7}{l}@{}}
#> \hline
#> &\multicolumn{2}{l}{I Love Long Titles } &\multicolumn{2}{l}{Prefer Brevity } &\multicolumn{2}{l}{Short }\tabularnewline
#> &\multicolumn{1}{c}{Estimate}&\multicolumn{1}{c}{(S.E.)}&\multicolumn{1}{c}{Estimate}&\multicolumn{1}{c}{(S.E.)}&\multicolumn{1}{c}{Estimate}&\multicolumn{1}{c}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & (0.618) & 29.774*** & (0.522) & 30.013*** & (0.490) \tabularnewline
#> x1 & 1.546* & (0.692) &\multicolumn{1}{l}{\_ }&& 2.217*** & (0.555) \tabularnewline
#> x2 &\multicolumn{1}{l}{\_ }&& 3.413*** & (0.512) & 3.717*** & (0.483) \tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100} &&\multicolumn{1}{l}{100} &&\multicolumn{1}{l}{100} & \tabularnewline
#> RMSE&6.121&&5.205&&4.849\tabularnewline
#> $R^2$&0.048&&0.312&&0.409\tabularnewline
#> adj $R^2$&0.039&&0.305&&0.397\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{7}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
cat(ex11)
#> \begin{tabular}{@{}l*{7}{l}@{}}
#> \hline
#> &\multicolumn{2}{l}{I Love Long Titles } &\multicolumn{2}{l}{Prefer Brevity } &\multicolumn{2}{l}{Short }\tabularnewline
#> &\multicolumn{1}{c}{Estimate}&\multicolumn{1}{c}{(S.E.)}&\multicolumn{1}{c}{Estimate}&\multicolumn{1}{c}{(S.E.)}&\multicolumn{1}{c}{Estimate}&\multicolumn{1}{c}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & (0.618) & 29.774*** & (0.522) & 30.013*** & (0.490) \tabularnewline
#> x1 & 1.546* & (0.692) &\multicolumn{1}{l}{\_ }&& 2.217*** & (0.555) \tabularnewline
#> x2 &\multicolumn{1}{l}{\_ }&& 3.413*** & (0.512) & 3.717*** & (0.483) \tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100} &&\multicolumn{1}{l}{100} &&\multicolumn{1}{l}{100} & \tabularnewline
#> RMSE&6.121&&5.205&&4.849\tabularnewline
#> $R^2$&0.048&&0.312&&0.409\tabularnewline
#> adj $R^2$&0.039&&0.305&&0.397\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{7}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
##'
ex12 <- outreg(list("GLM" = gm1), float = TRUE)
#> \begin{table}
#> \caption{A Regression}\label{regrlabl}
#> \begin{tabular}{@{}l*{2}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{GLM }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 0.033*** \tabularnewline
#> &(0.001)\tabularnewline
#> x1 & -0.002* \tabularnewline
#> &(0.001)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&\tabularnewline
#> $R^2$&\tabularnewline
#> Deviance&4.301\tabularnewline
#> $-2LLR (Model \chi^2)$ & 0.208 \tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{2}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
cat(ex12)
#> \begin{table}
#> \caption{A Regression}\label{regrlabl}
#> \begin{tabular}{@{}l*{2}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{GLM }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 0.033*** \tabularnewline
#> &(0.001)\tabularnewline
#> x1 & -0.002* \tabularnewline
#> &(0.001)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&\tabularnewline
#> $R^2$&\tabularnewline
#> Deviance&4.301\tabularnewline
#> $-2LLR (Model \chi^2)$ & 0.208 \tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{2}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
ex13 <- outreg(list("OLS" = m1, "GLM" = gm1), float = TRUE,
alpha = c(0.05, 0.01))
#> \begin{table}
#> \caption{A Regression}\label{regrlabl}
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{OLS } &\multicolumn{1}{l}{GLM }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245** & 0.033** \tabularnewline
#> &(0.618)&(0.001)\tabularnewline
#> x1 & 1.546* & -0.002* \tabularnewline
#> &(0.692)&(0.001)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121 &\tabularnewline
#> $R^2$&0.048 &\tabularnewline
#> Deviance& &4.301\tabularnewline
#> $-2LLR (Model \chi^2)$ & & 0.208 \tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
cat(ex13)
#> \begin{table}
#> \caption{A Regression}\label{regrlabl}
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{OLS } &\multicolumn{1}{l}{GLM }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245** & 0.033** \tabularnewline
#> &(0.618)&(0.001)\tabularnewline
#> x1 & 1.546* & -0.002* \tabularnewline
#> &(0.692)&(0.001)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121 &\tabularnewline
#> $R^2$&0.048 &\tabularnewline
#> Deviance& &4.301\tabularnewline
#> $-2LLR (Model \chi^2)$ & & 0.208 \tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
##'
ex14 <- outreg(list(OLS = m1, GLM = gm1), float = TRUE,
request = c(fstatistic = "F"), runFuns = c("BIC" = "BIC"))
#> \begin{table}
#> \caption{A Regression}\label{regrlabl}
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{OLS } &\multicolumn{1}{l}{GLM }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & 0.033*** \tabularnewline
#> &(0.618)&(0.001)\tabularnewline
#> x1 & 1.546* & -0.002* \tabularnewline
#> &(0.692)&(0.001)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121 &\tabularnewline
#> $R^2$&0.048 &\tabularnewline
#> F($df_{num}$,$df_{denom}$)&\multicolumn{1}{c}{4.98(1,98)*} &\tabularnewline
#> Deviance& &4.301\tabularnewline
#> $-2LLR (Model \chi^2)$ & & 0.208 \tabularnewline
#> BIC&\multicolumn{1}{c}{657.92} &\multicolumn{1}{c}{659.82}\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
cat(ex14)
#> \begin{table}
#> \caption{A Regression}\label{regrlabl}
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{OLS } &\multicolumn{1}{l}{GLM }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.245*** & 0.033*** \tabularnewline
#> &(0.618)&(0.001)\tabularnewline
#> x1 & 1.546* & -0.002* \tabularnewline
#> &(0.692)&(0.001)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.121 &\tabularnewline
#> $R^2$&0.048 &\tabularnewline
#> F($df_{num}$,$df_{denom}$)&\multicolumn{1}{c}{4.98(1,98)*} &\tabularnewline
#> Deviance& &4.301\tabularnewline
#> $-2LLR (Model \chi^2)$ & & 0.208 \tabularnewline
#> BIC&\multicolumn{1}{c}{657.92} &\multicolumn{1}{c}{659.82}\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
ex15 <- outreg(list(OLS = m1, GLM = gm1), float = TRUE,
request = c(fstatistic = "F"), runFuns = c("BIC" = "BIC"),
digits = 5, alpha = c(0.01))
#> \begin{table}
#> \caption{A Regression}\label{regrlabl}
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{OLS } &\multicolumn{1}{l}{GLM }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.24550* & 0.03313* \tabularnewline
#> &(0.61763)&(0.00068)\tabularnewline
#> x1 & 1.54553 & -0.00173 \tabularnewline
#> &(0.69242)&(0.00078)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.12090 &\tabularnewline
#> $R^2$&0.04838 &\tabularnewline
#> F($df_{num}$,$df_{denom}$)&\multicolumn{1}{c}{4.9821(1,98)} &\tabularnewline
#> Deviance& &4.30066\tabularnewline
#> $-2LLR (Model \chi^2)$ & & 0.20827 \tabularnewline
#> BIC&\multicolumn{1}{c}{657.92} &\multicolumn{1}{c}{659.82}\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.01$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
ex16 <- outreg(list("OLS 1" = m1, "OLS 2" = m2, GLM = gm1), float = TRUE,
request = c(fstatistic = "F"),
runFuns = c("BIC" = "BIC", logLik = "ll"),
digits = 5, alpha = c(0.05, 0.01, 0.001))
#> \begin{table}
#> \caption{A Regression}\label{regrlabl}
#> \begin{tabular}{@{}l*{4}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{OLS 1 } &\multicolumn{1}{l}{OLS 2 } &\multicolumn{1}{l}{GLM }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 30.24550*** & 29.77420*** & 0.03313*** \tabularnewline
#> &(0.61763)&(0.52229)&(0.00068)\tabularnewline
#> x1 & 1.54553* &\multicolumn{1}{l}{\_ }& -0.00173* \tabularnewline
#> &(0.69242) &&(0.00078)\tabularnewline
#> x2 &\multicolumn{1}{l}{\_ }& 3.41342*** &\multicolumn{1}{l}{\_ }\tabularnewline
#> &&(0.51222) &\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE&6.12090 &5.20508 &\tabularnewline
#> $R^2$&0.04838 &0.31184 &\tabularnewline
#> adj $R^2$&0.03867 &0.30482 &\tabularnewline
#> F($df_{num}$,$df_{denom}$)&\multicolumn{1}{c}{4.9821(1,98)*} &\multicolumn{1}{c}{44.409(1,98)***} &\tabularnewline
#> Deviance& & &4.30066\tabularnewline
#> $-2LLR (Model \chi^2)$ & & & 0.20827 \tabularnewline
#> BIC&\multicolumn{1}{c}{657.92} &\multicolumn{1}{c}{625.51} &\multicolumn{1}{c}{659.82}\tabularnewline
#> ll&\multicolumn{1}{c}{-322.05(3)} &\multicolumn{1}{c}{-305.85(3)} &\multicolumn{1}{c}{-323(3)}\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{4}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
#> \end{table}
#>
ex17 <- outreg(list("Model A" = gm1, "Model B label with Spaces" = m2),
request = c(fstatistic = "F"),
runFuns = c("BIC" = "Schwarz IC", "AIC" = "Akaike IC",
"nobs" = "N Again?"))
#> \begin{tabular}{@{}l*{3}{l}@{}}
#> \hline
#> &\multicolumn{1}{l}{Model A } &\multicolumn{1}{l}{Model B label with Spaces }\tabularnewline
#> &\multicolumn{1}{l}{Estimate}&\multicolumn{1}{l}{Estimate}\tabularnewline
#> &\multicolumn{1}{l}{(S.E.)}&\multicolumn{1}{l}{(S.E.)}\tabularnewline
#> \hline
#> \hline
#> (Intercept) & 0.033*** & 29.774*** \tabularnewline
#> &(0.001)&(0.522)\tabularnewline
#> x1 & -0.002* &\multicolumn{1}{l}{\_ }\tabularnewline
#> &(0.001) &\tabularnewline
#> x2 &\multicolumn{1}{l}{\_ }& 3.413*** \tabularnewline
#> &&(0.512)\tabularnewline
#> \hline
#> N&\multicolumn{1}{l}{100}&\multicolumn{1}{l}{100} \tabularnewline
#> RMSE& &5.205\tabularnewline
#> $R^2$& &0.312\tabularnewline
#> adj $R^2$& &0.305\tabularnewline
#> F($df_{num}$,$df_{denom}$)& &\multicolumn{1}{c}{44.4(1,98)***}\tabularnewline
#> Deviance&4.301 &\tabularnewline
#> $-2LLR (Model \chi^2)$ & 0.208 & \tabularnewline
#> Schwarz IC&\multicolumn{1}{c}{659.82} &\multicolumn{1}{c}{625.51}\tabularnewline
#> Akaike IC&\multicolumn{1}{c}{652.00} &\multicolumn{1}{c}{617.69}\tabularnewline
#> N Again?&\multicolumn{1}{c}{100} &\multicolumn{1}{c}{100}\tabularnewline
#> \hline
#> \hline
#>
#> \multicolumn{3}{l}{ ${* p}\le 0.05$${*\!\!* p}\le 0.01$${*\!\!*\!\!* p}\le 0.001$}\tabularnewline
#> \end{tabular}
## Here's a fit example from lme4.
if (require(lme4) && require(car)){
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
ex18 <- outreg(fm1)
cat(ex18)
## Fit same with lm for comparison
lm1 <- lm(Reaction ~ Days, sleepstudy)
## Get robust standard errors
lm1rse <- sqrt(diag(car::hccm(lm1)))
if(interactive()){
ex19 <- outreg(list("Random Effects" = fm1,
"OLS" = lm1, "OLS Robust SE" = lm1),
SElist = list("OLS Robust SE" = lm1rse), type = "html")
}
## From the glmer examples
gm2 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
data = cbpp, family = binomial)
lm2 <- lm(incidence/size ~ period, data = cbpp)
lm2rse <- sqrt(diag(car::hccm(lm2)))
## Lets see what MASS::rlm objects do? Mostly OK
rlm2 <- MASS::rlm(incidence/size ~ period, data = cbpp)
# \donttest{
ex20 <- outreg(list("GLMER" = gm2, "lm" = lm2, "lm w/robust se" = lm2,
"rlm" = rlm2), SElist = list("lm w/robust se" = lm2rse),
type = "html")
# }
}
#> Loading required package: lme4
#> Loading required package: Matrix
#> Loading required package: car
#> Warning: there is no package called ‘car’