# GeneralLinearModelResult¶

class GeneralLinearModelResult(*args)

General linear model result.

Parameters:
inputSample, outputSampleSample

The samples and .

metaModelFunction

The meta model: , defined in :eq:metaModel.

residualsPoint

The residual errors.

relativeErrorsPoint

The relative errors.

basisBasis

Functional basis of size : for each . Its size should be equal to zero if the trend is not estimated.

trendCoefsequence of float

The trend coefficients vectors stored as a Point.

covarianceModelCovarianceModel

Covariance function of the Gaussian process with its optimized parameters.

optimalLogLikelihoodfloat

The maximum log-likelihood corresponding to the model.

Notes

The structure is usually created by the method run() of a GeneralLinearModelAlgorithm, and obtained thanks to the getResult() method.

The meta model is defined by:

(1)

where and are the trend functions (the marginal of varphi(x)).

(2)

Examples

Create the model and the samples:

>>> import openturns as ot
>>> f = ot.SymbolicFunction(['x'],  ['x * sin(x)'])
>>> sampleX = [[1.0], [2.0], [3.0], [4.0], [5.0], [6.0]]
>>> sampleY = f(sampleX)


Create the algorithm:

>>> basis = ot.Basis([ot.SymbolicFunction(['x'], ['x']), ot.SymbolicFunction(['x'], ['x^2'])])
>>> covarianceModel = ot.GeneralizedExponential([2.0], 2.0)
>>> algo = ot.GeneralLinearModelAlgorithm(sampleX, sampleY, covarianceModel, basis)
>>> algo.run()


Get the result:

>>> result = algo.getResult()


Get the meta model:

>>> metaModel = result.getMetaModel()
>>> graph = metaModel.draw(0.0, 7.0)
>>> cloud = ot.Cloud(sampleX, sampleY)
>>> cloud.setPointStyle('fcircle')
>>> graph = ot.Graph()
>>> graph.setColors(['black', 'blue', 'red'])


Methods

 Accessor to the functional basis. Accessor to the object's name. Accessor to the covariance model. Accessor to the object's id. Accessor to the input sample. Accessor to the metamodel. Accessor to the object's name. Accessor to the Gaussian process. Accessor to the optimal log-likelihood of the model. Accessor to the output sample. Accessor to the relative errors. Accessor to the residuals. Accessor to the object's shadowed id. Accessor to the trend coefficients. Accessor to the object's visibility state. Test if the object is named. Test if the object has a distinguishable name. setInputSample(sampleX) Accessor to the input sample. 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. Accessor to the object's shadowed id. setVisibility(visible) Accessor to the object's visibility state.
__init__(*args)
getBasis()

Accessor to the functional basis.

Returns:
basisBasis

Functional basis of size : for each .

Notes

If the trend is not estimated, the collection is empty.

getClassName()

Accessor to the object’s name.

Returns:
class_namestr

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

getCovarianceModel()

Accessor to the covariance model.

Returns:
covModelCovarianceModel

The covariance model of the Gaussian process W.

getId()

Accessor to the object’s id.

Returns:
idint

Internal unique identifier.

getInputSample()

Accessor to the input sample.

Returns:
inputSampleSample

The input sample.

getMetaModel()

Accessor to the metamodel.

Returns:
metaModelFunction

Metamodel.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getNoise()

Accessor to the Gaussian process.

Returns:
processProcess

Returns the Gaussian process with the optimized parameters.

getOptimalLogLikelihood()

Accessor to the optimal log-likelihood of the model.

Returns:
optimalLogLikelihoodfloat

The value of the log-likelihood corresponding to the model.

getOutputSample()

Accessor to the output sample.

Returns:
outputSampleSample

The output sample.

getRelativeErrors()

Accessor to the relative errors.

Returns:
relativeErrorsPoint

The relative errors defined as follows for each output of the model: with the vector of the model’s values and the metamodel’s values.

getResiduals()

Accessor to the residuals.

Returns:
residualsPoint

The residual values defined as follows for each output of the model: with the model’s values and the metamodel’s values.

Accessor to the object’s shadowed id.

Returns:
idint

Internal unique identifier.

getTrendCoefficients()

Accessor to the trend coefficients.

Returns:
trendCoefsequence of float

The trend coefficients vectors stored as a Point.

getVisibility()

Accessor to the object’s visibility state.

Returns:
visiblebool

Visibility flag.

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:
hasVisibleNamebool

True if the name is not empty and not the default one.

setInputSample(sampleX)

Accessor to the input sample.

Parameters:
inputSampleSample

The input sample.

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:

The relative errors defined as follows for each output of the model: with the vector of the model’s values and 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: with the model’s values and the metamodel’s values.

Accessor to the object’s shadowed id.

Parameters:
idint

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:
visiblebool

Visibility flag.

## Examples using the class¶

Create a general linear model metamodel

Create a general linear model metamodel