I have quite a relatively large number of data, it has 80 columns and approx 220, 000 rows
When I'm attempting to use nnet
's multinom()
function to perform a mutlinomial logistic regression on unordered multi categorical data the function seems to stop after 100 iterations:
# weights: 322 (270 variable)
initial value 807521.728781
iter 10 value 191523.940813
iter 20 value 163085.728004
iter 30 value 146262.378340
iter 40 value 139398.851395
iter 50 value 134606.101687
iter 60 value 133588.725646
iter 70 value 133253.102380
iter 80 value 133129.328709
iter 90 value 133098.717752
iter 100 value 133095.661773
final value 133095.661773
stopped after 100 iterations
I have also attempted to use VGAM
's vglm()
however it gives me the following error:
Error in outer(X, Y, FUN, ...) : allocMatrix: too many elements specified
A possible explanation is that my tiny macbook air isn't up for the job, however I was wondering, what other alternatives do I have to perform multinomial logistic regression on the datasets I currently have?
If you look at the documentation for multinom()
, you'll see it includes a parameter ...
which is for "additional arguments for nnet".
Then, looking at the documentation for nnet
, you'll see the following usage:
nnet(x, y, weights, size, Wts, mask,
linout = FALSE, entropy = FALSE, softmax = FALSE,
censored = FALSE, skip = FALSE, rang = 0.7, decay = 0,
maxit = 100, Hess = FALSE, trace = TRUE, MaxNWts = 1000,
abstol = 1.0e-4, reltol = 1.0e-8, ...)
The problem you're running into is that the default maxit
is 100. Try adding maxit=1000
(or whatever you want to make it) to your multinom()
parameters. I have not tested this (I would need you to include reproducible sample data), but I think it will do the trick.
If you look at the help for ?multinom
it says it calls nnet
and the ...
is additional parameters to nnet
. One of these parameters is maxit
which defaults to 100. Add that as a parameter with whatever your max iterations should be.
You can also take a look at this question regarding the vglm
error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With