Creating Tables of Model Estimates

The mtable function

In conjunction with LaTeX, the output of the mtable function of the package can produce output as can be seen in the following screenshot:

Output of *mtable*

This output was produced using the following code:

# First a couple of models are run:
model1 <- glm((vote3=="Truman")~occup4,data=vote.48,
              family="binomial")
model2 <- glm((vote3=="Truman")~total.income,data=vote.48,
              family="binomial")
model3 <- glm((vote3=="Truman")~occup4+total.income,data=vote.48,
              family="binomial")
model4 <- glm((vote3=="Truman")~relig3,data=vote.48,
              family="binomial")
model5 <- glm((vote3=="Truman")~occup4+relig3,data=vote.48,
              family="binomial")
# then an mtable object is produced, relabelled and converted
# to LaTeX:
toLatex(
  relabel(
       mtable("Model 1"=model1,
              "Model 4"=model6,
              "Model 5"=model7,
              summary.stats=c("Nagelkerke R-sq.","Deviance","AIC","N")
       ),
       "[(]Intercept[)]"="\\\\emph{Intercept}",
       occup4="Occup. class",
       relig3="Religion",
       gsub=TRUE
  ),
  ddigits=5)

The mtable itself is produced by the following part of the code

mtable("Model 1"=model1,
       "Model 4"=model6,
       "Model 5"=model7,
       summary.stats=c("Nagelkerke R-sq.","Deviance","AIC","N"))

The resulting object, if printed to the R-console, would look like

=====================================================================
                                        Model 1   Model 4   Model 5
---------------------------------------------------------------------
(Intercept)                              1.047*** -0.213     0.698**
                                        (0.184)   (0.126)   (0.216)
occup4: Upper white collar/Blue collar  -2.448***           -2.385***
                                        (0.327)             (0.337)
occup4: Other white collar/Blue collar  -1.080***           -1.098***
                                        (0.315)             (0.326)
occup4: Farmer/Blue collar              -0.622              -0.346
                                        (0.362)             (0.374)
relig3: Catholic/Protestant                        0.877***  0.685*
                                                  (0.243)   (0.292)
relig3: Other,none/Protestant                      0.975**   1.191**
                                                  (0.347)   (0.441)
---------------------------------------------------------------------
Nagelkerke R-sq.                           0.246     0.060     0.281
Deviance                                 404.190   537.711   393.105
AIC                                      412.190   543.711   405.105
N                                        344       402       344
=====================================================================

It is then 'embellished' using a call to relabel:

relabel(...,
          "[(]Intercept[)]"="\\emph{Intercept}",
          "[$]"="\\$",
          occup4="Occup. class",
          relig3="Religion",
          gsub=TRUE
          )

Finally, the relabelled objected is converted into LaTeX:

toLatex(...,ddigits=5)

mtable can also be used to generate tab-delimited tables of estimates that can be included into word-processor software such as LibreOffice or MS-Word.