I am generating ecological inference estimates from ei.MD.bayes (as part of the eiPack) available in R. I want to manipulate the cell count estimates (i.e. Mean, Std. Error, 2.5% and 97.5%) so that they are printed in a table using stargazer. I've gotten pretty far along with this problem but am now facing the issue where I have two objects (one with the Mean and Std. Error and the other with 2.5% and 97.5% info.) which have the same variables (i.e. row names) but stargazer is printing them in two different tables.
Below is an example of the stargazer command I am using as well as the output it is producing. You'll notice that the row names are the same in both tables, yet stargazer wants to print both objects in two different tables. I want all four columns ('Mean', 'SD', '2.5%', '97.5%') in one table.
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}