convert an amelia object to a mice object
Source:R/margot_amelia_to_mice.R
margot_amelia_to_mice.Rd
convert an amelia object to a mice object
Value
a `mids` object compatible with the `mice` package, structured with the original dataset and imputed values
Examples
# load Amelia package and perform imputation
library(Amelia)
#> Loading required package: Rcpp
#> ##
#> ## Amelia II: Multiple Imputation
#> ## (Version 1.8.2, built: 2024-04-10)
#> ## Copyright (C) 2005-2024 James Honaker, Gary King and Matthew Blackwell
#> ## Refer to http://gking.harvard.edu/amelia/ for more information
#> ##
data(africa) # example dataset from Amelia package
amelia_output <- amelia(x = africa, m = 5, idvars = "country") # impute data
#> -- Imputation 1 --
#>
#> 1 2 3 4
#>
#> -- Imputation 2 --
#>
#> 1 2 3 4
#>
#> -- Imputation 3 --
#>
#> 1 2
#>
#> -- Imputation 4 --
#>
#> 1 2 3
#>
#> -- Imputation 5 --
#>
#> 1 2 3
#>
# convert amelia object to mice object
mids_obj <- margot_amelia_to_mice(amelia_output)
# verify mids object
print(mids_obj)
#> Class: mids
#> Number of multiple imputations: 5
#> Imputation methods:
#> gdp_pc trade
#> "amelia" "amelia"
#> PredictorMatrix:
#> NULL