Difference between printed and specified predictor matrix #578
-
Hello, I am new to github discussions and mice. I have looked through the main van Buuren paper and the function documentation as well as the discussion threads and still need some help. My goal is to impute 2 continuous variables (bounded between 0-100) in a longitudinal data set that is in long format. The data set is unbalanced without fixed measurement occasions. It is my understanding that I will use the 2L.norm method to impute these variables. I have edited a prediction matrix to include my covariates of interest (specified at '1') and the identification variable (specified as '-2'). I have not specified any random effects. When I run my mice object it does output that 2l.norm has been used but the predictor matrix is different than the one if i do imp$predictorMatrix. Is this a bug or something wrong with my process? Which predictor matrix is being used? Thank you for any help!
#multi-level imputation
#but here it is correct mice.data<-complete(imp2) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Welcome to MICE discussions. There is a difference between the real object library(mice, warn.conflicts = FALSE)
mice:::print.mids
#> function (x, ...)
#> {
#> cat("Class: mids\n")
#> cat("Number of multiple imputations: ", x$m, "\n")
#> cat("Imputation methods:\n")
#> print(x$method, ...)
#> cat("PredictorMatrix:\n")
#> print(head(x$predictorMatrix), ...)
#> if (!is.null(x$loggedEvents)) {
#> cat("Number of logged events: ", nrow(x$loggedEvents),
#> "\n")
#> print(head(x$loggedEvents), ...)
#> }
#> invisible(x)
#> }
#> <bytecode: 0x10f1e5af8>
#> <environment: namespace:mice> Created on 2023-08-18 with reprex v2.0.2 The line |
Beta Was this translation helpful? Give feedback.
Welcome to MICE discussions.
There is a difference between the real object
imp2$predictorMatrix
and the version that is printed on the terminal byimp2
. Here's whatmice
does to produce the printed version: