[R] Problem witth nnet:multinom

David Winsemius dw|n@em|u@ @end|ng |rom comc@@t@net
Sun Jun 23 22:10:34 CEST 2019


> On Jun 21, 2019, at 10:58 AM, Tom Woolman <twoolman using ontargettek.com> wrote:
> 
> 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."

Surely that is not its value. You should show the code that created the frmla object.

-- 
David.
> 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
> converged
> 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 iterations).
> 
> Thanks in advance.
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law



More information about the R-help mailing list