2
$\begingroup$

I have a dataframe with continuous and categorical variables and I want to obtain a kernel matrix for classification. The kernel matrix must be symmetric and positive semidefinite, so that no eigenvalue is negative. I started with Gower distance matrix for mixed data, which is not positive semidefinite. I tried to transform the Gower distance matrix into a positive semidefinite and symmetric kernel with the function D2Ksof MiRVpackage in R, with no success. I tried also to apply the approach of page 799 in Zhao, Ni et al. “Testing in Microbiome-Profiling Studies with MiRKAT, the Microbiome Regression-Based Kernel Association Test” American journal of human genetics vol. 96,5 (2015): 797-807. with no success, as well. I always obtain a indefinite kernel matrix with positive and negative eigenvalues. Any suggestion?

$\endgroup$
3
0
$\begingroup$

You may use nearPD in R to convert a matrix to its Nearest Positive Definite counterpart.

$\endgroup$
1
  • 1
    $\begingroup$ Perfect suggestion! Thank you! $\endgroup$ – coolsv Mar 13 '19 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.