Hi Julia,
One way to handle this issue would be to impute 4 of the parties and then
use them to infer the 5th party from one minus the sum of the rest (the
"transform" function on the amelia output can be helpful for this). Other
than that, we don't have a direct way to handle linear constraints in
amelia at this point. Hope that helps!
Cheers,
Matt
~~~~~~~~~~~
Matthew Blackwell
Assistant Professor of Government
Harvard University
url:
On Wed, Oct 11, 2017 at 10:38 AM, Julia CAGE <julia.cage(a)sciencespo.fr>
wrote:
Hi,
I am using Amelia to simulate missing vote values for French elections
(before performing multiparty electoral data analysis using Clarify).
I need to make sure that after the simulation the sum of the votes for the
different parties (vFN + vPC + vPS + vUMP + vVerts) is below one (these are
the main parties and some much smaller parties are not included).
I thought the prior I generated (see below) would make the trick but it
does not seem to work.
And the thing is that in the imputed data I generate now, the sum of the
votes is very often above 1 which makes no sense (and generate issue then
on Clarify with the logistic transformation).
Any idea of how I could handle that?
Many thanks in advance,
Best,
Julia
Here is my code:
database <- read.dta13("rall.dta")
prior <- matrix(NA, nrow=nrow(database),ncol=5)
for (i in 1:nrow(database)){
v3 <- database$vFN[i]
v5 <- database$vPC[i]
v7 <- database$vPS[i]
v9 <- database$vUMP[i]
v11 <- database$vVerts[i]
prior[i,] <- c(i, 3, 0, 1 - v5+v7+v9+v11, 0.999999)
}
prior <- prior[!is.na
<https://urldefense.proofpoint.com/v2/url?u=http-3A__is.na&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=EwICq0J5pL8CwgEJz8qkmauGonk0XmiLpxcYOEgk2a0&m=Bsxewvv0k-eJvfIIKK3xmLqzUyV_KL6mQPZj8hRqw-M&s=KDnho3vNFIzro_RsQo6SZnEK-BkzVNcf3aE0CfcPStU&e=>
(prior[,4]),]
a.out <- amelia(database, m = 5,ts="year", cs =
"district",priors=prior,lgstc=c("vFN","vPC","vPS","vUMP","
vVerts"),bound=rbind(c(4,0,Inf),c(6,0,Inf),c(8,0,Inf),c(
10,0,Inf),c(12,0,Inf)))
write.amelia(obj=a.out, file.stem = "R19932012/outdata", format =
"dta")
--
Amelia mailing list served by HUIT
[Un]Subscribe/View Archive:
http://lists.gking.harvard.edu/?info=amelia
More info about Amelia:
http://gking.harvard.edu/amelia
Amelia mailing list
Amelia(a)lists.gking.harvard.edu
To unsubscribe from this list or get other information:
https://lists.gking.harvard.edu/mailman/listinfo/amelia