Mercurial > octave-antonio
annotate scripts/statistics/distributions/chi2pdf.m @ 11472:1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 09 Jan 2011 21:33:04 -0800 |
parents | e00de2d5263c |
children | fd0a3ac60b0e |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 1995, 1996, 1997, 2005, 2006, 2007 Kurt Hornik |
5410 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
5410 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
5410 | 18 |
19 ## -*- texinfo -*- | |
10680
e00de2d5263c
Replace calls to obsolete chisquare_cdf with chi2cdf.
Rik <octave@nomad.inbox5.com>
parents:
7017
diff
changeset
|
20 ## @deftypefn {Function File} {} chi2pdf (@var{x}, @var{n}) |
5410 | 21 ## For each element of @var{x}, compute the probability density function |
5482 | 22 ## (PDF) at @var{x} of the chisquare distribution with @var{n} degrees |
5410 | 23 ## of freedom. |
24 ## @end deftypefn | |
25 | |
26 ## Author: TT <Teresa.Twaroch@ci.tuwien.ac.at> | |
5482 | 27 ## Description: PDF of the chi-square distribution |
5410 | 28 |
5482 | 29 function pdf = chi2pdf (x, n) |
5410 | 30 |
31 if (nargin != 2) | |
6046 | 32 print_usage (); |
5410 | 33 endif |
34 | |
35 if (!isscalar (n)) | |
36 [retval, x, n] = common_size (x, n); | |
37 if (retval > 0) | |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
10680
diff
changeset
|
38 error ("chi2pdf: X and N must be of common size or scalar"); |
5410 | 39 endif |
40 endif | |
41 | |
6859 | 42 pdf = gampdf (x, n / 2, 2); |
5410 | 43 |
44 endfunction |