R is a free and open-source software for statistical computing and graphics that provides packages and functions for performing discriminant analysis and logistic regression. For linear discriminant analysis (LDA), you can use the
package. To illustrate, if you have a data frame called
with four explanatory variables (
) and one outcome variable (
) with three categories (
) - running the code will output the coefficients of the discriminant function, the prior probabilities of the outcome categories, and the classification accuracy of the model. For logistic regression, you can use the
package. For example, if you have a data frame called
with four explanatory variables (
Pclass</
###### How to Interpret the Results
Interpreting the results of discriminant analysis and logistic regression depends on your research question and the type of outcome variable. For discriminant analysis, the coefficients of the discriminant function can show how each explanatory variable contributes to the separation between the outcome categories. You may also use the prior probabilities and classification accuracy to assess model fit. Additionally, you can plot discriminant scores and outcomes to illustrate discrimination. Logistic regression coefficients can indicate how each explanatory variable affects the odds of belonging to a certain outcome category. Standard errors, z-values, and p-values can test the significance of each explanatory variable and intercept. Predicted probabilities and confusion matrix can evaluate model fit, while plotting the logistic function and outcomes can visualize the relationship.
######Here’s what else to consider
This is a space to share examples, stories, or insights that don’t fit into any of the previous sections. What else would you like to add?