I am trying to predict a continuous variable using the code I made to predict binary variables. I don't understand if there is something else in the code that I am suppose to change, but this is where I get an error.
osmos is the continuous variable that has real values from (0-40.435).
I usually use binary values (0 or 1) for this specific code but I don't know what to change to apply the same concept to predict osmos.
The excel sheet is set up with osmos in the first column and variable that will be used to predict in the second column. Both columns contain continuous variables. The expected output is r squared and p values for the prediction.
# logistic regression model
library(nnet)
mymodel <- multinom(variable, na.action=na.omit, data=newdata)
# misclassification rate
p <- predict(mymodel, newdata)
tab <- table(p, newdata$osmos)
tab
sum(diag(tab))/sum(tab)
table(newdata$osmos)
# model performance evaluation
library(ROCR)
pred <- predict(mymodel, newdata, type = 'prob')
head(pred)
head(newdata)
hist(pred)
pred <- prediction(pred, newdata$osmos)
eval <- performance(pred, "acc")
plot(eval)
But I keep getting the error
Error in prediction(pred, newdata$osmos) :
Number of cross-validation runs must be equal for predictions and labels.