-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fit.mult.impute no longer accepts "fitter = lrm" #17
Comments
This is supposed to work. Either it is a bug or you haven't updated to the latest versions of Hmisc and rms on CRAN. Please provide the version numbers you are using and a minimal self-contained reproducible example. |
Dear Prof. Harrel, thanks for your quick reply. I am currently using version 4.4-1 of rms and version 3.17-1 of Hmisc which are the latest versions according to CRAN. I am having some troubles providing the reproducible example as I am not sure how to make a sample of the (unpublished) data I am using from the mids object created by mice for the imputed data. |
Don't take a sample. Generate simulated data using expand.grid, data.frame, rnorm, runif, etc. after set.seed(1) if using random numbers. |
Dear Prof. Harrell. I am not a very skilled programmer, simply a psychologist-researcher, so I have had some trouble generating simulated data. What I have done, however, is to upgrade all packages (and Rstudio), and then manually downgraded rms to package version 4.3-1 (installed from source from the CRAN archive). Then the fit.mult.impute function works again as expected. I also inspected the changelog of the update to rms version 4.4.1 and noticed this:
which (from my absolutely-non-programming background) appear to perhaps relate to the mmcolnames error message I got from version 4.4-1. Again, I apologize for not being able to provide you with simulated data, but at least downgrading the rms package seems to provide a workaround for me at this time. Thanks for your patience. |
I have just sent you an email about similar issue. If I take out factor variable, the function works just fine.
However if I excluded factor variables out of the formula, this works
|
tormodb: Fixing by downgrading doesn't help me fix the problem but it does show that there is a bug. thaoz: The complete function in mice adds unnecessary contrast attributes to the factor variables. If you remove those attributes it works. But note that aregImpute may work better in many cases. aregImpute will not work for such a tiny dataset as nhanes2 though. Here is a reproducible example that may serve as a model for how to simulate data to help debug problems:
|
Dear Prof. Harrel, thanks to your example I have been able to make simulated data that reproduces the error.
Produces the error:
in rms version 4.4-1, but runs fine in version 4.3-1. (I used packrat to run the old version of rms in a separate project, and updated rms to the most recent version outside of that project. Just letting you know in case that could make a difference). |
The little simulation I produced above demonstrates the point if you pass the result of mice() into fit.mult.impute. The problem is an error in how mice::complete() adds a contrasts attribute. In the next release of the Hmisc package I'll have fit.mult.impute take away this attribute. In the meantime you can use aregImpute or access the updated source file in Github for the Hmisc project which I'll have fixed today. The source file is transcan.s and you can source('https://raw.githubusercontent.com/harrelfe/Hmisc/master/R/transcan.s') after typing library(Hmisc) or require(Hmisc) to override fit.mult.impute to the new version once you see from https://github.com/harrelfe/Hmisc/blob/master/R/transcan.s that it is updated. |
I recently updated the rms package to version 4.4-1. When running through my analyses, I got an "Error in X[, mmcolnames, drop = FALSE] : subscript out of bounds".
The old models that use to work fine read:
fit <- fit.mult.impute(x ~ y, fitter = lrm, xtrans = imp, data = data)
but I have now have to fit using fitter = glm, family = "binomial" to run the models. I really miss the goodness of the plot(summary(fit)) and plot(anova(fit)) that I used to get, not to mention the convenience of getting the factor levels to print instead of simply: variable2.
Is this an error, or have you decided to drop fitter=lrm from fit.mult.impute?
The text was updated successfully, but these errors were encountered: