How can we make interaction plots for continuous variables in logistic regression?

705    Asked by ananyaPawar in Data Science , Asked on Nov 9, 2019
Answered by ananya Pawar

The interaction is between two continuous variables. The plot is using Lag4 as the x-axis variable and then picking a couple of values of Volume to show how the relationship between Direction and Lag4 varies for different values of Volume. By default, the minimum and maximum of Volume are chosen. We can instead show the median and quartiles of Volume or the mean and standard deviation of Volume by using the mdrt.values argument (see the help for additional options). For example:

theme_set(theme_classic()) # Set ggplot theme

plot_model(m1, type="int", colors=rainbow(3), mdrt.values="quart")

plot_model(m1, type="int", colors=rainbow(3), mdrt.values="meansd")



Your Answer

Answer (1)

Hey AnanyaPawar,


Great question! Making interaction plots for continuous variables in logistic regression can be quite insightful. I've had some experience with this, so here's my two cents.

First off, it's essential to visualize how the relationship between two continuous variables impacts the outcome. In your code snippet, you're using Lag4 as the x-axis variable and exploring its interaction with Volume. The choice of displaying quartiles or means and standard deviation using the 'mdrt.values' argument is clever. It helps to capture different aspects of the relationship.

My suggestion would be to further enhance the plot by incorporating confidence intervals, especially if you have a sizable dataset. This can provide a clearer picture of the uncertainty around the estimated relationships.

Additionally, consider experimenting with different color palettes to make the plot more visually appealing and easier to interpret. It might sound trivial, but a well-designed plot can convey complex information more effectively.

1 Year

Interviews

Parent Categories