How can I omit interactions using stargazer or xtable?

五迷三道 提交于 2019-12-06 04:03:23

问题


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}

回答1:


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.



来源:https://stackoverflow.com/questions/13445400/how-can-i-omit-interactions-using-stargazer-or-xtable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!