This file is indexed.

/usr/share/doc/octave/octave.html/Tests.html is in octave-doc 4.2.2-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Tests (GNU Octave)</title>

<meta name="description" content="Tests (GNU Octave)">
<meta name="keywords" content="Tests (GNU Octave)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Statistics.html#Statistics" rel="up" title="Statistics">
<link href="Random-Number-Generation.html#Random-Number-Generation" rel="next" title="Random Number Generation">
<link href="Distributions.html#Distributions" rel="prev" title="Distributions">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<a name="Tests"></a>
<div class="header">
<p>
Next: <a href="Random-Number-Generation.html#Random-Number-Generation" accesskey="n" rel="next">Random Number Generation</a>, Previous: <a href="Distributions.html#Distributions" accesskey="p" rel="prev">Distributions</a>, Up: <a href="Statistics.html#Statistics" accesskey="u" rel="up">Statistics</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Tests-1"></a>
<h3 class="section">26.6 Tests</h3>

<p>Octave can perform many different statistical tests.  The following
table summarizes the available tests.
</p>
<table>
<thead><tr><th width="40%">Hypothesis</th><th width="50%">Test Functions</th></tr></thead>
<tr><td width="40%">Equal mean values</td><td width="50%"><code>anova</code>, <code>hotelling_test2</code>, <code>t_test_2</code>,
       <code>welch_test</code>, <code>wilcoxon_test</code>, <code>z_test_2</code></td></tr>
<tr><td width="40%">Equal medians</td><td width="50%"><code>kruskal_wallis_test</code>, <code>sign_test</code></td></tr>
<tr><td width="40%">Equal variances</td><td width="50%"><code>bartlett_test</code>, <code>manova</code>, <code>var_test</code></td></tr>
<tr><td width="40%">Equal distributions</td><td width="50%"><code>chisquare_test_homogeneity</code>, <code>kolmogorov_smirnov_test_2</code>,
       <code>u_test</code></td></tr>
<tr><td width="40%">Equal marginal frequencies</td><td width="50%"><code>mcnemar_test</code></td></tr>
<tr><td width="40%">Equal success probabilities</td><td width="50%"><code>prop_test_2</code></td></tr>
<tr><td width="40%">Independent observations</td><td width="50%"><code>chisquare_test_independence</code>, <code>run_test</code></td></tr>
<tr><td width="40%">Uncorrelated observations</td><td width="50%"><code>cor_test</code></td></tr>
<tr><td width="40%">Given mean value</td><td width="50%"><code>hotelling_test</code>, <code>t_test</code>, <code>z_test</code></td></tr>
<tr><td width="40%">Observations from given distribution</td><td width="50%"><code>kolmogorov_smirnov_test</code></td></tr>
<tr><td width="40%">Regression</td><td width="50%"><code>f_test_regression</code>, <code>t_test_regression</code></td></tr>
</table>

<p>The tests return a p-value that describes the outcome of the test.
Assuming that the test hypothesis is true, the p-value is the probability
of obtaining a worse result than the observed one.  So large p-values
corresponds to a successful test.  Usually a test hypothesis is accepted
if the p-value exceeds 0.05.
</p>
<a name="XREFanova"></a><dl>
<dt><a name="index-anova"></a>: <em>[<var>pval</var>, <var>f</var>, <var>df_b</var>, <var>df_w</var>] =</em> <strong>anova</strong> <em>(<var>y</var>, <var>g</var>)</em></dt>
<dd><p>Perform a one-way analysis of variance (ANOVA).
</p>
<p>The goal is to test whether the population means of data taken from
<var>k</var> different groups are all equal.
</p>
<p>Data may be given in a single vector <var>y</var> with groups specified by a
corresponding vector of group labels <var>g</var> (e.g., numbers from 1 to
<var>k</var>).  This is the general form which does not impose any restriction
on the number of data in each group or the group labels.
</p>
<p>If <var>y</var> is a matrix and <var>g</var> is omitted, each column of <var>y</var> is
treated as a group.  This form is only appropriate for balanced ANOVA in
which the numbers of samples from each group are all equal.
</p>
<p>Under the null of constant means, the statistic <var>f</var> follows an F
distribution with <var>df_b</var> and <var>df_w</var> degrees of freedom.
</p>
<p>The p-value (1 minus the CDF of this distribution at <var>f</var>) is returned
in <var>pval</var>.
</p>
<p>If no output argument is given, the standard one-way ANOVA table is printed.
</p>
<p><strong>See also:</strong> <a href="#XREFmanova">manova</a>.
</p></dd></dl>


