I am performing a canonial variates analysis (i.e., a linear discriminant analysis with 3 or more categories) using the lda() funtion in the MASS package in R. I had been reporting the likelihood of a particular observation pertaining to a particular category as a posterior probability, but my supervisor said they would like the conditional probability to be included as well similar to some of their previous work. When I asked how they did it, they said that used JMP or SPSS and it just automatically returned the values for them.

I do not have access to either of these programs, and trying to export the dataset and re-running the CVA (which is analyzed beforehand in R and those results are what go into the CVA) seems counterintuitive. I was wondering if there was any way to calculate conditional probability for a canonical variates analysis in R, preferably a method that can be applied to the MASS package. I looked around online and on StackOverflow and I couldn't find anything about calculating conditional probabilities in lda() using MASS.

  • $\begingroup$ Is the predict.lda method provided by MASS not sufficient? It provides posterior probabilities already. $\endgroup$
    – Neal Fultz
    Commented Jun 29, 2020 at 21:10
  • $\begingroup$ @NealFultz The person I am working under wants both posterior probabilities AND conditional probabilities, mostly because when they performed similar analyses they had access to JMP and thus both values were provided as part of the built-in function of that program. I am not even sure if conditional probabilities are appropriate for a CVA. $\endgroup$ Commented Jun 30, 2020 at 1:35
  • $\begingroup$ I see. You could edit the predict.lda function and edit out the one line where it does the normalizing constant, and also pass it 1 as the prior. $\endgroup$
    – Neal Fultz
    Commented Jun 30, 2020 at 3:37

1 Answer 1


You can compute posterior probabilities using linear discriminant analysis under a strong assumption of multivariate normality of the predictors, e.g., you can't have a binary variable as one of the predictors. Since multivariate normality implies that the polytomous logistic model also fits the data, but logistic regression does not require normality, I'd suggest switching to polytomous (multinomial) logistic regression for your problem. It is a direct probability estimation method.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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