Open isaactpetersen opened 1 month ago
Thanks for your note. This is indeed a problem case that is not correctly caught.
The problem is caused by the automatic removal of character variables at initialization. mice
writes a message of such removals to the loggedEvents
. However, we never see these messages because the program crashes and does not return a mids
object.
More generally, the handling of cluster variables could be improved, and better support could be provided for factor
, character
, integer
and numeric
cluster variables.
Something for the wish list. Not a priority for me right now, but I'd be happy to take any pull requests.
Multilevel imputation does not appear to accept a character or factor variable as the cluster variable. It appears that the cluster variable must be integer. Note, when using
2l.pmm
/miceadds
, I receive the same error as documented in the MICE discussion here, so the reproducible example below could potentially explain why those users were experiencing the issue.Here is a reprex (adapted from the MICE vignette here):
Created on 2024-07-31 with reprex v2.1.1