4.66667

4.7 | 3 ratings Rate this file 33 downloads (last 30 days) File Size: 3.04 KB File ID: #22020

Goodness of Fit (Modified)

by Richard Crozier

 

07 Nov 2008 (Updated 01 Jul 2009)

Code covered by the BSD License  

Computes goodness of fit for regression model given matrix/vector of target and output values.

Download Now | Watch this File

File Information
Description

 GFIT2 Computes goodness of fit for regression model

 USAGE:
       [gf] = gfit2(t,y)
       [gf] = gfit2(t,y,gFitMeasure)
       [gf] = gfit2(t,y,gFitMeasure,options)

 INPUT:
           t: matrix or vector of target values for regression model
           y: matrix or vector of output from regression model.
 gFitMeasure: a string or cell array of string values representing
               different form of goodness of fit measure as follows:
               
               'all' - calculates all the measures below
               '1' - mean squared error (mse)
               '2' - normalised mean squared error (nmse)
               '3' - root mean squared error (rmse)
               '4' - normalised root mean squared error (nrmse)
               '5' - mean absolute error (mae)
               '6' - mean absolute relative error (mare)
               '7' - coefficient of correlation (r)
               '8' - coefficient of determination (d)
               '9' - coefficient of efficiency (e)
               '10' - maximum absolute error
               '11' - maximum absolute relative error

    options: a string containing other output options, currently the only option is verbose output.

                'v' - verbose output, posts some text output for the
                    chosen measures to the command line
              
 OUTPUT:

      gf: vector of goodness of fit values between model output and target for each of the strings in gFitMeasure

 EXAMPLES

      gf = gfit2(t,y); for all statistics in list returned as vector

      gf = gfit2(t,y,'3'); for root mean squared error

      gf = gfit2(t,y, {'3'}); for root mean squared error

      gf = gfit2(t,y, {'1' '3' '9'}); for mean squared error, root mean
            | squared error, and coefficient of
           \|/ efficiency
      gf = [mse rmse e]

      gf = gfit2(t,y,'all','v'); for all statistics in list returned as
                    vector with information posted to the
                    command line on each statistic

      gf = gfit2(t,y, {'1' '3' '9'}, 'v'); for mean squared error, root
                    mean squared error, and
                    coefficient of efficiency as a
                    vector with information on each
                    of these also posted to the
                    command line

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Goodness of Fit

MATLAB release MATLAB 7.2 (R2006a)
Zip File Content  
Other Files gfit2.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
24 Nov 2008 David Yeo

Thank you. !!

27 Oct 2009 Ben  
08 Mar 2010 Andre Guy Tranquille  
Please login to add a comment or rating.
Updates
07 Nov 2008

Fixed some bugs and spelling mistakes in comments, and added new output option.

21 Nov 2008

Changed output for gfit2(t,y) now returns all available statistics as a vector rather than just the mean squared error (choice 1). Also made minor changes to comments and help section.

24 Nov 2008

Actually uploaded new file this time, managed to forget to on last update.

01 Jul 2009

Added a verbose option to return some information to the command line

Tag Activity for this File
Tag Applied By Date/Time
fit Richard Crozier 07 Nov 2008 10:15:17
goodness Richard Crozier 07 Nov 2008 10:15:17
mathematics Richard Crozier 07 Nov 2008 10:15:17
model performance Richard Crozier 07 Nov 2008 10:15:17
mathematics Cristina McIntire 07 Nov 2008 12:56:50
modeling Cristina McIntire 10 Nov 2008 10:41:01

Contact us at files@mathworks.com