Cross-validated correlation

Version 1.0.0.0 (4,01 KB) von Ben
leave-one-out crossvalidated linear regression
380 Downloads
Aktualisiert 22. Nov 2015

Lizenz anzeigen

[PearsonR, PearsonP, SpearmanR, SpearmanP, yhat, R2 ] = BenStuff_CrossValCorr( x,y, [MathMagic], [OmNullModel] )

leave-one-out cross-validated simple linear regression
INPUT VARIABLES:
x, y: vectors of data (x(n) and y(n) correspond to a pair of observations)
MathMagic: optional parameter; defaults to 1 - avoid looping through n model with the power of MathMagic (http://stats.stackexchange.com/questions/164223/proof-of-loocv-formula)
OmNullModel: optional parameter; defaults to 1 - should null model for R2 be 'omnisicent'? if set to 1 (default) R2 will compare explained variance against variance around mean of *all* data points; if set to 0 will comapre against iteration-specific mean excluding data point to predict
OUTPUT VARIABLES:
PearsonR: Pearson correlation between predicted and observed values
PearsonP: p-value for PearsonR
SpearmanR: Spearman correlation between predicted and observed values
SpearmanP: p-value for SpearmanR
yhat: LOO predicted values
R2: cross-validated proportion of variance in y explained by x-based predictions

NOTE: depressingly, LOOCV isn't the holy grail either
(according to http://www.sciencedirect.com/science/article/pii/S1093326301001231 high LOO R^2 is a
necessary but not sufficient condition for (generalising) predictive validity)
also check out http://andrewgelman.com/2015/06/02/cross-validation-magic/ for some general words of caution

found a bug? please let me know!
benjamindehaas [at] gmail.com 11/2015

Zitieren als

Ben (2024). Cross-validated correlation (https://www.mathworks.com/matlabcentral/fileexchange/54120-cross-validated-correlation), MATLAB Central File Exchange. Abgerufen.

Kompatibilität der MATLAB-Version
Erstellt mit R2012b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.0

n/a
n/a