Skip to content
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

Default behavior of make.predictorMatrix() outputs 1s for complete variables #602

Open
hanneoberman opened this issue Nov 21, 2023 · 2 comments

Comments

@hanneoberman
Copy link
Member

The behavior is inconsequential, but might confuse users. I would suggest adding an argument that takes care of this (or change the behaviour altogether, but I don't think that's necessary)

library(mice)
make.predictorMatrix(nhanes)
#>     age bmi hyp chl
#> age   0   1   1   1
#> bmi   1   0   1   1
#> hyp   1   1   0   1
#> chl   1   1   1   0
quickpred(nhanes)
#>     age bmi hyp chl
#> age   0   0   0   0
#> bmi   1   0   1   1
#> hyp   1   0   0   1
#> chl   1   1   1   0

Created on 2023-11-21 with reprex v2.0.2

@stefvanbuuren
Copy link
Member

Would setting the first row of quickpred(nhanes) to 0, 1, 1, 1 be appropriate?

@hanneoberman
Copy link
Member Author

I was thinking the other way around: setting the first row of make.predictorMatrix(nhanes) to 0s if the user requests it (with an additional argument).

In my opinion, the predictor matrix should reflect which predictor variables are used to impute the target variable. So if there is nothing to impute, there should not be any predictors set. Although I do see how this suggested behaviour should not be the default, e.g. for over-imputing observed data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants