I recommend verifying your data. It is not uncommon with administrative data
to find errors that push the numbers outside of the logical bounds. The
tip-off is that the first 10 observations work for you.
============
Dr. Michael P. McDonald
Associate Professor, George Mason University
Non-Resident Senior Fellow, Brookings Institution
Mailing address:
(o) 703-993-4191 George Mason University
(f) 703-993-1399 Dept. of Public and International Affairs
mmcdon(a)gmu.edu 4400 University Drive - 3F4
http://elections.gmu.edu Fairfax, VA 22030-4444
-----Original Message-----
From: ei-bounces(a)lists.gking.harvard.edu
[mailto:ei-bounces@lists.gking.harvard.edu] On Behalf Of Jason McDaniel
Sent: Monday, February 27, 2012 3:26 AM
To: ei(a)lists.gking.harvard.edu
Subject: [ei] eiRxC error message
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
-
---
EI mailing list served by HUIT
Subscribe/Unsubscribe:
http://lists.gking.harvard.edu/mailman/listinfo/ei
More info on ei and eiR:
http://GKing.Harvard.edu/eiR
EI mailing list
EI(a)lists.gking.harvard.edu
https://lists.gking.harvard.edu/mailman/listinfo/ei