Cross-validated correlation

Versión 1.0.0.0 (4,01 KB) por Ben
leave-one-out crossvalidated linear regression
378 descargas
Actualizado 22 nov 2015

Ver licencia

[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

Citar como

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

Compatibilidad con la versión de MATLAB
Se creó con R2012b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Statistics and Machine Learning Toolbox en Help Center y MATLAB Answers.

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.0.0.0

n/a
n/a