Hello,

I would like to use the aregImpute and fit.mult.impute to impute missing
values for my dataset and then conduct logistic regression analyses on the
data, taking into account that we imputed values.  I have no problems
imputing the values using aregImpute, but I am getting an error at the
fit.mult.impute stage.

Here is some sample code (I actually have more observations and variables to
impute, but the error can be duplicated using the code below).

#################
library(Hmisc)
library(Design)
ds <- structure(list(use_statins1 = c(1L, 1L, 0L, 1L, 1L, 0L, 1L, 1L,
1L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, NA, 1L, 0L, 0L, 0L,
0L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 1L,
1L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, NA, 1L, 0L, 0L, 0L, 1L, 0L, 1L,
0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, NA, 0L, 0L, 0L, 0L,
1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L), use_nsaids =
structure(c(2L,
2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 2L,
1L, 1L, NA, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 2L,
2L, 2L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L,
2L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L,
2L, 2L, 2L), .Label = c("No", "Yes"), class = "factor")), .Names =
c("use_statins1",
"use_nsaids"), row.names = c(NA, 100L), class = "data.frame")

> gm <- aregImpute(formula = ~ use_statins1 + use_nsaids,data=ds,n.impute=5)
Iteration 8
> fmi=fit.mult.impute(use_statins1~ use_nsaids, fitter=lrm, xtrans = gm,
data = ds)
Error in if (object$family$family %in% c("poisson", "binomial")) 1 else if
(df.r >  :
  argument is of length zero
#################

It is this error in the last line that I am not sure why I am getting.  Any
help would be greatly appreciated.

Thanks,

Kim

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to