Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename variable names in stargazer latex table

Tags:

r

latex

stargazer

I have made this model selection table:

lm_mtcars <- lm(mpg ~ drat + hp + wt, mtcars)

library(MuMIn)
mod_sel_lm_mtcars <- (mod.sel(lm_mtcars))

mod_sel_lm_mtcars

Model selection table 
          (Intrc)  drat       hp     wt df  logLik AICc delta weight
lm_mtcars   29.39 1.615 -0.03223 -3.228  5 -73.366  159     0      1

I can get stargazer to convert it to a latex table:

library(stargazer)
stargazer(mod_sel_lm_mtcars)

How can I get stargazer to print variable names as in Coulombe Et Al 2011, p288, Table 2.

Therefore:

  1. df should be renamed to k (in italics)
  2. delta should be renamed to [latex symbol \Delta] AICc
  3. weight should be renamed to w[subscript i]
like image 850
luciano Avatar asked Apr 05 '14 18:04

luciano


1 Answers

You can use the covariate.labels argument. for this (As you didn't make clear which rows you wanted to keep in the output, I assumed you wanted them all, but you can change that as well using the keep argument.)

stargazer(mod_sel_lm_mtcars, 
      covariate.labels = 
        c("(Intercept)", "drat", "hp", "$w_{i}$",
          "\\textit{k}", "logLik", "AICc", "\\Delta AICc"))
like image 198
Lucas De Abreu Maia Avatar answered Nov 05 '22 16:11

Lucas De Abreu Maia