IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
Represents the result of a fit procedure. More...
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 |
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.
|
inline |
Gets an array of the best fit parameter set.
Referenced by Test.BivariateSampleTest.BivariateLinearPolynomialRegressionAgreement(), Test.BivariateSampleTest.BivariatePolynomialRegression(), Test.DataSetTest.FitDataToLineTest(), Test.DataSetTest.FitDataToLineUncertaintyTest(), Test.DataSetTest.FitToFunctionLinearCompatibilityTest(), Test.DataSetTest.FitToFunctionPolynomialCompatibilityTest(), and Test.MultivariateSampleTest.MultivariateLinearRegressionAgreement().
|
inline |
Get an estimate of a fit parameter.
n | The (zero-based) parameter number. |
ArgumentOutOfRangeException | n is not within [0,Dimension-1]. |
Referenced by Test.SampleTest.BetaFit(), Test.SampleTest.BetaFitUncertainty(), Test.BivariateSampleTest.BivariateLinearRegression(), Test.BugTests.Bug6162(), Test.SampleTest.ExponentialFit(), Test.SampleTest.ExponentialFitUncertainty(), Test.DataSetTest.FitDataToFunctionTest(), Test.DataSetTest.FitDataToLinearFunctionTest(), Test.DataSetTest.FitDataToLineTest(), Test.DataSetTest.FitDataToPolynomialTest(), Test.DataSetTest.FitDataToPolynomialUncertaintiesTest(), Test.DataSetTest.FitDataToProportionalityTest(), Test.DataSetTest.FitToFunctionLinearCompatibilityTest(), Test.DataSetTest.FitToFunctionPolynomialCompatibilityTest(), Test.SampleTest.GammaFit(), Test.SampleTest.GammaFitUncertainty(), Test.BivariateSampleTest.LinearLogisticRegression(), Test.SampleTest.LognormalFit(), Test.MultivariateSampleTest.MultivariateLinearRegressionTest(), Test.SampleTest.NormalFit(), Test.SampleTest.NormalFitUncertainties(), Test.SampleTest.SampleMaximumLikelihoodFit(), Test.SampleTest.WaldFitUncertainties(), Test.SampleTest.WeibullFit(), and Test.SampleTest.WeibullFitUncertainties().
|
inline |
Gets the covariance of two fit parameters.
n | The (zero-based) number of the fist parameter. |
m | The (zero-based) number of the second parameter. |
ArgumentOutOfRangeException | n 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().
|
inline |
Gets the coefficient of correlation between two fit parameters.
n | The (zero-based) number of the first parameter. |
m | The (zero-based) number of the second parameter. |
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.
ArgumentOutOfRangeException | n or m is not within [0,Dimension-1]. |
Referenced by Test.DataSetTest.FitDataToLineTest().
|
inline |
Gets the covariance matrix containing the variances and covariances for all fit parameters.
References Meta.Numerics.Matrices.SymmetricMatrix.Copy().
Referenced by Test.BivariateSampleTest.BivariateLinearPolynomialRegressionAgreement(), Test.BivariateSampleTest.BivariatePolynomialRegression(), Test.DataSetTest.FitDataToLineTest(), Test.DataSetTest.FitDataToLineUncertaintyTest(), Test.DataSetTest.FitToFunctionLinearCompatibilityTest(), Test.DataSetTest.FitToFunctionPolynomialCompatibilityTest(), and Test.MultivariateSampleTest.MultivariateLinearRegressionAgreement().
|
private |
|
private |
|
private |
|
get |
Gets the number of fit parameters.
Referenced by Test.BugTests.Bug6162(), Test.DataSetTest.FitDataToLinearFunctionTest(), Test.DataSetTest.FitDataToLineTest(), Test.DataSetTest.FitDataToPolynomialTest(), Test.DataSetTest.FitDataToPolynomialUncertaintiesTest(), Test.DataSetTest.FitDataToProportionalityTest(), Test.DataSetTest.FitToFunctionLinearCompatibilityTest(), Test.DataSetTest.FitToFunctionPolynomialCompatibilityTest(), Test.MultivariateSampleTest.MultivariateLinearRegressionTest(), and Test.SampleTest.SampleMaximumLikelihoodFit().
|
get |
Gets a test of the quality of the fit.
Which test is used to evaluate goodness-of-fit depends on the type of fit that was performed.
If no goodness-of-fit test was performed as a part of the fit, this property will be null.
Referenced by Test.SampleTest.BetaFit(), Test.BivariateSampleTest.BivariateLinearPolynomialRegressionAgreement(), Test.BivariateSampleTest.BivariateLinearRegression(), Test.BivariateSampleTest.BivariateLinearRegressionGoodnessOfFitDistribution(), Test.BivariateSampleTest.BivariatePolynomialRegression(), Test.SampleTest.ExponentialFit(), Test.DataSetTest.FitDataToLineChiSquaredTest(), Test.DataSetTest.FitDataToLineTest(), Test.DataSetTest.FitDataToPolynomialChiSquaredTest(), Test.DataSetTest.FitDataToPolynomialTest(), Test.DataSetTest.FitDataToProportionalityTest(), Test.DataSetTest.FitToFunctionLinearCompatibilityTest(), Test.DataSetTest.FitToFunctionPolynomialCompatibilityTest(), Test.SampleTest.GammaFit(), Test.SampleTest.LognormalFit(), Test.MultivariateSampleTest.MultivariateLinearRegressionAgreement(), Test.MultivariateSampleTest.MultivariateLinearRegressionNullDistribution(), Test.MultivariateSampleTest.MultivariateLinearRegressionTest(), Test.SampleTest.NormalFit(), and Test.SampleTest.SampleFitChiSquaredTest().