LinearFitBySvd Type

Performs a linear fit to a given function base using singular value decomposition.

Constructors

Constructor Description

LinearFitBySvd(xarr, yarr, stddev, numberOfData, numberOfParameter, evaluateFunctionBase, threshold)

Full Usage: LinearFitBySvd(xarr, yarr, stddev, numberOfData, numberOfParameter, evaluateFunctionBase, threshold)

Parameters:
    xarr : float[] - The array of x values of the data set.
    yarr : float[] - The array of y values of the data set.
    stddev : float[] - The array of y standard deviations of the data set. Can be null if the standard deviation is unkown.
    numberOfData : int - The number of data points (may be smaller than the array sizes of the data arrays).
    numberOfParameter : int - The number of parameters to fit == size of the function base.
    evaluateFunctionBase : FunctionBaseEvaluator - The function base used to fit.
    threshold : float - A treshold value (usually 1E-5) used to chop the unimportant singular values away.

Fits a data set linear to a given function base.

xarr : float[]

The array of x values of the data set.

yarr : float[]

The array of y values of the data set.

stddev : float[]

The array of y standard deviations of the data set. Can be null if the standard deviation is unkown.

numberOfData : int

The number of data points (may be smaller than the array sizes of the data arrays).

numberOfParameter : int

The number of parameters to fit == size of the function base.

evaluateFunctionBase : FunctionBaseEvaluator

The function base used to fit.

threshold : float

A treshold value (usually 1E-5) used to chop the unimportant singular values away.

LinearFitBySvd(xarr, yarr, stddev, numberOfData, numberOfParameter, evaluateFunctionBase, threshold)

Full Usage: LinearFitBySvd(xarr, yarr, stddev, numberOfData, numberOfParameter, evaluateFunctionBase, threshold)

Parameters:
    xarr : IReadOnlyList<float> - The array of x values of the data set.
    yarr : IReadOnlyList<float> - The array of y values of the data set.
    stddev : IReadOnlyList<float> - The array of y standard deviations of the data set. Can be null if the standard deviation is unkown.
    numberOfData : int - The number of data points (may be smaller than the array sizes of the data arrays).
    numberOfParameter : int - The number of parameters to fit == size of the function base.
    evaluateFunctionBase : FunctionBaseEvaluator - The function base used to fit.
    threshold : float - A treshold value (usually 1E-5) used to chop the unimportant singular values away.

Fits a data set linear to a given function base.

xarr : IReadOnlyList<float>

The array of x values of the data set.

yarr : IReadOnlyList<float>

The array of y values of the data set.

stddev : IReadOnlyList<float>

The array of y standard deviations of the data set. Can be null if the standard deviation is unkown.

numberOfData : int

The number of data points (may be smaller than the array sizes of the data arrays).

numberOfParameter : int

The number of parameters to fit == size of the function base.

evaluateFunctionBase : FunctionBaseEvaluator

The function base used to fit.

threshold : float

A treshold value (usually 1E-5) used to chop the unimportant singular values away.

LinearFitBySvd(xbase, yarr, stddev, numberOfData, numberOfParameter, threshold)

Full Usage: LinearFitBySvd(xbase, yarr, stddev, numberOfData, numberOfParameter, threshold)

Parameters:
    xbase : IROMatrix<float> - The matrix of x values of the data set. Dimensions: numberOfData x numberOfParameters. The matrix is changed during calculation!
    yarr : float[] - The array of y values of the data set.
    stddev : float[] - The array of y standard deviations of the data set. Can be null if the standard deviation is unkown.
    numberOfData : int - The number of data points (may be smaller than the array sizes of the data arrays).
    numberOfParameter : int - The number of parameters to fit == size of the function base.
    threshold : float - A treshold value (usually 1E-5) used to chop the unimportant singular values away.

Fits a data set linear to a given x base.

xbase : IROMatrix<float>

The matrix of x values of the data set. Dimensions: numberOfData x numberOfParameters. The matrix is changed during calculation!

yarr : float[]

The array of y values of the data set.

stddev : float[]

The array of y standard deviations of the data set. Can be null if the standard deviation is unkown.

numberOfData : int

The number of data points (may be smaller than the array sizes of the data arrays).

numberOfParameter : int

The number of parameters to fit == size of the function base.

threshold : float

A treshold value (usually 1E-5) used to chop the unimportant singular values away.

Instance members

Instance member Description

this.AdjustedRSquared

Full Usage: this.AdjustedRSquared

Returns: float

Gives the adjusted coefficient of determination.

Ref. "Introduction to linear regression analysis", Wiley, p.90.

Returns: float

this.Calculate

Full Usage: this.Calculate

Parameters:
    xbase : IROMatrix<float> - The matrix of x values of the data set. Dimensions: numberOfData x numberOfParameters. The matrix is changed during calculation!
    yarr : IReadOnlyList<float> - The array of y values of the data set.
    stddev : IReadOnlyList<float> - The array of y standard deviations of the data set. Can be null if the standard deviation is unkown.
    numberOfData : int - The number of data points (may be smaller than the array sizes of the data arrays).
    numberOfParameter : int - The number of parameters to fit == size of the function base.
    threshold : float - A treshold value (usually 1E-5) used to chop the unimportant singular values away.

