如何使用stargazer或xtable省略交互?

时间:2023-01-15 11:32:38

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?

是否可以使用omit选项省略stargazer中的交互?通常我会将变量名写入omit = c('varname'),但在交互的情况下我不知道写什么。有什么提示吗?你如何在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 个解决方案

#1


6  

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 *.

这是有效的,因为省略参数期望正则表达式。这是过滤字符串时非常强大的工具。请参阅?regexpr或浏览*上的正则表达式选项卡。

#1


6  

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 *.

这是有效的,因为省略参数期望正则表达式。这是过滤字符串时非常强大的工具。请参阅?regexpr或浏览*上的正则表达式选项卡。