0

I have a dataset that I ran an ordinal regression on. I found 2 significant predictors of my DV, but one of these predictors had a negative interaction with the other significant predictor, and another insignificant predictor. To explain this in an easier way, let’s say my DV is Academic.Performance, and the two IVs that were significant were ER_Ratio and Goals_Score. Goals_Score has a negative interaction with ER_Ratio, as in when the ER_Ratio decreases, the effect of Goals_Score on Academic.Performance weakens. Moreover, Goals_Score had a negative interaction with another insignificant IV (called Adj_Score), where when Adj_Score is high, the effect of Goals_Score on Academic Performance weakens.

The only reason I know that is because I ran an interaction model and this was the outcome:

Adj_Score:Goals_Score had a value of -0.064, and Std. Error of 
  0.026, and a t value of -2.428.

Goals_Score:ER_Ratio had a value of -0.055, an Std.Error of 0.0096, 
  and a t value of -5.7654.

Please correct me if I am wrong but the explanation I could come up with was the one above.

Anyway, I am trying to show, in a graph, that when Adj_Score is high, the effect of Goals_Score on Academic.Performance weakens (same for ER_Ratio). How can I do that?

I tried this function:

ggplot(data, aes(x=Goals_Score, y=Academic.Performance)) + 
    geom_point(aes(color = Adj_Score)) + 
    geom_smooth(method = “lm”, se = FALSE) + 
    scale_color_gradient (low = “blue”, high = “red”)

But it just showed me that students with higher academic performance have a high Goals_Score and a high Adj_Score which is not what I wanted to show.

I wanted to show that when Adj_Score is high, the effect of Goals_Score on Academic.Performance weakens.

n <- 10 dat <- data.frame(id=1:n, Adj_Score = c(0.555, 0.444, 0.4888, 0.7333, 0.4888, 0.8222, 0.7555, 0.666, 0.9111), Goals_Score= c(32, 54, 38, 47, 35, 50, 53, 42) Academic.Performance = c(“0-40%”, “41-50%”, “51-60%”, “61-70%”, “71-80%”, “81-90%”, “91-100%”))

  • 2
    You can try a conditioning plot `coplot`, there is an example at https://stats.stackexchange.com/questions/235442/investigate-correlation-conditional-on-a-threshold/299958#299958 Such plots can also be made with ggplot2. By the way, if you could attach some data so we can experiment, and people can use in an answer ... – kjetil b halvorsen Mar 10 '23 at 19:59
  • I am sorry i don’t know how to attach the data:( but I will check the link you sent me, thank youu ! – Lina Kader Mar 10 '23 at 20:04
  • 2
    For how to attach data see https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – kjetil b halvorsen Mar 10 '23 at 20:06
  • I checked your link (and other links on google) but I still don’t know how to attach my data. Can I edit my post and add it or is there any other way I could add it? – Lina Kader Mar 10 '23 at 20:13
  • 1
    The info is in the link, but very short: Make a data frame with the data necessary for the plot. Please remove unnecessary columns! Call this data frame `df`, then do `dput(df)` and include the output of that in your question. Make it as an edit at the end of the post! – kjetil b halvorsen Mar 10 '23 at 20:17
  • I added a small code, this is the best I could do, sorry:( – Lina Kader Mar 10 '23 at 20:33
  • 1
    The `marginaleffects` package can do this easily. There is a whole vignette about different variations of the plot you describe: https://vincentarelbundock.github.io/marginaleffects/articles/plot.html – Vincent Mar 10 '23 at 21:50
  • The data frame you have given cannot be used, since the variables in it does not have the same length. Also, the last variable with values like "51-60%" cannot be used for plotting, as it is character not numeric – kjetil b halvorsen Mar 11 '23 at 01:50

0 Answers0