Returns: LinearFitBySvd

Fits a data set linear to a given x base.

xbase : IROMatrix<float>

The matrix of x values of the data set. Dimensions: numberOfData x numberOfParameters. The matrix is changed during calculation!

yarr : IReadOnlyList<float>

The array of y values of the data set.

stddev : IReadOnlyList<float>

The array of y standard deviations of the data set. Can be null if the standard deviation is unkown.

numberOfData : int

The number of data points (may be smaller than the array sizes of the data arrays).

numberOfParameter : int

The number of parameters to fit == size of the function base.

threshold : float

A treshold value (usually 1E-5) used to chop the unimportant singular values away.

Returns: LinearFitBySvd

this.ConditionNumber

Full Usage: this.ConditionNumber

Returns: float

Gets the condition number. The decadic logarithm of the condition number is roughly the loss of precision (in digits) during the calculation.

Returns: float

this.Covariances

Full Usage: this.Covariances

Returns: float[][]

Get the variance-covariance-matrix for the fit.

Returns: float[][]

this.EstimatedVariance

Full Usage: this.EstimatedVariance

Returns: float

Get the estimated residual mean square, also called SigmaSquare..

The estimated mean square is defined as SumChiSquare(n-p), where n is the number of data points and p is the number of (free) parameters.

Returns: float

this.ExternallyStudentizedResidual

Full Usage: this.ExternallyStudentizedResidual

Parameters:
    i : int - The index to the residual.

Returns: float The ith externally studentized residual.

Gives the ith studentized residual, with the ith observation removed from the model.

As with the studentized residual, the expected variance of this residual is 1. Since the ith observation is excluded from the model, the externally studentized residual is better suited for outlier detection than the (normal) studentized residual.

Ref: Introduction to linear regression analysis, 3rd ed., Wiley, p.136

i : int

The index to the residual.

Returns: float

The ith externally studentized residual.

this.NumberOfData

Full Usage: this.NumberOfData

Returns: int

Returns the number of data value.

Returns: int

this.NumberOfParameter

Full Usage: this.NumberOfParameter

Returns: int

Returns the number of parameter (=Order+1) of the fit.

Returns: int

this.PRESSResidual

Full Usage: this.PRESSResidual

Parameters:
    i : int - The index of the PRESS residual.

Returns: float The ith PRESS residual.

Gives the ith PRESS residual.

The PRESS residual is the prediction error of the ith value, if the ith value itself is not used in the prediction model.

Ref: Introduction to linear regression analysis, 3rd ed., Wiley, p.135

i : int

The index of the PRESS residual.

Returns: float

The ith PRESS residual.

this.Parameter

Full Usage: this.Parameter

Returns: float[]

Get the resulting parameters, so that the model y = SUM(parameter[i]*functionbase[i])

Returns: float[]

this.PredictedValues

Full Usage: this.PredictedValues

Returns: float[]

Gets the predicted dependent values

Returns: float[]

this.PredictionVariance

Full Usage: this.PredictionVariance

Parameters:
    i : int - The index to the ith observation.

Returns: float The variance of the ith prediction value.

Gives the variance of the prediction of the ith y-value.

i : int

The index to the ith observation.

Returns: float

The variance of the ith prediction value.

this.RSquared

Full Usage: this.RSquared

Returns: float

Gives the coefficient of determination, also called R^2, squared correlation coefficient. It is a measure, how much of the variability of the y data is accounted for by the regression model.

Returns: float

this.RegressionCorrectedSumOfSquares

Full Usage: this.RegressionCorrectedSumOfSquares

Returns: float