<a name="XREFbartlett_005ftest"></a><dl>
<dt><a name="index-bartlett_005ftest"></a>: <em>[<var>pval</var>, <var>chisq</var>, <var>df</var>] =</em> <strong>bartlett_test</strong> <em>(<var>x1</var>, &hellip;)</em></dt>
<dd><p>Perform a Bartlett test for the homogeneity of variances in the data
vectors <var>x1</var>, <var>x2</var>, &hellip;, <var>xk</var>, where <var>k</var> &gt; 1.
</p>
<p>Under the null of equal variances, the test statistic <var>chisq</var>
approximately follows a chi-square distribution with <var>df</var> degrees of
freedom.
</p>
<p>The p-value (1 minus the CDF of this distribution at <var>chisq</var>) is
returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value is displayed.
</p></dd></dl>


<a name="XREFchisquare_005ftest_005fhomogeneity"></a><dl>
<dt><a name="index-chisquare_005ftest_005fhomogeneity"></a>: <em>[<var>pval</var>, <var>chisq</var>, <var>df</var>] =</em> <strong>chisquare_test_homogeneity</strong> <em>(<var>x</var>, <var>y</var>, <var>c</var>)</em></dt>
<dd><p>Given two samples <var>x</var> and <var>y</var>, perform a chisquare test for
homogeneity of the null hypothesis that <var>x</var> and <var>y</var> come from
the same distribution, based on the partition induced by the
(strictly increasing) entries of <var>c</var>.
</p>
<p>For large samples, the test statistic <var>chisq</var> approximately follows a
chisquare distribution with <var>df</var> = <code>length (<var>c</var>)</code> degrees of
freedom.
</p>
<p>The p-value (1 minus the CDF of this distribution at <var>chisq</var>) is
returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value is displayed.
</p></dd></dl>


<a name="XREFchisquare_005ftest_005findependence"></a><dl>
<dt><a name="index-chisquare_005ftest_005findependence"></a>: <em>[<var>pval</var>, <var>chisq</var>, <var>df</var>] =</em> <strong>chisquare_test_independence</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Perform a chi-square test for independence based on the contingency table
<var>x</var>.
</p>
<p>Under the null hypothesis of independence, <var>chisq</var> approximately has a
chi-square distribution with <var>df</var> degrees of freedom.
</p>
<p>The p-value (1 minus the CDF of this distribution at chisq) of the test is
returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value is displayed.
</p></dd></dl>


<a name="XREFcor_005ftest"></a><dl>
<dt><a name="index-cor_005ftest"></a>: <em></em> <strong>cor_test</strong> <em>(<var>x</var>, <var>y</var>, <var>alt</var>, <var>method</var>)</em></dt>
<dd><p>Test whether two samples <var>x</var> and <var>y</var> come from uncorrelated
populations.
</p>
<p>The optional argument string <var>alt</var> describes the alternative
hypothesis, and can be <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code> (nonzero), <code>&quot;&gt;&quot;</code>
(greater than 0), or <code>&quot;&lt;&quot;</code> (less than 0).  The default is the
two-sided case.
</p>
<p>The optional argument string <var>method</var> specifies which correlation
coefficient to use for testing.  If <var>method</var> is <code>&quot;pearson&quot;</code>
(default), the (usual) Pearson&rsquo;s product moment correlation coefficient is
used.  In this case, the data should come from a bivariate normal
distribution.  Otherwise, the other two methods offer nonparametric
alternatives.  If <var>method</var> is <code>&quot;kendall&quot;</code>, then Kendall&rsquo;s rank
correlation tau is used.  If <var>method</var> is <code>&quot;spearman&quot;</code>, then
Spearman&rsquo;s rank correlation rho is used.  Only the first character is
necessary.
</p>
<p>The output is a structure with the following elements:
</p>
<dl compact="compact">
<dt><var>pval</var></dt>
<dd><p>The p-value of the test.
</p>
</dd>
<dt><var>stat</var></dt>
<dd><p>The value of the test statistic.
</p>
</dd>
<dt><var>dist</var></dt>
<dd><p>The distribution of the test statistic.
</p>
</dd>
<dt><var>params</var></dt>
<dd><p>The parameters of the null distribution of the test statistic.
</p>
</dd>
<dt><var>alternative</var></dt>
<dd><p>The alternative hypothesis.
</p>
</dd>
<dt><var>method</var></dt>
<dd><p>The method used for testing.
</p></dd>
</dl>

