我正在从R中可用的ei.MD.bayes(作为eiPack的一部分)生成生态推断估计。我想操纵细胞计数估计(即平均值,标准误差,2.5%和97.5%),以便它们使用观星者打印在桌子上。 我已经有了这个问题,但我现在面临的问题是我有两个对象(一个是Mean和Std.Error,另一个是2.5%和97.5%的信息。)它们有相同的变量(即行但是,观星者将它们打印在两个不同的表格中。
下面是我正在使用的stargazer命令以及它正在生成的输出的示例。您会注意到两个表中的行名相同,但是stargazer想要在两个不同的表中打印两个对象。我想在一个表中列出所有四列('Mean','SD','2.5%','97 .5%')。
library(foreign)
library(stargazer)
library(coda)
library(eiPack)
tune.nocov <- tuneMD(cbind(ndc, npp, thirdparty, reject, novote12) ~ cbind(agona, ahafo, ahanta, akuapem, akwamu), data = STATA, ntunes = 10, totaldraws = 10000)
out.nocov <- ei.MD.bayes(cbind(ndc, npp, thirdparty, reject, novote12) ~ cbind(agona, ahafo, ahanta, akuapem, akwamu), covariate = NULL, data = STATA, tune.list = tune.nocov, ret.mcmc = TRUE, ret.beta = 'd')
summary <- summary(out.nocov)
names(summary)
[1] "draws" "acc.ratios" "call" "short"
try1 <- summary[['draws']]
names(try1)
[1] "Alpha" "Beta" "Cell.counts"
cell.counts <- summary(draws$Cell.counts)
names(cell.counts)
[1] "statistics" "quantiles" "start" "end" "thin"
[6] "nchain"
stargazer(cell.counts$statistics, cell.counts$quantiles
, omit = c('Naive SE' , 'Time-series SE', '25%', '50%', '75%'),
summary = FALSE)
\begin{table}[!htbp] \centering
\caption{}
\label{}
\begin{tabular}{@{\extracolsep{5pt}} ccccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& Mean & SD \\
\hline \\[-1.8ex]
ccount.agona.ndc & $18,277.450$ & $1,330.555$ \\
ccount.ahafo.ndc & $22,831.210$ & $1,473.978$ \\
ccount.ahanta.ndc & $35,175.080$ & $1,543.445$ \\
ccount.akuapem.ndc & $146,127.300$ & $4,245.508$ \\
ccount.akwamu.ndc & $4,075.178$ & $745.696$ \\
\hline \\[-1.8ex]
\end{tabular}
\end{table}
\begin{table}[!htbp] \centering
\caption{}
\label{}
\begin{tabular}{@{\extracolsep{5pt}} cccccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& 2.5\% & 97.5\% \\
\hline \\[-1.8ex]
ccount.agona.ndc & $15,884.210$ & $20,678.420$ \\
ccount.ahafo.ndc & $20,296.790$ & $25,612.700$ \\
ccount.ahanta.ndc & $32,282.440$ & $37,814.850$ \\
ccount.akuapem.ndc & $137,438.300$ & $154,081.700$ \\
ccount.akwamu.ndc & $2,873.071$ & $5,689.897$ \\
\hline \\[-1.8ex]
\end{tabular}
\end{table}
答案 0 :(得分:2)
好的,我发现了一个简单的骗子。如果我在同一个表环境中组合这两个表,那么latex会并排打印这些表。我可能最终会分别运行两个表并省略第二个表的值标签,以便它们可以轻松地与第一个表的行匹配。
\begin{table}[!htbp] \centering
\caption{}
\label{}
\begin{tabular}{@{\extracolsep{5pt}} ccccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& Mean & SD \\
\hline \\[-1.8ex]
ccount.agona.ndc & $18,277.450$ & $1,330.555$ \\
ccount.ahafo.ndc & $22,831.210$ & $1,473.978$ \\
ccount.ahanta.ndc & $35,175.080$ & $1,543.445$ \\
ccount.akuapem.ndc & $146,127.300$ & $4,245.508$ \\
ccount.akwamu.ndc & $4,075.178$ & $745.696$ \\
\hline \\[-1.8ex]
\end{tabular}
\begin{tabular}{@{\extracolsep{5pt}} cccccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& 2.5\% & 97.5\% \\
\hline \\[-1.8ex]
ccount.agona.ndc & $15,884.210$ & $20,678.420$ \\
ccount.ahafo.ndc & $20,296.790$ & $25,612.700$ \\
ccount.ahanta.ndc & $32,282.440$ & $37,814.850$ \\
ccount.akuapem.ndc & $137,438.300$ & $154,081.700$ \\
ccount.akwamu.ndc & $2,873.071$ & $5,689.897$ \\
\hline \\[-1.8ex]
\end{tabular}
\end{table}