Create new design matrix \(X_{ij}^* = X_j - X_i\) for PIM.

new_design_matrix(X)

Arguments

X

matrix original design matrix

Value

Assuming n = NROW(X), p = NCOL(X), the returned object is also an matrix but with dimension n^2 x p.

Examples

X <- matrix(c(4, 9, 2, 3, 5, 7, 8, 1, 6), ncol = 3, byrow = TRUE)
new_design_matrix(X)
#>       [,1] [,2] [,3]
#>  [1,]    0    0    0
#>  [2,]   -1   -4    5
#>  [3,]    4   -8    4
#>  [4,]    1    4   -5
#>  [5,]    0    0    0
#>  [6,]    5   -4   -1
#>  [7,]   -4    8   -4
#>  [8,]   -5    4    1
#>  [9,]    0    0    0