Amelia no longer seems to be recording chain lengths in imputations
correctly. I get the error "Error in 1:m : argument of length 0" after
the command "summary(a.out)." Because of this error, I also can't write
the imputation output to a file.
I'm running R 2.15.2 (latest version) and even uninstalled and
reinstalled R and all packages and am still getting the problem. I get
the problem whenever I run an imputation of any kind, even the simplest
conceivable, like this:
a.out<-amelia(data,m=2,ts="Year",cs="State")
on a file with two imputation variables.
Any insights appreciated!
--
Jason Sorens, PhD
Assistant Professor
Department of Political Science
520 Park Hall (North Campus)
University at Buffalo, SUNY
Buffalo, NY 14260
(716) 645-8436
Dear Gary,
The link to Ken Scheve's MI program to analyze multiple-imputed dataset is broken (http://gking.harvard.edu/amelia/amelia1/docs/mi.zip). Is it possible to fix it?
Thanks a lot in advance.
Best,
Xiaobo
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
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
Hi,
I'm surprised by the behaviour of missmap() when the argument is a dataframe with no missing data. It seems to plot everything as missing.
I did not see this feature documented in the help. I also didn't find any thread about that in this mailing list.
I realise this package is not for datasets without missing data, but this may still be misleading.
Example :
library(package = "Amelia")
tabComplete <- data.frame(a = 1:10, b = 11:20, c = 21:30)
missmap(tabComplete) # everything plotted missing
is.na(tabComplete$a) <- 1
missmap(tabComplete) # works when at least one observation is missing
Best regards,
Antoine Filipovic Pierucci
Institut national d'études démographiques INED
133 Bd Davout - 75 980 Paris 20 - France