# LinearModelTest_LinearModelResidualMean¶

LinearModelTest_LinearModelResidualMean(*args)

Test zero mean value of the residual of the linear regression model.

Available usages:

LinearModelTest.LinearModelResidualMean(firstSample, secondSample)

LinearModelTest.LinearModelResidualMean(firstSample, secondSample, level)

LinearModelTest.LinearModelResidualMean(firstSample, secondSample, linearModelResult)

LinearModelTest.LinearModelResidualMean(firstSample, secondSample, linearModelResult, level)

Parameters
firstSample2-d sequence of float

First tested sample, of dimension 1.

secondSample2-d sequence of float

Second tested sample, of dimension 1.

linearModelResultLinearModelResult

A linear model. If not provided, it is built using the given samples.

levelpositive float Threshold p-value of the test (= first kind risk), it must be , equal to 0.05 by default.

Returns
testResultTestResult

Structure containing the result of the test.

Notes

The LinearModelTest class is used through its static methods in order to evaluate the quality of the linear regression model between two samples. The linear regression model between the scalar variable and the -dimensional one is as follows: where is the residual, supposed to follow the standard Normal distribution.

The LinearModelResidualMean Test checks, under the hypothesis of a gaussian sample, if the mean of the residual is equal to zero. It is based on the Student test (equality of mean for two gaussian samples).

Examples

>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> distribution = ot.Normal()
>>> sample = distribution.getSample(30)
>>> func = ot.SymbolicFunction('x', '2 * x + 1')
>>> firstSample = sample
>>> secondSample = func(sample) + ot.Normal().getSample(30)
>>> test_result = ot.LinearModelTest.LinearModelResidualMean(firstSample, secondSample)