Cross-validated correlation

版本 1.0.0.0 (4.0 KB) 作者: Ben
leave-one-out crossvalidated linear regression
380.0 次下载
更新时间 2015/11/22

查看许可证

[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

引用格式

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

MATLAB 版本兼容性
创建方式 R2012b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0

n/a
n/a