title: How to find best parameters of NNETAR for forecasting in R
body: <p>I am currently trying to use these codes:</p>
  <pre><code>grid=expand.grid(p=seq(from=1,to=6,by=1),P=c(1,2,3),decay=c(0.01,0.05,0.1,0.15,0.2),size=c(1,2,3,4,5,6,7,8,9,10))
  
  results_grid=vector(mode=&quot;numeric&quot;,length = nrow(grid))
  
  training_y&lt;-ts(training$rmt,frequency = 12)
  model_nnetar&lt;-nnetar(training_y,size=parameters$size,decay=parameters$decay,p=parameters$p,P=parameters$P)
  predictions=forecast(model_nnetar)
  
  </code></pre>
  <p>Then I have to put this in a for loop with the training data and model, I believe but I am having some problems while doing this. Can I do this without Cross-Validation? Can someone please show me an example of finding the best parameters of NNETAR in R for forecasting using this kind of a loop? How can I do this checking by the MAPEs only? Are there any easy ways to do this?</p>
  <p>Thank you!</p>