In my design, I have two groups of subjects and every subject is tested in four different conditions. So, I have a within-subject factor ('span_num', which ranges from 0 to 3) and a between-subject factor (group, which can be 'Linear' or 'U-shape').
My goal is to show that the slope between the spans (from 0 to 3) is higher in the Linear group than in the U-shape group.
The slopes look very different and are significantly different when I compare the regression models I get when I ignore that my within-factor is a within-factor and treat it as a between-factor.
I compared the slopes like this (but I don't trust the comparison because I don't trust the SE values of the slopes because I am treating my within-factor like a between-factor):
linear_lm <- lm(RT ~ span_num, dat = data[data$group == "Linear",])
ushape_lm <- lm(RT ~ span_num, dat = data[data$group == "U-shape",])
linear_intercept <- summary(linear_lm)$coefficients[[1]]; linear_ise <- summary(linear_lm)$coefficients[[3]]; linear_slope <- summary(linear_lm)$coefficients[[2]]; linear_sse <- summary(linear_lm)$coefficients[[4]]
ushape_intercept <- summary(ushape_lm)$coefficients[[1]]; ushape_ise <- summary(ushape_lm)$coefficients[[3]]; ushape_slope <- summary(ushape_lm)$coefficients[[2]]; ushape_sse <- summary(ushape_lm)$coefficients[[4]]
z_intercept <- (ushape_intercept - linear_intercept) / sqrt(linear_ise^2 + ushape_ise^2) #z = -0.45; p = .67, n.s.
z_slope <- (ushape_slope - linear_slope) / sqrt(linear_sse^2 + ushape_sse^2) #z = -1.50; p = .93, sig.