<p>If no output argument is given, the p-value is displayed.
</p></dd></dl>


<a name="XREFf_005ftest_005fregression"></a><dl>
<dt><a name="index-f_005ftest_005fregression"></a>: <em>[<var>pval</var>, <var>f</var>, <var>df_num</var>, <var>df_den</var>] =</em> <strong>f_test_regression</strong> <em>(<var>y</var>, <var>x</var>, <var>rr</var>, <var>r</var>)</em></dt>
<dd><p>Perform an F test for the null hypothesis rr * b = r in a
classical normal regression model y = X * b + e.
</p>
<p>Under the null, the test statistic <var>f</var> follows an F distribution with
<var>df_num</var> and <var>df_den</var> degrees of freedom.
</p>
<p>The p-value (1 minus the CDF of this distribution at <var>f</var>) is returned
in <var>pval</var>.
</p>
<p>If not given explicitly, <var>r</var> = 0.
</p>
<p>If no output argument is given, the p-value is displayed.
</p></dd></dl>


<a name="XREFhotelling_005ftest"></a><dl>
<dt><a name="index-hotelling_005ftest"></a>: <em>[<var>pval</var>, <var>tsq</var>] =</em> <strong>hotelling_test</strong> <em>(<var>x</var>, <var>m</var>)</em></dt>
<dd><p>For a sample <var>x</var> from a multivariate normal distribution with unknown
mean and covariance matrix, test the null hypothesis that
<code>mean (<var>x</var>) == <var>m</var></code>.
</p>
<p>Hotelling&rsquo;s <em>T^2</em> is returned in <var>tsq</var>.  Under the null,
<em>(n-p) T^2 / (p(n-1))</em> has an F distribution with <em>p</em> and
<em>n-p</em> degrees of freedom, where <em>n</em> and <em>p</em> are the
numbers of samples and variables, respectively.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed.
</p></dd></dl>


<a name="XREFhotelling_005ftest_005f2"></a><dl>
<dt><a name="index-hotelling_005ftest_005f2"></a>: <em>[<var>pval</var>, <var>tsq</var>] =</em> <strong>hotelling_test_2</strong> <em>(<var>x</var>, <var>y</var>)</em></dt>
<dd><p>For two samples <var>x</var> from multivariate normal distributions with
the same number of variables (columns), unknown means and unknown
equal covariance matrices, test the null hypothesis <code>mean
(<var>x</var>) == mean (<var>y</var>)</code>.
</p>
<p>Hotelling&rsquo;s two-sample <em>T^2</em> is returned in <var>tsq</var>.  Under the null,
</p>
<div class="example">
<pre class="example">(n_x+n_y-p-1) T^2 / (p(n_x+n_y-2))
</pre></div>

<p>has an F distribution with <em>p</em> and <em>n_x+n_y-p-1</em> degrees of
freedom, where <em>n_x</em> and <em>n_y</em> are the sample sizes and
<em>p</em> is the number of variables.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed.
</p></dd></dl>


<a name="XREFkolmogorov_005fsmirnov_005ftest"></a><dl>
<dt><a name="index-kolmogorov_005fsmirnov_005ftest"></a>: <em>[<var>pval</var>, <var>ks</var>] =</em> <strong>kolmogorov_smirnov_test</strong> <em>(<var>x</var>, <var>dist</var>, <var>params</var>, <var>alt</var>)</em></dt>
<dd><p>Perform a Kolmogorov-Smirnov test of the null hypothesis that the
sample <var>x</var> comes from the (continuous) distribution <var>dist</var>.
</p>
<p>if F and G are the CDFs corresponding to the sample and dist,
respectively, then the null is that F == G.
</p>
<p>The optional argument <var>params</var> contains a list of parameters of
<var>dist</var>.  For example, to test whether a sample <var>x</var> comes from
a uniform distribution on [2,4], use
</p>
<div class="example">
<pre class="example">kolmogorov_smirnov_test (x, &quot;unif&quot;, 2, 4)
</pre></div>

