annotate scripts/statistics/tests/manova.m @ 21633:dcf8922b724b

Deprecate printf, puts, and scanf. Make fputs a M-file. * libinterp/corefcn/file-io.cc: extracted printf, puts, and scanf to M-files. * scripts/deprecated/printf.m: new function, equivalent to version file-io.cc. * scripts/deprecated/puts.m: new function, equivalent to version file-io.cc. * scripts/deprecated/scanf.m: new function, equivalent to version file-io.cc. * scripts/deprecated/module.mk: added printf, puts, and scanf. * scripts/io/fputs.m: new function, equivalent to version file-io.cc. * scripts/io/module.mk: added fputs. * doc/interpreter/io.txi: adapted documentation to current implementation. * NEWS: announced changes. * doc/interpreter/basics.txi: replaced printf by fprintf. * doc/interpreter/stmt.txi: replaced printf by fprintf. * doc/interpreter/var.txi: replaced printf by fprintf. * doc/refcard/refcard.tex: removed printf and scanf. * examples/code/@FIRfilter/display.m: replaced printf by fprintf. * examples/code/@polynomial/display.m: replaced printf by fprintf. * scripts/@ftp/display.m: replaced printf by fprintf. * scripts/general/inputParser.m: replaced printf by fprintf. * scripts/general/methods.m: replaced printf by fprintf. * scripts/general/profexplore.m: replaced printf by fprintf. * scripts/general/profshow.m: replaced printf by fprintf. * scripts/help/help.m: replaced puts by fputs and printf by fprintf. * scripts/help/lookfor.m: replaced puts by fputs and printf by fprintf. * scripts/help/which.m: replaced printf by fprintf. * scripts/image/imformats.m: replaced printf by fprintf. * scripts/io/beep.m: replaced puts by fputs. * scripts/io/textread.m: replaced printf by fprintf. * scripts/java/javaclasspath.m: replaced printf by fprintf. * scripts/java/javamem.m: replaced printf by fprintf. * scripts/miscellaneous/dir.m: replaced printf by fprintf. * scripts/miscellaneous/dos.m: replaced printf by fprintf. * scripts/miscellaneous/fact.m: replaced printf by fprintf. * scripts/miscellaneous/info.m: replaced printf by fprintf. * scripts/miscellaneous/license.m: replaced printf by fprintf. * scripts/miscellaneous/ls.m: replaced puts by fputs. * scripts/miscellaneous/menu.m: replaced printf by fprintf. * scripts/miscellaneous/mkoctfile.m: replaced printf by fprintf. * scripts/miscellaneous/private/display_info_file.m: * scripts/miscellaneous/unix.m: replaced printf by fprintf. * scripts/miscellaneous/ver.m: replaced printf by fprintf. * scripts/miscellaneous/what.m: replaced printf by fprintf. * scripts/ode/ode23.m: replaced printf by fprintf. * scripts/ode/ode45.m: replaced printf by fprintf. * scripts/optimization/fminbnd.m: replaced printf by fprintf. * scripts/optimization/optimset.m: replaced puts by fputs and printf by fprintf. * scripts/optimization/sqp.m: replaced printf by fprintf. * scripts/pkg/pkg.m: replaced printf by fprintf. * scripts/pkg/private/describe.m: replaced printf by fprintf. * scripts/pkg/private/install.m: replaced printf by fprintf. * scripts/pkg/private/installed_packages.m: replaced printf by fprintf. * scripts/pkg/private/list_forge_packages.m: replaced puts by fputs and printf by fprintf. * scripts/pkg/private/rebuild.m: replaced printf by fprintf. * scripts/plot/util/__gnuplot_drawnow__.m: replaced puts by fputs and printf by fprintf. * scripts/signal/stft.m: replaced printf by fprintf. * scripts/sparse/bicg.m: replaced printf by fprintf. * scripts/sparse/bicgstab.m: replaced printf by fprintf. * scripts/sparse/cgs.m: replaced printf by fprintf. * scripts/sparse/pcg.m: replaced printf by fprintf. * scripts/sparse/pcr.m: replaced printf by fprintf. * scripts/sparse/qmr.m: replaced printf by fprintf. * scripts/statistics/models/logistic_regression.m: replaced printf by fprintf. * scripts/statistics/tests/anova.m: replaced printf by fprintf. * scripts/statistics/tests/bartlett_test.m: replaced printf by fprintf. * scripts/statistics/tests/chisquare_test_homogeneity.m: replaced printf by fprintf. * scripts/statistics/tests/chisquare_test_independence.m: replaced printf by fprintf. * scripts/statistics/tests/cor_test.m: replaced printf by fprintf. * scripts/statistics/tests/f_test_regression.m: replaced printf by fprintf. * scripts/statistics/tests/hotelling_test.m: replaced printf by fprintf. * scripts/statistics/tests/hotelling_test_2.m: replaced printf by fprintf. * scripts/statistics/tests/kolmogorov_smirnov_test.m: replaced printf by fprintf. * scripts/statistics/tests/kolmogorov_smirnov_test_2.m: replaced printf by fprintf. * scripts/statistics/tests/kruskal_wallis_test.m: replaced printf by fprintf. * scripts/statistics/tests/manova.m: replaced printf by fprintf. * scripts/statistics/tests/mcnemar_test.m: replaced printf by fprintf. * scripts/statistics/tests/prop_test_2.m: replaced printf by fprintf. * scripts/statistics/tests/run_test.m: replaced printf by fprintf. * scripts/statistics/tests/sign_test.m: replaced printf by fprintf. * scripts/statistics/tests/t_test.m: replaced printf by fprintf. * scripts/statistics/tests/t_test_2.m: replaced printf by fprintf. * scripts/statistics/tests/t_test_regression.m: replaced printf by fprintf. * scripts/statistics/tests/u_test.m: replaced printf by fprintf. * scripts/statistics/tests/var_test.m: replaced printf by fprintf. * scripts/statistics/tests/welch_test.m: replaced printf by fprintf. * scripts/statistics/tests/wilcoxon_test.m: replaced printf by fprintf. * scripts/statistics/tests/z_test.m: replaced printf by fprintf. * scripts/statistics/tests/z_test_2.m: replaced printf by fprintf. * scripts/strings/strtok.m: replaced printf by fprintf. * scripts/testfun/__run_test_suite__.m: replaced puts by fputs and printf by fprintf. * scripts/testfun/demo.m: replaced printf by fprintf. * scripts/testfun/example.m: replaced printf by fprintf. * scripts/testfun/private/compare_plot_demos.m: replaced printf by fprintf. * scripts/testfun/rundemos.m: replaced printf by fprintf. * scripts/testfun/runtests.m: replaced puts by fputs and printf by fprintf. * scripts/testfun/speed.m: replaced printf by fprintf. * scripts/testfun/test.m: replaced printf by fprintf. * scripts/time/calendar.m: replaced puts by fputs and printf by fprintf. * test/io.tst: replaced printf by fprintf.
author Kai T. Ohlhus <k.ohlhus@gmail.com>
date Wed, 20 Apr 2016 17:53:10 +0200
parents 516bb87ea72e
children 96518f623c91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19040
diff changeset
1 ## Copyright (C) 1996-2015 Kurt Hornik
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
2 ##
3922
38c61cbf086c [project @ 2002-05-01 06:48:35 by jwe]
jwe
parents: 3456
diff changeset
3 ## This file is part of Octave.
38c61cbf086c [project @ 2002-05-01 06:48:35 by jwe]
jwe
parents: 3456
diff changeset
4 ##
38c61cbf086c [project @ 2002-05-01 06:48:35 by jwe]
jwe
parents: 3456
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
38c61cbf086c [project @ 2002-05-01 06:48:35 by jwe]
jwe
parents: 3456
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6046
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6046
diff changeset
8 ## your option) any later version.
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
9 ##
3922
38c61cbf086c [project @ 2002-05-01 06:48:35 by jwe]
jwe
parents: 3456
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
14 ##
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6046
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6046
diff changeset
17 ## <http://www.gnu.org/licenses/>.
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
18
3454
d8b731d3f7a3 [project @ 2000-01-18 10:13:31 by jwe]
jwe
parents: 3426
diff changeset
19 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20231
diff changeset
20 ## @deftypefn {} {} manova (@var{x}, @var{g})
20174
d9341b422488 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
21 ## Perform a one-way multivariate analysis of variance (MANOVA).
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
22 ##
20174
d9341b422488 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
23 ## The goal is to test whether the p-dimensional population means of data
d9341b422488 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
24 ## taken from @var{k} different groups are all equal. All data are assumed
d9341b422488 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
25 ## drawn independently from p-dimensional normal distributions with the same
d9341b422488 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
26 ## covariance matrix.
d9341b422488 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
27 ##
d9341b422488 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
28 ## The data matrix is given by @var{x}. As usual, rows are observations and
d9341b422488 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
29 ## columns are variables. The vector @var{g} specifies the corresponding
d9341b422488 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
30 ## group labels (e.g., numbers from 1 to @var{k}).
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
31 ##
19040
0850b5212619 doc: Add @nospell macro around proper names in documentation.
Rik <rik@octave.org>
parents: 17785
diff changeset
32 ## The LR test statistic (@nospell{Wilks' Lambda}) and approximate p-values are
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
33 ## computed and displayed.
20174
d9341b422488 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
34 ## @seealso{anova}
3454
d8b731d3f7a3 [project @ 2000-01-18 10:13:31 by jwe]
jwe
parents: 3426
diff changeset
35 ## @end deftypefn
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
36
17785
2a9114104271 manova.m: update of description for 2 disabled tests and 2 error msg fixes
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
37 ## The Hotelling-Lawley and Pillai-Bartlett test statistics are coded.
2a9114104271 manova.m: update of description for 2 disabled tests and 2 error msg fixes
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
38 ## However, they are currently disabled until they can be verified by someone
2a9114104271 manova.m: update of description for 2 disabled tests and 2 error msg fixes
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
39 ## with sufficient understanding of the algorithms. Please feel free to
2a9114104271 manova.m: update of description for 2 disabled tests and 2 error msg fixes
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
40 ## improve this.
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3273
diff changeset
41
3456
434790acb067 [project @ 2000-01-19 06:58:51 by jwe]
jwe
parents: 3454
diff changeset
42 ## Author: TF <Thomas.Fuereder@ci.tuwien.ac.at>
5428
2a16423e4aa0 [project @ 2005-08-23 18:38:27 by jwe]
jwe
parents: 5307
diff changeset
43 ## Adapted-By: KH <Kurt.Hornik@wu-wien.ac.at>
3456
434790acb067 [project @ 2000-01-19 06:58:51 by jwe]
jwe
parents: 3454
diff changeset
44 ## Description: One-way multivariate analysis of variance (MANOVA)
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
45
11469
c776f063fefe Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents: 10680
diff changeset
46 function manova (x, g)
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
47
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
48 if (nargin != 2)
6046
34f96dd5441b [project @ 2006-10-10 16:10:25 by jwe]
jwe
parents: 5428
diff changeset
49 print_usage ();
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
50 endif
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
51
11469
c776f063fefe Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents: 10680
diff changeset
52 if (isvector (x))
17785
2a9114104271 manova.m: update of description for 2 disabled tests and 2 error msg fixes
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
53 error ("manova: X must not be a vector");
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
54 endif
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
55
11469
c776f063fefe Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents: 10680
diff changeset
56 [n, p] = size (x);
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
57
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
58 if (! isvector (g) || (length (g) != n))
17785
2a9114104271 manova.m: update of description for 2 disabled tests and 2 error msg fixes
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17744
diff changeset
59 error ("manova: G must be a vector of length rows (X)");
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
60 endif
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
61
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
62 s = sort (g);
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
63 i = find (s (2:n) > s(1:(n-1)));
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
64 k = length (i) + 1;
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3273
diff changeset
65
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
66 if (k == 1)
3456
434790acb067 [project @ 2000-01-19 06:58:51 by jwe]
jwe
parents: 3454
diff changeset
67 error ("manova: there should be at least 2 groups");
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
68 else
3273
eb27ea9b7ff8 [project @ 1999-10-12 02:22:25 by jwe]
jwe
parents: 3200
diff changeset
69 group_label = s ([1, (reshape (i, 1, k - 1) + 1)]);
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
70 endif
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
71
20231
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20174
diff changeset
72 x -= ones (n, 1) * mean (x);
11469
c776f063fefe Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents: 10680
diff changeset
73 SST = x' * x;
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
74
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
75 s = zeros (1, p);
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
76 SSB = zeros (p, p);
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
77 for i = 1 : k;
11469
c776f063fefe Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents: 10680
diff changeset
78 v = x (find (g == group_label (i)), :);
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
79 s = sum (v);
20231
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20174
diff changeset
80 SSB += s' * s / rows (v);
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
81 endfor
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
82 n_b = k - 1;
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3273
diff changeset
83
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
84 SSW = SST - SSB;
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
85 n_w = n - k;
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
86
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
87 l = real (eig (SSB / SSW));
7795
df9519e9990c Handle single precision eps values
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
88
df9519e9990c Handle single precision eps values
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
89 if (isa (l, "single"))
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
90 l(l < eps ("single")) = 0;
7795
df9519e9990c Handle single precision eps values
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
91 else
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
92 l(l < eps) = 0;
7795
df9519e9990c Handle single precision eps values
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
93 endif
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
94
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
95 ## Wilks' Lambda
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
96 ## =============
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
97
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
98 Lambda = prod (1 ./ (1 + l));
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3273
diff changeset
99
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
100 delta = n_w + n_b - (p + n_b + 1) / 2;
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
101 df_num = p * n_b;
10680
e00de2d5263c Replace calls to obsolete chisquare_cdf with chi2cdf.
Rik <octave@nomad.inbox5.com>
parents: 9245
diff changeset
102 W_pval_1 = 1 - chi2cdf (- delta * log (Lambda), df_num);
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3273
diff changeset
103
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
104 if (p < 3)
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
105 eta = p;
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
106 else
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
107 eta = sqrt ((p^2 * n_b^2 - 4) / (p^2 + n_b^2 - 5));
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
108 endif
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
109
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
110 df_den = delta * eta - df_num / 2 + 1;
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3273
diff changeset
111
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
112 WT = exp (- log (Lambda) / eta) - 1;
13752
6f068e3f3f9c Change f_cdf references to fcdf in statistics/test directory (Bug #34628)
Rik <octave@nomad.inbox5.com>
parents: 11589
diff changeset
113 W_pval_2 = 1 - fcdf (WT * df_den / df_num, df_num, df_den);
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
114
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
115 if (0)
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
116
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
117 ## Hotelling-Lawley Test
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
118 ## =====================
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3273
diff changeset
119
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
120 HL = sum (l);
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3273
diff changeset
121
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
122 theta = min (p, n_b);
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3273
diff changeset
123 u = (abs (p - n_b) - 1) / 2;
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
124 v = (n_w - p - 1) / 2;
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
125
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
126 df_num = theta * (2 * u + theta + 1);
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
127 df_den = 2 * (theta * v + 1);
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
128
13752
6f068e3f3f9c Change f_cdf references to fcdf in statistics/test directory (Bug #34628)
Rik <octave@nomad.inbox5.com>
parents: 11589
diff changeset
129 HL_pval = 1 - fcdf (HL * df_den / df_num, df_num, df_den);
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
130
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
131 ## Pillai-Bartlett
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
132 ## ===============
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3273
diff changeset
133
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
134 PB = sum (l ./ (1 + l));
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
135
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
136 df_den = theta * (2 * v + theta + 1);
13752
6f068e3f3f9c Change f_cdf references to fcdf in statistics/test directory (Bug #34628)
Rik <octave@nomad.inbox5.com>
parents: 11589
diff changeset
137 PB_pval = 1 - fcdf (PB * df_den / df_num, df_num, df_den);
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
138
21633
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
139 fprintf ("\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
140 fprintf ("One-way MANOVA Table:\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
141 fprintf ("\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
142 fprintf ("Test Test Statistic Approximate p\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
143 fprintf ("**************************************************\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
144 fprintf ("Wilks %10.4f %10.9f \n", Lambda, W_pval_1);
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
145 fprintf (" %10.9f \n", W_pval_2);
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
146 fprintf ("Hotelling-Lawley %10.4f %10.9f \n", HL, HL_pval);
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
147 fprintf ("Pillai-Bartlett %10.4f %10.9f \n", PB, PB_pval);
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
148 fprintf ("\n");
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
149
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
150 endif
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
151
21633
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
152 fprintf ("\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
153 fprintf ("MANOVA Results:\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
154 fprintf ("\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
155 fprintf ("# of groups: %d\n", k);
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
156 fprintf ("# of samples: %d\n", n);
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
157 fprintf ("# of variables: %d\n", p);
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
158 fprintf ("\n");
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
159 fprintf ("Wilks' Lambda: %5.4f\n", Lambda);
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
160 fprintf ("Approximate p: %10.9f (chisquare approximation)\n", W_pval_1);
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
161 fprintf (" %10.9f (F approximation)\n", W_pval_2);
dcf8922b724b Deprecate printf, puts, and scanf. Make fputs a M-file.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 20852
diff changeset
162 fprintf ("\n");
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3273
diff changeset
163
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
164 endfunction
17338
1c89599167a6 maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents: 14138
diff changeset
165