Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I omit interactions using stargazer or xtable?

Is it possible to omit interactions in stargazer using the omit option? Normally I would write the variable name into the omit=c('varname') but in the case of an interaction I do not know what to write. Any hints on that? How do you solve this problem in other packages like xtable?

\documentclass{article}   
\begin{document}   
%Load dataset and run regression    

 << lm, echo=FALSE >>=   
 load('dataset.RData')  
 library(stargazer)  
 lm1 <- lm(y~ x + factor(v)*z ,data=dataset)  
 @


 << table_texstyle, echo=FALSE, comment=NA, results='asis' >>=  
 stargazer(lm1 ,omit=c('???'), omit.labels=c('Omitted interactions'),
      omit.yes.no = c("Yes", "No")))  
  @  
   \end{document}
like image 567
Tom Avatar asked Nov 18 '12 22:11

Tom


1 Answers

If you want to omit all interactions, try

stargazer(m1, omit = ":")

This works because omit argument is expecting a regular expression. This is a very powerful tool when filtering strings. See ?regexpr or browse the regex tab here on Stackoverflow.

like image 146
Roman Luštrik Avatar answered Oct 20 '22 03:10

Roman Luštrik