I have a faceted graph, and I want to be able to test whether or not the slope of one regression line in one of the division is significantly different from both a) the other lines within its facet, and b) the line of the same grouping in the other facet. Graph

Basically, I want to be able to test whether, for example, the red 'X' regression line in the 'A' facet is statistically different from the green 'Y' line and the blue 'Z' line within its own facet, and, more importantly, statistically different from the red 'X' line in the 'B' facet.

The graph was produced from this data in R...

ex.ID <- c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6,7,7,7,7,7,8,8,8,8,8,9,9,9,9,9,10,10,10,10,10,11,11,11,11,11,12,12,12,12,12)
ex.month <- c(0,6,12,18,24,0,6,12,18,24,0,6,12,18,24,0,6,12,18,24,0,6,12,18,24,0,6,12,18,24,0,6,12,18,24,0,6,12,18,24,0,6,12,18,24,0,6,12,18,24,0,6,12,18,24,0,6,12,18,24)
ex.label <- c("A","A","A","A","A","B","B","B","B","B","B","B","B","B","B","A","A","A","A","A","A","A","A","A","A","B","B","B","B","B","B","B","B","B","B","A","A","A","A","A","B","B","B","B","B","A","A","A","A","A","B","B","B","B","B","A","A","A","A","A")
ex.score <- c(100,100,89,85,70,95,90,90,86,80,84,80,71,68,60,100,100,98,90,92,100,95,90,85,80,98,96,90,83,81,85,80,78,72,69,95,90,89,85,80,90,84,83,80,75,90,80,80,77,75,91,90,82,76,73,93,90,84,80,75)
ex.status <- c("Y","Y","Y","Y","Y","Z","Z","Z","Z","Z","Y","Y","Y","Y","Y","Y","Y","Y","Y","Y","Z","Z","Z","Z","Z","Z","Z","Z","Z","Z","Y","Y","Y","Y","Y","Z","Z","Z","Z","Z","X","X","X","X","X","X","X","X","X","X","X","X","X","X","X","X","X","X","X","X")

ex.df <- data.frame(ex.ID,ex.month,ex.label,ex.score,ex.status)

I've done some looking around, and some sources suggested that an ANOVA test could be capable of accomplishing what I need to do. However, I am not entirely sure this is correct, and I thought I would check here. In addition, if that is correct, I have no idea how to actually do that test.

In essence, all I want to do is determine whether two regression lines are significantly different, but in this specific circumstance in R. Thank you.

  • $\begingroup$ The most common approach would be do something like ANCOVA, but because you are comparing several lines, it might be easier to construct 95% confidence intervals about each coefficient, and then conclude that coefficients without any overlap in their confidence intervals are statistically different. You could compare intercepts to intercepts and slopes to slopes. $\endgroup$ – Sal Mangiafico Jul 20 '17 at 21:56
  • $\begingroup$ ANCOVA with post-hoc tests should serve you well: stats.stackexchange.com/a/2472/121522 $\endgroup$ – mkt - Reinstate Monica Jul 21 '17 at 14:42