Some terminology: * frozen variables: the variables that have fixed values * warm variables: the remaining variables that vary freely
freeze(input, frozen)
thaw(input, frozen)
A frozen matrix specifies which variables to fix in a projection matrix.
Warm variables should be missing (NA
) while frozen variables should
be set to their fixed values.
frozen <- matrix(NA, nrow = 4, ncol = 2)
frozen[3, ] <- .5
input <- basis_random(4, 2)
freeze(input, frozen)
#> [,1] [,2]
#> [1,] -0.8322899 0.075799310
#> [2,] 0.4891694 -0.142628023
#> [3,] 0.0000000 0.000000000
#> [4,] -0.2223991 0.006898078
thaw(input, frozen)
#> [,1] [,2]
#> [1,] -0.7207842 0.065644128
#> [2,] 0.4236331 -0.123519492
#> [3,] 0.5000000 0.500000000
#> [4,] -0.1926032 0.005973911
freeze(basis_random(4, 2), frozen)
#> [,1] [,2]
#> [1,] -0.07747727 0.56988875
#> [2,] -0.17705244 0.07358932
#> [3,] 0.00000000 0.00000000
#> [4,] 0.71876388 0.59836848