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.

Reply via email to