change_cor_mat_tdpca: Draw a changed correlation matrix for use in dynamic TPCA. In Tveten/tpca: A function for tailoring PCA to change detection

Description

Changes an input correlation matrix that is based on lagged samples. This function assumes that the correlation matrix is based on observations X_t = vec(x_{t - l}, x_{t - l + 1}, …, x_t).

Usage

 ```1 2``` ```change_cor_mat_tdpca(cor_mat, lag, affected_dims, do_nearPD = TRUE, draw_cor = NULL, draw_sd = NULL) ```

Arguments

 `cor_mat` A correlation matrix of lagged observations to be changed. `lag` The lag used to obtain the lagged observations. `affected_dims` A vector specifying which unlagged dimensions (dimensions of x_t) that should be changed. `do_nearPD` A logical indicating whether the Matrix::nearPD function should be run on the changed correlation matrix to find the closest positve definite matrix to it. Highly recommended, as the changes in correlation are not guaranteed to result in a valid correlation matrix. `draw_cor` A function to draw n (any natural number) changes in correlation from. `draw_sd` A function to draw n (any natural number) changes in standard deviation from.

Details

The lagged observations X_t imposes a block structure on its correlation matrix, where the l + 1 diagonal blocks are all estimates of the correlation matrix of x_t. `change_cor_mat_tdpca` takes a set of indices indicating affected dimensions of x_t, and translates this into corresponding changes in the input correlation matrix of X_t. A change in one dimension of x_t (the unlagged, original data) corresponds to changes in (lag + 1) dimensions of X_t. See `change_cor_mat` for additional information.

Value

A changed correlation matrix, guaranteed to be positive definite if do_nearPD = TRUE.

Tveten/tpca documentation built on June 10, 2021, 8:43 p.m.