I have a dataset with p predictors for i items (so multiple regression). For each of s subjects, I have r repeated observations of v dependent variables (so it's a multivariate problem). I wish to find out for each individual how much variance the p predictors account for across all i items.
The formula for calculating the parameter coefficients (aka betas) (using MATLAB notation) is:
Betas=pinv(X'*X)*X'*Y
Where X is the [i × p] matrix of predictors, and Y is the matrix of observations. Unfortunately, my Y is a 3D matrix of size [i × r × v]. The matrix multiplication requires a 2D matrix, however I am not sure about which is the correct approach:
- Concatenate the r observations of v measurements together so that e.g. X=[i × p], Y=[i × (r * v)]
- Concatenate the r observations of i items together, and replicate the predictor matrix r times so that e.g., X=[(r*i) × p], Y=[(r*i) × v]
- Average the r observations of v measurements together so that X=[i × p] and Y=[i × v]
The second option multiplies the predictors which seems to be a bad idea, whereas the first option multiplies the dependent variables, which then makes it impossible to use the parameters to predict a set of v values. The last option seems to be the most reasonable, though you lose data through averaging. Are any of these the appropriate course of action?