IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Meta.Numerics.Statistics.FitResult Class Reference

Represents the result of a fit procedure. More...

+ Collaboration diagram for Meta.Numerics.Statistics.FitResult:

Public Member Functions

double[] Parameters ()
 Gets an array of the best fit parameter set. More...
 
UncertainValue Parameter (int n)
 Get an estimate of a fit parameter. More...
 
double Covariance (int n, int m)
 Gets the covariance of two fit parameters. More...
 
double CorrelationCoefficient (int n, int m)
 Gets the coefficient of correlation between two fit parameters. More...
 
SymmetricMatrix CovarianceMatrix ()
 Gets the covariance matrix containing the variances and covariances for all fit parameters. More...
 

Properties

int Dimension [get]
 Gets the number of fit parameters. More...
 
TestResult GoodnessOfFit [get]
 Gets a test of the quality of the fit. More...
 

Private Attributes

IList< double > parameters
 
SymmetricMatrix covarianceMatrix
 
TestResult test
 

Detailed Description

Represents the result of a fit procedure.

All fit methods in the Meta.Numerics library return their results as an instance of the FitResult class. This includes methods that fit a sample to a distribution (e.g. Meta.Numerics.Statistics.Distributions.NormalDistribution.FitToSample), regression methods for bivariate and multivariate data (e.g. BivariateSample.LinearLogisticRegression), and least-squares fits of data with error bars to a model function (e.g. UncertainMeasurementSample{T}.FitToFunction).

A FitResult instance contains not only the parameter values, but also covariances and a goodness-of-fit test.

The vector of best-fit parameter values can be obtained as an array using the Parameters method. Individual parameter values can be obtained using the Parameter method; this method gives not only a best-fit value but also an uncertainty by returning a UncertainValue.

The matrix of covariances can be obtained using the CovarianceMatrix method. Covariances between specific pairs of parameters van be obtained using the Covariance method.

The goodness-of-fit test result stored in the GoodnessOfFit measures the quality of the fit. For fits to distributions, it is a Kolmogorov-Smirnov test. For regressions, it is an F-test. For fits to data with error bars, it is a chi-square test.

Fits are done using the maximum likelyhood method, with results corrected for any small-sample bias.

Member Function Documentation

double Meta.Numerics.Statistics.FitResult.Covariance ( int  n,
int  m 
)
inline

Gets the covariance of two fit parameters.

Parameters
nThe (zero-based) number of the fist parameter.
mThe (zero-based) number of the second parameter.
Returns
The covariance of the two fit parameters.
Exceptions
ArgumentOutOfRangeExceptionn or m is not within [0,Dimension-1].

Referenced by Test.BivariateSampleTest.BivariateLinearRegression(), Test.DataSetTest.FitDataToLinearFunctionTest(), Test.DataSetTest.FitDataToLineTest(), Test.BivariateSampleTest.LinearLogisticRegression(), Test.SampleTest.NormalFitUncertainties(), Test.SampleTest.SampleMaximumLikelihoodFit(), Test.SampleTest.WaldFitUncertainties(), and Test.SampleTest.WeibullFitUncertainties().

double Meta.Numerics.Statistics.FitResult.CorrelationCoefficient ( int  n,
int  m 
)
inline

Gets the coefficient of correlation between two fit parameters.

Parameters
nThe (zero-based) number of the first parameter.
mThe (zero-based) number of the second parameter.
Returns
The correlation coefficient between the two parameters.

The correlation coefficient between two parameters is a re-scaling of their covariance to a number between -1 and 1 that indicates the strength of their correlation.

The correlation coefficient is also called the Pearson R coefficient.

Exceptions
ArgumentOutOfRangeExceptionn or m is not within [0,Dimension-1].

Referenced by Test.DataSetTest.FitDataToLineTest().

Member Data Documentation

IList<double> Meta.Numerics.Statistics.FitResult.parameters
private
SymmetricMatrix Meta.Numerics.Statistics.FitResult.covarianceMatrix
private
TestResult Meta.Numerics.Statistics.FitResult.test
private

Property Documentation


The documentation for this class was generated from the following file: