mtable {memisc} | R Documentation |
mtable
produces a table of estimates for several models.
mtable(...,coef.style=getOption("coef.style"), summary.stats=TRUE, factor.style=getOption("factor.style"), getSummary=function(obj,...)UseMethod("getSummary"), float.style=getOption("float.style"), digits=min(3,getOption("digits")), drop=TRUE ) ## S3 method for class 'mtable': relabel(x, ..., gsub = FALSE, fixed = !gsub, warn = FALSE) ## S3 method for class 'mtable': format(x, coef.title="Coefficients", summary.title="Summaries", colsep="\t", rowsep="\n", trim=TRUE, trimleft=trim, trimright=trim, center.at=NULL, align.integers=c("dot","right","left"), topsep="", bottomsep="", sectionsep="", compact=TRUE, forLaTeX=FALSE, useDcolumn=TRUE, colspec=if (useDcolumn) paste("D{.}{",LaTeXdec,"}{",ddigits,"}",sep="") else "r", LaTeXdec=".", ddigits=getOption("digits"), useBooktabs=TRUE, toprule=if(useBooktabs) "\\toprule" else "\\hline\\hline", midrule=if(useBooktabs) "\\midrule" else "\\hline", cmidrule=if(useBooktabs) "\\cmidrule" else "\\cline", bottomrule=if(useBooktabs) "\\bottomrule" else "\\hline\\hline", interaction.sep = if(forLaTeX) " $\\times$ " else " x ", center.summaries=FALSE, ... ) ## S3 method for class 'mtable': print(x,trim=FALSE,center.at=getOption("OutDec"), colsep=" ", topsep="=",bottomsep="=",sectionsep="-",...) ## S3 method for class 'mtable': toLatex(object,...) write.mtable(object,file="",...)
... |
as argument to mtable : several model objects, e.g. of class lm ; as argument to print.mtable ,
toLatex.mtable , write.mtable : further arguments
passed to format.mtable ; as argument to format.mtable :
further arguments passed to format.default ;
as argument to relabel.mtable : further arguments
passed to dimrename .
|
coef.style |
a character string which specifies the style of
coefficient values, whether standard errors, Wald/t-statistics,
or significance levels are reported, etc. See coef.style . |
summary.stats |
if FALSE , no summary statistics
are repored. If TRUE , all summary statistics
produced by getSummary are reported.
This argument may also contain a character vector with
the names of the summary statistics to report |
factor.style |
a character string that specifies the style in
which factor contrasts are labled. See factor.style . |
getSummary |
a function that computes model-related statistics that
appear in the table. See getSummary . |
float.style |
default format for floating point numbers if
no format is specified by coef.style ; see {float.style} .
|
digits |
number of significant digits if not specified by
the template returned from getCoefTemplate
getSummaryTemplate
|
drop |
logical value; should redundant column headings dropped if only one model is given as argument? |
x, object |
an object of class mtable |
gsub, warn, fixed |
logical values, see relabel |
coef.title |
a character vector, the title for the reported coefficients. |
summary.title |
a character vector, the title for the reported model summaries. |
colsep |
a character string which seperates the columns in the output. |
rowsep |
a character string which seperates the rows in the output. |
trim |
should leading and trailing spaces be trimmed? |
trimleft |
should leading spaces be trimmed? |
trimright |
should trailing spaces be trimmed? |
center.at |
a character string on which resulting values are centered.
Typically equal to ".". This is the default when forLaTeX==TRUE .
If NULL , reported values are not centered. |
align.integers |
how to align integer values. |
topsep |
a character string that is recycled to a top rule. |
bottomsep |
a character string that is recycled to a bottom rule. |
sectionsep |
a character string that is recycled to seperate coefficients from summary statistics. |
compact |
logical value; if TRUE, entries in the table are not aligned in any way, giving the table the most compact form. |
forLaTeX |
should LaTeX code be produced? |
useDcolumn |
should the dcolumn LaTeX package be used?
If true, you will have to include \usepackage{dcolumn} in
the preamble of your LaTeX document. |
colspec |
LaTeX table column format specifyer(s). |
LaTeXdec |
the decimal point in the final LaTeX output. |
ddigits |
alignment specification or digits after the decimal point. |
useBooktabs |
should the booktabs LaTeX package be used?
If true, you will have to include \usepackage{booktabs} in
the preamble of your LaTeX document. |
toprule |
appearance of the top border of the LaTeX tabular environment. |
midrule |
how are coefficients and summary statistics
separated in the LaTeX tabular environment. |
cmidrule |
appearance of rules under section headings. |
bottomrule |
appearance of the bottom border of the LaTeX tabular environment. |
interaction.sep |
a character string that separates factors that are involved in an interaction effect |
center.summaries |
logical value; if TRUE, summaries for each model are centered below the columns that correspond to the respective model coefficients. |
file |
a file where to write to; defaults to console output. |
mtable
constructs a table of estimates for regression-type models.
format.mtable
formats suitable for use with output or conversion functions
such as print.mtable
, toLatex.mtable
, or write.mtable
.
A call to mtable
results in an object that inherits from mtable
with the following components:
coefficients |
an array that contains the model coefficients. |
summaries |
a matrix that contains the model summaries. |
lm0 <- lm(sr ~ pop15 + pop75, data = LifeCycleSavings) lm1 <- lm(sr ~ dpi + ddpi, data = LifeCycleSavings) lm2 <- lm(sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings) mtable123 <- mtable("Model 1"=lm0,"Model 2"=lm1,"Model 3"=lm2, summary.stats=c("sigma","R-squared","F","p","N")) (mtable123 <- relabel(mtable123, "(Intercept)" = "Constant", pop15 = "Percentage of population under 15", pop75 = "Percentage of population over 75", dpi = "Real per-capita disposable income", ddpi = "Growth rate of real per-capita disp. income" )) write.mtable(mtable123) ## Not run: file123 <- "mtable123.txt" write.mtable(mtable123,file=file123) file.show(file123) ## End(Not run) ## Not run: texfile123 <- "mtable123.tex" cat(toLatex(mtable123),sep="\n",file=texfile123) file.show(texfile123) ## End(Not run) berkeley <- aggregate(Table(Admit,Freq)~.,data=UCBAdmissions) berk0 <- glm(cbind(Admitted,Rejected)~1,data=berkeley,family="binomial") berk1 <- glm(cbind(Admitted,Rejected)~Gender,data=berkeley,family="binomial") berk2 <- glm(cbind(Admitted,Rejected)~Gender+Dept,data=berkeley,family="binomial") mtable(berk0,summary.stats=c("Deviance","N")) mtable(berk0,drop=FALSE,summary.stats=c("Deviance","N")) mtable(berk1,summary.stats=c("Deviance","N")) mtable(berk1,drop=FALSE,summary.stats=c("Deviance","N")) mtable(berk0,berk1,berk2,summary.stats=c("Deviance","N")) mtable(berk0,berk1,berk2, coef.style="stat", summary.stats=c("Deviance","AIC","N")) mtable(berk0,berk1,berk2, coef.style="ci", summary.stats=c("Deviance","AIC","N")) mtable(berk0,berk1,berk2, coef.style="ci.vertical", summary.stats=c("Deviance","AIC","N")) mtable(berk0,berk1,berk2, coef.style="ci.horizontal", summary.stats=c("Deviance","AIC","N")) mtable(berk0,berk1,berk2, coef.style="all", summary.stats=c("Deviance","AIC","N")) mtable(berk0,berk1,berk2, coef.style="all.nostar", summary.stats=c("Deviance","AIC","N")) mtable(by(berkeley,berkeley$Dept,function(x)glm(cbind(Admitted,Rejected)~Gender, data=x,family="binomial")), summary.stats=c("Likelihood-ratio","N")) mtable(By(~Gender,glm(cbind(Admitted,Rejected)~Dept,family="binomial"), data=berkeley), summary.stats=c("Likelihood-ratio","N")) berkfull <- glm(cbind(Admitted,Rejected)~Dept/Gender - 1, data=berkeley,family="binomial") relabel(mtable(berkfull),Dept="Department",gsub=TRUE)