4.5

4.5 | 2 ratings Rate this file 155 downloads (last 30 days) File Size: 1.44 KB File ID: #13872

rsquare

by Felix Hebeler

 

06 Feb 2007 (Updated 06 Feb 2007)

No BSD License  

calculate rsquare from data y and estimate yhat

Download Now | Watch this File

File Information
Description

Simple function to calculate the r square of a dataset y (vector or matrix form) and the corresponding estimates yhat calculated using a regression.
Uses r2 = 1 - SSe/SSt
Input can contain NaNs.

MATLAB release MATLAB 7.3 (R2006b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
21 Feb 2007 baldo giovane  
17 Jul 2008 Daithi O'hEachach

Does the job.

05 Nov 2009 Petteri T

sum( (y-yhat).^2) could be replaced with (y-what)' * (y-what) for speedup as suggested there: http://www.mathworks.nl/matlabcentral/newsreader/view_thread/168821

Please login to add a comment or rating.
Updates
06 Feb 2007

Better deletion of NaNs

Tag Activity for this File
Tag Applied By Date/Time
approximation Felix Hebeler 22 Oct 2008 08:59:51
interpolation Felix Hebeler 22 Oct 2008 08:59:51
rsquare Felix Hebeler 22 Oct 2008 08:59:51
r2 Felix Hebeler 22 Oct 2008 08:59:51
goodness of fit Felix Hebeler 22 Oct 2008 08:59:51
regression Felix Hebeler 22 Oct 2008 08:59:51
estimate Felix Hebeler 22 Oct 2008 08:59:51
rsquare Yulia Ptitsyna 03 Nov 2009 18:57:40
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com