Show m sets of imputed values for a specified variable.
Arguments
- imputation.list
A list of
m
imputed datasets returned by themixgb
imputer.- var.name
The name of a variable of interest.
- original.data
The original data with missing data.
- true.values
A vector of the true values (if known) of the missing values. In general, this is unknown (
true.values = NULL
).
Value
A data.table with m
columns, each of which represents a set of imputed values for the variable of interest. If true.values
is provided, an additional column will display the true values of the missing values.
Examples
# obtain m multiply datasets
params <- list(max_depth = 3, subsample = 1, nthread = 2)
mixgb.data <- mixgb(data = nhanes3, m = 3, xgb.params = params, nrounds = 20)
imputed.BMPHEAD <- show_var(
imputation.list = mixgb.data, var.name = "BMPHEAD",
original.data = nhanes3
)
imputed.BMPHEAD
#> m1 m2 m3
#> 1: 40.81922 40.81922 40.81922
#> 2: 43.95104 43.95104 43.95104
#> 3: 45.60160 45.60160 45.60160
#> 4: 44.79435 44.79435 44.79435
#> 5: 40.94370 40.94370 40.94370
#> 6: 42.99262 42.99262 42.99262
#> 7: 45.47968 45.47968 45.47968
#> 8: 44.79435 44.79435 44.79435
#> 9: 43.09991 43.09991 43.09991
#> 10: 43.97232 43.97232 43.97232
#> 11: 44.77294 44.77294 44.77294
#> 12: 44.74327 44.74327 44.74327
#> 13: 41.50062 41.50062 41.50062
#> 14: 45.69271 45.69271 45.69271
#> 15: 42.72989 42.72989 42.72989
#> 16: 46.17781 46.17781 46.17781
#> 17: 43.16431 43.16431 43.16431
#> 18: 45.60556 45.60556 45.60556
#> 19: 43.84575 43.84575 43.84575
#> 20: 43.72111 43.72111 43.72111
#> 21: 41.81502 41.81502 41.81502
#> 22: 41.60730 41.60730 41.60730
#> 23: 43.47747 43.47747 43.47747
#> 24: 41.58686 41.58686 41.58686
#> 25: 44.58179 44.58179 44.58179
#> 26: 43.03172 43.03172 43.03172
#> 27: 42.21490 42.21490 42.21490
#> 28: 43.43150 43.43150 43.43150
#> 29: 45.54355 45.54355 45.54355
#> 30: 41.21716 41.21716 41.21716
#> 31: 41.44188 41.44188 41.44188
#> 32: 43.27520 43.27520 43.27520
#> m1 m2 m3