rknitrnnet

Suppress convergence message in nnet multinom function in R


I am using knitr in R to produce a document of model outputs. I have suppressed messages and warnings in my code chunk. But I still get the convergence messages. I have looked for settings in the net package and in the multinom function. Does anybody know how to suppress them? I have looked on SO and on the internet. Someone asked a question in 2006 but I can't get the answer returned (and I don't know if it relevant today).

I am running many models in a loop, so it gets verbose very quickly. This also means that I can't easily put the model runs in a different chunk from the output because I am printing tables in each loop. An example of the output I am trying to suppress is below:

# weights: 10 (4 variable) initial value 2454.392816 iter 10 value 2175.558042 iter 10 value 2175.558039 final value 2175.558039 converged


Solution

  • I finally found a function argument called "trace" in the nnet function. Its default is TRUE, and when set to "FALSE" the messages stop. I am guessing that nnet is called by multinom. Thank goodness for the ... in R so I could pass a function argument through.

    Hopefully this will help someone else. I didn't mean to answer my own question (but I hope that is ok).