|
shrinkr C API
|
Functions available to users of shrinkr. More...
Functions | |
| double | C_OAS (const double *const sample_cov, double *const sample_cov_star, size_t n, size_t p) |
| Oracle Approximating Shrinkage (OAS) covariance estimator. | |
| void | C_LWAnalytical (const double *const lam, double *const lam_star, size_t n, size_t p, double eps) |
| Ledoit-Wolf Analytical (nonlinear) shrinkage of eigenvalues. | |
| double | C_LWLinear (const double *const data, const double *const sample_cov, double *const sample_cov_star, size_t n, size_t p) |
| Ledoit-Wolf linear shrinkage estimator. | |
| double | C_DEALObjective (const double *const base_evals, const double *const surr_evals, const double *const z_vec, double gamma, double *start_value, size_t n, size_t p) |
| Objective function of DEAL. | |
| double | C_DEAL (const double *const base_evals, const double *const surr_evals, const double *const z_vec, double gamma_min, double gamma_max, size_t n, size_t p) |
| DEAL (Deterministic Equivalents for Adaptive LDA) shrinkage. | |
Functions available to users of shrinkr.
| double C_DEAL | ( | const double *const | base_evals, |
| const double *const | surr_evals, | ||
| const double *const | z_vec, | ||
| double | gamma_min, | ||
| double | gamma_max, | ||
| size_t | n, | ||
| size_t | p | ||
| ) |
DEAL (Deterministic Equivalents for Adaptive LDA) shrinkage.
For more information check shrinkr.functional.deal.
| base_evals | Array of length p of eigenvalues for the objective. Which will be shrunk. |
| surr_evals | Array of length p of eigenvalues for the objective. Used to compute shrinkage paramters. |
| z_vec | Array of length p of the vector of interest projected into the eigenvector space. |
| gamma_min | Minimum value for the gamma bounded search. |
| gamma_max | Maximum value for the gamma bounded search. |
| n | Number of effective samples used to compute the sample covariance |
| p | One of the dimensions of the covariance matrix. Number of features. |
| double C_DEALObjective | ( | const double *const | base_evals, |
| const double *const | surr_evals, | ||
| const double *const | z_vec, | ||
| double | gamma, | ||
| double * | start_value, | ||
| size_t | n, | ||
| size_t | p | ||
| ) |
Objective function of DEAL.
For more information check shrinkr.functional.deal.
| base_evals | Array of length p of eigenvalues for the objective. Which will be shrunk. |
| surr_evals | Array of length p of eigenvalues for the objective. Used to compute shrinkage paramters. |
| z_vec | Array of length p of the vector of interest projected into the eigenvector space. |
| gamma | The value of gamma to evaluate. During optimization only this value changes. |
| start_value | Starting value of delta for the fixed point iteration method used by for the objective. |
| n | Number of effective samples used to compute the sample covariance |
| p | One of the dimensions of the covariance matrix. Number of features. |
| void C_LWAnalytical | ( | const double *const | lam, |
| double *const | lam_star, | ||
| size_t | n, | ||
| size_t | p, | ||
| double | eps | ||
| ) |
Ledoit-Wolf Analytical (nonlinear) shrinkage of eigenvalues.
Based on Ledoit and Wolf (2018), using the analytic formula that avoids numerical optimization. Handles the high-dimensional setting where p > n.
| lam | Array of length p containing eigenvalues of the sample covariance matrix |
| lam_star | Array buffer of length p for shrunk eigenvalues |
| sample_cov_star | Output buffer for the shurnk covariance (pxp) (C or F contiguous but matching sample_cov) |
| n | Number of samples used to compute the sample covariance |
| p | Number of variables. Length of lam and lam_star |
| eps | Epsilon value for numerical stability |
| double C_LWLinear | ( | const double *const | data, |
| const double *const | sample_cov, | ||
| double *const | sample_cov_star, | ||
| size_t | n, | ||
| size_t | p | ||
| ) |
Ledoit-Wolf linear shrinkage estimator.
Based on the Ledoit-Wolf Lemma. http://www.ledoit.net/ole1a.pdf
| data | Data matrix (nxp) (C contiguous) |
| sample_cov | Sample covariance matrix (pxp) (C or F contiguous) |
| sample_cov_star | Output buffer for the shurnk covariance (pxp) (C or F contiguous but matching sample_cov) |
| n | Number of samples used to compute the sample covariance |
| p | One of the dimensions of the covariance matrix |
| double C_OAS | ( | const double *const | sample_cov, |
| double *const | sample_cov_star, | ||
| size_t | n, | ||
| size_t | p | ||
| ) |
Oracle Approximating Shrinkage (OAS) covariance estimator.
The formulation is based on https://arxiv.org/pdf/0907.4698.pdf.
| sample_cov | Sample covariance matrix (pxp) (C or F contiguous) |
| sample_cov_star | Output buffer for the shurnk covariance (pxp) (C or F contiguous but matching sample_cov) |
| n | Number of samples used to compute the sample covariance |
| p | One of the dimensions of the matrix |