1
nnet_f1 <- 
nnet(Z24train$f1~Z24train$TSU+Z24train$TSL+Z24train$TW+Z24train$TP,size=10,linout=T)
plot(Z24$datahora,Z24$f1,col=1,xlab="time", ylab ="f(Hz)",pch="x")
legend("topright","1stMode",text.col=1,bty="n")
lines(Z24train$datahora[complete.cases(Z24train$datahora)],nnet_f1$fitted.values,col="blue",pch="x") 
predict <- predict(nnet_f1, newdata = Z24test)

> predict <- predict(nnet_f1, newdata = Z24test)
Error in predict.nnet(nnet_f1, newdata = Z24test) : 
  NAs are not allowed in subscripted assignments

In addition: Warning message: 'newdata' had 282 rows but variables found have 3315 rows

I have problem with the function predict. Can you help me? My data are diveded in two groups, train and test. Now i want to find the function predict for the data test. Thank you

WitVault
  • 23,445
  • 19
  • 103
  • 133
Emilia
  • 81
  • 1
  • 1
  • 2
  • Does the test set have the same column names as the training set? Instead of `df$col1~df$col2+...` try `col1~col2+..., data=df` – Gabe May 13 '16 at 16:46
  • Can you provide a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? It'll be easier to help you then – Gabe May 16 '16 at 10:47
  • You mean with the first suggestion I gave? – Gabe May 16 '16 at 10:53
  • Glad to hear! No problem :) – Gabe May 16 '16 at 15:21

0 Answers0