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.01765492 0.7043658
#> [2,] 0.38704199 0.4125632
#> [3,] 0.00000000 0.0000000
#> [4,] -0.15989910 -0.5189965
thaw(input, frozen)
#> [,1] [,2]
#> [1,] -0.01528961 0.6099987
#> [2,] 0.33518820 0.3572902
#> [3,] 0.50000000 0.5000000
#> [4,] -0.13847669 -0.4494641
freeze(basis_random(4, 2), frozen)
#> [,1] [,2]
#> [1,] -0.1212654 0.1985167
#> [2,] 0.3536921 0.5179840
#> [3,] 0.0000000 0.0000000
#> [4,] -0.5591836 -0.5460886