LinearModelResult

class LinearModelResult(*args)

Result of a LinearModelAlgorithm.

Parameters:
inputSample2-d sequence of float

The input sample of a model.

basisBasis

Functional basis to estimate the trend.

designMatrix

The design matrix X.

outputSample2-d sequence of float

The output sample of a model.

metaModelFunction

The meta model.

coefficientssequence of float

The trend coefficients associated to the linear model.

formulastr

The formula description.

coefficientsNamessequence of str

The coefficients names of the basis.

sampleResiduals2-d sequence of float

The residual errors.

standardizedSampleResiduals2-d sequence of float

The normalized residual errors.

diagonalGramInversesequence of float

The diagonal of the Gram inverse matrix.

leveragessequence of float

The leverage score.

cookDistancessequence of float

Cook’s distances.

residualsVariancefloat

The unbiased variance estimator of the output observation error.

Methods

buildMethod()

Accessor to the least squares method.

getAdjustedRSquared()

Accessor to the Adjusted R-squared test.

getBasis()

Accessor to the basis.

getClassName()

Accessor to the object's name.

getCoefficients()

Accessor to the coefficients of the linear model of the trend.

getCoefficientsNames()

Accessor to the coefficients names.

getCoefficientsStandardErrors()

Accessor to the coefficients of standard error.

getCookDistances()

Accessor to the cook's distances.

getDegreesOfFreedom()

Accessor to the degrees of freedom.

getDesign()

Accessor to the design matrix.

getDiagonalGramInverse()

Accessor to the diagonal gram inverse matrix.

getFittedSample()

Accessor to the fitted sample.

getFormula()

Accessor to the formula.

getInputSample()

Accessor to the input sample.

getLeverages()

Accessor to the leverages.

getMetaModel()

Accessor to the metamodel.

getName()

Accessor to the object's name.

getNoiseDistribution()

Accessor to the noise distribution, ie the underlying distribution of the residual.

getOutputSample()

Accessor to the output sample.

getRSquared()

Accessor to the R-squared test.

getRelativeErrors()

Accessor to the relative errors.

getResiduals()

Accessor to the residuals.

getResidualsVariance()

Accessor to the unbiased sample variance of the residuals.

getSampleResiduals()

Accessor to the residuals.

getStandardizedResiduals()

Accessor to the standardized residuals.

hasIntercept()

Returns if intercept is provided in the basis or not.

hasName()

Test if the object is named.

involvesModelSelection()

Get the model selection flag.

setInputSample(sampleX)

Accessor to the input sample.

setInvolvesModelSelection(involvesModelSelection)

Set the model selection flag.

setMetaModel(metaModel)

Accessor to the metamodel.

setName(name)

Accessor to the object's name.

setOutputSample(sampleY)

Accessor to the output sample.

setRelativeErrors(relativeErrors)

Accessor to the relative errors.

setResiduals(residuals)

Accessor to the residuals.

__init__(*args)
buildMethod()

Accessor to the least squares method.

Returns:
leastSquaresMethod: LeastSquaresMethod

The least squares method.

getAdjustedRSquared()

Accessor to the Adjusted R-squared test.

Returns:
adjustedRSquaredfloat

Not defined when degrees of freedom is null.

getBasis()

Accessor to the basis.

Returns:
basisBasis

The basis.

getClassName()

Accessor to the object’s name.

Returns:
class_namestr

The object class name (object.__class__.__name__).

getCoefficients()

Accessor to the coefficients of the linear model of the trend.

Returns:
coefficientsPoint
getCoefficientsNames()

Accessor to the coefficients names.

Returns:
coefficientsNamesDescription
getCoefficientsStandardErrors()

Accessor to the coefficients of standard error.

Returns:
standardErrorsPoint
getCookDistances()

Accessor to the cook’s distances.

Returns:
cookDistancesPoint
getDegreesOfFreedom()

