1%feature("docstring") OT::LinearModelAnalysis
2"Analyse a linear model.
3
4Available constructors:
5    LinearModelAnalysis(linearModelResult)
6
7Parameters
8----------
9linearModelResult : :class:`~openturns.LinearModelResult`
10    A linear model result.
11
12See Also
13--------
14LinearModelResult
15
16Notes
17-----
18This class relies on a linear model result structure and performs diagnostic
19of linearity. This diagnostic mainly relies on graphics and a `summary` like
20function (pretty-print)
21
22By default, on graphs, labels of the 3 most significant points are displayed.
23This number can be changed by modifying the ResourceMap key
24(``LinearModelAnalysis-Identifiers``).
25
26Examples
27--------
28>>> import openturns as ot
29>>> ot.RandomGenerator.SetSeed(0)
30>>> distribution = ot.Normal()
31>>> Xsample = distribution.getSample(30)
32>>> func = ot.SymbolicFunction(['x'], ['2 * x + 1'])
33>>> Ysample = func(Xsample) + ot.Normal().getSample(30)
34>>> algo = ot.LinearModelAlgorithm(Ysample, Xsample)
35>>> result = algo.getResult()
36>>> analysis = ot.LinearModelAnalysis(result)
37"
38
39// ---------------------------------------------------------------------
40
41%feature("docstring") OT::LinearModelAnalysis::getLinearModelResult
42"Accessor to the linear model result.
43
44Returns
45-------
46linearModelResult : :class:`~openturns.LinearModelResult`
47    The  linear model result which had been passed to the constructor."
48
49// ---------------------------------------------------------------------
50
51%feature("docstring") OT::LinearModelAnalysis::getCoefficientsTScores
52"Accessor to the coefficients of linear expansion over their standard error.
53
54Returns
55-------
56tScores : :class:`~openturns.Point`
57"
58
59// ---------------------------------------------------------------------
60
61%feature("docstring") OT::LinearModelAnalysis::getCoefficientsPValues
62"Accessor to the coefficients of the p values.
63
64Returns
65-------
66pValues : :class:`~openturns.Point`
67"
68// ---------------------------------------------------------------------
69
70%feature("docstring") OT::LinearModelAnalysis::getCoefficientsConfidenceInterval
71"Accessor to the confidence interval of level :math:`\alpha` for the coefficients
72of the linear expansion
73
74Returns
75-------
76confidenceInterval : :class:`~openturns.Interval`
77"
78
79// ---------------------------------------------------------------------
80
81%feature("docstring") OT::LinearModelAnalysis::getFisherScore
82"Accessor to the Fisher test.
83
84Returns
85-------
86fisherScore : float
87"
88
89// ---------------------------------------------------------------------
90
91%feature("docstring") OT::LinearModelAnalysis::getFisherPValue
92"Accessor to the Fisher p value.
93
94Returns
95-------
96fisherPValue : float
97"
98
99// ---------------------------------------------------------------------
100
101%feature("docstring") OT::LinearModelAnalysis::getNormalityTestResultChiSquared
102"Performs Chi-Square test.
103The statistical test checks the Gaussian assumption of the model (null hypothesis).
104
105Returns
106-------
107testResult : :class:`~openturns.TestResult`
108    Test result class.
109
110Notes
111-----
112The Chi-Square test is a goodness of fit test which objective is to check the
113normality assumption (null hypothesis) of residuals (and thus the model).
114
115Usually, Chi-Square test applies for discrete distributions. Here we rely on
116the :class:`~openturns.FittingTest_ChiSquared` to check the normality.
117"
118
119// ---------------------------------------------------------------------
120
121%feature("docstring") OT::LinearModelAnalysis::getNormalityTestResultKolmogorovSmirnov
122"Performs Kolmogorov test.
123
124Performs Kolmogorov test to check Gaussian assumption of the model (null hypothesis).
125
126Returns
127-------
128testResult : :class:`~openturns.TestResult`
129    Test result class.
130
131
132Notes
133-----
134We check that the residual is Gaussian thanks to :class:`~openturns.FittingTest::Kolmogorov`."
135
136// ---------------------------------------------------------------------
137
138%feature("docstring") OT::LinearModelAnalysis::getNormalityTestResultAndersonDarling
139"Performs Anderson-Darling test.
140The statistical test checks the Gaussian assumption of the model (null hypothesis).
141
142Returns
143-------
144testResult : :class:`~openturns.TestResult`
145    Test result class.
146
147
148Notes
149-----
150We check that the residual is Gaussian thanks to :class:`~openturns.NormalityTest::AndersonDarling`."
151
152// ---------------------------------------------------------------------
153
154%feature("docstring") OT::LinearModelAnalysis::getNormalityTestCramerVonMises
155"Performs Cramer-Von Mises test.
156
157The statistical test checks the Gaussian assumption of the model (null hypothesis).
158
159Returns
160-------
161testResult : :class:`~openturns.TestResult`
162    Test result class.
163
164
165Notes
166-----
167We check that the residual is Gaussian thanks to :class:`~openturns.NormalityTest::CramerVonMisesNormal`."
168
169// ---------------------------------------------------------------------
170
171%feature("docstring") OT::LinearModelAnalysis::drawModelVsFitted
172"Accessor to plot of model versus fitted values.
173
174Returns
175-------
176graph : :class:`~openturns.Graph`
177"
178
179// ---------------------------------------------------------------------
180%feature("docstring") OT::LinearModelAnalysis::drawResidualsVsFitted
181"Accessor to plot of residuals versus fitted values.
182
183Returns
184-------
185graph : :class:`~openturns.Graph`
186"
187
188// ---------------------------------------------------------------------
189
190%feature("docstring") OT::LinearModelAnalysis::drawScaleLocation
191"Accessor to a Scale-Location plot of sqrt(abs(residuals)) versus fitted values.
192
193Returns
194-------
195graph : :class:`~openturns.Graph`
196"
197
198// ---------------------------------------------------------------------
199
200%feature("docstring") OT::LinearModelAnalysis::drawQQplot
201"Accessor to plot a Normal quantiles-quantiles plot of standardized residuals.
202
203Returns
204-------
205graph : :class:`~openturns.Graph`
206"
207
208// ---------------------------------------------------------------------
209
210%feature("docstring") OT::LinearModelAnalysis::drawCookDistance
211"Accessor to plot of Cook's distances versus row labels.
212
213Returns
214-------
215graph : :class:`~openturns.Graph`
216"
217
218// ---------------------------------------------------------------------
219
220%feature("docstring") OT::LinearModelAnalysis::drawResidualsVsLeverages
221"Accessor to plot of residuals versus leverages that adds bands corresponding to Cook's distances of 0.5 and 1.
222
223Returns
224-------
225graph : :class:`~openturns.Graph`
226"
227
228// ---------------------------------------------------------------------
229
230%feature("docstring") OT::LinearModelAnalysis::drawCookVsLeverages
231"Accessor to plot of Cook's distances versus leverage/(1-leverage).
232
233Returns
234-------
235graph : :class:`~openturns.Graph`
236"
237
238