0
$\begingroup$

I've got three variables, a factored (c) and two ordinal independent (a,b). Every variable has five categories (1,2,3,4,5). Thus, I fitted a multinomial logit regression (testus, see below) with the car package. Now I would like to predict the 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 cols shows the categories of the independent variables a and b. the next five columns show the conditional probabilities (p.e. 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$

migrated from stackoverflow.com Nov 18 '13 at 7:02

This question came from our site for professional and enthusiast programmers.

  • $\begingroup$ What do you mean by "the predicted probabilities for c under a or the predicted probabilities for c under b"? $\endgroup$ – DWin Sep 16 '13 at 22:11
  • $\begingroup$ predicted probabilities for c under b means: given a certain setting for b, the probability of c is given. predicted probabilities for c under a follows the same explanaition (given a certain setting for a, the probability of c is given). Is it possible to get this probabilities?Thanks $\endgroup$ – user2685139 Sep 17 '13 at 6:50
  • $\begingroup$ I suppose you could take a weighted mean of the 5 probabilities for all the b==1 cases to construct some sort of estimate. I would have imagined one might construct an alternate model with just c depending on b. $\endgroup$ – DWin Sep 17 '13 at 16:01
  • $\begingroup$ Fitting an alternative model with only two variables gives me some non significant results...Now I can't predict the probabilities in this way. About the idea of a weighted mean: do you think to weight the mean with the number of observations? I didn't found anything about the mean of the variance. Is this allowed? $\endgroup$ – user2685139 Sep 18 '13 at 7:43
  • $\begingroup$ Your question is becoming increasingly non-reproducible. It appears you are talking about a specific set of data that has not been provided and asking about variances instead of probabilities. I think you need statistical consultation rather than programming tips. The CrossValidated.com website is better fit for this and you should be more forthcoming about the actual data and research question when you repost. $\endgroup$ – DWin Sep 18 '13 at 15:02

Your Answer

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

Browse other questions tagged or ask your own question.