<p><var>dist</var> can be any string for which a function <var>distcdf</var>
that calculates the CDF of distribution <var>dist</var> exists.
</p>
<p>With the optional argument string <var>alt</var>, the alternative of interest
can be selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
is tested against the two-sided alternative F != G.  In this case, the
test statistic <var>ks</var> follows a two-sided Kolmogorov-Smirnov
distribution.  If <var>alt</var> is <code>&quot;&gt;&quot;</code>, the one-sided alternative F &gt;
G is considered.  Similarly for <code>&quot;&lt;&quot;</code>, the one-sided alternative F &gt;
G is considered.  In this case, the test statistic <var>ks</var> has a
one-sided Kolmogorov-Smirnov distribution.  The default is the two-sided
case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value is displayed.
</p></dd></dl>


<a name="XREFkolmogorov_005fsmirnov_005ftest_005f2"></a><dl>
<dt><a name="index-kolmogorov_005fsmirnov_005ftest_005f2"></a>: <em>[<var>pval</var>, <var>ks</var>, <var>d</var>] =</em> <strong>kolmogorov_smirnov_test_2</strong> <em>(<var>x</var>, <var>y</var>, <var>alt</var>)</em></dt>
<dd><p>Perform a 2-sample Kolmogorov-Smirnov test of the null hypothesis that the
samples <var>x</var> and <var>y</var> come from the same (continuous) distribution.
</p>
<p>If F and G are the CDFs corresponding to the <var>x</var> and <var>y</var> samples,
respectively, then the null is that F == G.
</p>
<p>With the optional argument string <var>alt</var>, the alternative of interest
can be selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
is tested against the two-sided alternative F != G.  In this case, the
test statistic <var>ks</var> follows a two-sided Kolmogorov-Smirnov
distribution.  If <var>alt</var> is <code>&quot;&gt;&quot;</code>, the one-sided alternative F &gt;
G is considered.  Similarly for <code>&quot;&lt;&quot;</code>, the one-sided alternative F &lt;
G is considered.  In this case, the test statistic <var>ks</var> has a
one-sided Kolmogorov-Smirnov distribution.  The default is the two-sided
case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>The third returned value, <var>d</var>, is the test statistic, the maximum
vertical distance between the two cumulative distribution functions.
</p>
<p>If no output argument is given, the p-value is displayed.
</p></dd></dl>


<a name="XREFkruskal_005fwallis_005ftest"></a><dl>
<dt><a name="index-kruskal_005fwallis_005ftest"></a>: <em>[<var>pval</var>, <var>k</var>, <var>df</var>] =</em> <strong>kruskal_wallis_test</strong> <em>(<var>x1</var>, &hellip;)</em></dt>
<dd><p>Perform a Kruskal-Wallis one-factor analysis of variance.
</p>
<p>Suppose a variable is observed for <var>k</var> &gt; 1 different groups, and let
<var>x1</var>, &hellip;, <var>xk</var> be the corresponding data vectors.
</p>
<p>Under the null hypothesis that the ranks in the pooled sample are not
affected by the group memberships, the test statistic <var>k</var> is
approximately chi-square with <var>df</var> = <var>k</var> - 1 degrees of freedom.
</p>
<p>If the data contains ties (some value appears more than once)
<var>k</var> is divided by
</p>
<p>1 - <var>sum_ties</var> / (<var>n</var>^3 - <var>n</var>)
</p>
<p>where <var>sum_ties</var> is the sum of <var>t</var>^2 - <var>t</var> over each group of
ties where <var>t</var> is the number of ties in the group and <var>n</var> is the
total number of values in the input data.  For more info on this
adjustment see William H. Kruskal and W. Allen Wallis,
<cite>Use of Ranks in One-Criterion Variance Analysis</cite>,
Journal of the American Statistical Association, Vol. 47, No. 260 (Dec
1952).
</p>
<p>The p-value (1 minus the CDF of this distribution at <var>k</var>) is returned
in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value is displayed.
</p></dd></dl>


