I am using SIMPUTE package in R to impute a continuous variable. This is my dataset
'data.frame': 6000 obs. of 11 variables:
$ age : chr "1" "1" "1" "1" ...
$ GI : num 5.29 12.52 2.03 NA 31.51 ...
$ sex : chr "2" "1" "1" "1" ...
$ Weight : num 1.2 1.2 1.2 1.2 1.2 ...
I am using the following command from simpute package to impute "GI" variable using age and sex to create imputation cell. I have a weight variable to use for "prob"
imp_simpuatation<-impute_rhd(
data,
GI~age+sex,
pool = "univariate",
prob = Weight
)
but i get the following error: Error: object 'Weight' not found and when
I tried the prob= data$Weight instead, i got the following error:
Error in impute_rhd(data, GI ~ age + sex, pool = "univariate", prob = data$Weight, :
length(prob) != nrow(dat) is not TRUE
whereas
> length(data$Weight)
[1] 6000
> nrow(data)
[1] 6000
I suggest using a different imputation package. The
simputationpackage is buggy.The correct usage is
data$WeightnotWeight. But the error is a bug insimputation. The author has corrected the error you identified, but not submitted the update to CRAN. However, the code is still buggy. Use a different package.Install the dev version and you'll get past your error, but note that the code is still buggy: