I have calculated a multinomial logistic regression using the multinom function with the following code:
####multinomial regression analysis####
MyData <- read.csv(file="Data.csv", header=TRUE, sep=";")
### changes DV to a factor variable####
MyData2 <- transform(MyData,Y = factor(Y) )
###sets the base for the regression###
MyData3 <- within(MyData2, Y <- relevel(Y, ref= 3))
###the regression equation###
REG=multinom(Y~ a + b + c + d + e + f + g, data=MyData3)
summary (REG)
###predicted probabilities###
prob=fitted(REG)
prob
Now, I would like to create a classification table from which I can determine the percentage of the predicted probabilities that actually agree with the data. The dependent variable (leg_pat_mean
) represents has four value 1,2,3,4.
I would appreciate it very much if someone suggests code that can help to solve this problem.