<a name="XREFmanova"></a><dl>
<dt><a name="index-manova"></a>: <em></em> <strong>manova</strong> <em>(<var>x</var>, <var>g</var>)</em></dt>
<dd><p>Perform a one-way multivariate analysis of variance (MANOVA).
</p>
<p>The goal is to test whether the p-dimensional population means of data
taken from <var>k</var> different groups are all equal.  All data are assumed
drawn independently from p-dimensional normal distributions with the same
covariance matrix.
</p>
<p>The data matrix is given by <var>x</var>.  As usual, rows are observations and
columns are variables.  The vector <var>g</var> specifies the corresponding
group labels (e.g., numbers from 1 to <var>k</var>).
</p>
<p>The LR test statistic (Wilks&rsquo; Lambda) and approximate p-values are
computed and displayed.
</p>
<p><strong>See also:</strong> <a href="#XREFanova">anova</a>.
</p></dd></dl>


<a name="XREFmcnemar_005ftest"></a><dl>
<dt><a name="index-mcnemar_005ftest"></a>: <em>[<var>pval</var>, <var>chisq</var>, <var>df</var>] =</em> <strong>mcnemar_test</strong> <em>(<var>x</var>)</em></dt>
<dd><p>For a square contingency table <var>x</var> of data cross-classified on the row
and column variables, McNemar&rsquo;s test can be used for testing the
null hypothesis of symmetry of the classification probabilities.
</p>
<p>Under the null, <var>chisq</var> is approximately distributed as chisquare with
<var>df</var> degrees of freedom.
</p>
<p>The p-value (1 minus the CDF of this distribution at <var>chisq</var>) is
returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed.
</p></dd></dl>


<a name="XREFprop_005ftest_005f2"></a><dl>
<dt><a name="index-prop_005ftest_005f2"></a>: <em>[<var>pval</var>, <var>z</var>] =</em> <strong>prop_test_2</strong> <em>(<var>x1</var>, <var>n1</var>, <var>x2</var>, <var>n2</var>, <var>alt</var>)</em></dt>
<dd><p>If <var>x1</var> and <var>n1</var> are the counts of successes and trials in one
sample, and <var>x2</var> and <var>n2</var> those in a second one, test the null
hypothesis that the success probabilities <var>p1</var> and <var>p2</var> are the
same.
</p>
<p>Under the null, the test statistic <var>z</var> approximately follows a
standard normal distribution.
</p>
<p>With the optional argument string <var>alt</var>, the alternative of interest
can be selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
is tested against the two-sided alternative <var>p1</var> != <var>p2</var>.  If
<var>alt</var> is <code>&quot;&gt;&quot;</code>, the one-sided alternative <var>p1</var> &gt; <var>p2</var> is
used.  Similarly for <code>&quot;&lt;&quot;</code>, the one-sided alternative
<var>p1</var> &lt; <var>p2</var> is used.  The default is the two-sided case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed.
</p></dd></dl>


<a name="XREFrun_005ftest"></a><dl>
<dt><a name="index-run_005ftest"></a>: <em>[<var>pval</var>, <var>chisq</var>] =</em> <strong>run_test</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Perform a chi-square test with 6 degrees of freedom based on the upward
runs in the columns of <var>x</var>.
</p>
<p><code>run_test</code> can be used to decide whether <var>x</var> contains independent
data.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value is displayed.
</p></dd></dl>


<a name="XREFsign_005ftest"></a><dl>
<dt><a name="index-sign_005ftest"></a>: <em>[<var>pval</var>, <var>b</var>, <var>n</var>] =</em> <strong>sign_test</strong> <em>(<var>x</var>, <var>y</var>, <var>alt</var>)</em></dt>
<dd><p>For two matched-pair samples <var>x</var> and <var>y</var>, perform a sign test
of the null hypothesis
PROB (<var>x</var> &gt; <var>y</var>) == PROB (<var>x</var> &lt; <var>y</var>) == 1/2.
</p>
<p>Under the null, the test statistic <var>b</var> roughly follows a
binomial distribution with parameters
<code><var>n</var> = sum (<var>x</var> != <var>y</var>)</code> and <var>p</var> = 1/2.
</p>
<p>With the optional argument <code>alt</code>, the alternative of interest can be
selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
hypothesis is tested against the two-sided alternative
PROB (<var>x</var> &lt; <var>y</var>) != 1/2.  If <var>alt</var> is <code>&quot;&gt;&quot;</code>, the one-sided
alternative PROB (<var>x</var> &gt; <var>y</var>) &gt; 1/2 (&quot;x is stochastically greater
than y&quot;) is considered.  Similarly for <code>&quot;&lt;&quot;</code>, the one-sided
alternative PROB (<var>x</var> &gt; <var>y</var>) &lt; 1/2 (&quot;x is stochastically less than
y&quot;) is considered.  The default is the two-sided case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed.
</p></dd></dl>


