make_pd_weight: Weighted Bending of a Matrix

Description Usage Arguments Value Examples

View source: R/MakePD.R

Description

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.

Usage

1
2
3
4
5
6
7
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
)

Arguments

A

input matrix

pmat_weight

weight matrix

pn_eps

smallest accepted eigenvalue

number

of digits to be rounded to

Value

mat_result bended matrix

Examples

1
2
3
4
# 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)

pvrqualitasag/rvcetools documentation built on Dec. 31, 2021, 2:09 p.m.