Dear Ms. Janz,
Since you were kind enough to post the data so we could track down this issue, I thought
I'd just mention a few more specifics about your issue in the context of your data,
off-list since it's your own data.
The Amelia error revealed itself because there are variables to be logged,
"l_US_fdi_petrol" and "l_US_fdi_mining", which had no observations in
common (every observation is missing one or the other or both). That's not a problem
with the data necessarily, just a curious feature I assume. Additionally, I see that in
working around this you have made additional copies of all the variables to be logged with
all non-positive values changed to 1's. That is fine, if the negative values really
are better measured as 1's, but not necessary. Amelia will shift variables to be
logged to the right so they are positive in the event there are negative values for the
imputation dataset, and then return the imputations on the original scale. That's
slightly different than your fix; it's of course your choice to substantively decide
which you think is appropriate for your data. Finally, the dataset you posted has both
the variables to be logged, and the original unlogged variables in the imputation model.
That's certainly identified, and a good choice if you don't know whether the
effect is with the linear or logged term, but perhaps also an oversight if you believe
from theory these need to be logged.
Thanks again for your help in tracking this down and making your data so easily
available.
Let me know if anything just raises more questions,
Best,
James.
--
James Honaker, Senior Research Scientist
//// Institute for Quantitative Social Science, Harvard University
________________________________________
From: Honaker, James
Sent: Friday, January 04, 2013 6:49 PM
To: N. Janz; amelia(a)lists.gking.harvard.edu
Cc: nicolejanz(a)gmail.com
Subject: RE: [amelia] Problem with logs
Dear Ms. Janz,
There was an error in one of the checking routines we use in Amelia to see if there are
any problems in the data that can be preempted. I fixed the error and it will be changed
in the next Amelia release. In the meantime, you can avoid this issue by turning off the
checking routines as an option in the amelia() call with the "incheck"
argument.
In your example, this would be:
amelia.out <- amelia(n, m=5, ts="year", incheck=FALSE,
cs="country",intercs=TRUE,polytime=1,logs=vlogs)
Thanks for your help in finding this error and making your data available so we could
resolve it.
Best,
James.
--
James Honaker, Senior Research Scientist
//// Institute for Quantitative Social Science, Harvard University
________________________________________
From: amelia-bounces(a)lists.gking.harvard.edu [amelia-bounces(a)lists.gking.harvard.edu] On
Behalf Of N. Janz [nj248(a)cam.ac.uk]
Sent: Thursday, January 03, 2013 4:31 PM
To: amelia(a)lists.gking.harvard.edu
Cc: nicolejanz(a)gmail.com
Subject: [amelia] Problem with logs
Dear all, Amelia works fine when I do NOT specify any variables that should
be logged. As soon as I include logs, I get an error ("#Error in
matrix(unlist(value, recursive = FALSE, use.names = FALSE), nrow = nr, :
negative extents to matrix"). I checked that the variables to log can be
logged (no negative/zero values). I'm grateful for any hints. Best, Nicole
--Rcode--
#load MI package
require(Amelia)
set.seed(1000)
#load data set
load(url("http://schreiberin.de/nicole.Rdata"))
n <- nicole
dim(n) #3822 59
class(n) #"data.frame"
# Declare variables to be logged vlogs <- c("GDP_const2000" ,
"GDP_curr"
,"population" , "lifeexp" ,"infmortality" ,"trade"
, "l_US_fdi_total" ,
"l_US_fdi_petrol" , "l_US_fdi_total_manuf","l_US_fdi_food"
,
"l_US_fdi_chemical" , "l_US_fdi_prim_fab_metal"
,"l_US_fdi_machinery",
"l_US_fdi_electrical" , "l_US_fdi_transport"
,"l_US_fdi_whole_trade",
"l_US_fdi_depository" ,
"l_US_fdi_finance_except" ,"l_US_fdi_mining" ,
"l_WB_FDI_percentGDP" ,
"l_WB_FDI_curr" , "l_UN_FDI_flow" , "l_UN_FDI_flow_pgdp" ,
"l_UN_FDI_stock", "l_UN_FDI_stock_pgdp" )
amelia.out <- amelia(n, m=5, ts="year",
cs="country",intercs=TRUE,polytime=1,logs=vlogs) #Error in
matrix(unlist(value, recursive = FALSE, use.names = FALSE), nrow = nr, :
negative extents to matrix
--END Rcode--
--
Nicole Janz, PhD Cand.
Lecturer at Social Sciences Research Methods Centre 2012/13
University of Cambridge
Department of Politics and International Studies
www.nicolejanz.de | nj248(a)cam.ac.uk | Mobile: +44 (0) 7905 70 1 69 4
Skype: nicole.janz
--
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