<a name="XREFt_005ftest"></a><dl>
<dt><a name="index-t_005ftest"></a>: <em>[<var>pval</var>, <var>t</var>, <var>df</var>] =</em> <strong>t_test</strong> <em>(<var>x</var>, <var>m</var>, <var>alt</var>)</em></dt>
<dd><p>For a sample <var>x</var> from a normal distribution with unknown mean and
variance, perform a t-test of the null hypothesis
<code>mean (<var>x</var>) == <var>m</var></code>.
</p>
<p>Under the null, the test statistic <var>t</var> follows a Student distribution
with <code><var>df</var> = length (<var>x</var>) - 1</code> degrees of freedom.
</p>
<p>With the optional argument string <var>alt</var>, the alternative of interest
can be selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
is tested against the two-sided alternative <code>mean (<var>x</var>) !=
<var>m</var></code>.  If <var>alt</var> is <code>&quot;&gt;&quot;</code>, the one-sided alternative
<code>mean (<var>x</var>) &gt; <var>m</var></code> is considered.  Similarly for <var>&quot;&lt;&quot;</var>,
the one-sided alternative <code>mean (<var>x</var>) &lt; <var>m</var></code> is considered.
The default is the two-sided case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed.
</p></dd></dl>


<a name="XREFt_005ftest_005f2"></a><dl>
<dt><a name="index-t_005ftest_005f2"></a>: <em>[<var>pval</var>, <var>t</var>, <var>df</var>] =</em> <strong>t_test_2</strong> <em>(<var>x</var>, <var>y</var>, <var>alt</var>)</em></dt>
<dd><p>For two samples x and y from normal distributions with unknown means and
unknown equal variances, perform a two-sample t-test of the null
hypothesis of equal means.
</p>
<p>Under the null, the test statistic <var>t</var> follows a Student distribution
with <var>df</var> degrees of freedom.
</p>
<p>With the optional argument string <var>alt</var>, the alternative of interest
can be selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
is tested against the two-sided alternative <code>mean (<var>x</var>) != mean
(<var>y</var>)</code>.  If <var>alt</var> is <code>&quot;&gt;&quot;</code>, the one-sided alternative
<code>mean (<var>x</var>) &gt; mean (<var>y</var>)</code> is used.  Similarly for
<code>&quot;&lt;&quot;</code>, the one-sided alternative <code>mean (<var>x</var>) &lt; mean
(<var>y</var>)</code> is used.  The default is the two-sided case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed.
</p></dd></dl>


<a name="XREFt_005ftest_005fregression"></a><dl>
<dt><a name="index-t_005ftest_005fregression"></a>: <em>[<var>pval</var>, <var>t</var>, <var>df</var>] =</em> <strong>t_test_regression</strong> <em>(<var>y</var>, <var>x</var>, <var>rr</var>, <var>r</var>, <var>alt</var>)</em></dt>
<dd><p>Perform a t test for the null hypothesis
<code><var>rr</var> * <var>b</var> = <var>r</var></code> in a classical normal
regression model <code><var>y</var> = <var>x</var> * <var>b</var> + <var>e</var></code>.
</p>
<p>Under the null, the test statistic <var>t</var> follows a <var>t</var> distribution
with <var>df</var> degrees of freedom.
</p>
<p>If <var>r</var> is omitted, a value of 0 is assumed.
</p>
<p>With the optional argument string <var>alt</var>, the alternative of interest
can be selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
is tested against the two-sided alternative <code><var>rr</var> *
<var>b</var> != <var>r</var></code>.  If <var>alt</var> is <code>&quot;&gt;&quot;</code>, the one-sided
alternative <code><var>rr</var> * <var>b</var> &gt; <var>r</var></code> is used.
Similarly for <var>&quot;&lt;&quot;</var>, the one-sided alternative <code><var>rr</var>
* <var>b</var> &lt; <var>r</var></code> is used.  The default is the two-sided case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed.
</p></dd></dl>


