[R] Problem witth nnet:multinom

Tom Woolman twoo|m@n @end|ng |rom ont@rgettek@com
Fri Jun 21 19:58:02 CEST 2019

I am using R with the nnet package to perform a multinomial logistic  
regression on a training dataset with ~5800 training dataset records  
and 45 predictor variables in that training data. Predictor variables  
were chosen as a subset of all ~120 available variables based on PCA  
analysis. My target variable is a factor with 10 items.
All predictor variable are numeric (type "dbl").

My command in R is as follows:

model <- nnet:multinom(frmla, data = training_set, maxit = 1000,  
na.action = na.omit)

#note that the frmla string is a value of "Target_Variable ~ v1 + v2 +  
v3, etc."
Output of this command is as follows (I will truncate to save a little  
space after the first few rows):

# weights: 360 (308 variable)
initial value 10912.909211

iter 10 value 9194.608309

iter 20 value 9142.608309

iter 30 value 9128.737991

iter 40 value 9093.899887
iter 420 value 8077.803755

final value 8077.800112
Error in nnet:multinom(frmla, data = training_set, maxit = 1000, :
NA/NaN argument

In addition: Warning message:

In nnet:multinom(frmla, data= training_set, maxit = 1000, :
numerical expression has 26 elements: only the first used

So that's my issue. I can't figure out the meaning behind both the  
error message and the warning message above. There are no NA values in  
my data set. I've also tried reducing the number of predictor  
variables, but I get the same issue (just a different number of  

Thanks in advance.

More information about the R-help mailing list