Accessor to the degrees of freedom.

Returns:
dofint

Sample size minus basis size, a null value is allowed.

getDesign()

Accessor to the design matrix.

Returns:
design: Matrix

The design matrix.

getDiagonalGramInverse()

Accessor to the diagonal gram inverse matrix.

Returns:
diagonalGramInversePoint
getFittedSample()

Accessor to the fitted sample.

Returns:
outputSampleSample
getFormula()

Accessor to the formula.

Returns:
condensedFormulastr
getInputSample()

Accessor to the input sample.

Returns:
inputSampleSample

The input sample.

getLeverages()

Accessor to the leverages.

Returns:
leveragesPoint
getMetaModel()

Accessor to the metamodel.

Returns:
metaModelFunction

Metamodel.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getNoiseDistribution()

Accessor to the noise distribution, ie the underlying distribution of the residual.

Returns:
noiseDistributionDistribution

Not defined when degrees of freedom is null.

getOutputSample()

Accessor to the output sample.

Returns:
outputSampleSample

The output sample.

getRSquared()

Accessor to the R-squared test.

Returns:
rSquaredfloat
getRelativeErrors()

Accessor to the relative errors.

Returns:
relativeErrorsPoint

The relative errors defined as follows for each output of the model: \displaystyle \frac{\sum_{i=1}^N (y_i - \hat{y_i})^2}{N \Var{\vect{Y}}} with \vect{Y} the vector of the N model’s values y_i and \hat{y_i} the metamodel’s values.

getResiduals()

Accessor to the residuals.

Returns:
residualsPoint

The residual values defined as follows for each output of the model: \displaystyle \frac{\sqrt{\sum_{i=1}^N (y_i - \hat{y_i})^2}}{N} with y_i the N model’s values and \hat{y_i} the metamodel’s values.

getResidualsVariance()

Accessor to the unbiased sample variance of the residuals.

Returns:
residualsVariancefloat
getSampleResiduals()

Accessor to the residuals.

Returns:
sampleResidualsSample
getStandardizedResiduals()

Accessor to the standardized residuals.

Returns:
standardizedResidualsSample
hasIntercept()

Returns if intercept is provided in the basis or not.

Returns:
interceptBool
hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

involvesModelSelection()

Get the model selection flag.

A model selection method can be used to select the coefficients to best predict the output. Model selection can lead to a sparse model.

Returns:
involvesModelSelectionbool

True if the method involves a model selection method.

setInputSample(sampleX)

Accessor to the input sample.

Parameters:
inputSampleSample

The input sample.

setInvolvesModelSelection(involvesModelSelection)

Set the model selection flag.

A model selection method can be used to select the coefficients to best predict the output. Model selection can lead to a sparse model.

Parameters:
involvesModelSelectionbool

True if the method involves a model selection method.

setMetaModel(metaModel)

Accessor to the metamodel.

Parameters:
metaModelFunction

Metamodel.

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.

setOutputSample(sampleY)

Accessor to the output sample.

Parameters:
outputSampleSample

The output sample.

setRelativeErrors(relativeErrors)

Accessor to the relative errors.

Parameters:
relativeErrorssequence of float

The relative errors defined as follows for each output of the model: \displaystyle \frac{\sum_{i=1}^N (y_i - \hat{y_i})^2}{N \Var{\vect{Y}}} with \vect{Y} the vector of the N model’s values y_i and \hat{y_i} the metamodel’s values.

setResiduals(residuals)

Accessor to the residuals.

Parameters:
residualssequence of float

The residual values defined as follows for each output of the model: \displaystyle \frac{\sqrt{\sum_{i=1}^N (y_i - \hat{y_i})^2}}{N} with y_i the N model’s values and \hat{y_i} the metamodel’s values.

Examples using the class

Build and validate a linear model

Build and validate a linear model

Create a linear model

Create a linear model

Perform stepwise regression

Perform stepwise regression