<a name="XREFu_005ftest"></a><dl>
<dt><a name="index-u_005ftest"></a>: <em>[<var>pval</var>, <var>z</var>] =</em> <strong>u_test</strong> <em>(<var>x</var>, <var>y</var>, <var>alt</var>)</em></dt>
<dd><p>For two samples <var>x</var> and <var>y</var>, perform a Mann-Whitney U-test of
the null hypothesis
PROB (<var>x</var> &gt; <var>y</var>) == 1/2 == PROB (<var>x</var> &lt; <var>y</var>).
</p>
<p>Under the null, the test statistic <var>z</var> approximately follows a
standard normal distribution.  Note that this test is equivalent to the
Wilcoxon rank-sum test.
</p>
<p>With the optional argument string <var>alt</var>, the alternative of interest
can be selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
is tested against the two-sided alternative
PROB (<var>x</var> &gt; <var>y</var>) != 1/2.  If <var>alt</var> is <code>&quot;&gt;&quot;</code>, the one-sided
alternative PROB (<var>x</var> &gt; <var>y</var>) &gt; 1/2 is considered.  Similarly for
<code>&quot;&lt;&quot;</code>, the one-sided alternative PROB (<var>x</var> &gt; <var>y</var>) &lt; 1/2 is
considered.  The default is the two-sided case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed.
</p></dd></dl>


<a name="XREFvar_005ftest"></a><dl>
<dt><a name="index-var_005ftest"></a>: <em>[<var>pval</var>, <var>f</var>, <var>df_num</var>, <var>df_den</var>] =</em> <strong>var_test</strong> <em>(<var>x</var>, <var>y</var>, <var>alt</var>)</em></dt>
<dd><p>For two samples <var>x</var> and <var>y</var> from normal distributions with
unknown means and unknown variances, perform an F-test of the null
hypothesis of equal variances.
</p>
<p>Under the null, the test statistic <var>f</var> follows an F-distribution with
<var>df_num</var> and <var>df_den</var> degrees of freedom.
</p>
<p>With the optional argument string <var>alt</var>, the alternative of interest
can be selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
is tested against the two-sided alternative <code>var (<var>x</var>) != var
(<var>y</var>)</code>.  If <var>alt</var> is <code>&quot;&gt;&quot;</code>, the one-sided alternative
<code>var (<var>x</var>) &gt; var (<var>y</var>)</code> is used.  Similarly for &quot;&lt;&quot;, the
one-sided alternative <code>var (<var>x</var>) &gt; var (<var>y</var>)</code> is used.  The
default is the two-sided case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed.
</p></dd></dl>


<a name="XREFwelch_005ftest"></a><dl>
<dt><a name="index-welch_005ftest"></a>: <em>[<var>pval</var>, <var>t</var>, <var>df</var>] =</em> <strong>welch_test</strong> <em>(<var>x</var>, <var>y</var>, <var>alt</var>)</em></dt>
<dd><p>For two samples <var>x</var> and <var>y</var> from normal distributions with
unknown means and unknown and not necessarily equal variances,
perform a Welch test of the null hypothesis of equal means.
</p>
<p>Under the null, the test statistic <var>t</var> approximately follows a
Student distribution with <var>df</var> degrees of freedom.
</p>
<p>With the optional argument string <var>alt</var>, the alternative of interest
can be selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
is tested against the two-sided alternative
<code>mean (<var>x</var>) != <var>m</var></code>.  If <var>alt</var> is <code>&quot;&gt;&quot;</code>, the
one-sided alternative mean(x) &gt; <var>m</var> is considered.  Similarly for
<code>&quot;&lt;&quot;</code>, the one-sided alternative mean(x) &lt; <var>m</var> is considered.
The default is the two-sided case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed.
</p></dd></dl>


