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 0.3451460 0.3096125 4 0.3827077 0.3819603 0.2353320 5 0.2973288 0.2977994 0.4048718 6 0.3817027 0.3809759 0.2373214 Thanks again, Lars. On Sun, Jun 26, 2016 at 1:05 PM, Bert Gunter <bgunter.4...@gmail.com> wrote: > 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 ) > > > On Sun, Jun 26, 2016 at 9:27 AM, Lars Bishop <lars...@gmail.com> wrote: > > 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) > > > > fit <- multinom(y ~ X, trace = FALSE) > > pred <- predict(fit, X_new, type = "probs") > > > > Error in predict.multinom(fit, X_new, type = "probs") : > > NAs are not allowed in subscripted assignments > > In addition: Warning message: > > 'newdata' had 200 rows but variables found have 300 rows > > > > Thanks, > > Lars. > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@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. > [[alternative HTML version deleted]] ______________________________________________ R-help@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.