Covariance is of universal prevalence across various disciplines within
statistics. This package aims at providing a rich collection of
geometric and statistical tools for a variety of inferences on
covariance structures as well as its inverse called precision
matrix. See the package help file by help("package-CovTools") in R
console for the list of available functions.
Installation
You can install the released version of CovTools from
CRAN with:
CovEst.hardPD() does not give a matrix that is positive definite? See code below
I believe this comes from the second search, which searches within the "first non pd" (Cvec1[iter]) to the last "pd" (Cvec1[iter-1]). It starts from the lowest, and then see if it is non pd. So this will stop at the first value (first non pd), and hence returns a non-pd value!?
Solution is probably either to inverse the line: Cvec2 = seq(from=Cvec1[iter], to=Cvec1[iter-1], length.out=20), or to change the sign in the second if ((min(eigen(tmpS, only.values=TRUE)$values)) < sqrt(.Machine$double.eps)){ to stop at the first pd?
I was looking at the code, trying to implement Cai and Zhang (2016) shrinkage method allowing NA values.
Looking at thr1.multiple(), I notice that it takes a new function func_*_givenS, which seems to involve rewriting code many times? What was the reason for this exactly? The additional problem is that the function I am writing requires X at each iteration, meaning a _givenS function cannot be written.
It looks like thr1.multiple_X() could actually store the training X instead of computing the training S (S1), still compute the test S (S2) as before, and then thr1.singlesum() would work using the direct functions?
Am I missing something there? Happy to send a pull request for that!