1
votes

I want to perform a correlation analysis with imputed datasets from the original dataset "freetrade" from Amelia package. So first I loaded the data and created multiple datasets with amelia function:

library(Amelia)
data <- freetrade %>%
  select(c("country", "tariff", "pop", "gdp.pc", "intresmi", "fiveop", "usheg"))
am <- amelia(data, m=5, idvars=1)

Now I would like to perform a correlation between tarriff, pop and gdp.pc. I absolutely did not find anything on the Internet on how to do it, only for the mice package "micombine.cor()". I tried transforming the imputed data sets "am" into the data type mids, since micombine.cor() only takes the data type mids:

as.mids(am)

but there is only an error called : "Imputation index .imp not found" Do you have any methods on how to perform the correlation analysis? I would be very grateful!

1

1 Answers

0
votes

You need to read the manual page for Amelia, particularly the part that tells how amelia returns its results. Trying the examples is also very useful. The example on the manual page uses the data set africa which is included in the package and seems roughly similar to yours:

am <- amelia(africa[, 3:7])    # Just using the numeric variables
cor(am$imputations[[1]])       # For the first imputed data set
lapply(am$imputations, cor)    # For all five imputed data sets