Hi Matthijs,
One thing you may want to check is the length of the new variable you
created against the number of rows in the dataset. In addition, cbind
might be creating problems. Perhaps you could try this alternative
method of adding a variable:
##### begin code #####
a.out.final <- a.out
for(i in 1:10){
<create new variables>
a.out.final$imputatations[[i]][,"newvarname"] <- <new
variables>
}
##### end code #####
Where you can replace newvarname with a more substantive name.
I hope this helps,
matt.
On Tue, Dec 15, 2009 at 12:00 PM, Matthijs de Zwaan <m.dezwaan(a)gmail.com> wrote:
Dear Amelia Listers
I have a data set which gives me the counts of a number of religious groups, in 3 cities
for 60 years. I use these counts to generate an index for religious diversity in each
available year.
I had missing data, which I imputed using AmeliaII in R. I included both the counts and
the index to generate the imputed values, and then used the "new" counts to
generate the index again (overwriting the imputed index). I also generated a number of
other variables using the index (squared, interactions etc). I gather the originally
imputed data and my new variables using:
##### begin code #####
a.out.final <- a.out
for(i in 1:10){
<create new variables>
a.out.final$imputatations[[i]] <- cbind(a.out$imputations[[i]], <new
variables>)
}
##### end code #####
where a.out is the original Amelia output. This works fine, as far as I can see. however,
when I now ask for a summary(a.out.final), I get an error message. The first past of the
message is the same as for summary(a.out), but then I get:
Fraction Missing for individual variables:
-----------------------------------------
Error in `row.names<-.data.frame`(`*tmp*`, value = c("cityid",
"year", :
invalid 'row.names' length
("cityid" and "year" are obviously my panel/time indicators )
Does this mean that I have made a mistake, or am trying to do something that cannot be
done? Or is it simply due to the fact that Zelig can no longer recognise what was
originally missing and what not? I am new to R and Zelig, and such (unintelligible) error
messages scare me!
Thanks again for your time,
Matthijs de Zwaan
-
Amelia mailing list served by Harvard-MIT Data Center
[Un]Subscribe/View Archive:
http://lists.gking.harvard.edu/?info=amelia
More info about Amelia:
http://gking.harvard.edu/amelia
-
Amelia mailing list served by Harvard-MIT Data Center
[Un]Subscribe/View Archive:
http://lists.gking.harvard.edu/?info=amelia
More info about Amelia:
http://gking.harvard.edu/amelia