Hi Juan,
To perform PCA using a Spearman correlation matrix and obtain scores, you'll need to follow a few steps, as the pcacov function in MATLAB does not directly return scores. Here's how you can accomplish this:Steps to Perform PCA with Spearman Correlation
Compute the Spearman Correlation Matrix:
- First, calculate the Spearman correlation matrix for your data. You can use the corr function with the 'Spearman' option:
spearmanCorr = corr(data, 'Type', 'Spearman')
Perform PCA Using pcacov:
- Use the pcacov function to perform PCA on the Spearman correlation matrix. This function will return the eigenvectors (coefficients) and eigenvalues, among other outputs.
Compute the Scores Manually:
- To obtain the scores, you need to project your standardized data onto the principal component space. First, standardize your data (mean = 0, variance = 1), and then multiply by the coefficients:
[coeff, latent, explained] = pcacov(spearmanCorr);
standardizedData = zscore(data);
scores = standardizedData * coeff;
Hope this helps.