simputation icon indicating copy to clipboard operation
simputation copied to clipboard

error with using weight variable

Open sfallahpour opened this issue 1 year ago • 2 comments

when i try the following command

imp_simpuatation<-impute_rhd(
  data,
  GI~age+sex,
  pool = "univariate",
  prob = data$SamplingWeight
)

i get the following error:

Error in impute_rhd(data, earnings ~ AG + sex, pool = "univariate", prob = data$SamplingWeight) : 
  length(prob) != nrow(dat) is not TRUE

I used a debugger function and i think there is a bug in the package which i believe is here: image

I believe the highlighted line should be stopifnot(length(prob) == nrow(dat))

sfallahpour avatar Dec 18 '23 15:12 sfallahpour

@markvanderloo please see my suggestion above to fix the bug with impute_rhd function

sfallahpour avatar Dec 18 '23 19:12 sfallahpour

On this note, could it be documented that prob is an optional parameter? Currently, it looks required, which made me get stuck with this issue until I noticed that I don't need to specify weights.

LukasWallrich avatar Feb 07 '24 13:02 LukasWallrich