Consider an RCT with individuals "i" in 2 arms ("group", with 0 = control and 1 = treatment) in which one metric outcome ("score") is collected at baseline ("pre") and after some treatment ("post").
In an ANCOVA model, the two explanatory variables "pre" and "group" are mapped to the dependent variable "post" as follows:
post_i ≈ a + b * pre_i + c * group_i
Now, Van Breukelen (reference below) claims that ANCOVA is equivalent to testing the group by time interaction c' in the model
score_i,t ≈ a' + b' * time_i,t + c' * group_i * time_i,t
with time = 0 denoting the pretest and time = 1 the posttest time point.
I tried to verify Van Breukelen's statement on a toy dataset in R:
```R
# toy dataset
df_wide |t|)
#(Intercept) 2.7090 1.5362 1.763 0.176
#pre 0.1700 0.6354 0.268 0.806
#group 0.8030 0.8282 0.970 0.404
# reshaping data, ensuring correct coding of the time variable
df_long