## Help with linear regression when multiple subjects

Hi,

I have some data where each subject is presented with pairwise combinations of four test items (A, B, C and D). Each observation is a subjective difference between the two items (the exact details of the experiment are not necessary but I can expand if it helps):

obs(A, B) = A - B
obs(B, C) = B - C

Given the observations from every pair, the aim is to estimate the best fitting parameters (A, B, C and D). The per subject regression is therefore performed using the following design matrix:
A B C D
[[ 1. 0. 0. 0.]
[ 1. -1. 0. 0.]
[ 1. 0. -1. 0.]
[ 1. 0. 0. -1.]
[ 1. 0. 0. 0.]
[ 1. 1. 0. 0.]
[ 1. 1. -1. 0.]
[ 1. 1. 0. -1.]
[ 1. 0. 0. 0.]
[ 1. 0. 1. 0.]
[ 1. -1. 1. 0.]
[ 1. 0. 1. -1.]
[ 1. 0. 0. 0.]
[ 1. 0. 0. 1.]
[ 1. -1. 0. 1.]
[ 1. 0. -1. 1.]]

In this case, A serves as the intercept meaning the remaining three coefficients are expressed relative to A.

I am interested in the significance of the predictors and the standard errors of the coefficients but I am unsure how to implement the regression because I have repeated-measures, i.e. I have multiple subjects each tested on all pairs. I can perform a single regression with the entire data set (duplicating the above design matrix for every subject), but I am not confident that this is the most appropriate approach since the errors are not independent.

Can anyone help with this?

Thanks for your time