Hello, I am trying to impute data with the mi() function (mi package) and keep receiving an error message. When imputing the variable, "sex," the mi() function accesses the mi.categorical() function, which then accesses the nnet() function. I then receive the following error message (preceded by my code below):
> imputed.england=mi(england.pre.imputed, n.iter=6, add.noise=FALSE) Beginning Multiple Imputation ( Mon Jan 14 13:39:49 2013 ): Iteration 1 Chain 1 : sex Error while imputing variable: sex , model: mi.categorical Error in nnet.default(X, Y, w, mask = mask, size = 0, skip = TRUE, softmax = TRUE, : too many (3432) weights The error message indicates that there are too many weights (3432). I know you can adjust the maximum weights with the mi.categorical() function (i.e., MaxNWts= 3500), but I do not see a way to do this with the mi() function. I found an R-help posting from two years ago with some instruction on how to change the max weights in mi(), but I can't seem to get it to work. The following is a link to the post: http://r.789695.n4.nabble.com/Changing-model-parameters-in-the-mi-package-td2288851.html#a2288933 And my implementation of the suggestion from that post: > info=mi.info(england.pre.imputed) > info[["sex"]]$params$MaxNWts=3500 > info[["sex"]]$params $n.iter [1] 100 $MaxNWts [1] 3500 $missing.index NULL When I try the imputation again I receive the same error message as before: > imputed.england=mi(england.pre.imputed, n.iter=6, add.noise=FALSE) Beginning Multiple Imputation ( Mon Jan 14 14:20:46 2013 ): Iteration 1 Chain 1 : sex* Error while imputing variable: sex , model: mi.categorical Error in nnet.default(X, Y, w, mask = mask, size = 0, skip = TRUE, softmax = TRUE, : too many (3432) weights So, I tried a few more things, and received the same error message. First............... > imputed.england=mi(england.pre.imputed,info=info) This yields the same error message. Then............... > inf=mi.info(england.pre.imputed) > inf=update(inf, "MaxNWts", list(sex=3500)) > imputed.england=mi(england.pre.imputed, info=inf) Beginning Multiple Imputation ( Mon Jan 14 14:31:20 2013 ): Iteration 1 Chain 1 : sex* Error while imputing variable: sex , model: mi.categorical Error in nnet.default(X, Y, w, mask = mask, size = 0, skip = TRUE, softmax = TRUE, : too many (3432) weights Again, the same error message. For some reason, I am unable to successfully adjust the max weights. I would greatly appreciate any suggestions. Thanks in advance! -- Heather Hensman Kettrey PhD Candidate Department of Sociology Vanderbilt University ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.