This function implements the algorithm described in Jorjani2003. Without specifying a weight matrix, it corresponds to the unweighted bending where each eigenvalue is set to a lower limit which is given by the parameter pn_eps. The advantage of this bending method is that it is possible to specify a weight matrix where matrix elements with a high weight do not get changed as much as elements with a small weight. The number of observations used to estimate each variance component can be used as a weighting factor.
make_pd_weight( A, pmat_weight = matrix(1, nrow = nrow(A), ncol = ncol(A)), pn_eps = 1e-04, pn_max_iter = 1e+06, pn_digits = NULL )
A | input matrix |
---|---|
pmat_weight | weight matrix |
pn_eps | smallest accepted eigenvalue |
number | of digits to be rounded to |
mat_result bended matrix
# reading input matrix from paper by Jorjani et al 2003 sinput_file <- system.file('extdata', 'mat_test_jorjani2003.dat', package = 'rvcetools') mat_test_jorjani <- as.matrix(readr::read_delim(file = sinput_file, delim = ' ', col_names = FALSE))#>#>#> #>#> #>#>make_pd_weight(mat_test_jorjani)#> X1 X2 X3 X4 X5 #> [1,] 103.16918 90.83313 79.47122 44.53731 37.07254 #> [2,] 90.83313 106.49734 94.18961 74.07039 44.53731 #> [3,] 79.47122 94.18961 102.31355 94.18961 79.47122 #> [4,] 44.53731 74.07039 94.18961 106.49734 90.83313 #> [5,] 37.07254 44.53731 79.47122 90.83313 103.16918