1
$\begingroup$

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?

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ @flom: thank you for your answer. Yes you understood my question. I also thought about this, but don't you get more detailed results in fitting a model with two independent variables? My problem is, that my results for "testus" are not significant. That's the reason why I tried to predict the probabilities with testus. $\endgroup$ – user2685139 Sep 17 '13 at 6:44
  • $\begingroup$ You can use one independent variable or two, but you can't use both one and two at the same time. Non-significant results could be due to all sorts of things. $\endgroup$ – Peter Flom Sep 17 '13 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.