<a name="XREFwilcoxon_005ftest"></a><dl>
<dt><a name="index-wilcoxon_005ftest"></a>: <em>[<var>pval</var>, <var>z</var>] =</em> <strong>wilcoxon_test</strong> <em>(<var>x</var>, <var>y</var>, <var>alt</var>)</em></dt>
<dd><p>For two matched-pair sample vectors <var>x</var> and <var>y</var>, perform a
Wilcoxon signed-rank test of the null hypothesis
PROB (<var>x</var> &gt; <var>y</var>) == 1/2.
</p>
<p>Under the null, the test statistic <var>z</var> approximately follows a
standard normal distribution when <var>n</var> &gt; 25.
</p>
<p><strong>Caution:</strong> This function assumes a normal distribution for <var>z</var>
and thus is invalid for <var>n</var> &le; 25.
</p>
<p>With the optional argument string <var>alt</var>, the alternative of interest
can be selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
is tested against the two-sided alternative
PROB (<var>x</var> &gt; <var>y</var>) != 1/2.  If alt is <code>&quot;&gt;&quot;</code>, the one-sided
alternative PROB (<var>x</var> &gt; <var>y</var>) &gt; 1/2 is considered.  Similarly for
<code>&quot;&lt;&quot;</code>, the one-sided alternative PROB (<var>x</var> &gt; <var>y</var>) &lt; 1/2 is
considered.  The default is the two-sided case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed.
</p></dd></dl>


<a name="XREFz_005ftest"></a><dl>
<dt><a name="index-z_005ftest"></a>: <em>[<var>pval</var>, <var>z</var>] =</em> <strong>z_test</strong> <em>(<var>x</var>, <var>m</var>, <var>v</var>, <var>alt</var>)</em></dt>
<dd><p>Perform a Z-test of the null hypothesis <code>mean (<var>x</var>) == <var>m</var></code>
for a sample <var>x</var> from a normal distribution with unknown mean and known
variance <var>v</var>.
</p>
<p>Under the null, the test statistic <var>z</var> follows a standard normal
distribution.
</p>
<p>With the optional argument string <var>alt</var>, the alternative of interest
can be selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
is tested against the two-sided alternative
<code>mean (<var>x</var>) != <var>m</var></code>.  If <var>alt</var> is <code>&quot;&gt;&quot;</code>, the
one-sided alternative <code>mean (<var>x</var>) &gt; <var>m</var></code> is considered.
Similarly for <code>&quot;&lt;&quot;</code>, the one-sided alternative
<code>mean (<var>x</var>) &lt; <var>m</var></code> is considered.  The default is the two-sided
case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed along
with some information.
</p></dd></dl>


<a name="XREFz_005ftest_005f2"></a><dl>
<dt><a name="index-z_005ftest_005f2"></a>: <em>[<var>pval</var>, <var>z</var>] =</em> <strong>z_test_2</strong> <em>(<var>x</var>, <var>y</var>, <var>v_x</var>, <var>v_y</var>, <var>alt</var>)</em></dt>
<dd><p>For two samples <var>x</var> and <var>y</var> from normal distributions with unknown
means and known variances <var>v_x</var> and <var>v_y</var>, perform a Z-test of the
hypothesis of equal means.
</p>
<p>Under the null, the test statistic <var>z</var> follows a standard normal
distribution.
</p>
<p>With the optional argument string <var>alt</var>, the alternative of interest
can be selected.  If <var>alt</var> is <code>&quot;!=&quot;</code> or <code>&quot;&lt;&gt;&quot;</code>, the null
is tested against the two-sided alternative
<code>mean (<var>x</var>) != mean (<var>y</var>)</code>.  If alt is <code>&quot;&gt;&quot;</code>, the
one-sided alternative <code>mean (<var>x</var>) &gt; mean (<var>y</var>)</code> is used.
Similarly for <code>&quot;&lt;&quot;</code>, the one-sided alternative
<code>mean (<var>x</var>) &lt; mean (<var>y</var>)</code> is used.  The default is the
two-sided case.
</p>
<p>The p-value of the test is returned in <var>pval</var>.
</p>
<p>If no output argument is given, the p-value of the test is displayed along
with some information.
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="Random-Number-Generation.html#Random-Number-Generation" accesskey="n" rel="next">Random Number Generation</a>, Previous: <a href="Distributions.html#Distributions" accesskey="p" rel="prev">Distributions</a>, Up: <a href="Statistics.html#Statistics" accesskey="u" rel="up">Statistics</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>