Gets the regression sum of squares, i.e. SUM(yi`-ymean), where yi` is the predicted ith y value and y mean is the mean value of all y values.

Returns: float

this.ResidualSumOfSquares

Full Usage: this.ResidualSumOfSquares

Returns: float

Gets the sum of ChiSquare for the fit. This is SUM(yi-yi`)^2, where yi is the ith y value and yi` is the ith predicted y.

Returns: float

this.ResidualValues

Full Usage: this.ResidualValues

Returns: float[]

Gets the array of residual values defined as the difference y[i]-ypredicted[i].

Returns: float[]

this.Sigma

Full Usage: this.Sigma

Returns: float

Get the standard error of regression, defined as Sqrt(SigmaSquare).

Returns: float

this.StandardErrorOfParameter

Full Usage: this.StandardErrorOfParameter

Parameters:
    i : int - Index of the parameter.

Returns: float The estimated standard error of parameter i.

Gets the estimated standard error of parameter i.

i : int

Index of the parameter.

Returns: float

The estimated standard error of parameter i.

this.StudentizedResidual

Full Usage: this.StudentizedResidual

Parameters:
    i : int - The index of the residual.

Returns: float The ith studentized residual.

Gives the ith studentized residual.

The studentized residual has constant variance of 1, regardless of the location of xi.

Ref: Introduction to linear regression analysis, 3rd ed., Wiley, p.134

i : int

The index of the residual.

Returns: float

The ith studentized residual.

this.TofParameter

Full Usage: this.TofParameter

Parameters:
    i : int

Returns: float

i : int
Returns: float

this.TotalCorrectedSumOfSquares

Full Usage: this.TotalCorrectedSumOfSquares

Returns: float

Gives the corrected sum of squares of y, i.e. SUM(yi-ymean), where yi is the ith y value and ymean is the mean of all y values.

Returns: float

Static members

Static member Description

LinearFitBySvd.CorrectedSumOfSquares(x, mean, start, length)

Full Usage: LinearFitBySvd.CorrectedSumOfSquares(x, mean, start, length)

Parameters:
    x : IReadOnlyList<float> - Array of values.
    mean : float - Mean value of the values.
    start : int - Starting index.
    length : int - Number of elements used for calculation.

Returns: float

Calculates the corrected sum of squares of length elements of array x starting from index start. The corrected sum of squares is defined as sum of squares of the elements minus their mean value.

x : IReadOnlyList<float>

Array of values.

mean : float

Mean value of the values.

start : int

Starting index.

length : int

Number of elements used for calculation.

Returns: float

LinearFitBySvd.FitPolymomial(order, xValues, yValues, start, count, doRemoveNaNValues)

Full Usage: LinearFitBySvd.FitPolymomial(order, xValues, yValues, start, count, doRemoveNaNValues)

Parameters:
    order : int - The order of the fit (1:linear, 2:quadratic, etc.)
    xValues : IReadOnlyList<float> - The column of x-values. Only those values are used, that are not NaN
    yValues : IReadOnlyList<float> - The column of y-values.
    start : int - Index of first data point to use.
    count : int - Number of data points to use.
    doRemoveNaNValues : bool - If true, value pairs containing NaN are removed before calculation of the fit.

Returns: LinearFitBySvd The fit.

Fits data provided as xcolumn and ycolumn with a polynomial base. Here special measures are taken (scaling of the x-variable) in order to keep the precision high.

order : int

The order of the fit (1:linear, 2:quadratic, etc.)

xValues : IReadOnlyList<float>

The column of x-values. Only those values are used, that are not NaN

yValues : IReadOnlyList<float>

The column of y-values.

start : int

Index of first data point to use.

count : int

Number of data points to use.

doRemoveNaNValues : bool

If true, value pairs containing NaN are removed before calculation of the fit.

Returns: LinearFitBySvd

The fit.

LinearFitBySvd.FitPolymomialDestructive(order, xValues, yValues, errorValues, count)

Full Usage: LinearFitBySvd.FitPolymomialDestructive(order, xValues, yValues, errorValues, count)

Parameters:
    order : int - The order of the fit (1:linear, 2:quadratic, etc.)
    xValues : float[] - The array of x-values. The values of the array are destroyed (altered) during the evaluation!
    yValues : float[] - The array of y-values.
    errorValues : float[] - The column of errorValues. If null, errorValues are set to 1 for each element.
    count : int - Number of values to use (array[0] ... array[count-1].

Returns: LinearFitBySvd The fit.

Fits data provided as xcolumn and ycolumn with a polynomial base. Here special measures are taken (scaling of the x-variable) in order to keep the precision high.

order : int

The order of the fit (1:linear, 2:quadratic, etc.)

xValues : float[]

The array of x-values. The values of the array are destroyed (altered) during the evaluation!

yValues : float[]

The array of y-values.

errorValues : float[]

The column of errorValues. If null, errorValues are set to 1 for each element.

count : int

Number of values to use (array[0] ... array[count-1].

Returns: LinearFitBySvd

The fit.

LinearFitBySvd.GetPolynomialFunctionBase(order)

Full Usage: LinearFitBySvd.GetPolynomialFunctionBase(order)

Parameters:
    order : int - Order of the polynomial (0: only intercept, 1: linear, 2: quadratic ...

Returns: FunctionBaseEvaluator The function base to use with this fit.

Gets a default polynomial function base with intercept, i.e. f(y)=a+b*x+c*x*x ...

order : int

Order of the polynomial (0: only intercept, 1: linear, 2: quadratic ...

Returns: FunctionBaseEvaluator

The function base to use with this fit.

LinearFitBySvd.Mean(x, start, length)

Full Usage: LinearFitBySvd.Mean(x, start, length)

Parameters:
    x : IReadOnlyList<float> - The array of values.
    start : int - First element.
    length : int - Number of elements used for calculation.

Returns: float

Calculates the mean value of length elements in array x starting from index start.

x : IReadOnlyList<float>

The array of values.

start : int

First element.

length : int

Number of elements used for calculation.

Returns: float