%include data(fitness); title 'Cross-validation of a regression model'; /* --------------------------------------- o Hold back a portion of the data from the original fit. o Evaluate how well the model determined from the rest of the data does on the cross-validatation sample. */ data fit2; set fitness; if uniform(125741) < .667 /* generate model on 2/3 of data */ then oxy2 = oxy; else oxy2 = . ; /* generate prediction on CV sample */ proc reg data=fit2; title2 'Model generation (2/3) sample'; model oxy2=age weight runtime runpulse / p; output out=stats p=predict r=resid; proc corr data=stats nosimple; where (oxy2 = .); /* select CV 1/3 sample */ var predict oxy; /* correlate y, yhat */ title 'Cross-validation (1/3) sample';