Re: [R] Help please with error from nnet::multinom

2016-06-26 Thread David Winsemius
> On Jun 26, 2016, at 1:03 PM, Lars Bishop wrote: > > Thanks, David. Sorry, do you mean this? > > library(nnet) > set.seed(1) > ysim <- gl(3, 100) > y <- model.matrix(~ysim -1) > X <- matrix( 3 * runif(length(ysim)), nrow = 300, ncol = 3) > X_new <- matrix( 3 *

Re: [R] Help please with error from nnet::multinom

2016-06-26 Thread Lars Bishop
Thanks, David. Sorry, do you mean this? library(nnet) set.seed(1) ysim <- gl(3, 100) y <- model.matrix(~ysim -1) X <- matrix( 3 * runif(length(ysim)), nrow = 300, ncol = 3) X_new <- matrix( 3 * runif(length(ysim)), nrow = 200, ncol = 3) fit <- multinom(y ~ X, trace = FALSE) pred <- predict(fit,

Re: [R] Help please with error from nnet::multinom

2016-06-26 Thread David Winsemius
> On Jun 26, 2016, at 12:39 PM, Lars Bishop wrote: > > Many thanks David. That works. Looks then this error will always occur in > predict.multinom whenever the data argument is missing in the mutlinom fit, > but the data argument is optional as per documentation. I don't

Re: [R] Help please with error from nnet::multinom

2016-06-26 Thread Lars Bishop
Many thanks David. That works. Looks then this error will always occur in predict.multinom whenever the data argument is missing in the mutlinom fit, but the data argument is optional as per documentation. Best, Lars. On Sun, Jun 26, 2016 at 3:14 PM, David Winsemius

Re: [R] Help please with error from nnet::multinom

2016-06-26 Thread Bert Gunter
Thanks, David. That is very interesting, because ?multinom says that the value is: "A nnet object with additional components: ..." Of course I could have checked methods(predict), but I just took the Help file at its word. Should it not be revised to say explicitly: "An object of class

Re: [R] Help please with error from nnet::multinom

2016-06-26 Thread David Winsemius
> On Jun 26, 2016, at 11:32 AM, Lars Bishop wrote: > > Thanks Bert. > > But I it doesn't complain when predict is used on X instead of X_new > (using nnet_7.3-12), which is even more puzzling to me: > > pred <- predict(fit, X, type = "probs") Indeed: There is a

Re: [R] Help please with error from nnet::multinom

2016-06-26 Thread Lars Bishop
Thanks Bert. But I it doesn't complain when predict is used on X instead of X_new (using nnet_7.3-12), which is even more puzzling to me: pred <- predict(fit, X, type = "probs") head(pred) ysim1 ysim2 ysim3 1 0.3059421 0.3063284 0.3877295 2 0.3200219 0.3202551 0.3597230 3 0.3452414

Re: [R] Help please with error from nnet::multinom

2016-06-26 Thread Bert Gunter
Well, for one thing, there is no "probs" method for predict.nnet, at least in my version: nnet_7.3-12 Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

[R] Help please with error from nnet::multinom

2016-06-26 Thread Lars Bishop
Hello, I'd appreciate your help in spotting the reason for the error and warning messages below. library(nnet) set.seed(1) ysim <- gl(3, 100) y <- model.matrix(~ysim -1) X <- matrix( 3 * runif(length(ysim)), nrow = 300, ncol = 3) X_new <- matrix( 3 * runif(length(ysim)), nrow = 200, ncol = 3)