IQSS / Amelia

Amelia: A Package for Missing Data
http://gking.harvard.edu/amelia
61 stars 17 forks source link

overimpute() not using bounds parameter of amelia() output structure #33

Open LutzDE opened 2 years ago

LutzDE commented 2 years ago

Bug, problem or wanted behavior?

"overimpute() This function temporarily treats each observed value in var as missing and imputes that value based on the imputation model of output. " ^^ Quote from R-Help.

The bounds parameter is used in amelia() for all NA values of a specific dataset-column. But if the bounds parameter is set, it's not used in the function overimpute().

The problem in such a situation is, that it is possible to force amelia() in a specific way (for example to use only values between 40 and 50). But if you use overimpute() nobody notice these boundarys.

Anyway: this behavior is missing in the documentation.

Demosource:

set.seed(1234) x.out_overimpute_bug<-amelia(africa,cs=2,ts=1 ,bounds=rbind(c(5,40,50)) ,lags="infl" ) test<-overimpute(x.out_overimpute_bug,var=c(5)) test$lower.overimputed[c(100:115)] test$mean.overimputed[c(100:115)] test$upper.overimputed[c(100:115)]

^^ values are not between 40 and 50 ..