[R] problem using MICE with option "lda"

RA Hughes rachael.hughes at bristol.ac.uk
Fri Nov 30 17:39:46 CET 2007


Hi

I am unable to impute using the MICE command in R when imputing
a binary variable using linear discriminant analysis. To illustrate my 
problem I have created a dataset, which consists of 1 continuous and 1 
binary variable. The continuous variable is complete and the binary 
variable is partially observed.

I am able to impute using the MICE command where the imputation methods is 
logistic regression (option logreg). However I have been unsuccessful when 
I've tried to impute the binary variable using linear discriminant analysis 
(option lda) Instead I get the following error message "Error in 
colMeans(as.matrix(imp[[visitSequence[j]]])) : 'x' must be numeric"

I can however impute using the elementary imputation method "impute.lda".

Please upload the example dataset "mice_univariate.txt" from:
https://www.bris.ac.uk/fluff/u/epzrah/wO7LD4sIw1qqwPO_kTakLAsW/

Please upload the R code "multiple_imputation_univariate.R" from:
https://www.bris.ac.uk/fluff/u/epzrah/KyjUMRptLAI_fShpzGHDsQsW/

The dataset I would like to apply the command to has missingness on more 
than one variable. Therefore I need to use the MICE command.

Your help would be much appreciated

Kind Regards
Rachael Hughes


----------------------
RA Hughes
rachael.hughes at bristol.ac.uk



More information about the R-help mailing list