Hi folks:
I am trying to use EiRxC to estimate votes by race for 7 candidates. (412 precincts, 7 variables of vote counts for candidates, proportion asian turnout, and proportion asian noturnout) I also intend to run estimates for black, latino, and white voters.
But, I keep encountering a frustrating error message that tells me my data are neither counts nor proportions. This is frustrating because its just not true. I have attempted to load my data into R in various formats: stata .dta, .csv, .spss, and .dbf. I have attempted to run RxC models with data that are all count data, with data that are all proportions, and with a mixture. The error message occurs, regardless. I am using the most recent versions of the EiR package on a Mac.
Here is the weird part: I have been able to do one successful run using the ei.MD.bayes function, but only with a vastly reduced version of my data. If I only input the first 10 observations, I am able to complete a semi-successful run. This works using either the eiR coding dbuf = ei(formula, data=) and with the eiPack example code dbuf <- ei.MD.bayes(formula, data=).
I have had successful runs with the ei 2x2 functions with my data, and I have also been able to successfully run the eiRxC example code using the RxCdata.
I appreciate any help you can give me.
Best,
Jason McDaniel
Assistant Professor
Political Science Dept.
San Francisco State University
Here is the code that I am running:
> sfvotes.csv <- read.table("sfvotes.csv", sep=",", header=TRUE)
> View(sfvotes.csv)
> formula <- cbind(onelee, oneava, oneherr, onechiu, oneyee, oneada, oneduft) ~ cbind(tasian, nta)
> dbuf.a1 <- ei.MD.bayes(formula, total="nv1", data=sfvotes.csv)
Error in BayesMDei(formula, data, total = total, lambda1 = lambda1, lambda2 = lambda2, :
row marginals are neither counts nor proportions - please
respecify data
The semi-successful limited run below:
> sfs.csv <- read.table("sfvotes.csv", sep=",", header=TRUE)
> View(sfs.csv)
> formula <- cbind(onelee, oneava, oneherr, onechiu, oneyee, oneada, oneduft) ~ cbind(tasian, nta)
> dbuf <- ei.MD.bayes(formula, total="nv1", data=sfs.csv)
In BayesMDei(formula, data, total = total, lambda1 = lambda1, lambda2 = lambda2, :
row margnials are proportions - multiplying by unit size
> summary(dbuf)
Formula: formula
Total sims: 2000
Burnin discarded: 1000
Sims saved: 1000
Acceptance ratios for Beta (averaged over units):
onelee oneava oneherr onechiu oneyee oneada
tasian 0.309 0.304 0.297 0.276 0.298 0.282
ntasian 0.210 0.197 0.193 0.187 0.205 0.166
Acceptance ratios for alpha:
columns
rows onelee oneava oneherr onechiu oneyee oneada oneduft
tasian 0.895 0.853 0.828 0.754 0.783 0.777 0.635
ntasian 0.916 0.871 0.754 0.691 0.839 0.632 0.615
Draws for Alpha:
Mean Std. Error 2.5% 97.5%
tasian.onelee 5.766 0.943 4.361 8.080
ntasian.onelee 6.282 1.196 4.275 9.253
tasian.oneava 2.995 0.618 1.730 4.218
ntasian.oneava 3.763 0.695 2.561 5.218
tasian.oneherr 2.735 0.648 1.797 4.097
ntasian.oneherr 1.204 0.389 0.625 2.055
tasian.onechiu 1.784 0.681 0.720 3.014
ntasian.onechiu 1.071 0.376 0.513 1.916
tasian.oneyee 2.181 0.887 0.983 4.101
ntasian.oneyee 2.572 0.557 1.677 3.798
tasian.oneada 2.425 0.506 1.566 3.429
ntasian.oneada 0.617 0.187 0.280 1.010
tasian.oneduft 0.928 0.404 0.347 1.847
ntasian.oneduft 0.804 0.298 0.319 1.456
Aggregate cell counts (summed over units):
Mean Std. Error 2.5% 97.5%
tasian.onelee 688.8 46.4 597.3 783.9
ntasian.onelee 1552.1 49.5 1446.3 1627.5
tasian.oneava 367.3 28.2 309.0 411.5
ntasian.oneava 937.9 25.7 893.2 995.4
tasian.oneherr 329.8 36.4 258.8 393.0
ntasian.oneherr 211.4 39.3 142.7 284.7
tasian.onechiu 175.6 49.1 97.6 245.6
ntasian.onechiu 160.1 52.5 82.6 243.5
tasian.oneyee 252.1 64.5 170.1 381.7
ntasian.oneyee 512.9 68.2 387.7 614.8
tasian.oneada 263.3 28.5 201.1 319.6
ntasian.oneada 76.0 26.7 32.7 143.5
tasian.oneduft 73.8 30.6 20.4 137.9
ntasian.oneduft 93.9 31.3 33.0 152.8
Please excuse if this is a newbie question - I am just starting the transition from Stata to R for more compelx estimation...
I installed R and Zelig on OSX (10.6.8), installing each of the component packages individually as recommended in the Zelig installation guide. Everything appeared to go OK. Then I installed eiPack, again without incident. Then I went to install ei, and I received the following:
Warning: dependencies ‘msm’, ‘tmvtnorm’, ‘ellipse’, ‘plotrix’, ‘ucminf’, ‘cubature’, ‘mnormt’, ‘foreach’ are not available
The installation ended with a non-zero exit status.
What should I do?
-Rob
Hi ei users,
We've just released a new version of ei. This new version wraps both ei 2x2
and eiRxC into one function. It also includes a new way of visualizing
model dependence in eiRxC data with a new function called tomogRxC.
Because it incorporates all these new features, the code for using eiR has
changed slightly. Please take a look at the new
documentation<http://gking.harvard.edu/gking/files/ei.pdf> to
get acquainted with this new code. You can download the new version using
the command install.packages("ei", repos="http://r.iq.harvard.edu",
type="source"). The new version relies on eiPack, so make sure that is
also installed. As always, the old version is still available at
http://gking.harvard.edu/eiR if you wish to continue using that. Please
let us know if you have any questions or suggestions!
Best,
Gary and Molly