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(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")