Describing the problem - Linear Example

To make possible the calculation, we copy the value obtained for each range of \(X^1\).

same_group_y_mean_filled <-
  colSums(same_group_y_mean_matrix, na.rm = TRUE) |>
  matrix(nrow = 5, ncol = 5, byrow = TRUE)

same_group_y_mean_filled
##      [,1] [,2] [,3] [,4] [,5]
## [1,] 0.19 0.59 0.98  1.4 1.77
## [2,] 0.19 0.59 0.98  1.4 1.77
## [3,] 0.19 0.59 0.98  1.4 1.77
## [4,] 0.19 0.59 0.98  1.4 1.77
## [5,] 0.19 0.59 0.98  1.4 1.77