LinearModelTest_LinearModelHarrisonMcCabe¶

LinearModelTest_LinearModelHarrisonMcCabe
(*args)¶ Test the homoskedasticity of the linear regression model residuals.
Available usages:
LinearModelTest.LinearModelHarrisonMcCabe(firstSample, secondSample)
LinearModelTest.LinearModelHarrisonMcCabe(firstSample, secondSample, linearModel)
LinearModelTest.LinearModelHarrisonMcCabe(firstSample, secondSample, level, breakPoint, simulationSize)
LinearModelTest.LinearModelHarrisonMcCabe(firstSample, secondSample, linearModel, level, breakPoint, simulationSize)
Parameters:  fisrtSample : 2d sequence of float
First tested sample, of dimension 1.
 secondSample : 2d sequence of float
Second tested sample, of dimension 1.
 linearModel :
LinearModel
A linear model. If not provided, it is built using the given samples.
 level : positive float
Threshold pvalue of the test (= 1  first type risk), it must be , equal to 0.95 by default.
 breakPoint : positive float
Percentage of data to be taken as breakPoint in the variances. It must be , equal to 0.5 by default.
 simulationSize : positive int
Size of the sample used to compute the pvalue. Default is 1000.
Returns:  testResult :
TestResult
Structure containing the result of the test.
See also
LinearModelTest_LinearModelBreuschPagan
,LinearModelTest_LinearModelResidualMean
,LinearModelTest_LinearModelDurbinWatson
Notes
The LinearModelTest class is used through its static methods in order to evaluate the quality of the linear regression model between two samples (see
LinearModel
). The linear regression model between the scalar variable and the dimensional one is as follows:where is the residual.
The HarrisonMcCabe test checks the heteroskedasticity of the residuals. The breakpoint in the variances is set by default to the half of the sample. The pvalue is estimed using simulation. If the binary quality measure is false, then the homoskedasticity hypothesis can be rejected with respect to the given level.
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.LinearModelHarrisonMcCabe(firstSample, secondSample) >>> print(test_result) class=TestResult name=Unnamed type=HarrisonMcCabe binaryQualityMeasure=true pvalue threshold=0.95 pvalue=0.142 description=[]