amices / mice

Multivariate Imputation by Chained Equations
https://amices.org/mice/
GNU General Public License v2.0
433 stars 107 forks source link

Add informative error message to `mcar()` function for too little missing data patterns #467

Closed hanneoberman closed 2 years ago

hanneoberman commented 2 years ago

If someone were to ignore the function documentation and just ran the mcar() function on a dataset with one missing data pattern, the error message would be:

Error in mcar.data.frame(popmis2) : object 'idpats' not found.

It may be nice to make this more informative by adding the following to the mcar() function:

  if(nrow(pats) < 4L){
    stop("This MCAR test requires two or more missing data patterns.")
  }

@cjvanlissa Do you think that would make sense?

cjvanlissa commented 2 years ago

Absolutely! Are you on this, or do you need me to make the change>?