Fits an additive pattern to matrix data using training data specified by a mask. The pattern is based on row and column main effects, creating an additive model where each cell value is the sum of a row effect and column effect minus the overall mean.
additiveMatrixFitter(mat, trainMask)Numeric matrix of same dimensions as mat containing the fitted additive pattern
Numeric matrix containing the data to fit
Logical matrix of same dimensions as mat, indicating which cells to use for training
The function creates an additive pattern by:
Masking non-training cells as NA to compute statistics only on training data
Computing overall mean of training data
Computing row means and column means from training data
Replacing non-finite means with overall mean as fallback
Creating additive pattern as outer sum of row and column effects minus overall mean