1## Copyright (C) 2007 Lukasz Komsta, http://www.komsta.net/
2##
3## This program is free software; you can redistribute it and/or modify
4## it under the terms of the GNU General Public License as published by
5## the Free Software Foundation; either version 2 of the License, or
6## (at your option) any later version.
7##
8## This program is distributed in the hope that it will be useful,
9## but WITHOUT ANY WARRANTY; without even the implied warranty of
10## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11## GNU General Public License for more details.
12##
13## You should have received a copy of the GNU General Public License
14## along with this program; If not, see <http://www.gnu.org/licenses/>.
15
16## Critical values for Cochran outlying variance test
17##
18## Description:
19##
20##      This functions calculates quantiles (critical values)
21##      for Cochran test for outlying variance.
22##
23## Usage:
24##
25##       [res] = cochraninv(p,n,k)
26##
27## Arguments:
28##
29##        p: vector of probabilities.
30##
31##        n: number of values in each group (if not equal, use arithmetic
32##           mean).
33##
34##        k: number of groups.
35##
36## Value:
37##
38##      Vector of critical values.
39##
40## Author(s):
41##
42##      Lukasz Komsta, ported from R package "outliers".
43##	See R News, 6(2):10-13, May 2006
44##
45## References:
46##
47##      Snedecor, G.W., Cochran, W.G. (1980). Statistical Methods (seventh
48##      edition). Iowa State University Press, Ames, Iowa.
49##
50##
51
52function [res] = cochraninv(p,n,k)
53	f = finv((1 - p)./k, (n - 1) .* (k - 1), n - 1);
54    	res = 1./(1 + (k - 1) .* f);
55end
56