Description Usage Arguments Details Value References Examples
View source: R/cov-estim-help.R
Implements the algorithm of \insertCitehigham2002computing;textualCovEstim to compute the nearest positive-definite matrix to an approximate one, typically a correlation or variance-covariance matrix.
1 2 3 4 5 6 7 8 9 10 11 |
mat |
a pxp matrix. |
corr |
a logical, indicating if the result should be a correlation matrix. Default value is FALSE. |
keep_diag |
a logical, indicating if the result should have the same diagonal as the original matrix mat. |
do_dykstra |
a logical, indicating if Dykstra's correlation is to be used. Default value is TRUE. |
eig_tol |
a double, defining the relative positiveness of eigenvalues compared to the largest eigenvalue. Default value is 1e-6. |
conv_tol |
a double, defining the convergence tolerance for the Higham algorithm. Default value is 1e-7. |
posd_tol |
a double, defining the tolerance for enforcing positive definiteness. Default value is 1e-8. |
maxit |
maximum number of iterations. Default value is 100. |
trace |
a logical, indicating whether iterations are to be traced (printed out). Default value is FALSE. |
Note that setting corr = TRUE just sets diag(.) <- 1 within the algorithm. The near_posdef() is originally found under \insertCitematrixpackage;textualCovEstim.
a positive-definite matrix.
1 2 3 4 | data(sp200)
sp_rets <- sp200[1:100,-1]
ml_sigma <- sigma_estim(sp_rets, "ML")
ml_sigma_near_posdef <- near_posdef(ml_sigma, eig_tol=1e-8)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.