-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdiagnostic.html
666 lines (428 loc) · 35.8 KB
/
diagnostic.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" href="_static/favicon.ico">
<title>Regression Diagnostics and Specification Tests - statsmodels 0.15.0 (+617)</title>
<link rel="icon" type="image/png" sizes="32x32" href="_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="_static/icons/favicon-16x16.png">
<link rel="manifest" href="_static/icons/site.webmanifest">
<link rel="mask-icon" href="_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="_static/icons/browserconfig.xml">
<link rel="stylesheet" href="_static/stylesheets/examples.css">
<link rel="stylesheet" href="_static/stylesheets/deprecation.css">
<meta name="theme-color" content="#4051b5">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<link rel="stylesheet" type="text/css" href="_static/sphinx_immaterial_theme.02cb18745d09eea51.min.css?v=ff456132" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=fd3f3429" />
<link rel="stylesheet" type="text/css" href="_static/plot_directive.css" />
<script>__md_scope=new URL(".",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="" data-md-color-primary="indigo" data-md-color-accent="blue">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
</div>
<div data-md-component="announce">
</div>
<div data-md-component="outdated" hidden>
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="index.html" title="statsmodels 0.15.0 (+617)" class="md-header__button md-logo" aria-label="statsmodels 0.15.0 (+617)" data-md-component="logo">
<img src="_static/statsmodels-logo-v2-bw.svg" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
statsmodels 0.15.0 (+617)
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Regression Diagnostics and Specification Tests
</span>
</div>
</div>
</div>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://github.com/statsmodels/statsmodels/" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="index.html" title="statsmodels 0.15.0 (+617)" class="md-nav__button md-logo" aria-label="statsmodels 0.15.0 (+617)" data-md-component="logo">
<img src="_static/statsmodels-logo-v2-bw.svg" alt="logo">
</a>
statsmodels 0.15.0 (+617)
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels/" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="install.html" class="md-nav__link">
<span title="/install.rst (reference label)" class="md-ellipsis">Installing statsmodels</span>
</a>
</li>
<li class="md-nav__item">
<a href="gettingstarted.html" class="md-nav__link">
<span title="/gettingstarted.rst (reference label)" class="md-ellipsis">Getting started</span>
</a>
</li>
<li class="md-nav__item">
<a href="user-guide.html" class="md-nav__link">
<span title="/user-guide.rst (reference label)" class="md-ellipsis">User Guide</span>
</a>
</li>
<li class="md-nav__item">
<a href="examples/index.html" class="md-nav__link">
<span title="/examples/index.rst (reference label)" class="md-ellipsis">Examples</span>
</a>
</li>
<li class="md-nav__item">
<a href="api.html" class="md-nav__link">
<span title="/api.rst (reference label)" class="md-ellipsis">API Reference</span>
</a>
</li>
<li class="md-nav__item">
<a href="about.html" class="md-nav__link">
<span title="/about.rst (reference label)" class="md-ellipsis">About statsmodels</span>
</a>
</li>
<li class="md-nav__item">
<a href="dev/index.html" class="md-nav__link">
<span title="/dev/index.rst (reference label)" class="md-ellipsis">Developer Page</span>
</a>
</li>
<li class="md-nav__item">
<a href="release/index.html" class="md-nav__link">
<span title="/release/index.rst (reference label)" class="md-ellipsis">Release Notes</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="regression-diagnostics-and-specification-tests"><span id="diagnostics"></span>Regression Diagnostics and Specification Tests<a class="headerlink" href="#regression-diagnostics-and-specification-tests" title="Link to this heading">¶</a></h1>
<h2 id="introduction">Introduction<a class="headerlink" href="#introduction" title="Link to this heading">¶</a></h2>
<p>In many cases of statistical analysis, we are not sure whether our statistical
model is correctly specified. For example when using ols, then linearity and
homoscedasticity are assumed, some test statistics additionally assume that
the errors are normally distributed or that we have a large sample.
Since our results depend on these statistical assumptions, the results are
only correct of our assumptions hold (at least approximately).</p>
<p>One solution to the problem of uncertainty about the correct specification is
to use robust methods, for example robust regression or robust covariance
(sandwich) estimators. The second approach is to test whether our sample is
consistent with these assumptions.</p>
<p>The following briefly summarizes specification and diagnostics tests for
linear regression.</p>
<h2 id="heteroscedasticity-tests">Heteroscedasticity Tests<a class="headerlink" href="#heteroscedasticity-tests" title="Link to this heading">¶</a></h2>
<p>For these test the null hypothesis is that all observations have the same
error variance, i.e. errors are homoscedastic. The tests differ in which kind
of heteroscedasticity is considered as alternative hypothesis. They also vary
in the power of the test for different types of heteroscedasticity.</p>
<dl class="simple">
<dt><a class="reference internal" href="generated/statsmodels.stats.diagnostic.het_breuschpagan.html#statsmodels.stats.diagnostic.het_breuschpagan" title="statsmodels.stats.diagnostic.het_breuschpagan (Python function) — Breusch-Pagan Lagrange Multiplier test for heteroscedasticity"><code class="xref py py-func docutils literal notranslate"><span class="pre">het_breuschpagan</span></code></a></dt><dd><p>Lagrange Multiplier Heteroscedasticity Test by Breusch-Pagan</p>
</dd>
<dt><a class="reference internal" href="generated/statsmodels.stats.diagnostic.het_white.html#statsmodels.stats.diagnostic.het_white" title="statsmodels.stats.diagnostic.het_white (Python function) — White's Lagrange Multiplier Test for Heteroscedasticity."><code class="xref py py-func docutils literal notranslate"><span class="pre">het_white</span></code></a></dt><dd><p>Lagrange Multiplier Heteroscedasticity Test by White</p>
</dd>
<dt><a class="reference internal" href="generated/statsmodels.stats.diagnostic.het_goldfeldquandt.html#statsmodels.stats.diagnostic.het_goldfeldquandt" title="statsmodels.stats.diagnostic.het_goldfeldquandt (Python function) — Goldfeld-Quandt homoskedasticity test."><code class="xref py py-func docutils literal notranslate"><span class="pre">het_goldfeldquandt</span></code></a></dt><dd><p>test whether variance is the same in 2 subsamples</p>
</dd>
</dl>
<h2 id="autocorrelation-tests">Autocorrelation Tests<a class="headerlink" href="#autocorrelation-tests" title="Link to this heading">¶</a></h2>
<p>This group of test whether the regression residuals are not autocorrelated.
They assume that observations are ordered by time.</p>
<dl class="simple">
<dt><code class="xref py py-func docutils literal notranslate"><span class="pre">durbin_watson</span></code></dt><dd><ul class="simple">
<li><p>Durbin-Watson test for no autocorrelation of residuals</p></li>
<li><p>printed with summary()</p></li>
</ul>
</dd>
<dt><a class="reference internal" href="generated/statsmodels.stats.diagnostic.acorr_ljungbox.html#statsmodels.stats.diagnostic.acorr_ljungbox" title="statsmodels.stats.diagnostic.acorr_ljungbox (Python function) — Ljung-Box test of autocorrelation in residuals."><code class="xref py py-func docutils literal notranslate"><span class="pre">acorr_ljungbox</span></code></a></dt><dd><ul class="simple">
<li><p>Ljung-Box test for no autocorrelation of residuals</p></li>
<li><p>also returns Box-Pierce statistic</p></li>
</ul>
</dd>
<dt><a class="reference internal" href="generated/statsmodels.stats.diagnostic.acorr_breusch_godfrey.html#statsmodels.stats.diagnostic.acorr_breusch_godfrey" title="statsmodels.stats.diagnostic.acorr_breusch_godfrey (Python function) — Breusch-Godfrey Lagrange Multiplier tests for residual autocorrelation."><code class="xref py py-func docutils literal notranslate"><span class="pre">acorr_breusch_godfrey</span></code></a></dt><dd><ul class="simple">
<li><p>Breusch-Pagan test for no autocorrelation of residuals</p></li>
</ul>
</dd>
<dt>missing</dt><dd><ul class="simple">
<li><p>?</p></li>
</ul>
</dd>
</dl>
<h2 id="non-linearity-tests">Non-Linearity Tests<a class="headerlink" href="#non-linearity-tests" title="Link to this heading">¶</a></h2>
<dl class="simple">
<dt><a class="reference internal" href="generated/statsmodels.stats.diagnostic.linear_harvey_collier.html#statsmodels.stats.diagnostic.linear_harvey_collier" title="statsmodels.stats.diagnostic.linear_harvey_collier (Python function) — Harvey Collier test for linearity"><code class="xref py py-func docutils literal notranslate"><span class="pre">linear_harvey_collier</span></code></a></dt><dd><ul class="simple">
<li><p>Multiplier test for Null hypothesis that linear specification is
correct</p></li>
</ul>
</dd>
<dt><code class="xref py py-func docutils literal notranslate"><span class="pre">acorr_linear_rainbow</span></code></dt><dd><ul class="simple">
<li><p>Multiplier test for Null hypothesis that linear specification is
correct.</p></li>
</ul>
</dd>
<dt><code class="xref py py-func docutils literal notranslate"><span class="pre">acorr_linear_lm</span></code></dt><dd><ul class="simple">
<li><p>Lagrange Multiplier test for Null hypothesis that linear specification is
correct. This tests against specific functional alternatives.</p></li>
</ul>
</dd>
<dt><a class="reference internal" href="generated/statsmodels.stats.diagnostic.spec_white.html#statsmodels.stats.diagnostic.spec_white" title="statsmodels.stats.diagnostic.spec_white (Python function) — White's Two-Moment Specification Test"><code class="xref py py-func docutils literal notranslate"><span class="pre">spec_white</span></code></a></dt><dd><ul class="simple">
<li><p>White’s two-moment specification test with null hypothesis of homoscedastic
and correctly specified.</p></li>
</ul>
</dd>
</dl>
<h2 id="tests-for-structural-change-parameter-stability">Tests for Structural Change, Parameter Stability<a class="headerlink" href="#tests-for-structural-change-parameter-stability" title="Link to this heading">¶</a></h2>
<p>Test whether all or some regression coefficient are constant over the
entire data sample.</p>
<h3 id="known-change-point">Known Change Point<a class="headerlink" href="#known-change-point" title="Link to this heading">¶</a></h3>
<dl class="simple">
<dt>OneWayLS :</dt><dd><ul class="simple">
<li><p>flexible ols wrapper for testing identical regression coefficients across
predefined subsamples (eg. groups)</p></li>
</ul>
</dd>
<dt>missing</dt><dd><ul class="simple">
<li><p>predictive test: Greene, number of observations in subsample is smaller than
number of regressors</p></li>
</ul>
</dd>
</dl>
<h3 id="unknown-change-point">Unknown Change Point<a class="headerlink" href="#unknown-change-point" title="Link to this heading">¶</a></h3>
<dl class="simple">
<dt><a class="reference internal" href="generated/statsmodels.stats.diagnostic.breaks_cusumolsresid.html#statsmodels.stats.diagnostic.breaks_cusumolsresid" title="statsmodels.stats.diagnostic.breaks_cusumolsresid (Python function) — Cusum test for parameter stability based on ols residuals."><code class="xref py py-func docutils literal notranslate"><span class="pre">breaks_cusumolsresid</span></code></a></dt><dd><ul class="simple">
<li><p>cusum test for parameter stability based on ols residuals</p></li>
</ul>
</dd>
<dt><a class="reference internal" href="generated/statsmodels.stats.diagnostic.breaks_hansen.html#statsmodels.stats.diagnostic.breaks_hansen" title="statsmodels.stats.diagnostic.breaks_hansen (Python function) — Test for model stability, breaks in parameters for ols, Hansen 1992"><code class="xref py py-func docutils literal notranslate"><span class="pre">breaks_hansen</span></code></a></dt><dd><ul class="simple">
<li><p>test for model stability, breaks in parameters for ols, Hansen 1992</p></li>
</ul>
</dd>
<dt><a class="reference internal" href="generated/statsmodels.stats.diagnostic.recursive_olsresiduals.html#statsmodels.stats.diagnostic.recursive_olsresiduals" title="statsmodels.stats.diagnostic.recursive_olsresiduals (Python function) — Calculate recursive ols with residuals and Cusum test statistic"><code class="xref py py-func docutils literal notranslate"><span class="pre">recursive_olsresiduals</span></code></a></dt><dd><p>Calculate recursive ols with residuals and cusum test statistic. This is
currently mainly helper function for recursive residual based tests.
However, since it uses recursive updating and does not estimate separate
problems it should be also quite efficient as expanding OLS function.</p>
</dd>
<dt>missing</dt><dd><ul class="simple">
<li><p>supLM, expLM, aveLM (Andrews, Andrews/Ploberger)</p></li>
<li><p>R-structchange also has musum (moving cumulative sum tests)</p></li>
<li><p>test on recursive parameter estimates, which are there?</p></li>
</ul>
</dd>
</dl>
<h2 id="multicollinearity-tests">Multicollinearity Tests<a class="headerlink" href="#multicollinearity-tests" title="Link to this heading">¶</a></h2>
<dl class="simple">
<dt>conditionnum (statsmodels.stattools)</dt><dd><ul class="simple">
<li><p>– needs test vs Stata –</p></li>
<li><p>cf Grene (3rd ed.) pp 57-8</p></li>
</ul>
</dd>
<dt>numpy.linalg.cond</dt><dd><ul class="simple">
<li><p>(for more general condition numbers, but no behind the scenes help for
design preparation)</p></li>
</ul>
</dd>
<dt>Variance Inflation Factors</dt><dd><p>This is currently together with influence and outlier measures
(with some links to other tests here: <a class="reference external" href="http://www.stata.com/help.cgi?vif">http://www.stata.com/help.cgi?vif</a>)</p>
</dd>
</dl>
<h2 id="normality-and-distribution-tests">Normality and Distribution Tests<a class="headerlink" href="#normality-and-distribution-tests" title="Link to this heading">¶</a></h2>
<dl class="simple">
<dt><code class="xref py py-func docutils literal notranslate"><span class="pre">jarque_bera</span></code></dt><dd><ul class="simple">
<li><p>printed with summary()</p></li>
<li><p>test for normal distribution of residuals</p></li>
</ul>
</dd>
<dt>Normality tests in scipy stats</dt><dd><p>need to find list again</p>
</dd>
<dt><code class="xref py py-func docutils literal notranslate"><span class="pre">omni_normtest</span></code></dt><dd><ul class="simple">
<li><p>test for normal distribution of residuals</p></li>
<li><p>printed with summary()</p></li>
</ul>
</dd>
<dt><a class="reference internal" href="generated/statsmodels.stats.diagnostic.normal_ad.html#statsmodels.stats.diagnostic.normal_ad" title="statsmodels.stats.diagnostic.normal_ad (Python function) — Anderson-Darling test for normal distribution unknown mean and variance."><code class="xref py py-func docutils literal notranslate"><span class="pre">normal_ad</span></code></a></dt><dd><ul class="simple">
<li><p>Anderson Darling test for normality with estimated mean and variance</p></li>
</ul>
</dd>
<dt><a class="reference internal" href="generated/statsmodels.stats.diagnostic.kstest_normal.html#statsmodels.stats.diagnostic.kstest_normal" title="statsmodels.stats.diagnostic.kstest_normal (Python function) — Test assumed normal or exponential distribution using Lilliefors' test."><code class="xref py py-func docutils literal notranslate"><span class="pre">kstest_normal</span></code></a> <a class="reference internal" href="generated/statsmodels.stats.diagnostic.lilliefors.html#statsmodels.stats.diagnostic.lilliefors" title="statsmodels.stats.diagnostic.lilliefors (Python function) — Test assumed normal or exponential distribution using Lilliefors' test."><code class="xref py py-func docutils literal notranslate"><span class="pre">lilliefors</span></code></a></dt><dd><p>Lilliefors test for normality, this is a Kolmogorov-Smirnov tes with for
normality with estimated mean and variance. lilliefors is an alias for
kstest_normal</p>
</dd>
</dl>
<p>qqplot, scipy.stats.probplot</p>
<dl class="simple">
<dt>other goodness-of-fit tests for distributions in scipy.stats and enhancements</dt><dd><ul class="simple">
<li><p>kolmogorov-smirnov</p></li>
<li><p>anderson : Anderson-Darling</p></li>
<li><p>likelihood-ratio, …</p></li>
<li><p>chisquare tests, powerdiscrepancy : needs wrapping (for binning)</p></li>
</ul>
</dd>
</dl>
<h2 id="outlier-and-influence-diagnostic-measures">Outlier and Influence Diagnostic Measures<a class="headerlink" href="#outlier-and-influence-diagnostic-measures" title="Link to this heading">¶</a></h2>
<p>These measures try to identify observations that are outliers, with large
residual, or observations that have a large influence on the regression
estimates. Robust Regression, RLM, can be used to both estimate in an outlier
robust way as well as identify outlier. The advantage of RLM that the
estimation results are not strongly influenced even if there are many
outliers, while most of the other measures are better in identifying
individual outliers and might not be able to identify groups of outliers.</p>
<dl>
<dt><a class="reference internal" href="generated/statsmodels.robust.robust_linear_model.RLM.html#statsmodels.robust.robust_linear_model.RLM" title="statsmodels.robust.robust_linear_model.RLM (Python class) — Robust Linear Model"><code class="xref py py-class docutils literal notranslate"><span class="pre">RLM</span></code></a></dt><dd><p>example from example_rlm.py</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><code><span class="kn">import</span><span class="w"> </span><span class="nn">statsmodels.api</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">sm</span>
<span class="c1">### Example for using Huber's T norm with the default</span>
<span class="c1">### median absolute deviation scaling</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">sm</span><span class="o">.</span><span class="n">datasets</span><span class="o">.</span><span class="n">stackloss</span><span class="o">.</span><span class="n">load</span><span class="p">()</span>
<span class="n">data</span><span class="o">.</span><span class="n">exog</span> <span class="o">=</span> <span class="n">sm</span><span class="o">.</span><span class="n">add_constant</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">exog</span><span class="p">)</span>
<span class="n">huber_t</span> <span class="o">=</span> <span class="n">sm</span><span class="o">.</span><span class="n">RLM</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">endog</span><span class="p">,</span> <span class="n">data</span><span class="o">.</span><span class="n">exog</span><span class="p">,</span> <span class="n">M</span><span class="o">=</span><span class="n">sm</span><span class="o">.</span><span class="n">robust</span><span class="o">.</span><span class="n">norms</span><span class="o">.</span><span class="n">HuberT</span><span class="p">())</span>
<span class="n">hub_results</span> <span class="o">=</span> <span class="n">huber_t</span><span class="o">.</span><span class="n">fit</span><span class="p">()</span>
<span class="nb">print</span><span class="p">(</span><span class="n">hub_results</span><span class="o">.</span><span class="n">weights</span><span class="p">)</span>
</code></pre></div>
</div>
<p>And the weights give an idea of how much a particular observation is
down-weighted according to the scaling asked for.</p>
</dd>
<dt><a class="reference internal" href="generated/statsmodels.stats.outliers_influence.OLSInfluence.html#statsmodels.stats.outliers_influence.OLSInfluence" title="statsmodels.stats.outliers_influence.OLSInfluence (Python class) — class to calculate outlier and influence measures for OLS result"><code class="xref py py-class docutils literal notranslate"><span class="pre">Influence</span></code></a></dt><dd><p>Class in stats.outliers_influence, most standard measures for outliers
and influence are available as methods or attributes given a fitted
OLS model. This is mainly written for OLS, some but not all measures
are also valid for other models.
Some of these statistics can be calculated from an OLS results instance,
others require that an OLS is estimated for each left out variable.</p>
<ul class="simple">
<li><p>resid_press</p></li>
<li><p>resid_studentized_external</p></li>
<li><p>resid_studentized_internal</p></li>
<li><p>ess_press</p></li>
<li><p>hat_matrix_diag</p></li>
<li><p>cooks_distance - Cook’s Distance <a class="reference external" href="https://en.wikipedia.org/wiki/Cook%27s_distance">Wikipedia</a> (with some other links)</p></li>
<li><p>cov_ratio</p></li>
<li><p>dfbetas</p></li>
<li><p>dffits</p></li>
<li><p>dffits_internal</p></li>
<li><p>det_cov_params_not_obsi</p></li>
<li><p>params_not_obsi</p></li>
<li><p>sigma2_not_obsi</p></li>
</ul>
</dd>
</dl>
<hr>
<div class="md-source-file">
<small>
Last update:
Feb 19, 2025
</small>
</div>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2025, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Created using
<a href="https://www.sphinx-doc.org/" target="_blank" rel="noopener">Sphinx</a>
7.3.7.
and
<a href="https://github.com/jbms/sphinx-immaterial/" target="_blank" rel="noopener">Sphinx-Immaterial</a>
</div>
<div class="md-social">
<a href="https://github.com/statsmodels/statsmodels/" target="_blank" rel="noopener" title="Source on github.com" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
</a>
<a href="https://pypi.org/project/statsmodels/" target="_blank" rel="noopener" title="pypi.org" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z"/></svg>
</a>
<a href="https://doi.org/10.5281/zenodo.593847" target="_blank" rel="noopener" title="doi.org" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M0 216C0 149.7 53.7 96 120 96h8c17.7 0 32 14.3 32 32s-14.3 32-32 32h-8c-30.9 0-56 25.1-56 56v8h64c35.3 0 64 28.7 64 64v64c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V216zm256 0c0-66.3 53.7-120 120-120h8c17.7 0 32 14.3 32 32s-14.3 32-32 32h-8c-30.9 0-56 25.1-56 56v8h64c35.3 0 64 28.7 64 64v64c0 35.3-28.7 64-64 64h-64c-35.3 0-64-28.7-64-64V216z"/></svg>
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": ".", "features": [], "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "version": {"provider": "mike", "staticVersions": null, "versionPath": "../versions-v3.json"}}</script>
<script src="_static/sphinx_immaterial_theme.f9d9eeeb247ace16c.min.js?v=8ec58cb5"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
</body>
</html>