Solved – Predicted probabilities for multinomial logistic regression

logisticmultinomial-distributionrregression

I have three variables, a factor (c) as the dependent variable and two ordinal independent variables (a, b). Each variable has five categories (1,2,3,4,5). Thus, I fitted a multinomial logistic regression (testus, see below) with the car package. Now I would like to get the predicted probabilities.

> a <- sample(5,100,TRUE)
> b <- sample(5,100,TRUE)
> c <- sample(5,100,TRUE)
> required(car)
> a <- as.ordered(a)
> b <- as.ordered(b)
> c <- as.factor(c)
> testus        <- multinom(c~a+b)
> predictors    <- expand.grid(b=c("1","2","3","4","5"), a=c("1","2","3","4","5"))
> p.fit         <- predict(testus, predictors, type='probs')
> probabilities <- data.frame(predictors,p.fit)

Now I got the predicted probabilities for a under b and c.

> head(probabilities)
  b a         X1         X2         X3         X4        X5
1 1 1 0.10609054 0.22599152 0.20107167 0.21953158 0.2473147
2 2 1 0.20886614 0.27207108 0.08613633 0.18276394 0.2501625
3 3 1 0.17041268 0.24995975 0.16234240 0.13111518 0.2861700
4 4 1 0.23704078 0.21179521 0.08493274 0.03135092 0.4348804
5 5 1 0.09494071 0.09659144 0.24162612 0.21812449 0.3487172
6 1 2 0.14059489 0.17793438 0.29272452 0.26104833 0.1276979`

The first two columns show the categories of the independent variables a and b. The next five columns show the conditional probabilities (e.g., $P(c=1|b=1~\&~a=1) = 0.10609$. But now I would like to know only the predicted probabilities for c under a or the predicted probabilities for c under b. Is this possible?

Best Answer

If I understand the question, couldn't you simply run

testus2        <- multinom(c~a)
predictors    <- expand.grid(a=c("1","2","3","4","5"))
p.fit         <- predict(testus, predictors, type='probs')
probabilities <- data.frame(predictors,p.fit)

and similarly for b?

If this is not what you want, please explain further.

Related Question