title: Understanding multinomial nnet
body: <p>I am trying to understand the code behind <code>nnet</code>.  I am currently getting different results when I split a multinomial factor in to the binary columns instead of using the formula method.</p>
  
  <pre><code>library(nnet)
  
  set.seed(123)
  y &lt;- class.ind(iris$Species)
  x &lt;- as.matrix(iris[,1:4])
  fit1 &lt;- nnet(x, y, size = 3, decay = .1)
  
  # weights:  27
  #initial  value 164.236516 
  #iter  10 value 102.567531
  #iter  20 value 58.229722
  #iter  30 value 39.720137
  #iter  40 value 25.049530
  #iter  50 value 23.671837
  #iter  60 value 23.602392
  #iter  70 value 23.601927
  #final  value 23.601926 
  #converged
  
  pred1 &lt;- predict(fit1, iris[,1:4])
  rowSums(head(pred1))
  [1] 1.032197661 1.033700173 1.032750746 1.034229149 1.032052937 1.032539980
  
  set.seed(123)
  fit2 &lt;- nnet(Species ~ ., data = iris, size = 3, decay = .1)
  
  # weights:  27
  #initial  value 158.508573 
  #iter  10 value 37.167558
  #iter  20 value 26.815839
  #iter  30 value 23.746418
  #iter  40 value 23.698182
  #iter  50 value 23.697907
  #final  value 23.697907 
  #converged
  
  pred2 &lt;- predict(fit2, iris[,1:4])
  rowSums(head(pred2))
  1 2 3 4 5 6 
  1 1 1 1 1 1 
  </code></pre>
  
  <p>I know I can just use the latter approach (<code>formula</code> method) but I want to understand why the results are different when it appears the same method of splitting the factor is in the source code <code>nnet.formula</code>.</p>