Dear Amelia Users,
This may be a problem with my understanding of how Amelia is
supposed to work, but I’ve encountered the following problem. I give Amelia the following command:
amelia.out <- amelia(smalldat, cs=1, ts=2, polytime=3, lags=1,
leads=1, intercs=F, incheck=F,
mins=mins, maxs=maxs, conf=conf, means=NULL,
sds=NULL,
logs=c(5,6,7,8),
sqrts=c(9,10,11,12,13,14,15,16),
noms=c(17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32))
and I get the
following error:
Error in mu.priors - (ones %*% meanx) : non-conformable arrays
using traceback() I tracked it down to the scalecenter
subcommand. Since I’ve not
provided any means and standard deviations for the priors, rather I’ve
provided
ranges, I assume that
setting means and sds both to NULL will suggest that mu.priors and sd.priors will also
be NULL. If I comment out the
troublesome piece of
the scalecenter command as below, source this command in and
issue the same command as above to Amelia, it works fine.
scalecenter <-
function (x, mu.priors = NULL, sd.priors
= NULL)
{
AMn <- nrow(x)
ones
<- matrix(1, AMn, 1)
meanx <- colMeans(x,
na.rm = TRUE)
stdvx <- apply(x, 2, sd, na.rm = TRUE)
x.ztrans <- (x - (ones %*% meanx))/(ones %*% stdvx)
# if (!identical(mu.priors, NULL)) {
# mu.priors <- (mu.priors -
(ones %*% meanx))/(ones %*%
# stdvx)
# sd.priors <- sd.priors/(ones %*% stdvx)
# }
return(list(x
= x.ztrans, mu = meanx, sd = stdvx,
mu.priors = NULL,
sd.priors = NULL))
}
Can you give me some advice as to what I’m doing wrong
in the first step?
Thanks,
Dave.
Dave Armstrong
Department of Politics
and International Relations
Manor Road
OX1 3UQ
Phone: 08165 285956
E-mail: david.armstrong@politics.ox.ac.uk
Web: http://users.ox.ac.uk/~polf0104