texreg的RPy布尔值

时间:2013-11-16 13:09:38

标签: python r rpy2 texreg

我正在使用texreg package为我的R线性模型打印LaTeX表。包的默认设置包括打印许多与我的分析无关的内容。幸运的是,该软件包提供了开关以关闭许多东西。

我通过反复试验发现R中设置为single.row=TRUE的内容可以在RPy中设置为single_row=True

正如您在我的notebook example here中看到的那样适用于single_row,并且在随后的乳胶打印中,置信区间与我的值打印在同一行。

选项include_loglikinclude_deviance应控制是否打印对数似然和偏差。由于我不比较模型,我不需要这些。我试图通过许多不同的方法将它们设置为假,但它不起作用。

显然,一切都在纯粹的R中完美无缺:

> texreg(lm, include.deviance=FALSE, include.loglik=FALSE)
Computing profile confidence intervals ...
Computing confidence intervals at a confidence level of 0.95. Use argument "method = 'boot'" for bootstrapped CIs.

\begin{table}
\begin{center}
\begin{tabular}{l c }
\hline
                         & Model 1 \\
\hline
(Intercept)              & $1.85^{*}$       \\
                         & $[1.60;\ 2.10]$  \\
COIem-hard               & $0.54^{*}$       \\
                         & $[0.38;\ 0.69]$  \\
COIsc-10                 & $0.19^{*}$       \\
                         & $[0.03;\ 0.34]$  \\
COIsc-14                 & $-0.04$          \\
                         & $[-0.20;\ 0.11]$ \\
COIsc-18                 & $-0.04$          \\
                         & $[-0.20;\ 0.12]$ \\
COIsc-22                 & $-0.01$          \\
                         & $[-0.16;\ 0.15]$ \\
COIsc-26                 & $-0.13$          \\
                         & $[-0.29;\ 0.02]$ \\
COIsc-6                  & $0.64^{*}$       \\
                         & $[0.48;\ 0.79]$  \\
\hline
AIC                      & 2342.49          \\
BIC                      & 2392.70          \\
Num. obs.                & 1120             \\
Num. groups: ID          & 7                \\
Variance: ID.(Intercept) & 0.08             \\
Variance: Residual       & 0.45             \\
\hline
\multicolumn{2}{l}{\scriptsize{$^*$ 0 outside the confidence interval}}
\end{tabular}
\caption{Statistical models}
\label{table:coefficients}
\end{center}
\end{table}

你能帮助我通过RPy关闭这些开关吗?

1 个答案:

答案 0 :(得分:2)

这是因为这些命名参数未在R函数texreg::texreg的签名中定义(这些参数通过省略号...传递),并且{转换无法安全尝试{ {1}}。

  

我通过反复试验发现,在R中,thisgs设置为single.row = TRUE可以在RPy中设置为single_row = True。

咨询文档是另一种考虑因素。查看: http://rpy.sourceforge.net/rpy2/doc-2.3/html/robjects_functions.html