According to multinom , package nnet , βThe answer must be a factor or matrix with K columns that will be interpreted as counters for each of the K classes.β I tried to use this function in the second case, getting an error.
Here is an example of the code I'm doing:
response <- matrix(round(runif(200,0,1)*100),ncol=20)
Here I get:
'newdata' had 1 row but variables found have 10 rows
How can I solve this problem?
Bonus question: I also noticed that we can use multinom with a predictor of factors, for example. predictor <- factor(c(1,2,2,3,1,2,3,3,1,2)) . I cannot understand how this is mathematically possible, given that a multi-linear linear logical regression should work only with continuous or dichotomous predictors.
r multinomial nnet
Pippo
source share