# HG changeset patch # User jwe # Date 1121277229 0 # Node ID bee21f38811034f6597124a9b49d360346080ddf # Parent 56e066f5efc144c420f641328fc7f43bf806fb4c [project @ 2005-07-13 17:53:44 by jwe] diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/beta_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/beta_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} beta_cdf (@var{x}, @var{a}, @var{b}) +## For each element of @var{x}, returns the CDF at @var{x} of the beta +## distribution with parameters @var{a} and @var{b}, i.e., +## PROB (beta (@var{a}, @var{b}) <= @var{x}). +## @end deftypefn + +## Author: KH +## Description: CDF of the Beta distribution + +function cdf = beta_cdf (varargin) + + cdf = betacdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/beta_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/beta_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} beta_inv (@var{x}, @var{a}, @var{b}) +## For each component of @var{x}, compute the quantile (the inverse of +## the CDF) at @var{x} of the Beta distribution with parameters @var{a} +## and @var{b}. +## @end deftypefn + +## Author: KH +## Description: Quantile function of the Beta distribution + +function inv = beta_inv (varargin) + + inv = betainv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/beta_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/beta_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,33 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} beta_pdf (@var{x}, @var{a}, @var{b}) +## For each element of @var{x}, returns the PDF at @var{x} of the beta +## distribution with parameters @var{a} and @var{b}. +## @end deftypefn + +## Author: KH +## Description: PDF of the Beta distribution + +function pdf = beta_pdf (varargin) + + pdf = betapdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/beta_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/beta_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,39 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} beta_rnd (@var{a}, @var{b}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} beta_rnd (@var{a}, @var{b}, @var{sz}) +## Return an @var{r} by @var{c} or @code{size (@var{sz})} matrix of +## random samples from the Beta distribution with parameters @var{a} and +## @var{b}. Both @var{a} and @var{b} must be scalar or of size @var{r} +## by @var{c}. +## +## If @var{r} and @var{c} are omitted, the size of the result matrix is +## the common size of @var{a} and @var{b}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the Beta distribution + +function rnd = beta_rnd (varargin) + + rnd = betarnd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/binomial_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/binomial_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,33 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} binomial_cdf (@var{x}, @var{n}, @var{p}) +## For each element of @var{x}, compute the CDF at @var{x} of the +## binomial distribution with parameters @var{n} and @var{p}. +## @end deftypefn + +## Author: KH +## Description: CDF of the binomial distribution + +function cdf = binomial_cdf (varargin) + + cdf = binocdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/binomial_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/binomial_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,33 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} binomial_inv (@var{x}, @var{n}, @var{p}) +## For each element of @var{x}, compute the quantile at @var{x} of the +## binomial distribution with parameters @var{n} and @var{p}. +## @end deftypefn + +## Author: KH +## Description: Quantile function of the binomial distribution + +function inv = binomial_inv (varargin) + + inv = binoinv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/binomial_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/binomial_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} binomial_pdf (@var{x}, @var{n}, @var{p}) +## For each element of @var{x}, compute the probability density function +## (PDF) at @var{x} of the binomial distribution with parameters @var{n} +## and @var{p}. +## @end deftypefn + +## Author: KH +## Description: PDF of the binomial distribution + +function pdf = binomial_pdf (varargin) + + pdf = binopdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/binomial_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/binomial_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,39 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} binomial_rnd (@var{n}, @var{p}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} binomial_rnd (@var{n}, @var{p}, @var{sz}) +## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of +## random samples from the binomial distribution with parameters @var{n} +## and @var{p}. Both @var{n} and @var{p} must be scalar or of size +## @var{r} by @var{c}. +## +## If @var{r} and @var{c} are omitted, the size of the result matrix is +## the common size of @var{n} and @var{p}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the binomial distribution + +function rnd = binomial_rnd (varargin) + + rnd = binornd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/chisquare_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/chisquare_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} chisquare_cdf (@var{x}, @var{n}) +## For each element of @var{x}, compute the cumulative distribution +## function (CDF) at @var{x} of the chisquare distribution with @var{n} +## degrees of freedom. +## @end deftypefn + +## Author: TT +## Description: CDF of the chi-square distribution + +function cdf = chisquare_cdf (varargin) + + cdf = chi2cdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/chisquare_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/chisquare_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} chisquare_inv (@var{x}, @var{n}) +## For each element of @var{x}, compute the quantile (the inverse of the +## CDF) at @var{x} of the chisquare distribution with @var{n} degrees of +## freedom. +## @end deftypefn + +## Author: TT +## Description: Quantile function of the chi-square distribution + +function inv = chisquare_inv (varargin) + + inv = chi2inv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/chisquare_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/chisquare_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} chisquare_pdf (@var{x}, @var{n}) +## For each element of @var{x}, compute the probability density function +## (PDF) at @var{x} of the chisquare distribution with @var{k} degrees +## of freedom. +## @end deftypefn + +## Author: TT +## Description: PDF of the chi-sqaure distribution + +function pdf = chisquare_pdf (varargin) + + pdf = chi2pdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/chisquare_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/chisquare_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,38 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} chisquare_rnd (@var{n}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} chisquare_rnd (@var{n}, @var{sz}) +## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of +## random samples from the chisquare distribution with @var{n} degrees +## of freedom. @var{n} must be a scalar or of size @var{r} by @var{c}. +## +## If @var{r} and @var{c} are omitted, the size of the result matrix is +## the size of @var{n}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the chi-square distribution + +function rnd = chisquare_rnd (varargin) + + rnd = chi2rnd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/exponential_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/exponential_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,36 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} exponential_cdf (@var{x}, @var{lambda}) +## For each element of @var{x}, compute the cumulative distribution +## function (CDF) at @var{x} of the exponential distribution with +## parameter @var{lambda}. +## +## The arguments can be of common size or scalar. +## @end deftypefn + +## Author: KH +## Description: CDF of the exponential distribution + +function cdf = exponential_cdf (varargin) + + cdf = expcdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/exponential_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/exponential_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} exponential_inv (@var{x}, @var{lambda}) +## For each element of @var{x}, compute the quantile (the inverse of the +## CDF) at @var{x} of the exponential distribution with parameter +## @var{lambda}. +## @end deftypefn + +## Author: KH +## Description: Quantile function of the exponential distribution + +function inv = exponential_inv (varargin) + + inv = expinv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/exponential_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/exponential_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,33 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} exponential_pdf (@var{x}, @var{lambda}) +## For each element of @var{x}, compute the probability density function +## (PDF) of the exponential distribution with parameter @var{lambda}. +## @end deftypefn + +## Author: KH +## Description: PDF of the exponential distribution + +function pdf = exponential_pdf (varargin) + + pdf = exppdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/exponential_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/exponential_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,39 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} exponential_rnd (@var{lambda}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} exponential_rnd (@var{lambda}, @var{sz}) +## Return an @var{r} by @var{c} matrix of random samples from the +## exponential distribution with parameter @var{lambda}, which must be a +## scalar or of size @var{r} by @var{c}. Or if @var{sz} is a vector, +## create a matrix of size @var{sz}. +## +## If @var{r} and @var{c} are omitted, the size of the result matrix is +## the size of @var{lambda}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the exponential distribution + +function rnd = exponential_rnd (varargin) + + rnd = exprnd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/f_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/f_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} f_cdf (@var{x}, @var{m}, @var{n}) +## For each element of @var{x}, compute the CDF at @var{x} of the F +## distribution with @var{m} and @var{n} degrees of freedom, i.e., +## PROB (F (@var{m}, @var{n}) <= @var{x}). +## @end deftypefn + +## Author: KH +## Description: CDF of the F distribution + +function cdf = f_cdf (varargin) + + cdf = fcdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/f_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/f_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} f_inv (@var{x}, @var{m}, @var{n}) +## For each component of @var{x}, compute the quantile (the inverse of +## the CDF) at @var{x} of the F distribution with parameters @var{m} and +## @var{n}. +## @end deftypefn + +## Author: KH +## Description: Quantile function of the F distribution + +function inv = f_inv (varargin) + + inv = finv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/f_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/f_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} f_pdf (@var{x}, @var{m}, @var{n}) +## For each element of @var{x}, compute the probability density function +## (PDF) at @var{x} of the F distribution with @var{m} and @var{n} +## degrees of freedom. +## @end deftypefn + +## Author: KH +## Description: PDF of the F distribution + +function pdf = f_pdf (varargin) + + pdf = fpdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/f_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/f_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,40 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} f_rnd (@var{m}, @var{n}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} f_rnd (@var{m}, @var{n}, @var{sz}) +## Return an @var{r} by @var{c} matrix of random samples from the F +## distribution with @var{m} and @var{n} degrees of freedom. Both +## @var{m} and @var{n} must be scalar or of size @var{r} by @var{c}. +## If @var{sz} is a vector the random samples are in a matrix of +## size @var{sz}. +## +## If @var{r} and @var{c} are omitted, the size of the result matrix is +## the common size of @var{m} and @var{n}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the F distribution + +function rnd = f_rnd (varargin) + + rnd = frnd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/gamma_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/gamma_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} gamma_cdf (@var{x}, @var{a}, @var{b}) +## For each element of @var{x}, compute the cumulative distribution +## function (CDF) at @var{x} of the Gamma distribution with parameters +## @var{a} and @var{b}. +## @end deftypefn + +## Author: TT +## Description: CDF of the Gamma distribution + +function cdf = gamma_cdf (varargin) + + cdf = gamcdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/gamma_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/gamma_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} gamma_inv (@var{x}, @var{a}, @var{b}) +## For each component of @var{x}, compute the quantile (the inverse of +## the CDF) at @var{x} of the Gamma distribution with parameters @var{a} +## and @var{b}. +## @end deftypefn + +## Author: KH +## Description: Quantile function of the Gamma distribution + +function inv = gamma_inv (varargin) + + inv = gaminv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/gamma_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/gamma_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} gamma_pdf (@var{x}, @var{a}, @var{b}) +## For each element of @var{x}, return the probability density function +## (PDF) at @var{x} of the Gamma distribution with parameters @var{a} +## and @var{b}. +## @end deftypefn + +## Author: TT +## Description: PDF of the Gamma distribution + +function pdf = gamma_pdf (varargin) + + pdf = gampdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/gamma_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/gamma_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,39 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} gamma_rnd (@var{a}, @var{b}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} gamma_rnd (@var{a}, @var{b}, @var{sz}) +## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of +## random samples from the Gamma distribution with parameters @var{a} +## and @var{b}. Both @var{a} and @var{b} must be scalar or of size +## @var{r} by @var{c}. +## +## If @var{r} and @var{c} are omitted, the size of the result matrix is +## the common size of @var{a} and @var{b}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the Gamma distribution + +function rnd = gamma_rnd (varargin) + + rnd = gamrnd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/geometric_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/geometric_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,33 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} geometric_cdf (@var{x}, @var{p}) +## For each element of @var{x}, compute the CDF at @var{x} of the +## geometric distribution with parameter @var{p}. +## @end deftypefn + +## Author: KH +## Description: CDF of the geometric distribution + +function cdf = geometric_cdf (varargin) + + cdf = geocdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/geometric_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/geometric_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,33 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} geometric_inv (@var{x}, @var{p}) +## For each element of @var{x}, compute the quantile at @var{x} of the +## geometric distribution with parameter @var{p}. +## @end deftypefn + +## Author: KH +## Description: Quantile function of the geometric distribution + +function inv = geometric_inv (varargin) + + inv = geoinv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/geometric_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/geometric_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,33 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} geometric_pdf (@var{x}, @var{p}) +## For each element of @var{x}, compute the probability density function +## (PDF) at @var{x} of the geometric distribution with parameter @var{p}. +## @end deftypefn + +## Author: KH +## Description: PDF of the geometric distribution + +function pdf = geometric_pdf (varargin) + + pdf = geopdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/geometric_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/geometric_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,39 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} geometric_rnd (@var{p}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} geometric_rnd (@var{p}, @var{sz}) +## Return an @var{r} by @var{c} matrix of random samples from the +## geometric distribution with parameter @var{p}, which must be a scalar +## or of size @var{r} by @var{c}. +## +## If @var{r} and @var{c} are given create a matrix with @var{r} rows and +## @var{c} columns. Or if @var{sz} is a vector, create a matrix of size +## @var{sz}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the geometric distribution + +function rnd = geometric_rnd (varargin) + + rnd = geornd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/hypergeometric_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/hypergeometric_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,42 @@ +## Copyright (C) 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} hypergeometric_cdf (@var{x}, @var{m}, @var{t}, @var{n}) +## Compute the cumulative distribution function (CDF) at @var{x} of the +## hypergeometric distribution with parameters @var{m}, @var{t}, and +## @var{n}. This is the probability of obtaining not more than @var{x} +## marked items when randomly drawing a sample of size @var{n} without +## replacement from a population of total size @var{t} containing +## @var{m} marked items. +## +## The parameters @var{m}, @var{t}, and @var{n} must positive integers +## with @var{m} and @var{n} not greater than @var{t}. +## @end deftypefn + +## Author: KH +## Description: CDF of the hypergeometric distribution + +function cdf = hypergeometric_cdf (varargin) + + cdf = hygecdf (varargin{:}); + +endfunction + + diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/hypergeometric_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/hypergeometric_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,37 @@ +## Copyright (C) 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} hypergeometric_inv (@var{x}, @var{m}, @var{t}, @var{n}) +## For each element of @var{x}, compute the quantile at @var{x} of the +## hypergeometric distribution with parameters @var{m}, @var{t}, and +## @var{n}. +## +## The parameters @var{m}, @var{t}, and @var{n} must positive integers +## with @var{m} and @var{n} not greater than @var{t}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the hypergeometric distribution + +function inv = hypergeometric_inv (varargin) + + inv = hygeinv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/hypergeometric_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/hypergeometric_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,38 @@ +## Copyright (C) 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} hypergeometric_pdf (@var{x}, @var{m}, @var{t}, @var{n}) +## Compute the probability density function (PDF) at @var{x} of the +## hypergeometric distribution with parameters @var{m}, @var{t}, and +## @var{n}. This is the probability of obtaining @var{x} marked items +## when randomly drawing a sample of size @var{n} without replacement +## from a population of total size @var{t} containing @var{m} marked items. +## +## The arguments must be of common size or scalar. +## @end deftypefn + +## Author: KH +## Description: PDF of the hypergeometric distribution + +function pdf = hypergeometric_pdf (varargin) + + pdf = hygepdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/hypergeometric_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/hypergeometric_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,41 @@ +## Copyright (C) 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} hypergeometric_rnd (@var{n_size}, @var{m}, @var{t}, @var{n}) +## @deftypefnx {Function File} {} hypergeometric_rnd (@var{m}, @var{t}, @var{n}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} hypergeometric_rnd (@var{m}, @var{t}, @var{n}, @var{sz}) +## Generate a row vector containing a random sample of size @var{n_size} +## from the hypergeometric distribution with parameters @var{m}, @var{t}, +## and @var{n}. +## +## If @var{r} and @var{c} are given create a matrix with @var{r} rows and +## @var{c} columns. Or if @var{sz} is a vector, create a matrix of size +## @var{sz}. +## +## The parameters @var{m}, @var{t}, and @var{n} must positive integers +## with @var{m} and @var{n} not greater than @var{t}. +## @end deftypefn + +## function rnd = hypergeometric_rnd (N, m, t, n) +function rnd = hypergeometric_rnd (varargin) + + rnd = hygernd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/lognormal_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/lognormal_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,38 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} lognormal_cdf (@var{x}, @var{a}, @var{v}) +## For each element of @var{x}, compute the cumulative distribution +## function (CDF) at @var{x} of the lognormal distribution with +## parameters @var{a} and @var{v}. If a random variable follows this +## distribution, its logarithm is normally distributed with mean +## @code{log (@var{a})} and variance @var{v}. +## +## Default values are @var{a} = 1, @var{v} = 1. +## @end deftypefn + +## Author: KH +## Description: CDF of the log normal distribution + +function cdf = lognormal_cdf (varargin) + + cdf = logncdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/lognormal_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/lognormal_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,38 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} lognormal_inv (@var{x}, @var{a}, @var{v}) +## For each element of @var{x}, compute the quantile (the inverse of the +## CDF) at @var{x} of the lognormal distribution with parameters @var{a} +## and @var{v}. If a random variable follows this distribution, its +## logarithm is normally distributed with mean @code{log (@var{a})} and +## variance @var{v}. +## +## Default values are @var{a} = 1, @var{v} = 1. +## @end deftypefn + +## Author: KH +## Description: Quantile function of the log normal distribution + +function inv = lognormal_inv (varargin) + + inv = logninv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/lognormal_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/lognormal_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,38 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} lognormal_pdf (@var{x}, @var{a}, @var{v}) +## For each element of @var{x}, compute the probability density function +## (PDF) at @var{x} of the lognormal distribution with parameters +## @var{a} and @var{v}. If a random variable follows this distribution, +## its logarithm is normally distributed with mean @code{log (@var{a})} +## and variance @var{v}. +## +## Default values are @var{a} = 1, @var{v} = 1. +## @end deftypefn + +## Author: KH +## Description: PDF of the log normal distribution + +function pdf = lognormal_pdf (varargin) + + pdf = lognpdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/lognormal_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/lognormal_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,39 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} lognormal_rnd (@var{a}, @var{v}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} lognormal_rnd (@var{a}, @var{v}, @var{sz}) +## Return an @var{r} by @var{c} matrix of random samples from the +## lognormal distribution with parameters @var{a} and @var{v}. Both +## @var{a} and @var{v} must be scalar or of size @var{r} by @var{c}. +## Or if @var{sz} is a vector, create a matrix of size @var{sz}. +## +## If @var{r} and @var{c} are omitted, the size of the result matrix is +## the common size of @var{a} and @var{v}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the log normal distribution + +function rnd = lognormal_rnd (varargin) + + rnd = lognrnd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/normal_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/normal_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,36 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} normal_cdf (@var{x}, @var{m}, @var{v}) +## For each element of @var{x}, compute the cumulative distribution +## function (CDF) at @var{x} of the normal distribution with mean +## @var{m} and variance @var{v}. +## +## Default values are @var{m} = 0, @var{v} = 1. +## @end deftypefn + +## Author: TT +## Description: CDF of the normal distribution + +function cdf = normal_cdf (varargin) + + cdf = normcdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/normal_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/normal_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,36 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} normal_inv (@var{x}, @var{m}, @var{v}) +## For each element of @var{x}, compute the quantile (the inverse of the +## CDF) at @var{x} of the normal distribution with mean @var{m} and +## variance @var{v}. +## +## Default values are @var{m} = 0, @var{v} = 1. +## @end deftypefn + +## Author: KH +## Description: Quantile function of the normal distribution + +function inv = normal_inv (varargin) + + inv = norminv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/normal_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/normal_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,36 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} normal_pdf (@var{x}, @var{m}, @var{v}) +## For each element of @var{x}, compute the probability density function +## (PDF) at @var{x} of the normal distribution with mean @var{m} and +## variance @var{v}. +## +## Default values are @var{m} = 0, @var{v} = 1. +## @end deftypefn + +## Author: TT +## Description: PDF of the normal distribution + +function pdf = normal_pdf (varargin) + + pdf = normpdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/normal_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/normal_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,39 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} normal_rnd (@var{m}, @var{v}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} normal_rnd (@var{m}, @var{v}, @var{sz}) +## Return an @var{r} by @var{c} or @code{size (@var{sz})} matrix of +## random samples from the normal distribution with parameters @var{m} +## and @var{v}. Both @var{m} and @var{v} must be scalar or of size +## @var{r} by @var{c}. +## +## If @var{r} and @var{c} are omitted, the size of the result matrix is +## the common size of @var{m} and @var{v}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the normal distribution + +function rnd = normal_rnd (varargin) + + rnd = normrnd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/poisson_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/poisson_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} poisson_cdf (@var{x}, @var{lambda}) +## For each element of @var{x}, compute the cumulative distribution +## function (CDF) at @var{x} of the Poisson distribution with parameter +## lambda. +## @end deftypefn + +## Author: KH +## Description: CDF of the Poisson distribution + +function cdf = poisson_cdf (varargin) + + cdf = poisscdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/poisson_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/poisson_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} poisson_inv (@var{x}, @var{lambda}) +## For each component of @var{x}, compute the quantile (the inverse of +## the CDF) at @var{x} of the Poisson distribution with parameter +## @var{lambda}. +## @end deftypefn + +## Author: KH +## Description: Quantile function of the Poisson distribution + +function inv = poisson_inv (varargin) + + inv = poissinv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/poisson_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/poisson_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,33 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} poisson_pdf (@var{x}, @var{lambda}) +## For each element of @var{x}, compute the probability density function +## (PDF) at @var{x} of the poisson distribution with parameter @var{lambda}. +## @end deftypefn + +## Author: KH +## Description: PDF of the Poisson distribution + +function pdf = poisson_pdf (varargin) + + pdf = poisspdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/poisson_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/poisson_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,37 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} poisson_rnd (@var{lambda}, @var{r}, @var{c}) +## Return an @var{r} by @var{c} matrix of random samples from the +## Poisson distribution with parameter @var{lambda}, which must be a +## scalar or of size @var{r} by @var{c}. +## +## If @var{r} and @var{c} are omitted, the size of the result matrix is +## the size of @var{lambda}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the Poisson distribution + +function rnd = poisson_rnd (varargin) + + rnd = poissrnd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/t_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/t_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} t_cdf (@var{x}, @var{n}) +## For each element of @var{x}, compute the CDF at @var{x} of the +## t (Student) distribution with @var{n} degrees of freedom, i.e., +## PROB (t(@var{n}) <= @var{x}). +## @end deftypefn + +## Author: KH +## Description: CDF of the t distribution + +function cdf = t_cdf (varargin) + + cdf = tcdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/t_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/t_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,38 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} t_inv (@var{x}, @var{n}) +## For each component of @var{x}, compute the quantile (the inverse of +## the CDF) at @var{x} of the t (Student) distribution with parameter +## @var{n}. +## @end deftypefn + +## For very large n, the "correct" formula does not really work well, +## and the quantiles of the standard normal distribution are used +## directly. + +## Author: KH +## Description: Quantile function of the t distribution + +function inv = t_inv (varargin) + + inv = tinv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/t_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/t_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} t_pdf (@var{x}, @var{n}) +## For each element of @var{x}, compute the probability density function +## (PDF) at @var{x} of the @var{t} (Student) distribution with @var{n} +## degrees of freedom. +## @end deftypefn + +## Author: KH +## Description: PDF of the t distribution + +function pdf = t_pdf (varargin) + + pdf = tpdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/t_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/t_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,39 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} t_rnd (@var{n}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} t_rnd (@var{n}, @var{sz}) +## Return an @var{r} by @var{c} matrix of random samples from the t +## (Student) distribution with @var{n} degrees of freedom. @var{n} must +## be a scalar or of size @var{r} by @var{c}. Or if @var{sz} is a +## vector create a matrix of size @var{sz}. +## +## If @var{r} and @var{c} are omitted, the size of the result matrix is +## the size of @var{n}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the t distribution + +function rnd = t_rnd (varargin) + + rnd = t_rnd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/uniform_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/uniform_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,35 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} uniform_cdf (@var{x}, @var{a}, @var{b}) +## Return the CDF at @var{x} of the uniform distribution on [@var{a}, +## @var{b}], i.e., PROB (uniform (@var{a}, @var{b}) <= x). +## +## Default values are @var{a} = 0, @var{b} = 1. +## @end deftypefn + +## Author: KH +## Description: CDF of the uniform distribution + +function cdf = uniform_cdf (varargin) + + cdf = unifcdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/uniform_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/uniform_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,35 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} uniform_inv (@var{x}, @var{a}, @var{b}) +## For each element of @var{x}, compute the quantile (the inverse of the +## CDF) at @var{x} of the uniform distribution on [@var{a}, @var{b}]. +## +## Default values are @var{a} = 0, @var{b} = 1. +## @end deftypefn + +## Author: KH +## Description: Quantile function of the uniform distribution + +function inv = uniform_inv (varargin) + + inv = unifinv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/uniform_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/uniform_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,35 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} uniform_pdf (@var{x}, @var{a}, @var{b}) +## For each element of @var{x}, compute the PDF at @var{x} of the uniform +## distribution on [@var{a}, @var{b}]. +## +## Default values are @var{a} = 0, @var{b} = 1. +## @end deftypefn + +## Author: KH +## Description: PDF of the uniform distribution + +function pdf = uniform_pdf (varargin) + + pdf = unifpdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/uniform_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/uniform_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,38 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} uniform_rnd (@var{a}, @var{b}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} uniform_rnd (@var{a}, @var{b}, @var{sz}) +## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of +## random samples from the uniform distribution on [@var{a}, @var{b}]. +## Both @var{a} and @var{b} must be scalar or of size @var{r} by @var{c}. +## +## If @var{r} and @var{c} are omitted, the size of the result matrix is +## the common size of @var{a} and @var{b}. +## @end deftypefn + +## Author: KH +## Description: Random deviates from the uniform distribution + +function rnd = uniform_rnd (varargin) + + rnd = unifrnd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/weibull_cdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/weibull_cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,41 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} weibull_cdf (@var{x}, @var{alpha}, @var{sigma}) +## Compute the cumulative distribution function (CDF) at @var{x} of the +## Weibull distribution with shape parameter @var{alpha} and scale +## parameter @var{sigma}, which is +## +## @example +## 1 - exp(-(x/sigma)^alpha) +## @end example +## +## @noindent +## for @var{x} >= 0. +## @end deftypefn + +## Author: KH +## Description: CDF of the Weibull distribution + +function cdf = weibull_cdf (varargin) + + cdf = weibcdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/weibull_inv.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/weibull_inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,34 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} weibull_inv (@var{x}, @var{lambda}, @var{alpha}) +## Compute the quantile (the inverse of the CDF) at @var{x} of the +## Weibull distribution with shape parameter @var{alpha} and scale +## parameter @var{sigma}. +## @end deftypefn + +## Author: KH +## Description: Quantile function of the Weibull distribution + +function inv = weibull_inv (varargin) + + inv = weibinv (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/weibull_pdf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/weibull_pdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,41 @@ +## Copyright (C) 1995, 1996, 1997 Kurt Hornik +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} weibull_pdf (@var{x}, @var{alpha}, @var{sigma}) +## Compute the probability density function (PDF) at @var{x} of the +## Weibull distribution with shape parameter @var{alpha} and scale +## parameter @var{sigma} which is given by +## +## @example +## alpha * sigma^(-alpha) * x^(alpha-1) * exp(-(x/sigma)^alpha) +## @end example +## +## @noindent +## for @var{x} > 0. +## @end deftypefn + +## Author: KH +## Description: PDF of the Weibull distribution + +function pdf = weibull_pdf (varargin) + + pdf = weibpdf (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/deprecated/wiener_rnd.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/wiener_rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -0,0 +1,39 @@ +## Copyright (C) 1995, 1996, 1997 Friedrich Leisch +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} wiener_rnd (@var{t}, @var{d}, @var{n}) +## Return a simulated realization of the @var{d}-dimensional Wiener Process +## on the interval [0, @var{t}]. If @var{d} is omitted, @var{d} = 1 is +## used. The first column of the return matrix contains time, the +## remaining columns contain the Wiener process. +## +## The optional parameter @var{n} gives the number of summands used for +## simulating the process over an interval of length 1. If @var{n} is +## omitted, @var{n} = 1000 is used. +## @end deftypefn + +## Author: FL +## Description: Simulate a Wiener process + +function retval = wiener_rnd (varargin) + + retval = wienrnd (varargin{:}); + +endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/beta_cdf.m --- a/scripts/statistics/distributions/beta_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} beta_cdf (@var{x}, @var{a}, @var{b}) -## For each element of @var{x}, returns the CDF at @var{x} of the beta -## distribution with parameters @var{a} and @var{b}, i.e., -## PROB (beta (@var{a}, @var{b}) <= @var{x}). -## @end deftypefn - -## Author: KH -## Description: CDF of the Beta distribution - -function cdf = beta_cdf (x, a, b) - - if (nargin != 3) - usage ("beta_cdf (a, b, x)"); - endif - - if (!isscalar (a) || !isscalar(b)) - [retval, x, a, b] = common_size (x, a, b); - if (retval > 0) - error ("beta_cdf: x, a and b must be of common size or scalar"); - endif - endif - - sz = size(x); - cdf = zeros (sz); - - k = find (!(a > 0) | !(b > 0) | isnan (x)); - if (any (k)) - cdf (k) = NaN; - endif - - k = find ((x >= 1) & (a > 0) & (b > 0)); - if (any (k)) - cdf (k) = 1; - endif - - k = find ((x > 0) & (x < 1) & (a > 0) & (b > 0)); - if (any (k)) - if (isscalar (a) && isscalar(b)) - cdf (k) = betainc (x(k), a, b); - else - cdf (k) = betainc (x(k), a(k), b(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/beta_inv.m --- a/scripts/statistics/distributions/beta_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} beta_inv (@var{x}, @var{a}, @var{b}) -## For each component of @var{x}, compute the quantile (the inverse of -## the CDF) at @var{x} of the Beta distribution with parameters @var{a} -## and @var{b}. -## @end deftypefn - -## Author: KH -## Description: Quantile function of the Beta distribution - -function inv = beta_inv (x, a, b) - - if (nargin != 3) - usage ("beta_inv (x, a, b)"); - endif - - if (!isscalar (a) || !isscalar(b)) - [retval, x, a, b] = common_size (x, a, b); - if (retval > 0) - error ("beta_inv: x, a and b must be of common size or scalars"); - endif - endif - - sz = size (x); - inv = zeros (sz); - - k = find ((x < 0) | (x > 1) | !(a > 0) | !(b > 0) | isnan (x)); - if (any (k)) - inv (k) = NaN; - endif - - k = find ((x == 1) & (a > 0) & (b > 0)); - if (any (k)) - inv (k) = 1; - endif - - k = find ((x > 0) & (x < 1) & (a > 0) & (b > 0)); - if (any (k)) - if (!isscalar(a) || !isscalar(b)) - a = a (k); - b = b (k); - y = a ./ (a + b); - else - y = a / (a + b) * ones (size (k)); - endif - x = x (k); - l = find (y < eps); - if (any (l)) - y(l) = sqrt (eps) * ones (length (l), 1); - endif - l = find (y > 1 - eps); - if (any (l)) - y(l) = 1 - sqrt (eps) * ones (length (l), 1); - endif - - y_old = y; - for i = 1 : 10000 - h = (beta_cdf (y_old, a, b) - x) ./ beta_pdf (y_old, a, b); - y_new = y_old - h; - ind = find (y_new <= eps); - if (any (ind)) - y_new (ind) = y_old (ind) / 10; - endif - ind = find (y_new >= 1 - eps); - if (any (ind)) - y_new (ind) = 1 - (1 - y_old (ind)) / 10; - endif - h = y_old - y_new; - if (max (abs (h)) < sqrt (eps)) - break; - endif - y_old = y_new; - endfor - - inv (k) = y_new; - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/beta_pdf.m --- a/scripts/statistics/distributions/beta_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} beta_pdf (@var{x}, @var{a}, @var{b}) -## For each element of @var{x}, returns the PDF at @var{x} of the beta -## distribution with parameters @var{a} and @var{b}. -## @end deftypefn - -## Author: KH -## Description: PDF of the Beta distribution - -function pdf = beta_pdf (x, a, b) - - if (nargin != 3) - usage ("beta_pdf (a, b, x)"); - endif - - if (!isscalar (a) || !isscalar(b)) - [retval, x, a, b] = common_size (x, a, b); - if (retval > 0) - error ("beta_pdf: x, a and b must be of common size or scalar"); - endif - endif - - sz = size (x); - pdf = zeros (sz); - - k = find (!(a > 0) | !(b > 0) | isnan (x)); - if (any (k)) - pdf (k) = NaN; - endif - - k = find ((x > 0) & (x < 1) & (a > 0) & (b > 0)); - if (any (k)) - if (isscalar(a) && isscalar(b)) - pdf(k) = exp ((a - 1) .* log (x(k)) - + (b - 1) .* log (1 - x(k))) ./ beta (a, b); - else - pdf(k) = exp ((a(k) - 1) .* log (x(k)) - + (b(k) - 1) .* log (1 - x(k))) ./ beta (a(k), b(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/beta_rnd.m --- a/scripts/statistics/distributions/beta_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} beta_rnd (@var{a}, @var{b}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} beta_rnd (@var{a}, @var{b}, @var{sz}) -## Return an @var{r} by @var{c} or @code{size (@var{sz})} matrix of -## random samples from the Beta distribution with parameters @var{a} and -## @var{b}. Both @var{a} and @var{b} must be scalar or of size @var{r} -## by @var{c}. -## -## If @var{r} and @var{c} are omitted, the size of the result matrix is -## the common size of @var{a} and @var{b}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the Beta distribution - -function rnd = beta_rnd (a, b, r, c) - - if (nargin > 1) - if (!isscalar(a) || !isscalar(b)) - [retval, a, b] = common_size (a, b); - if (retval > 0) - error ("beta_rnd: a and b must be of common size or scalar"); - endif - endif - endif - - if (nargin == 4) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("beta_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("beta_rnd: c must be a positive integer"); - endif - sz = [r, c]; - - if (any (size (a) != 1) - && (length (size (a)) != length (sz) || any (size (a) != sz))) - error ("beta_rnd: a and b must be scalar or of size [r,c]"); - endif - elseif (nargin == 3) - if (isscalar (r) && (r > 0)) - sz = [r, r]; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("beta_rnd: r must be a postive integer or vector"); - endif - - if (any (size (a) != 1) - && (length (size (a)) != length (sz) || any (size (a) != sz))) - error ("beta_rnd: a and b must be scalar or of size sz"); - endif - elseif (nargin == 2) - sz = size(a); - else - usage ("beta_rnd (a, b, r, c)"); - endif - - if (isscalar(a) && isscalar(b)) - if (find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf))) - rnd = NaN * ones (sz); - else - rnd = beta_inv (rand(sz), a, b); - endif - else - rnd = zeros (sz); - - k = find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf)); - if (any (k)) - rnd(k) = NaN * ones (size (k)); - endif - - k = find ((a > 0) & (a < Inf) & (b > 0) & (b < Inf)); - if (any (k)) - rnd(k) = beta_inv (rand (size (k)), a(k), b(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/betacdf.m --- a/scripts/statistics/distributions/betacdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/betacdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} beta_cdf (@var{x}, @var{a}, @var{b}) +## @deftypefn {Function File} {} betacdf (@var{x}, @var{a}, @var{b}) ## For each element of @var{x}, returns the CDF at @var{x} of the beta ## distribution with parameters @var{a} and @var{b}, i.e., ## PROB (beta (@var{a}, @var{b}) <= @var{x}). @@ -27,16 +27,16 @@ ## Author: KH ## Description: CDF of the Beta distribution -function cdf = beta_cdf (x, a, b) +function cdf = betacdf (x, a, b) if (nargin != 3) - usage ("beta_cdf (a, b, x)"); + usage ("betacdf (a, b, x)"); endif if (!isscalar (a) || !isscalar(b)) [retval, x, a, b] = common_size (x, a, b); if (retval > 0) - error ("beta_cdf: x, a and b must be of common size or scalar"); + error ("betacdf: x, a and b must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/betainv.m --- a/scripts/statistics/distributions/betainv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/betainv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} beta_inv (@var{x}, @var{a}, @var{b}) +## @deftypefn {Function File} {} betainv (@var{x}, @var{a}, @var{b}) ## For each component of @var{x}, compute the quantile (the inverse of ## the CDF) at @var{x} of the Beta distribution with parameters @var{a} ## and @var{b}. @@ -27,16 +27,16 @@ ## Author: KH ## Description: Quantile function of the Beta distribution -function inv = beta_inv (x, a, b) +function inv = betainv (x, a, b) if (nargin != 3) - usage ("beta_inv (x, a, b)"); + usage ("betainv (x, a, b)"); endif if (!isscalar (a) || !isscalar(b)) [retval, x, a, b] = common_size (x, a, b); if (retval > 0) - error ("beta_inv: x, a and b must be of common size or scalars"); + error ("betainv: x, a and b must be of common size or scalars"); endif endif @@ -74,7 +74,7 @@ y_old = y; for i = 1 : 10000 - h = (beta_cdf (y_old, a, b) - x) ./ beta_pdf (y_old, a, b); + h = (betacdf (y_old, a, b) - x) ./ betapdf (y_old, a, b); y_new = y_old - h; ind = find (y_new <= eps); if (any (ind)) diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/betapdf.m --- a/scripts/statistics/distributions/betapdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/betapdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} beta_pdf (@var{x}, @var{a}, @var{b}) +## @deftypefn {Function File} {} betapdf (@var{x}, @var{a}, @var{b}) ## For each element of @var{x}, returns the PDF at @var{x} of the beta ## distribution with parameters @var{a} and @var{b}. ## @end deftypefn @@ -26,16 +26,16 @@ ## Author: KH ## Description: PDF of the Beta distribution -function pdf = beta_pdf (x, a, b) +function pdf = betapdf (x, a, b) if (nargin != 3) - usage ("beta_pdf (a, b, x)"); + usage ("betapdf (a, b, x)"); endif if (!isscalar (a) || !isscalar(b)) [retval, x, a, b] = common_size (x, a, b); if (retval > 0) - error ("beta_pdf: x, a and b must be of common size or scalar"); + error ("betapdf: x, a and b must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/betarnd.m --- a/scripts/statistics/distributions/betarnd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/betarnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,8 +18,8 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} beta_rnd (@var{a}, @var{b}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} beta_rnd (@var{a}, @var{b}, @var{sz}) +## @deftypefn {Function File} {} betarnd (@var{a}, @var{b}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} betarnd (@var{a}, @var{b}, @var{sz}) ## Return an @var{r} by @var{c} or @code{size (@var{sz})} matrix of ## random samples from the Beta distribution with parameters @var{a} and ## @var{b}. Both @var{a} and @var{b} must be scalar or of size @var{r} @@ -32,29 +32,29 @@ ## Author: KH ## Description: Random deviates from the Beta distribution -function rnd = beta_rnd (a, b, r, c) +function rnd = betarnd (a, b, r, c) if (nargin > 1) if (!isscalar(a) || !isscalar(b)) [retval, a, b] = common_size (a, b); if (retval > 0) - error ("beta_rnd: a and b must be of common size or scalar"); + error ("betarnd: a and b must be of common size or scalar"); endif endif endif if (nargin == 4) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("beta_rnd: r must be a positive integer"); + error ("betarnd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("beta_rnd: c must be a positive integer"); + error ("betarnd: c must be a positive integer"); endif sz = [r, c]; if (any (size (a) != 1) && (length (size (a)) != length (sz) || any (size (a) != sz))) - error ("beta_rnd: a and b must be scalar or of size [r,c]"); + error ("betarnd: a and b must be scalar or of size [r,c]"); endif elseif (nargin == 3) if (isscalar (r) && (r > 0)) @@ -62,24 +62,24 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("beta_rnd: r must be a postive integer or vector"); + error ("betarnd: r must be a postive integer or vector"); endif if (any (size (a) != 1) && (length (size (a)) != length (sz) || any (size (a) != sz))) - error ("beta_rnd: a and b must be scalar or of size sz"); + error ("betarnd: a and b must be scalar or of size sz"); endif elseif (nargin == 2) sz = size(a); else - usage ("beta_rnd (a, b, r, c)"); + usage ("betarnd (a, b, r, c)"); endif if (isscalar(a) && isscalar(b)) if (find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf))) rnd = NaN * ones (sz); else - rnd = beta_inv (rand(sz), a, b); + rnd = betainv (rand(sz), a, b); endif else rnd = zeros (sz); @@ -91,7 +91,7 @@ k = find ((a > 0) & (a < Inf) & (b > 0) & (b < Inf)); if (any (k)) - rnd(k) = beta_inv (rand (size (k)), a(k), b(k)); + rnd(k) = betainv (rand (size (k)), a(k), b(k)); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/binocdf.m --- a/scripts/statistics/distributions/binocdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/binocdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} binomial_cdf (@var{x}, @var{n}, @var{p}) +## @deftypefn {Function File} {} binocdf (@var{x}, @var{n}, @var{p}) ## For each element of @var{x}, compute the CDF at @var{x} of the ## binomial distribution with parameters @var{n} and @var{p}. ## @end deftypefn @@ -26,16 +26,16 @@ ## Author: KH ## Description: CDF of the binomial distribution -function cdf = binomial_cdf (x, n, p) +function cdf = binocdf (x, n, p) if (nargin != 3) - usage ("binomial_cdf (x, n, p)"); + usage ("binocdf (x, n, p)"); endif if (!isscalar (n) || !isscalar (p)) [retval, x, n, p] = common_size (x, n, p); if (retval > 0) - error ("binomial_cdf: x, n and p must be of common size or scalar"); + error ("binocdf: x, n and p must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/binoinv.m --- a/scripts/statistics/distributions/binoinv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/binoinv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} binomial_inv (@var{x}, @var{n}, @var{p}) +## @deftypefn {Function File} {} binoinv (@var{x}, @var{n}, @var{p}) ## For each element of @var{x}, compute the quantile at @var{x} of the ## binomial distribution with parameters @var{n} and @var{p}. ## @end deftypefn @@ -26,16 +26,16 @@ ## Author: KH ## Description: Quantile function of the binomial distribution -function inv = binomial_inv (x, n, p) +function inv = binoinv (x, n, p) if (nargin != 3) - usage ("binomial_inv (x, n, p)"); + usage ("binoinv (x, n, p)"); endif if (!isscalar (n) || !isscalar (p)) [retval, x, n, p] = common_size (x, n, p); if (retval > 0) - error ("binomial_inv: x, n and p must be of common size or scalars"); + error ("binoinv: x, n and p must be of common size or scalars"); endif endif @@ -52,12 +52,12 @@ & (p >= 0) & (p <= 1)); if (any (k)) if (isscalar (n) && isscalar (p)) - cdf = binomial_pdf (0, n, p) * ones (size(k)); + cdf = binopdf (0, n, p) * ones (size(k)); while (any (inv(k) < n)) m = find (cdf < x(k)); if (any (m)) inv(k(m)) = inv(k(m)) + 1; - cdf(m) = cdf(m) + binomial_pdf (inv(k(m)), n, p); + cdf(m) = cdf(m) + binopdf (inv(k(m)), n, p); else break; endif @@ -68,7 +68,7 @@ m = find (cdf < x(k)); if (any (m)) inv(k(m)) = inv(k(m)) + 1; - cdf(m) = cdf(m) + binomial_pdf (inv(k(m)), n(k(m)), p(k(m))); + cdf(m) = cdf(m) + binopdf (inv(k(m)), n(k(m)), p(k(m))); else break; endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/binomial_cdf.m --- a/scripts/statistics/distributions/binomial_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} binomial_cdf (@var{x}, @var{n}, @var{p}) -## For each element of @var{x}, compute the CDF at @var{x} of the -## binomial distribution with parameters @var{n} and @var{p}. -## @end deftypefn - -## Author: KH -## Description: CDF of the binomial distribution - -function cdf = binomial_cdf (x, n, p) - - if (nargin != 3) - usage ("binomial_cdf (x, n, p)"); - endif - - if (!isscalar (n) || !isscalar (p)) - [retval, x, n, p] = common_size (x, n, p); - if (retval > 0) - error ("binomial_cdf: x, n and p must be of common size or scalar"); - endif - endif - - sz = size (x); - cdf = zeros (sz); - - k = find (isnan (x) | !(n >= 0) | (n != round (n)) - | !(p >= 0) | !(p <= 1)); - if (any (k)) - cdf(k) = NaN; - endif - - k = find ((x >= n) & (n >= 0) & (n == round (n)) - & (p >= 0) & (p <= 1)); - if (any (k)) - cdf(k) = 1; - endif - - k = find ((x >= 0) & (x < n) & (n == round (n)) - & (p >= 0) & (p <= 1)); - if (any (k)) - tmp = floor (x(k)); - if (isscalar (n) && isscalar (p)) - cdf(k) = 1 - betainc (p, tmp + 1, n - tmp); - else - cdf(k) = 1 - betainc (p(k), tmp + 1, n(k) - tmp); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/binomial_inv.m --- a/scripts/statistics/distributions/binomial_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} binomial_inv (@var{x}, @var{n}, @var{p}) -## For each element of @var{x}, compute the quantile at @var{x} of the -## binomial distribution with parameters @var{n} and @var{p}. -## @end deftypefn - -## Author: KH -## Description: Quantile function of the binomial distribution - -function inv = binomial_inv (x, n, p) - - if (nargin != 3) - usage ("binomial_inv (x, n, p)"); - endif - - if (!isscalar (n) || !isscalar (p)) - [retval, x, n, p] = common_size (x, n, p); - if (retval > 0) - error ("binomial_inv: x, n and p must be of common size or scalars"); - endif - endif - - sz = size (x); - inv = zeros (sz); - - k = find (!(x >= 0) | !(x <= 1) | !(n >= 0) | (n != round (n)) - | !(p >= 0) | !(p <= 1)); - if (any (k)) - inv(k) = NaN; - endif - - k = find ((x >= 0) & (x <= 1) & (n >= 0) & (n == round (n)) - & (p >= 0) & (p <= 1)); - if (any (k)) - if (isscalar (n) && isscalar (p)) - cdf = binomial_pdf (0, n, p) * ones (size(k)); - while (any (inv(k) < n)) - m = find (cdf < x(k)); - if (any (m)) - inv(k(m)) = inv(k(m)) + 1; - cdf(m) = cdf(m) + binomial_pdf (inv(k(m)), n, p); - else - break; - endif - endwhile - else - cdf = binomial_pdf (0, n(k), p(k)); - while (any (inv(k) < n(k))) - m = find (cdf < x(k)); - if (any (m)) - inv(k(m)) = inv(k(m)) + 1; - cdf(m) = cdf(m) + binomial_pdf (inv(k(m)), n(k(m)), p(k(m))); - else - break; - endif - endwhile - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/binomial_pdf.m --- a/scripts/statistics/distributions/binomial_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} binomial_pdf (@var{x}, @var{n}, @var{p}) -## For each element of @var{x}, compute the probability density function -## (PDF) at @var{x} of the binomial distribution with parameters @var{n} -## and @var{p}. -## @end deftypefn - -## Author: KH -## Description: PDF of the binomial distribution - -function pdf = binomial_pdf (x, n, p) - - if (nargin != 3) - usage ("binomial_pdf (x, n, p)"); - endif - - if (! isscalar (n) || ! isscalar (p)) - [retval, x, n, p] = common_size (x, n, p); - if (retval > 0) - error ("binomial_pdf: x, n and p must be of common size or scalar"); - endif - endif - - k = ((x >= 0) & (x <= n) - & (x == round (x)) & (n == round (n)) - & (p >= 0) & (p <= 1)); - - pdf = zeros (size (x)); - pdf(! k) = NaN; - if (any (k(:))) - x = x(k); - if (! isscalar (n)) - n = n(k); - endif - if (! isscalar (p)) - p = p(k); - endif - z = gammaln(n+1) - gammaln(x+1) - gammaln(n-x+1) + x.*log(p) + (n-x).*log(1-p); - pdf(k) = exp (z); - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/binomial_rnd.m --- a/scripts/statistics/distributions/binomial_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} binomial_rnd (@var{n}, @var{p}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} binomial_rnd (@var{n}, @var{p}, @var{sz}) -## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of -## random samples from the binomial distribution with parameters @var{n} -## and @var{p}. Both @var{n} and @var{p} must be scalar or of size -## @var{r} by @var{c}. -## -## If @var{r} and @var{c} are omitted, the size of the result matrix is -## the common size of @var{n} and @var{p}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the binomial distribution - -function rnd = binomial_rnd (n, p, r, c) - - if (nargin > 1) - if (!isscalar(n) || !isscalar(p)) - [retval, n, p] = common_size (n, p); - if (retval > 0) - error ("binomial_rnd: n and p must be of common size or scalar"); - endif - endif - endif - - if (nargin == 4) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("binomial_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("binomial_rnd: c must be a positive integer"); - endif - sz = [r, c]; - - if (any (size (n) != 1) - && (length (size (n)) != length (sz) || any (size (n) != sz))) - error ("binomial_rnd: n and must be scalar or of size [r, c]"); - endif - elseif (nargin == 3) - if (isscalar (r) && (r > 0)) - sz = [r, r]; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("binomial_rnd: r must be a postive integer or vector"); - endif - - if (any (size (n) != 1) - && (length (size (n)) != length (sz) || any (size (n) != sz))) - error ("binomial_rnd: n and must be scalar or of size sz"); - endif - elseif (nargin == 2) - sz = size(n); - else - usage ("binomial_rnd (n, p, r, c)"); - endif - - if (isscalar (n) && isscalar (p)) - if (find (!(n > 0) | !(n < Inf) | !(n == round (n)) | - !(p >= 0) | !(p <= 1))) - rnd = NaN * ones (sz); - else - nel = prod (sz); - tmp = rand (n, nel); - rnd = sum(tmp < ones (n, nel) * p, 1); - rnd = reshape(rnd, sz); - endif - else - rnd = zeros (sz); - - k = find (!(n > 0) | !(n < Inf) | !(n == round (n)) | - !(p >= 0) | !(p <= 1)); - if (any (k)) - rnd(k) = NaN; - endif - - k = find ((n > 0) & (n < Inf) & (n == round (n)) & (p >= 0) & (p <= 1)); - if (any (k)) - N = max (n(k)); - L = length (k); - tmp = rand (N, L); - ind = (1 : N)' * ones (1, L); - rnd(k) = sum ((tmp < ones (N, 1) * p(k)(:)') & - (ind <= ones (N, 1) * n(k)(:)'),1); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/binopdf.m --- a/scripts/statistics/distributions/binopdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/binopdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} binomial_pdf (@var{x}, @var{n}, @var{p}) +## @deftypefn {Function File} {} binopdf (@var{x}, @var{n}, @var{p}) ## For each element of @var{x}, compute the probability density function ## (PDF) at @var{x} of the binomial distribution with parameters @var{n} ## and @var{p}. @@ -27,16 +27,16 @@ ## Author: KH ## Description: PDF of the binomial distribution -function pdf = binomial_pdf (x, n, p) +function pdf = binopdf (x, n, p) if (nargin != 3) - usage ("binomial_pdf (x, n, p)"); + usage ("binopdf (x, n, p)"); endif if (! isscalar (n) || ! isscalar (p)) [retval, x, n, p] = common_size (x, n, p); if (retval > 0) - error ("binomial_pdf: x, n and p must be of common size or scalar"); + error ("binopdf: x, n and p must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/binornd.m --- a/scripts/statistics/distributions/binornd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/binornd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,8 +18,8 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} binomial_rnd (@var{n}, @var{p}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} binomial_rnd (@var{n}, @var{p}, @var{sz}) +## @deftypefn {Function File} {} binornd (@var{n}, @var{p}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} binornd (@var{n}, @var{p}, @var{sz}) ## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of ## random samples from the binomial distribution with parameters @var{n} ## and @var{p}. Both @var{n} and @var{p} must be scalar or of size @@ -32,29 +32,29 @@ ## Author: KH ## Description: Random deviates from the binomial distribution -function rnd = binomial_rnd (n, p, r, c) +function rnd = binornd (n, p, r, c) if (nargin > 1) if (!isscalar(n) || !isscalar(p)) [retval, n, p] = common_size (n, p); if (retval > 0) - error ("binomial_rnd: n and p must be of common size or scalar"); + error ("binornd: n and p must be of common size or scalar"); endif endif endif if (nargin == 4) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("binomial_rnd: r must be a positive integer"); + error ("binornd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("binomial_rnd: c must be a positive integer"); + error ("binornd: c must be a positive integer"); endif sz = [r, c]; if (any (size (n) != 1) && (length (size (n)) != length (sz) || any (size (n) != sz))) - error ("binomial_rnd: n and must be scalar or of size [r, c]"); + error ("binornd: n and must be scalar or of size [r, c]"); endif elseif (nargin == 3) if (isscalar (r) && (r > 0)) @@ -62,17 +62,17 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("binomial_rnd: r must be a postive integer or vector"); + error ("binornd: r must be a postive integer or vector"); endif if (any (size (n) != 1) && (length (size (n)) != length (sz) || any (size (n) != sz))) - error ("binomial_rnd: n and must be scalar or of size sz"); + error ("binornd: n and must be scalar or of size sz"); endif elseif (nargin == 2) sz = size(n); else - usage ("binomial_rnd (n, p, r, c)"); + usage ("binornd (n, p, r, c)"); endif if (isscalar (n) && isscalar (p)) diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/chi2cdf.m --- a/scripts/statistics/distributions/chi2cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/chi2cdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} chisquare_cdf (@var{x}, @var{n}) +## @deftypefn {Function File} {} chi2cdf (@var{x}, @var{n}) ## For each element of @var{x}, compute the cumulative distribution ## function (CDF) at @var{x} of the chisquare distribution with @var{n} ## degrees of freedom. @@ -27,19 +27,19 @@ ## Author: TT ## Description: CDF of the chi-square distribution -function cdf = chisquare_cdf (x, n) +function cdf = chi2cdf (x, n) if (nargin != 2) - usage ("chisquare_cdf (x, n)"); + usage ("chi2cdf (x, n)"); endif if (!isscalar (n)) [retval, x, n] = common_size (x, n); if (retval > 0) - error ("chisquare_cdf: x and n must be of common size or scalar"); + error ("chi2cdf: x and n must be of common size or scalar"); endif endif - cdf = gamma_cdf (x, n / 2, 1 / 2); + cdf = gamcdf (x, n / 2, 1 / 2); endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/chi2inv.m --- a/scripts/statistics/distributions/chi2inv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/chi2inv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} chisquare_inv (@var{x}, @var{n}) +## @deftypefn {Function File} {} chi2inv (@var{x}, @var{n}) ## For each element of @var{x}, compute the quantile (the inverse of the ## CDF) at @var{x} of the chisquare distribution with @var{n} degrees of ## freedom. @@ -27,19 +27,19 @@ ## Author: TT ## Description: Quantile function of the chi-square distribution -function inv = chisquare_inv (x, n) +function inv = chi2inv (x, n) if (nargin != 2) - usage ("chisquare_inv (x, n)"); + usage ("chi2inv (x, n)"); endif if (!isscalar (n)) [retval, x, n] = common_size (x, n); if (retval > 0) - error ("chisquare_inv: x and n must be of common size or scalar"); + error ("chi2inv: x and n must be of common size or scalar"); endif endif - inv = gamma_inv (x, n / 2, 1 / 2); + inv = gaminv (x, n / 2, 1 / 2); endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/chi2rnd.m --- a/scripts/statistics/distributions/chi2rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/chi2rnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,8 +18,8 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} chisquare_rnd (@var{n}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} chisquare_rnd (@var{n}, @var{sz}) +## @deftypefn {Function File} {} chi2rnd (@var{n}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} chi2rnd (@var{n}, @var{sz}) ## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of ## random samples from the chisquare distribution with @var{n} degrees ## of freedom. @var{n} must be a scalar or of size @var{r} by @var{c}. @@ -31,20 +31,20 @@ ## Author: KH ## Description: Random deviates from the chi-square distribution -function rnd = chisquare_rnd (n, r, c) +function rnd = chi2rnd (n, r, c) if (nargin == 3) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("chisquare_rnd: r must be a positive integer"); + error ("chi2rnd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("chisquare_rnd: c must be a positive integer"); + error ("chi2rnd: c must be a positive integer"); endif sz = [r, c]; if (any (size (n) != 1) && (length (size (n)) != length (sz) || any (size (n) != sz))) - error ("chisquare_rnd: n must be scalar or of size [r, c]"); + error ("chi2rnd: n must be scalar or of size [r, c]"); endif elseif (nargin == 2) if (isscalar (r) && (r > 0)) @@ -52,29 +52,29 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("chisquare_rnd: r must be a postive integer or vector"); + error ("chi2rnd: r must be a postive integer or vector"); endif if (any (size (n) != 1) && (length (size (n)) != length (sz) || any (size (n) != sz))) - error ("chisquare_rnd: n must be scalar or of size sz"); + error ("chi2rnd: n must be scalar or of size sz"); endif elseif (nargin == 1) sz = size(n); else - usage ("chisquare_rnd (n, r, c)"); + usage ("chi2rnd (n, r, c)"); endif if (isscalar (n)) if (find (!(n > 0) | !(n < Inf))) rnd = NaN * ones (sz); else - rnd = chisquare_inv (rand (sz), n); + rnd = chi2inv (rand (sz), n); endif else [retval, n, dummy] = common_size (n, ones (sz)); if (retval > 0) - error ("chisquare_rnd: a and b must be of common size or scalar"); + error ("chi2rnd: a and b must be of common size or scalar"); endif rnd = zeros (sz); @@ -85,7 +85,7 @@ k = find ((n > 0) & (n < Inf)); if (any (k)) - rnd(k) = chisquare_inv (rand (size (k)), n(k)); + rnd(k) = chi2inv (rand (size (k)), n(k)); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/chisquare_cdf.m --- a/scripts/statistics/distributions/chisquare_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} chisquare_cdf (@var{x}, @var{n}) -## For each element of @var{x}, compute the cumulative distribution -## function (CDF) at @var{x} of the chisquare distribution with @var{n} -## degrees of freedom. -## @end deftypefn - -## Author: TT -## Description: CDF of the chi-square distribution - -function cdf = chisquare_cdf (x, n) - - if (nargin != 2) - usage ("chisquare_cdf (x, n)"); - endif - - if (!isscalar (n)) - [retval, x, n] = common_size (x, n); - if (retval > 0) - error ("chisquare_cdf: x and n must be of common size or scalar"); - endif - endif - - cdf = gamma_cdf (x, n / 2, 1 / 2); - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/chisquare_inv.m --- a/scripts/statistics/distributions/chisquare_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} chisquare_inv (@var{x}, @var{n}) -## For each element of @var{x}, compute the quantile (the inverse of the -## CDF) at @var{x} of the chisquare distribution with @var{n} degrees of -## freedom. -## @end deftypefn - -## Author: TT -## Description: Quantile function of the chi-square distribution - -function inv = chisquare_inv (x, n) - - if (nargin != 2) - usage ("chisquare_inv (x, n)"); - endif - - if (!isscalar (n)) - [retval, x, n] = common_size (x, n); - if (retval > 0) - error ("chisquare_inv: x and n must be of common size or scalar"); - endif - endif - - inv = gamma_inv (x, n / 2, 1 / 2); - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/chisquare_pdf.m --- a/scripts/statistics/distributions/chisquare_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} chisquare_pdf (@var{x}, @var{n}) -## For each element of @var{x}, compute the probability density function -## (PDF) at @var{x} of the chisquare distribution with @var{k} degrees -## of freedom. -## @end deftypefn - -## Author: TT -## Description: PDF of the chi-sqaure distribution - -function pdf = chisquare_pdf (x, n) - - if (nargin != 2) - usage ("chisquare_pdf (x, n)"); - endif - - if (!isscalar (n)) - [retval, x, n] = common_size (x, n); - if (retval > 0) - error ("chisquare_pdf: x and n must be of common size or scalar"); - endif - endif - - pdf = gamma_pdf (x, n / 2, 1 / 2); - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/chisquare_rnd.m --- a/scripts/statistics/distributions/chisquare_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} chisquare_rnd (@var{n}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} chisquare_rnd (@var{n}, @var{sz}) -## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of -## random samples from the chisquare distribution with @var{n} degrees -## of freedom. @var{n} must be a scalar or of size @var{r} by @var{c}. -## -## If @var{r} and @var{c} are omitted, the size of the result matrix is -## the size of @var{n}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the chi-square distribution - -function rnd = chisquare_rnd (n, r, c) - - if (nargin == 3) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("chisquare_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("chisquare_rnd: c must be a positive integer"); - endif - sz = [r, c]; - - if (any (size (n) != 1) - && (length (size (n)) != length (sz) || any (size (n) != sz))) - error ("chisquare_rnd: n must be scalar or of size [r, c]"); - endif - elseif (nargin == 2) - if (isscalar (r) && (r > 0)) - sz = [r, r]; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("chisquare_rnd: r must be a postive integer or vector"); - endif - - if (any (size (n) != 1) - && (length (size (n)) != length (sz) || any (size (n) != sz))) - error ("chisquare_rnd: n must be scalar or of size sz"); - endif - elseif (nargin == 1) - sz = size(n); - else - usage ("chisquare_rnd (n, r, c)"); - endif - - if (isscalar (n)) - if (find (!(n > 0) | !(n < Inf))) - rnd = NaN * ones (sz); - else - rnd = chisquare_inv (rand (sz), n); - endif - else - [retval, n, dummy] = common_size (n, ones (sz)); - if (retval > 0) - error ("chisquare_rnd: a and b must be of common size or scalar"); - endif - - rnd = zeros (sz); - k = find (!(n > 0) | !(n < Inf)); - if (any (k)) - rnd(k) = NaN; - endif - - k = find ((n > 0) & (n < Inf)); - if (any (k)) - rnd(k) = chisquare_inv (rand (size (k)), n(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/expcdf.m --- a/scripts/statistics/distributions/expcdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/expcdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} exponential_cdf (@var{x}, @var{lambda}) +## @deftypefn {Function File} {} expcdf (@var{x}, @var{lambda}) ## For each element of @var{x}, compute the cumulative distribution ## function (CDF) at @var{x} of the exponential distribution with ## parameter @var{lambda}. @@ -29,16 +29,16 @@ ## Author: KH ## Description: CDF of the exponential distribution -function cdf = exponential_cdf (x, l) +function cdf = expcdf (x, l) if (nargin != 2) - usage ("exponential_cdf (x, lambda)"); + usage ("expcdf (x, lambda)"); endif if (!isscalar (x) && !isscalar(l)) [retval, x, l] = common_size (x, l); if (retval > 0) - error ("exponential_cdf: x and lambda must be of common size or scalar"); + error ("expcdf: x and lambda must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/expinv.m --- a/scripts/statistics/distributions/expinv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/expinv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} exponential_inv (@var{x}, @var{lambda}) +## @deftypefn {Function File} {} expinv (@var{x}, @var{lambda}) ## For each element of @var{x}, compute the quantile (the inverse of the ## CDF) at @var{x} of the exponential distribution with parameter ## @var{lambda}. @@ -27,16 +27,16 @@ ## Author: KH ## Description: Quantile function of the exponential distribution -function inv = exponential_inv (x, l) +function inv = expinv (x, l) if (nargin != 2) - usage ("exponential_inv (x, lambda)"); + usage ("expinv (x, lambda)"); endif if (!isscalar (x) && !isscalar(l)) [retval, x, l] = common_size (x, l); if (retval > 0) - error ("exponential_inv: x and lambda must be of common size or scalar"); + error ("expinv: x and lambda must be of common size or scalar"); endif endif @@ -70,3 +70,4 @@ endif endfunction + diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/exponential_cdf.m --- a/scripts/statistics/distributions/exponential_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} exponential_cdf (@var{x}, @var{lambda}) -## For each element of @var{x}, compute the cumulative distribution -## function (CDF) at @var{x} of the exponential distribution with -## parameter @var{lambda}. -## -## The arguments can be of common size or scalar. -## @end deftypefn - -## Author: KH -## Description: CDF of the exponential distribution - -function cdf = exponential_cdf (x, l) - - if (nargin != 2) - usage ("exponential_cdf (x, lambda)"); - endif - - if (!isscalar (x) && !isscalar(l)) - [retval, x, l] = common_size (x, l); - if (retval > 0) - error ("exponential_cdf: x and lambda must be of common size or scalar"); - endif - endif - - if (isscalar (x)) - sz = size (l); - else - sz = size (x); - endif - - cdf = zeros (sz); - - k = find (isnan (x) | !(l > 0)); - if (any (k)) - cdf(k) = NaN; - endif - - k = find ((x == Inf) & (l > 0)); - if (any (k)) - cdf(k) = 1; - endif - - k = find ((x > 0) & (x < Inf) & (l > 0)); - if (any (k)) - if isscalar (l) - cdf (k) = 1 - exp (- l .* x(k)); - elseif isscalar (x) - cdf (k) = 1 - exp (- l(k) .* x); - else - cdf (k) = 1 - exp (- l(k) .* x(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/exponential_inv.m --- a/scripts/statistics/distributions/exponential_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} exponential_inv (@var{x}, @var{lambda}) -## For each element of @var{x}, compute the quantile (the inverse of the -## CDF) at @var{x} of the exponential distribution with parameter -## @var{lambda}. -## @end deftypefn - -## Author: KH -## Description: Quantile function of the exponential distribution - -function inv = exponential_inv (x, l) - - if (nargin != 2) - usage ("exponential_inv (x, lambda)"); - endif - - if (!isscalar (x) && !isscalar(l)) - [retval, x, l] = common_size (x, l); - if (retval > 0) - error ("exponential_inv: x and lambda must be of common size or scalar"); - endif - endif - - if (isscalar (x)) - sz = size (l); - else - sz = size (x); - endif - - inv = zeros (sz); - - k = find (!(l > 0) | (x < 0) | (x > 1) | isnan (x)); - if (any (k)) - inv(k) = NaN; - endif - - k = find ((x == 1) & (l > 0)); - if (any (k)) - inv(k) = Inf; - endif - - k = find ((x > 0) & (x < 1) & (l > 0)); - if (any (k)) - if isscalar (l) - inv(k) = - log (1 - x(k)) ./ l; - elseif isscalar (x) - inv(k) = - log (1 - x) ./ l(k); - else - inv(k) = - log (1 - x(k)) ./ l(k); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/exponential_pdf.m --- a/scripts/statistics/distributions/exponential_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} exponential_pdf (@var{x}, @var{lambda}) -## For each element of @var{x}, compute the probability density function -## (PDF) of the exponential distribution with parameter @var{lambda}. -## @end deftypefn - -## Author: KH -## Description: PDF of the exponential distribution - -function pdf = exponential_pdf (x, l) - - if (nargin != 2) - usage ("exponential_pdf (x, lambda)"); - endif - - if (!isscalar (x) && !isscalar(l)) - [retval, x, l] = common_size (x, l); - if (retval > 0) - error ("exponential_pdf: x and lambda must be of common size or scalar"); - endif - endif - - if (isscalar (x)) - sz = size (l); - else - sz = size (x); - endif - pdf = zeros (sz); - - k = find (!(l > 0) | isnan (x)); - if (any (k)) - pdf(k) = NaN; - endif - - k = find ((x > 0) & (x < Inf) & (l > 0)); - if (any (k)) - if isscalar (l) - pdf(k) = l .* exp (- l .* x(k)); - elseif isscalar (x) - pdf(k) = l(k) .* exp (- l(k) .* x); - else - pdf(k) = l(k) .* exp (- l(k) .* x(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/exponential_rnd.m --- a/scripts/statistics/distributions/exponential_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} exponential_rnd (@var{lambda}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} exponential_rnd (@var{lambda}, @var{sz}) -## Return an @var{r} by @var{c} matrix of random samples from the -## exponential distribution with parameter @var{lambda}, which must be a -## scalar or of size @var{r} by @var{c}. Or if @var{sz} is a vector, -## create a matrix of size @var{sz}. -## -## If @var{r} and @var{c} are omitted, the size of the result matrix is -## the size of @var{lambda}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the exponential distribution - -function rnd = exponential_rnd (l, r, c) - - if (nargin == 3) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("exponential_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("exponential_rnd: c must be a positive integer"); - endif - sz = [r, c]; - - if (any (size (l) != 1) && - ((length (size (nl)) != length (sz)) || any (size (l) != sz))) - error ("exponential_rnd: lambda must be scalar or of size [r, c]"); - endif - elseif (nargin == 2) - if (isscalar (r) && (r > 0)) - sz = [r, r]; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("exponential_rnd: r must be a postive integer or vector"); - endif - - if (any (size (l) != 1) && - ((length (size (l)) != length (sz)) || any (size (l) != sz))) - error ("exponential_rnd: lambda must be scalar or of size sz"); - endif - elseif (nargin == 1) - sz = size (l); - else - usage ("exponential_rnd (lambda, r, c)"); - endif - - - if (isscalar (l)) - if ((l > 0) && (l < Inf)) - rnd = - log (1 - rand (sz)) ./ l; - else - rnd = NaN * ones (sz); - endif - else - rnd = zeros (sz); - k = find (!(l > 0) | !(l < Inf)); - if (any (k)) - rnd(k) = NaN; - endif - k = find ((l > 0) & (l < Inf)); - if (any (k)) - rnd(k) = - log (1 - rand (size (k))) ./ l(k); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/exppdf.m --- a/scripts/statistics/distributions/exppdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/exppdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} exponential_pdf (@var{x}, @var{lambda}) +## @deftypefn {Function File} {} exppdf (@var{x}, @var{lambda}) ## For each element of @var{x}, compute the probability density function ## (PDF) of the exponential distribution with parameter @var{lambda}. ## @end deftypefn @@ -26,16 +26,16 @@ ## Author: KH ## Description: PDF of the exponential distribution -function pdf = exponential_pdf (x, l) +function pdf = exppdf (x, l) if (nargin != 2) - usage ("exponential_pdf (x, lambda)"); + usage ("exppdf (x, lambda)"); endif if (!isscalar (x) && !isscalar(l)) [retval, x, l] = common_size (x, l); if (retval > 0) - error ("exponential_pdf: x and lambda must be of common size or scalar"); + error ("exppdf: x and lambda must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/exprnd.m --- a/scripts/statistics/distributions/exprnd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/exprnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,8 +18,8 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} exponential_rnd (@var{lambda}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} exponential_rnd (@var{lambda}, @var{sz}) +## @deftypefn {Function File} {} exprnd (@var{lambda}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} exprnd (@var{lambda}, @var{sz}) ## Return an @var{r} by @var{c} matrix of random samples from the ## exponential distribution with parameter @var{lambda}, which must be a ## scalar or of size @var{r} by @var{c}. Or if @var{sz} is a vector, @@ -32,20 +32,20 @@ ## Author: KH ## Description: Random deviates from the exponential distribution -function rnd = exponential_rnd (l, r, c) +function rnd = exprnd (l, r, c) if (nargin == 3) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("exponential_rnd: r must be a positive integer"); + error ("exprnd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("exponential_rnd: c must be a positive integer"); + error ("exprnd: c must be a positive integer"); endif sz = [r, c]; if (any (size (l) != 1) && ((length (size (nl)) != length (sz)) || any (size (l) != sz))) - error ("exponential_rnd: lambda must be scalar or of size [r, c]"); + error ("exprnd: lambda must be scalar or of size [r, c]"); endif elseif (nargin == 2) if (isscalar (r) && (r > 0)) @@ -53,17 +53,17 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("exponential_rnd: r must be a postive integer or vector"); + error ("exprnd: r must be a postive integer or vector"); endif if (any (size (l) != 1) && ((length (size (l)) != length (sz)) || any (size (l) != sz))) - error ("exponential_rnd: lambda must be scalar or of size sz"); + error ("exprnd: lambda must be scalar or of size sz"); endif elseif (nargin == 1) sz = size (l); else - usage ("exponential_rnd (lambda, r, c)"); + usage ("exprnd (lambda, r, c)"); endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/f_cdf.m --- a/scripts/statistics/distributions/f_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} f_cdf (@var{x}, @var{m}, @var{n}) -## For each element of @var{x}, compute the CDF at @var{x} of the F -## distribution with @var{m} and @var{n} degrees of freedom, i.e., -## PROB (F (@var{m}, @var{n}) <= @var{x}). -## @end deftypefn - -## Author: KH -## Description: CDF of the F distribution - -function cdf = f_cdf (x, m, n) - - if (nargin != 3) - usage ("f_cdf (x, m, n)"); - endif - - if (!isscalar (m) || !isscalar (n)) - [retval, x, m, n] = common_size (x, m, n); - if (retval > 0) - error ("f_cdf: x, m and n must be of common size or scalar"); - endif - endif - - sz = size (x); - cdf = zeros (sz); - - k = find (!(m > 0) | !(n > 0) | isnan (x)); - if (any (k)) - cdf(k) = NaN; - endif - - k = find ((x == Inf) & (m > 0) & (n > 0)); - if (any (k)) - cdf(k) = 1; - endif - - k = find ((x > 0) & (x < Inf) & (m > 0) & (n > 0)); - if (any (k)) - if (isscalar (m) && isscalar (n)) - cdf(k) = 1 - betainc (1 ./ (1 + m .* x(k) ./ n), n / 2, m / 2); - else - cdf(k) = 1 - betainc (1 ./ (1 + m(k) .* x(k) ./ n(k)), n(k) / 2, - m(k) / 2); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/f_inv.m --- a/scripts/statistics/distributions/f_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} f_inv (@var{x}, @var{m}, @var{n}) -## For each component of @var{x}, compute the quantile (the inverse of -## the CDF) at @var{x} of the F distribution with parameters @var{m} and -## @var{n}. -## @end deftypefn - -## Author: KH -## Description: Quantile function of the F distribution - -function inv = f_inv (x, m, n) - - if (nargin != 3) - usage ("f_inv (x, m, n)"); - endif - - if (!isscalar (m) || !isscalar (n)) - [retval, x, m, n] = common_size (x, m, n); - if (retval > 0) - error ("f_inv: x, m and n must be of common size or scalar"); - endif - endif - - sz = size (x); - inv = zeros (sz); - - k = find ((x < 0) | (x > 1) | isnan (x) | !(m > 0) | !(n > 0)); - if (any (k)) - inv(k) = NaN; - endif - - k = find ((x == 1) & (m > 0) & (n > 0)); - if (any (k)) - inv(k) = Inf; - endif - - k = find ((x > 0) & (x < 1) & (m > 0) & (n > 0)); - if (any (k)) - if (isscalar (m) && isscalar (n)) - inv(k) = ((1 ./ beta_inv (1 - x(k), n / 2, m / 2) - 1) .* n ./ m); - else - inv(k) = ((1 ./ beta_inv (1 - x(k), n(k) / 2, m(k) / 2) - 1) - .* n(k) ./ m(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/f_pdf.m --- a/scripts/statistics/distributions/f_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} f_pdf (@var{x}, @var{m}, @var{n}) -## For each element of @var{x}, compute the probability density function -## (PDF) at @var{x} of the F distribution with @var{m} and @var{n} -## degrees of freedom. -## @end deftypefn - -## Author: KH -## Description: PDF of the F distribution - -function pdf = f_pdf (x, m, n) - - if (nargin != 3) - usage ("f_pdf (x, m, n)"); - endif - - if (!isscalar (m) || !isscalar (n)) - [retval, x, m, n] = common_size (x, m, n); - if (retval > 0) - error ("f_pdf: x, m and n must be of common size or scalar"); - endif - endif - - sz = size (x); - pdf = zeros (sz); - - k = find (isnan (x) | !(m > 0) | !(n > 0)); - if (any (k)) - pdf(k) = NaN; - endif - - k = find ((x > 0) & (x < Inf) & (m > 0) & (n > 0)); - if (any (k)) - if (isscalar (m) && isscalar (n)) - tmp = m / n * x(k); - pdf(k) = (exp ((m / 2 - 1) .* log (tmp) - - ((m + n) / 2) .* log (1 + tmp)) - .* (m / n) ./ beta (m / 2, n / 2)); - else - tmp = m(k) .* x(k) ./ n(k); - pdf(k) = (exp ((m(k) / 2 - 1) .* log (tmp) - - ((m(k) + n(k)) / 2) .* log (1 + tmp)) - .* (m(k) ./ n(k)) ./ beta (m(k) / 2, n(k) / 2)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/f_rnd.m --- a/scripts/statistics/distributions/f_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} f_rnd (@var{m}, @var{n}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} f_rnd (@var{m}, @var{n}, @var{sz}) -## Return an @var{r} by @var{c} matrix of random samples from the F -## distribution with @var{m} and @var{n} degrees of freedom. Both -## @var{m} and @var{n} must be scalar or of size @var{r} by @var{c}. -## If @var{sz} is a vector the random samples are in a matrix of -## size @var{sz}. -## -## If @var{r} and @var{c} are omitted, the size of the result matrix is -## the common size of @var{m} and @var{n}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the F distribution - -function rnd = f_rnd (m, n, r, c) - - if (nargin > 1) - if (!isscalar(m) || !isscalar(n)) - [retval, m, n] = common_size (m, n); - if (retval > 0) - error ("f_rnd: m and n must be of common size or scalar"); - endif - endif - endif - - - if (nargin == 4) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("f_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("f_rnd: c must be a positive integer"); - endif - sz = [r, c]; - - if (any (size (m) != 1) && - ((length (size (m)) != length (sz)) || any (size (m) != sz))) - error ("f_rnd: m and n must be scalar or of size [r,c]"); - endif - elseif (nargin == 3) - if (isscalar (r) && (r > 0)) - sz = [r, r]; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("f_rnd: r must be a postive integer or vector"); - endif - - if (any (size (m) != 1) && - ((length (size (m)) != length (sz)) || any (size (m) != sz))) - error ("f_rnd: m and n must be scalar or of size sz"); - endif - elseif (nargin == 2) - sz = size(a); - else - usage ("f_rnd (m, n, r, c)"); - endif - - - if (isscalar (m) && isscalar (n)) - if ((m > 0) && (m < Inf) && (n > 0) && (n < Inf)) - rnd = f_inv (rand (sz), m, n); - else - rnd = NaN * ones (sz); - endif - else - rnd = zeros (sz); - - k = find (!(m > 0) | !(m < Inf) | - !(n > 0) | !(n < Inf)); - if (any (k)) - rnd(k) = NaN; - endif - - k = find ((m > 0) & (m < Inf) & - (n > 0) & (n < Inf)); - if (any (k)) - rnd(k) = f_inv (rand (size (k)), m(k), n(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/fcdf.m --- a/scripts/statistics/distributions/fcdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/fcdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} f_cdf (@var{x}, @var{m}, @var{n}) +## @deftypefn {Function File} {} fcdf (@var{x}, @var{m}, @var{n}) ## For each element of @var{x}, compute the CDF at @var{x} of the F ## distribution with @var{m} and @var{n} degrees of freedom, i.e., ## PROB (F (@var{m}, @var{n}) <= @var{x}). @@ -27,16 +27,16 @@ ## Author: KH ## Description: CDF of the F distribution -function cdf = f_cdf (x, m, n) +function cdf = fcdf (x, m, n) if (nargin != 3) - usage ("f_cdf (x, m, n)"); + usage ("fcdf (x, m, n)"); endif if (!isscalar (m) || !isscalar (n)) [retval, x, m, n] = common_size (x, m, n); if (retval > 0) - error ("f_cdf: x, m and n must be of common size or scalar"); + error ("fcdf: x, m and n must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/finv.m --- a/scripts/statistics/distributions/finv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/finv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} f_inv (@var{x}, @var{m}, @var{n}) +## @deftypefn {Function File} {} finv (@var{x}, @var{m}, @var{n}) ## For each component of @var{x}, compute the quantile (the inverse of ## the CDF) at @var{x} of the F distribution with parameters @var{m} and ## @var{n}. @@ -27,16 +27,16 @@ ## Author: KH ## Description: Quantile function of the F distribution -function inv = f_inv (x, m, n) +function inv = finv (x, m, n) if (nargin != 3) - usage ("f_inv (x, m, n)"); + usage ("finv (x, m, n)"); endif if (!isscalar (m) || !isscalar (n)) [retval, x, m, n] = common_size (x, m, n); if (retval > 0) - error ("f_inv: x, m and n must be of common size or scalar"); + error ("finv: x, m and n must be of common size or scalar"); endif endif @@ -56,9 +56,9 @@ k = find ((x > 0) & (x < 1) & (m > 0) & (n > 0)); if (any (k)) if (isscalar (m) && isscalar (n)) - inv(k) = ((1 ./ beta_inv (1 - x(k), n / 2, m / 2) - 1) .* n ./ m); + inv(k) = ((1 ./ betainv (1 - x(k), n / 2, m / 2) - 1) .* n ./ m); else - inv(k) = ((1 ./ beta_inv (1 - x(k), n(k) / 2, m(k) / 2) - 1) + inv(k) = ((1 ./ betainv (1 - x(k), n(k) / 2, m(k) / 2) - 1) .* n(k) ./ m(k)); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/fpdf.m --- a/scripts/statistics/distributions/fpdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/fpdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} f_pdf (@var{x}, @var{m}, @var{n}) +## @deftypefn {Function File} {} fpdf (@var{x}, @var{m}, @var{n}) ## For each element of @var{x}, compute the probability density function ## (PDF) at @var{x} of the F distribution with @var{m} and @var{n} ## degrees of freedom. @@ -27,16 +27,16 @@ ## Author: KH ## Description: PDF of the F distribution -function pdf = f_pdf (x, m, n) +function pdf = fpdf (x, m, n) if (nargin != 3) - usage ("f_pdf (x, m, n)"); + usage ("fpdf (x, m, n)"); endif if (!isscalar (m) || !isscalar (n)) [retval, x, m, n] = common_size (x, m, n); if (retval > 0) - error ("f_pdf: x, m and n must be of common size or scalar"); + error ("fpdf: x, m and n must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/frnd.m --- a/scripts/statistics/distributions/frnd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/frnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,8 +18,8 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} f_rnd (@var{m}, @var{n}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} f_rnd (@var{m}, @var{n}, @var{sz}) +## @deftypefn {Function File} {} frnd (@var{m}, @var{n}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} frnd (@var{m}, @var{n}, @var{sz}) ## Return an @var{r} by @var{c} matrix of random samples from the F ## distribution with @var{m} and @var{n} degrees of freedom. Both ## @var{m} and @var{n} must be scalar or of size @var{r} by @var{c}. @@ -33,13 +33,13 @@ ## Author: KH ## Description: Random deviates from the F distribution -function rnd = f_rnd (m, n, r, c) +function rnd = frnd (m, n, r, c) if (nargin > 1) if (!isscalar(m) || !isscalar(n)) [retval, m, n] = common_size (m, n); if (retval > 0) - error ("f_rnd: m and n must be of common size or scalar"); + error ("frnd: m and n must be of common size or scalar"); endif endif endif @@ -47,16 +47,16 @@ if (nargin == 4) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("f_rnd: r must be a positive integer"); + error ("frnd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("f_rnd: c must be a positive integer"); + error ("frnd: c must be a positive integer"); endif sz = [r, c]; if (any (size (m) != 1) && ((length (size (m)) != length (sz)) || any (size (m) != sz))) - error ("f_rnd: m and n must be scalar or of size [r,c]"); + error ("frnd: m and n must be scalar or of size [r,c]"); endif elseif (nargin == 3) if (isscalar (r) && (r > 0)) @@ -64,17 +64,17 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("f_rnd: r must be a postive integer or vector"); + error ("frnd: r must be a postive integer or vector"); endif if (any (size (m) != 1) && ((length (size (m)) != length (sz)) || any (size (m) != sz))) - error ("f_rnd: m and n must be scalar or of size sz"); + error ("frnd: m and n must be scalar or of size sz"); endif elseif (nargin == 2) sz = size(a); else - usage ("f_rnd (m, n, r, c)"); + usage ("frnd (m, n, r, c)"); endif @@ -96,7 +96,7 @@ k = find ((m > 0) & (m < Inf) & (n > 0) & (n < Inf)); if (any (k)) - rnd(k) = f_inv (rand (size (k)), m(k), n(k)); + rnd(k) = finv (rand (size (k)), m(k), n(k)); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/gamcdf.m --- a/scripts/statistics/distributions/gamcdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/gamcdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} gamma_cdf (@var{x}, @var{a}, @var{b}) +## @deftypefn {Function File} {} gamcdf (@var{x}, @var{a}, @var{b}) ## For each element of @var{x}, compute the cumulative distribution ## function (CDF) at @var{x} of the Gamma distribution with parameters ## @var{a} and @var{b}. @@ -27,16 +27,16 @@ ## Author: TT ## Description: CDF of the Gamma distribution -function cdf = gamma_cdf (x, a, b) +function cdf = gamcdf (x, a, b) if (nargin != 3) - usage ("gamma_cdf (x, a, b)"); + usage ("gamcdf (x, a, b)"); endif if (!isscalar (a) || !isscalar(b)) [retval, x, a, b] = common_size (x, a, b); if (retval > 0) - error ("gamma_cdf: x, a and b must be of common size or scalars"); + error ("gamcdf: x, a and b must be of common size or scalars"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/gaminv.m --- a/scripts/statistics/distributions/gaminv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/gaminv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} gamma_inv (@var{x}, @var{a}, @var{b}) +## @deftypefn {Function File} {} gaminv (@var{x}, @var{a}, @var{b}) ## For each component of @var{x}, compute the quantile (the inverse of ## the CDF) at @var{x} of the Gamma distribution with parameters @var{a} ## and @var{b}. @@ -27,16 +27,16 @@ ## Author: KH ## Description: Quantile function of the Gamma distribution -function inv = gamma_inv (x, a, b) +function inv = gaminv (x, a, b) if (nargin != 3) - usage ("gamma_inv (x, a, b)"); + usage ("gaminv (x, a, b)"); endif if (!isscalar (a) || !isscalar(b)) [retval, x, a, b] = common_size (x, a, b); if (retval > 0) - error ("gamma_inv: x, a and b must be of common size or scalars"); + error ("gaminv: x, a and b must be of common size or scalars"); endif endif @@ -70,7 +70,7 @@ y_old = y; for i = 1 : 100 - h = (gamma_cdf (y_old, a, b) - x) ./ gamma_pdf (y_old, a, b); + h = (gamcdf (y_old, a, b) - x) ./ gampdf (y_old, a, b); y_new = y_old - h; ind = find (y_new <= eps); if (any (ind)) diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/gamma_cdf.m --- a/scripts/statistics/distributions/gamma_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} gamma_cdf (@var{x}, @var{a}, @var{b}) -## For each element of @var{x}, compute the cumulative distribution -## function (CDF) at @var{x} of the Gamma distribution with parameters -## @var{a} and @var{b}. -## @end deftypefn - -## Author: TT -## Description: CDF of the Gamma distribution - -function cdf = gamma_cdf (x, a, b) - - if (nargin != 3) - usage ("gamma_cdf (x, a, b)"); - endif - - if (!isscalar (a) || !isscalar(b)) - [retval, x, a, b] = common_size (x, a, b); - if (retval > 0) - error ("gamma_cdf: x, a and b must be of common size or scalars"); - endif - endif - - sz = size (x); - cdf = zeros (sz); - - k = find (!(a > 0) | !(b > 0) | isnan (x)); - if (any (k)) - cdf (k) = NaN; - endif - - k = find ((x > 0) & (a > 0) & (b > 0)); - if (any (k)) - if (isscalar (a) && isscalar(b)) - cdf (k) = gammainc (b * x(k), a); - else - cdf (k) = gammainc (b(k) .* x(k), a(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/gamma_inv.m --- a/scripts/statistics/distributions/gamma_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} gamma_inv (@var{x}, @var{a}, @var{b}) -## For each component of @var{x}, compute the quantile (the inverse of -## the CDF) at @var{x} of the Gamma distribution with parameters @var{a} -## and @var{b}. -## @end deftypefn - -## Author: KH -## Description: Quantile function of the Gamma distribution - -function inv = gamma_inv (x, a, b) - - if (nargin != 3) - usage ("gamma_inv (x, a, b)"); - endif - - if (!isscalar (a) || !isscalar(b)) - [retval, x, a, b] = common_size (x, a, b); - if (retval > 0) - error ("gamma_inv: x, a and b must be of common size or scalars"); - endif - endif - - sz = size (x); - inv = zeros (sz); - - k = find ((x < 0) | (x > 1) | isnan (x) | !(a > 0) | !(b > 0)); - if (any (k)) - inv (k) = NaN; - endif - - k = find ((x == 1) & (a > 0) & (b > 0)); - if (any (k)) - inv (k) = Inf; - endif - - k = find ((x > 0) & (x < 1) & (a > 0) & (b > 0)); - if (any (k)) - if (!isscalar(a) || !isscalar(b)) - a = a (k); - b = b (k); - y = a ./ b; - else - y = a / b * ones (size (k)); - endif - x = x (k); - l = find (x < eps); - if (any (l)) - y(l) = sqrt (eps) * ones (length (l), 1); - endif - - y_old = y; - for i = 1 : 100 - h = (gamma_cdf (y_old, a, b) - x) ./ gamma_pdf (y_old, a, b); - y_new = y_old - h; - ind = find (y_new <= eps); - if (any (ind)) - y_new (ind) = y_old (ind) / 10; - h = y_old - y_new; - endif - if (max (abs (h)) < sqrt (eps)) - break; - endif - y_old = y_new; - endfor - - inv (k) = y_new; - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/gamma_pdf.m --- a/scripts/statistics/distributions/gamma_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} gamma_pdf (@var{x}, @var{a}, @var{b}) -## For each element of @var{x}, return the probability density function -## (PDF) at @var{x} of the Gamma distribution with parameters @var{a} -## and @var{b}. -## @end deftypefn - -## Author: TT -## Description: PDF of the Gamma distribution - -function pdf = gamma_pdf (x, a, b) - - if (nargin != 3) - usage ("gamma_pdf (x, a, b)"); - endif - - if (!isscalar (a) || !isscalar(b)) - [retval, x, a, b] = common_size (x, a, b); - if (retval > 0) - error ("gamma_pdf: x, a and b must be of common size or scalars"); - endif - endif - - sz = size(x); - pdf = zeros (sz); - - k = find (!(a > 0) | !(b > 0) | isnan (x)); - if (any (k)) - pdf (k) = NaN; - endif - - k = find ((x > 0) & (a > 0) & (a <= 1) & (b > 0)); - if (any (k)) - if (isscalar(a) && isscalar(b)) - pdf(k) = ((b .^ a) .* (x(k) .^ (a - 1)) - .* exp(-b .* x(k)) ./ gamma (a)); - else - pdf(k) = ((b(k) .^ a(k)) .* (x(k) .^ (a(k) - 1)) - .* exp(-b(k) .* x(k)) ./ gamma (a(k))); - endif - endif - - k = find ((x > 0) & (a > 1) & (b > 0)); - if (any (k)) - if (isscalar(a) && isscalar(b)) - pdf(k) = exp (a .* log (b) + (a-1) .* log (x(k)) - - b .* x(k) - gammaln (a)); - else - pdf(k) = exp (a(k) .* log (b(k)) + (a(k)-1) .* log (x(k)) - - b(k) .* x(k) - gammaln (a(k))); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/gamma_rnd.m --- a/scripts/statistics/distributions/gamma_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} gamma_rnd (@var{a}, @var{b}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} gamma_rnd (@var{a}, @var{b}, @var{sz}) -## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of -## random samples from the Gamma distribution with parameters @var{a} -## and @var{b}. Both @var{a} and @var{b} must be scalar or of size -## @var{r} by @var{c}. -## -## If @var{r} and @var{c} are omitted, the size of the result matrix is -## the common size of @var{a} and @var{b}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the Gamma distribution - -function rnd = gamma_rnd (a, b, r, c) - - if (nargin > 1) - if (!isscalar(a) || !isscalar(b)) - [retval, a, b] = common_size (a, b); - if (retval > 0) - error ("gamma_rnd: a and b must be of common size or scalar"); - endif - endif - endif - - if (nargin == 4) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("gamma_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("gamma_rnd: c must be a positive integer"); - endif - sz = [r, c]; - - if (any (size (a) != 1) - && (length (size (a)) != length (sz) || any (size (a) != sz))) - error ("gamma_rnd: a and b must be scalar or of size [r, c]"); - endif - elseif (nargin == 3) - if (isscalar (r) && (r > 0)) - sz = [r, r]; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("uniform_rnd: r must be a postive integer or vector"); - endif - - if (any (size (a) != 1) - && (length (size (a)) != length (sz) || any (size (a) != sz))) - error ("gamma_rnd: a and b must be scalar or of size sz"); - endif - elseif (nargin == 2) - sz = size(a); - else - usage ("gamma_rnd (a, b, r, c)"); - endif - - rnd = zeros (sz); - - if (isscalar (a) && isscalar(b)) - if (find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf))) - rnd = NaN * ones (sz); - else - rnd = gamma_inv (rand (sz), a, b); - endif - else - k = find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf)); - if (any (k)) - rnd(k) = NaN; - endif - k = find ((a > 0) & (a < Inf) & (b > 0) & (b < Inf)); - if (any (k)) - rnd(k) = gamma_inv (rand (size (k)), a(k), b(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/gampdf.m --- a/scripts/statistics/distributions/gampdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/gampdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} gamma_pdf (@var{x}, @var{a}, @var{b}) +## @deftypefn {Function File} {} gampdf (@var{x}, @var{a}, @var{b}) ## For each element of @var{x}, return the probability density function ## (PDF) at @var{x} of the Gamma distribution with parameters @var{a} ## and @var{b}. @@ -27,16 +27,16 @@ ## Author: TT ## Description: PDF of the Gamma distribution -function pdf = gamma_pdf (x, a, b) +function pdf = gampdf (x, a, b) if (nargin != 3) - usage ("gamma_pdf (x, a, b)"); + usage ("gampdf (x, a, b)"); endif if (!isscalar (a) || !isscalar(b)) [retval, x, a, b] = common_size (x, a, b); if (retval > 0) - error ("gamma_pdf: x, a and b must be of common size or scalars"); + error ("gampdf: x, a and b must be of common size or scalars"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/gamrnd.m --- a/scripts/statistics/distributions/gamrnd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/gamrnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,8 +18,8 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} gamma_rnd (@var{a}, @var{b}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} gamma_rnd (@var{a}, @var{b}, @var{sz}) +## @deftypefn {Function File} {} gamrnd (@var{a}, @var{b}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} gamrnd (@var{a}, @var{b}, @var{sz}) ## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of ## random samples from the Gamma distribution with parameters @var{a} ## and @var{b}. Both @var{a} and @var{b} must be scalar or of size @@ -32,29 +32,29 @@ ## Author: KH ## Description: Random deviates from the Gamma distribution -function rnd = gamma_rnd (a, b, r, c) +function rnd = gamrnd (a, b, r, c) if (nargin > 1) if (!isscalar(a) || !isscalar(b)) [retval, a, b] = common_size (a, b); if (retval > 0) - error ("gamma_rnd: a and b must be of common size or scalar"); + error ("gamrnd: a and b must be of common size or scalar"); endif endif endif if (nargin == 4) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("gamma_rnd: r must be a positive integer"); + error ("gamrnd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("gamma_rnd: c must be a positive integer"); + error ("gamrnd: c must be a positive integer"); endif sz = [r, c]; if (any (size (a) != 1) && (length (size (a)) != length (sz) || any (size (a) != sz))) - error ("gamma_rnd: a and b must be scalar or of size [r, c]"); + error ("gamrnd: a and b must be scalar or of size [r, c]"); endif elseif (nargin == 3) if (isscalar (r) && (r > 0)) @@ -62,17 +62,17 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("uniform_rnd: r must be a postive integer or vector"); + error ("gamrnd: r must be a postive integer or vector"); endif if (any (size (a) != 1) && (length (size (a)) != length (sz) || any (size (a) != sz))) - error ("gamma_rnd: a and b must be scalar or of size sz"); + error ("gamrnd: a and b must be scalar or of size sz"); endif elseif (nargin == 2) sz = size(a); else - usage ("gamma_rnd (a, b, r, c)"); + usage ("gamrnd (a, b, r, c)"); endif rnd = zeros (sz); @@ -81,7 +81,7 @@ if (find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf))) rnd = NaN * ones (sz); else - rnd = gamma_inv (rand (sz), a, b); + rnd = gaminv (rand (sz), a, b); endif else k = find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf)); @@ -90,7 +90,7 @@ endif k = find ((a > 0) & (a < Inf) & (b > 0) & (b < Inf)); if (any (k)) - rnd(k) = gamma_inv (rand (size (k)), a(k), b(k)); + rnd(k) = gaminv (rand (size (k)), a(k), b(k)); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/geocdf.m --- a/scripts/statistics/distributions/geocdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/geocdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} geometric_cdf (@var{x}, @var{p}) +## @deftypefn {Function File} {} geocdf (@var{x}, @var{p}) ## For each element of @var{x}, compute the CDF at @var{x} of the ## geometric distribution with parameter @var{p}. ## @end deftypefn @@ -26,16 +26,16 @@ ## Author: KH ## Description: CDF of the geometric distribution -function cdf = geometric_cdf (x, p) +function cdf = geocdf (x, p) if (nargin != 2) - usage ("geometric_cdf (x, p)"); + usage ("geocdf (x, p)"); endif if (!isscalar (x) && !isscalar (p)) [retval, x, p] = common_size (x, p); if (retval > 0) - error ("geometric_cdf: x and p must be of common size or scalar"); + error ("geocdf: x and p must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/geoinv.m --- a/scripts/statistics/distributions/geoinv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/geoinv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} geometric_inv (@var{x}, @var{p}) +## @deftypefn {Function File} {} geoinv (@var{x}, @var{p}) ## For each element of @var{x}, compute the quantile at @var{x} of the ## geometric distribution with parameter @var{p}. ## @end deftypefn @@ -26,16 +26,16 @@ ## Author: KH ## Description: Quantile function of the geometric distribution -function inv = geometric_inv (x, p) +function inv = geoinv (x, p) if (nargin != 2) - usage ("geometric_inv (x, p)"); + usage ("geoinv (x, p)"); endif if (!isscalar (x) && !isscalar (p)) [retval, x, p] = common_size (x, p); if (retval > 0) - error ("geometric_inv: x and p must be of common size or scalar"); + error ("geoinv: x and p must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/geometric_cdf.m --- a/scripts/statistics/distributions/geometric_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} geometric_cdf (@var{x}, @var{p}) -## For each element of @var{x}, compute the CDF at @var{x} of the -## geometric distribution with parameter @var{p}. -## @end deftypefn - -## Author: KH -## Description: CDF of the geometric distribution - -function cdf = geometric_cdf (x, p) - - if (nargin != 2) - usage ("geometric_cdf (x, p)"); - endif - - if (!isscalar (x) && !isscalar (p)) - [retval, x, p] = common_size (x, p); - if (retval > 0) - error ("geometric_cdf: x and p must be of common size or scalar"); - endif - endif - - cdf = zeros (size (x)); - - k = find (isnan (x) | !(p >= 0) | !(p <= 1)); - if (any (k)) - cdf(k) = NaN; - endif - - k = find ((x == Inf) & (p >= 0) & (p <= 1)); - if (any (k)) - cdf(k) = 1; - endif - - k = find ((x >= 0) & (x < Inf) & (x == round (x)) & (p > 0) & (p <= 1)); - if (any (k)) - if (isscalar (x)) - cdf(k) = 1 - ((1 - p(k)) .^ (x + 1)); - elseif (isscalar (p)) - cdf(k) = 1 - ((1 - p) .^ (x(k) + 1)); - else - cdf(k) = 1 - ((1 - p(k)) .^ (x(k) + 1)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/geometric_inv.m --- a/scripts/statistics/distributions/geometric_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} geometric_inv (@var{x}, @var{p}) -## For each element of @var{x}, compute the quantile at @var{x} of the -## geometric distribution with parameter @var{p}. -## @end deftypefn - -## Author: KH -## Description: Quantile function of the geometric distribution - -function inv = geometric_inv (x, p) - - if (nargin != 2) - usage ("geometric_inv (x, p)"); - endif - - if (!isscalar (x) && !isscalar (p)) - [retval, x, p] = common_size (x, p); - if (retval > 0) - error ("geometric_inv: x and p must be of common size or scalar"); - endif - endif - - inv = zeros (size (x)); - - k = find (!(x >= 0) | !(x <= 1) | !(p >= 0) | !(p <= 1)); - if (any (k)) - inv(k) = NaN; - endif - - k = find ((x == 1) & (p >= 0) & (p <= 1)); - if (any (k)) - inv(k) = Inf; - endif - - k = find ((x > 0) & (x < 1) & (p > 0) & (p <= 1)); - if (any (k)) - if (isscalar (x)) - inv(k) = max (ceil (log (1 - x) ./ log (1 - p(k))) - 1, 0); - elseif (isscalar (p)) - inv(k) = max (ceil (log (1 - x(k)) / log (1 - p)) - 1, 0); - else - inv(k) = max (ceil (log (1 - x(k)) ./ log (1 - p(k))) - 1, 0); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/geometric_pdf.m --- a/scripts/statistics/distributions/geometric_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} geometric_pdf (@var{x}, @var{p}) -## For each element of @var{x}, compute the probability density function -## (PDF) at @var{x} of the geometric distribution with parameter @var{p}. -## @end deftypefn - -## Author: KH -## Description: PDF of the geometric distribution - -function pdf = geometric_pdf (x, p) - - if (nargin != 2) - usage ("geometric_pdf (x, p)"); - endif - - if (!isscalar (x) && !isscalar (p)) - [retval, x, p] = common_size (x, p); - if (retval > 0) - error ("geometric_pdf: x and p must be of common size or scalar"); - endif - endif - - pdf = zeros (size (x)); - - k = find (isnan (x) | !(p >= 0) | !(p <= 1)); - if (any (k)) - pdf(k) = NaN; - endif - - ## Just for the fun of it ... - k = find ((x == Inf) & (p == 0)); - if (any (k)) - pdf(k) = 1; - endif - - k = find ((x >= 0) & (x < Inf) & (x == round (x)) & (p > 0) & (p <= 1)); - if (any (k)) - if (isscalar (x)) - pdf(k) = p(k) .* ((1 - p(k)) .^ x); - elseif (isscalar (p)) - pdf(k) = p .* ((1 - p) .^ x(k)); - else - pdf(k) = p(k) .* ((1 - p(k)) .^ x(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/geometric_rnd.m --- a/scripts/statistics/distributions/geometric_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} geometric_rnd (@var{p}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} geometric_rnd (@var{p}, @var{sz}) -## Return an @var{r} by @var{c} matrix of random samples from the -## geometric distribution with parameter @var{p}, which must be a scalar -## or of size @var{r} by @var{c}. -## -## If @var{r} and @var{c} are given create a matrix with @var{r} rows and -## @var{c} columns. Or if @var{sz} is a vector, create a matrix of size -## @var{sz}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the geometric distribution - -function rnd = geometric_rnd (p, r, c) - - if (nargin == 3) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("geometric_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("geometric_rnd: c must be a positive integer"); - endif - sz = [r, c]; - - if (any (size (p) != 1) && ((length (size (p)) != length (sz)) || - any (size (p) != sz))) - error ("geometric_rnd: p must be scalar or of size [r, c]"); - endif - elseif (nargin == 2) - if (isscalar (r) && (r > 0)) - sz = [r, r]; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("geometric_rnd: r must be a postive integer or vector"); - endif - - if (any (size (p) != 1) && ((length (size (p)) != length (sz)) || - any (size (p) != sz))) - error ("geometric_rnd: n must be scalar or of size sz"); - endif - elseif (nargin == 1) - sz = size(n); - elseif (nargin != 1) - usage ("geometric_rnd (p, r, c)"); - endif - - - if (isscalar (p)) - if (!(p >= 0) || !(p <= 1)) - rnd = NaN * ones (sz); - elseif (p == 0) - rnd = Inf * ones (sz); - elseif ((p > 0) & (p < 1)); - rnd = floor (log (rand (sz)) / log (1 - p)); - else - rnd = zeros (sz); - endif - else - rnd = zeros (sz); - - k = find (!(p >= 0) | !(p <= 1)); - if (any (k)) - rnd(k) = NaN * ones (1, length (k)); - endif - - k = find (p == 0); - if (any (k)) - rnd(k) = Inf * ones (1, length (k)); - endif - - k = find ((p > 0) & (p < 1)); - if (any (k)) - rnd(k) = floor (log (rand (size (k))) ./ log (1 - p(k))); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/geopdf.m --- a/scripts/statistics/distributions/geopdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/geopdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} geometric_pdf (@var{x}, @var{p}) +## @deftypefn {Function File} {} geopdf (@var{x}, @var{p}) ## For each element of @var{x}, compute the probability density function ## (PDF) at @var{x} of the geometric distribution with parameter @var{p}. ## @end deftypefn @@ -26,16 +26,16 @@ ## Author: KH ## Description: PDF of the geometric distribution -function pdf = geometric_pdf (x, p) +function pdf = geopdf (x, p) if (nargin != 2) - usage ("geometric_pdf (x, p)"); + usage ("geopdf (x, p)"); endif if (!isscalar (x) && !isscalar (p)) [retval, x, p] = common_size (x, p); if (retval > 0) - error ("geometric_pdf: x and p must be of common size or scalar"); + error ("geopdf: x and p must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/geornd.m --- a/scripts/statistics/distributions/geornd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/geornd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,8 +18,8 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} geometric_rnd (@var{p}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} geometric_rnd (@var{p}, @var{sz}) +## @deftypefn {Function File} {} geornd (@var{p}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} geornd (@var{p}, @var{sz}) ## Return an @var{r} by @var{c} matrix of random samples from the ## geometric distribution with parameter @var{p}, which must be a scalar ## or of size @var{r} by @var{c}. @@ -32,20 +32,20 @@ ## Author: KH ## Description: Random deviates from the geometric distribution -function rnd = geometric_rnd (p, r, c) +function rnd = geornd (p, r, c) if (nargin == 3) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("geometric_rnd: r must be a positive integer"); + error ("geornd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("geometric_rnd: c must be a positive integer"); + error ("geornd: c must be a positive integer"); endif sz = [r, c]; if (any (size (p) != 1) && ((length (size (p)) != length (sz)) || any (size (p) != sz))) - error ("geometric_rnd: p must be scalar or of size [r, c]"); + error ("geornd: p must be scalar or of size [r, c]"); endif elseif (nargin == 2) if (isscalar (r) && (r > 0)) @@ -53,17 +53,17 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("geometric_rnd: r must be a postive integer or vector"); + error ("geornd: r must be a postive integer or vector"); endif if (any (size (p) != 1) && ((length (size (p)) != length (sz)) || any (size (p) != sz))) - error ("geometric_rnd: n must be scalar or of size sz"); + error ("geornd: n must be scalar or of size sz"); endif elseif (nargin == 1) sz = size(n); elseif (nargin != 1) - usage ("geometric_rnd (p, r, c)"); + usage ("geornd (p, r, c)"); endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/hygecdf.m --- a/scripts/statistics/distributions/hygecdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/hygecdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} hypergeometric_cdf (@var{x}, @var{m}, @var{t}, @var{n}) +## @deftypefn {Function File} {} hygecdf (@var{x}, @var{m}, @var{t}, @var{n}) ## Compute the cumulative distribution function (CDF) at @var{x} of the ## hypergeometric distribution with parameters @var{m}, @var{t}, and ## @var{n}. This is the probability of obtaining not more than @var{x} @@ -33,21 +33,21 @@ ## Author: KH ## Description: CDF of the hypergeometric distribution -function cdf = hypergeometric_cdf (x, m, t, n) +function cdf = hygecdf (x, m, t, n) if (nargin != 4) - usage ("hypergeometric_cdf (x, m, t, n)"); + usage ("hygecdf (x, m, t, n)"); endif if (!isscalar (m) || !isscalar (t) || !isscalar (n)) - error ("hypergeometric_cdf: m, t and n must all be positive integers"); + error ("hygecdf: m, t and n must all be positive integers"); endif if ((m < 0) | (t < 0) | (n <= 0) | (m != round (m)) | (t != round (t)) | (n != round (n)) | (m > t) | (n > t)) cdf = NaN * ones (size (x)) else - cdf = discrete_cdf (x, 0 : n, hypergeometric_pdf (0 : n, m, t, n)); + cdf = discrete_cdf (x, 0 : n, hygepdf (0 : n, m, t, n)); endif endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/hygeinv.m --- a/scripts/statistics/distributions/hygeinv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/hygeinv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} hypergeometric_inv (@var{x}, @var{m}, @var{t}, @var{n}) +## @deftypefn {Function File} {} hygeinv (@var{x}, @var{m}, @var{t}, @var{n}) ## For each element of @var{x}, compute the quantile at @var{x} of the ## hypergeometric distribution with parameters @var{m}, @var{t}, and ## @var{n}. @@ -30,21 +30,21 @@ ## Author: KH ## Description: Random deviates from the hypergeometric distribution -function inv = hypergeometric_inv (x, m, t, n) +function inv = hygeinv (x, m, t, n) if (nargin != 4) - usage ("hypergeometric_inv (x, m, t, n)"); + usage ("hygeinv (x, m, t, n)"); endif if (!isscalar (m) || !isscalar (t) || !isscalar (n)) - error ("hypergeometrix_inv: m, t and n must all be positive integers"); + error ("hygeinv: m, t and n must all be positive integers"); endif if ((m < 0) | (t < 0) | (n <= 0) | (m != round (m)) | (t != round (t)) | (n != round (n)) | (m > t) | (n > t)) inv = NaN * ones (size (x)) else - inv = discrete_inv (x, 0 : n, hypergeometric_pdf (0 : n, m, t, n)); + inv = discrete_inv (x, 0 : n, hygepdf (0 : n, m, t, n)); endif endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/hygepdf.m --- a/scripts/statistics/distributions/hygepdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/hygepdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} hypergeometric_pdf (@var{x}, @var{m}, @var{t}, @var{n}) +## @deftypefn {Function File} {} hygepdf (@var{x}, @var{m}, @var{t}, @var{n}) ## Compute the probability density function (PDF) at @var{x} of the ## hypergeometric distribution with parameters @var{m}, @var{t}, and ## @var{n}. This is the probability of obtaining @var{x} marked items @@ -31,16 +31,16 @@ ## Author: KH ## Description: PDF of the hypergeometric distribution -function pdf = hypergeometric_pdf (x, m, t, n) +function pdf = hygepdf (x, m, t, n) if (nargin != 4) - usage ("hypergeometric_pdf (x, m, t, n)"); + usage ("hygepdf (x, m, t, n)"); endif if (!isscalar (m) || !isscalar (t) || !isscalar (n)) [retval, x, m, t, n] = common_size (x, m, t, n); if (retval > 0) - error ("hypergeometric_pdf: x, m, t, and n must be of common size or scalar"); + error ("hygepdf: x, m, t, and n must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/hygernd.m --- a/scripts/statistics/distributions/hygernd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/hygernd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,9 +18,9 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} hypergeometric_rnd (@var{n_size}, @var{m}, @var{t}, @var{n}) -## @deftypefnx {Function File} {} hypergeometric_rnd (@var{m}, @var{t}, @var{n}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} hypergeometric_rnd (@var{m}, @var{t}, @var{n}, @var{sz}) +## @deftypefn {Function File} {} hygernd (@var{n_size}, @var{m}, @var{t}, @var{n}) +## @deftypefnx {Function File} {} hygernd (@var{m}, @var{t}, @var{n}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} hygernd (@var{m}, @var{t}, @var{n}, @var{sz}) ## Generate a row vector containing a random sample of size @var{n_size} ## from the hypergeometric distribution with parameters @var{m}, @var{t}, ## and @var{n}. @@ -33,15 +33,15 @@ ## with @var{m} and @var{n} not greater than @var{t}. ## @end deftypefn -## function rnd = hypergeometric_rnd (N, m, t, n) -function rnd = hypergeometric_rnd (m, t, n, r, c) +## function rnd = hygernd (N, m, t, n) +function rnd = hygernd (m, t, n, r, c) if (nargin == 5) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("hypergeometric_rnd: r must be a positive integer"); + error ("hygernd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("hypergeometric_rnd: c must be a positive integer"); + error ("hygernd: c must be a positive integer"); endif sz = [r, c]; elseif (nargin == 4) @@ -59,21 +59,21 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("hypergeometric_rnd: r must be a vector of positive integers"); + error ("hygernd: r must be a vector of positive integers"); endif else - usage ("hypergeometric_rnd (N, m, t, n) | hypergeometric_rnd (m, t, n, r, c)"); + usage ("hygernd (N, m, t, n) | hygernd (m, t, n, r, c)"); endif if (!isscalar (m) || !isscalar (t) || !isscalar (n)) - error ("hypergeometric_cdf: m, t and n must all be positive integers"); + error ("hygernd: m, t and n must all be positive integers"); endif if ((m < 0) | (t < 0) | (n <= 0) | (m != round (m)) | (t != round (t)) | (n != round (n)) | (m > t) | (n > t)) rnd = NaN * ones (sz) else - rnd = discrete_rnd (0 : n, hypergeometric_pdf (0 : n, m, t, n), sz); + rnd = discrete_rnd (0 : n, hygepdf (0 : n, m, t, n), sz); endif endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/hypergeometric_cdf.m --- a/scripts/statistics/distributions/hypergeometric_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -## Copyright (C) 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} hypergeometric_cdf (@var{x}, @var{m}, @var{t}, @var{n}) -## Compute the cumulative distribution function (CDF) at @var{x} of the -## hypergeometric distribution with parameters @var{m}, @var{t}, and -## @var{n}. This is the probability of obtaining not more than @var{x} -## marked items when randomly drawing a sample of size @var{n} without -## replacement from a population of total size @var{t} containing -## @var{m} marked items. -## -## The parameters @var{m}, @var{t}, and @var{n} must positive integers -## with @var{m} and @var{n} not greater than @var{t}. -## @end deftypefn - -## Author: KH -## Description: CDF of the hypergeometric distribution - -function cdf = hypergeometric_cdf (x, m, t, n) - - if (nargin != 4) - usage ("hypergeometric_cdf (x, m, t, n)"); - endif - - if (!isscalar (m) || !isscalar (t) || !isscalar (n)) - error ("hypergeometric_cdf: m, t and n must all be positive integers"); - endif - - if ((m < 0) | (t < 0) | (n <= 0) | (m != round (m)) | - (t != round (t)) | (n != round (n)) | (m > t) | (n > t)) - cdf = NaN * ones (size (x)) - else - cdf = discrete_cdf (x, 0 : n, hypergeometric_pdf (0 : n, m, t, n)); - endif - -endfunction - - diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/hypergeometric_inv.m --- a/scripts/statistics/distributions/hypergeometric_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -## Copyright (C) 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} hypergeometric_inv (@var{x}, @var{m}, @var{t}, @var{n}) -## For each element of @var{x}, compute the quantile at @var{x} of the -## hypergeometric distribution with parameters @var{m}, @var{t}, and -## @var{n}. -## -## The parameters @var{m}, @var{t}, and @var{n} must positive integers -## with @var{m} and @var{n} not greater than @var{t}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the hypergeometric distribution - -function inv = hypergeometric_inv (x, m, t, n) - - if (nargin != 4) - usage ("hypergeometric_inv (x, m, t, n)"); - endif - - if (!isscalar (m) || !isscalar (t) || !isscalar (n)) - error ("hypergeometrix_inv: m, t and n must all be positive integers"); - endif - - if ((m < 0) | (t < 0) | (n <= 0) | (m != round (m)) | - (t != round (t)) | (n != round (n)) | (m > t) | (n > t)) - inv = NaN * ones (size (x)) - else - inv = discrete_inv (x, 0 : n, hypergeometric_pdf (0 : n, m, t, n)); - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/hypergeometric_pdf.m --- a/scripts/statistics/distributions/hypergeometric_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -## Copyright (C) 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} hypergeometric_pdf (@var{x}, @var{m}, @var{t}, @var{n}) -## Compute the probability density function (PDF) at @var{x} of the -## hypergeometric distribution with parameters @var{m}, @var{t}, and -## @var{n}. This is the probability of obtaining @var{x} marked items -## when randomly drawing a sample of size @var{n} without replacement -## from a population of total size @var{t} containing @var{m} marked items. -## -## The arguments must be of common size or scalar. -## @end deftypefn - -## Author: KH -## Description: PDF of the hypergeometric distribution - -function pdf = hypergeometric_pdf (x, m, t, n) - - if (nargin != 4) - usage ("hypergeometric_pdf (x, m, t, n)"); - endif - - if (!isscalar (m) || !isscalar (t) || !isscalar (n)) - [retval, x, m, t, n] = common_size (x, m, t, n); - if (retval > 0) - error ("hypergeometric_pdf: x, m, t, and n must be of common size or scalar"); - endif - endif - - pdf = zeros (size (x)); - - ## everything in i1 gives NaN - i1 = ((m < 0) | (t < 0) | (n <= 0) | (m != round (m)) | - (t != round (t)) | (n != round (n)) | (m > t) | (n > t)); - ## everything in i2 gives 0 unless in i1 - i2 = ((x != round (x)) | (x < 0) | (x > m) | (n < x) | (n-x > t-m)); - k = find (i1); - if (any (k)) - if (isscalar (m) && isscalar (t) && isscalar (n)) - pdf = NaN * ones ( size (x)); - else - pdf (k) = NaN; - endif - endif - k = find (!i1 & !i2); - if (any (k)) - if (isscalar (m) && isscalar (t) && isscalar (n)) - pdf (k) = (bincoeff (m, x(k)) .* bincoeff (t-m, n-x(k)) - / bincoeff (t, n)); - else - pdf (k) = (bincoeff (m(k), x(k)) .* bincoeff (t(k)-m(k), n(k)-x(k)) - ./ bincoeff (t(k), n(k))); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/hypergeometric_rnd.m --- a/scripts/statistics/distributions/hypergeometric_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -## Copyright (C) 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} hypergeometric_rnd (@var{n_size}, @var{m}, @var{t}, @var{n}) -## @deftypefnx {Function File} {} hypergeometric_rnd (@var{m}, @var{t}, @var{n}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} hypergeometric_rnd (@var{m}, @var{t}, @var{n}, @var{sz}) -## Generate a row vector containing a random sample of size @var{n_size} -## from the hypergeometric distribution with parameters @var{m}, @var{t}, -## and @var{n}. -## -## If @var{r} and @var{c} are given create a matrix with @var{r} rows and -## @var{c} columns. Or if @var{sz} is a vector, create a matrix of size -## @var{sz}. -## -## The parameters @var{m}, @var{t}, and @var{n} must positive integers -## with @var{m} and @var{n} not greater than @var{t}. -## @end deftypefn - -## function rnd = hypergeometric_rnd (N, m, t, n) -function rnd = hypergeometric_rnd (m, t, n, r, c) - - if (nargin == 5) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("hypergeometric_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("hypergeometric_rnd: c must be a positive integer"); - endif - sz = [r, c]; - elseif (nargin == 4) - ## A potential problem happens here if all args are scalar, as - ## we can distiguish between the command syntax. This is quite - ## ambigous! I assume that if the last arg is a vector then - ## then third form is assumed. This means that you can't define - ## and r-by-r matrix with a single scalar! - - if (isscalar (r)) - sz = [1, floor(m)]; - m = t; - t = n; - n = r; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("hypergeometric_rnd: r must be a vector of positive integers"); - endif - else - usage ("hypergeometric_rnd (N, m, t, n) | hypergeometric_rnd (m, t, n, r, c)"); - endif - - if (!isscalar (m) || !isscalar (t) || !isscalar (n)) - error ("hypergeometric_cdf: m, t and n must all be positive integers"); - endif - - if ((m < 0) | (t < 0) | (n <= 0) | (m != round (m)) | - (t != round (t)) | (n != round (n)) | (m > t) | (n > t)) - rnd = NaN * ones (sz) - else - rnd = discrete_rnd (0 : n, hypergeometric_pdf (0 : n, m, t, n), sz); - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/logncdf.m --- a/scripts/statistics/distributions/logncdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/logncdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} lognormal_cdf (@var{x}, @var{a}, @var{v}) +## @deftypefn {Function File} {} logncdf (@var{x}, @var{a}, @var{v}) ## For each element of @var{x}, compute the cumulative distribution ## function (CDF) at @var{x} of the lognormal distribution with ## parameters @var{a} and @var{v}. If a random variable follows this @@ -31,10 +31,10 @@ ## Author: KH ## Description: CDF of the log normal distribution -function cdf = lognormal_cdf (x, a, v) +function cdf = logncdf (x, a, v) if (! ((nargin == 1) || (nargin == 3))) - usage ("lognormal_cdf (x, a, v)"); + usage ("logncdf (x, a, v)"); endif if (nargin == 1) @@ -50,7 +50,7 @@ if (!isscalar (a) || !isscalar (v)) [retval, x, a, v] = common_size (x, a, v); if (retval > 0) - error ("lognormal_cdf: x, a and v must be of common size or scalars"); + error ("logncdf: x, a and v must be of common size or scalars"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/logninv.m --- a/scripts/statistics/distributions/logninv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/logninv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} lognormal_inv (@var{x}, @var{a}, @var{v}) +## @deftypefn {Function File} {} logninv (@var{x}, @var{a}, @var{v}) ## For each element of @var{x}, compute the quantile (the inverse of the ## CDF) at @var{x} of the lognormal distribution with parameters @var{a} ## and @var{v}. If a random variable follows this distribution, its @@ -31,10 +31,10 @@ ## Author: KH ## Description: Quantile function of the log normal distribution -function inv = lognormal_inv (x, a, v) +function inv = logninv (x, a, v) if (! ((nargin == 1) || (nargin == 3))) - usage ("lognormal_inv (x, a, v)"); + usage ("logninv (x, a, v)"); endif if (nargin == 1) @@ -50,7 +50,7 @@ if (!isscalar (a) || !isscalar (v)) [retval, x, a, v] = common_size (x, a, v); if (retval > 0) - error ("lognormal_inv: x, a and v must be of common size or scalars"); + error ("logninv: x, a and v must be of common size or scalars"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/lognormal_cdf.m --- a/scripts/statistics/distributions/lognormal_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} lognormal_cdf (@var{x}, @var{a}, @var{v}) -## For each element of @var{x}, compute the cumulative distribution -## function (CDF) at @var{x} of the lognormal distribution with -## parameters @var{a} and @var{v}. If a random variable follows this -## distribution, its logarithm is normally distributed with mean -## @code{log (@var{a})} and variance @var{v}. -## -## Default values are @var{a} = 1, @var{v} = 1. -## @end deftypefn - -## Author: KH -## Description: CDF of the log normal distribution - -function cdf = lognormal_cdf (x, a, v) - - if (! ((nargin == 1) || (nargin == 3))) - usage ("lognormal_cdf (x, a, v)"); - endif - - if (nargin == 1) - a = 1; - v = 1; - endif - - ## The following "straightforward" implementation unfortunately does - ## not work (because exp (Inf) -> NaN etc): - ## cdf = normal_cdf (log (x), log (a), v); - ## Hence ... - - if (!isscalar (a) || !isscalar (v)) - [retval, x, a, v] = common_size (x, a, v); - if (retval > 0) - error ("lognormal_cdf: x, a and v must be of common size or scalars"); - endif - endif - - cdf = zeros (size (x)); - - k = find (isnan (x) | !(a > 0) | !(a < Inf) | !(v > 0) | !(v < Inf)); - if (any (k)) - cdf(k) = NaN; - endif - - k = find ((x == Inf) & (a > 0) & (a < Inf) & (v > 0) & (v < Inf)); - if (any (k)) - cdf(k) = 1; - endif - - k = find ((x > 0) & (x < Inf) & (a > 0) & (a < Inf) & (v > 0) & (v < Inf)); - if (any (k)) - if (isscalar (a) && isscalar (v)) - cdf(k) = stdnormal_cdf ((log (x(k)) - log (a)) / sqrt (v)); - else - cdf(k) = stdnormal_cdf ((log (x(k)) - log (a(k))) ./ sqrt (v(k))); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/lognormal_inv.m --- a/scripts/statistics/distributions/lognormal_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} lognormal_inv (@var{x}, @var{a}, @var{v}) -## For each element of @var{x}, compute the quantile (the inverse of the -## CDF) at @var{x} of the lognormal distribution with parameters @var{a} -## and @var{v}. If a random variable follows this distribution, its -## logarithm is normally distributed with mean @code{log (@var{a})} and -## variance @var{v}. -## -## Default values are @var{a} = 1, @var{v} = 1. -## @end deftypefn - -## Author: KH -## Description: Quantile function of the log normal distribution - -function inv = lognormal_inv (x, a, v) - - if (! ((nargin == 1) || (nargin == 3))) - usage ("lognormal_inv (x, a, v)"); - endif - - if (nargin == 1) - a = 1; - v = 1; - endif - - ## The following "straightforward" implementation unfortunately does - ## not work (because exp (Inf) -> NaN): - ## inv = exp (normal_inv (x, log (a), v)); - ## Hence ... - - if (!isscalar (a) || !isscalar (v)) - [retval, x, a, v] = common_size (x, a, v); - if (retval > 0) - error ("lognormal_inv: x, a and v must be of common size or scalars"); - endif - endif - - inv = zeros (size (x)); - - k = find (!(x >= 0) | !(x <= 1) | !(a > 0) | !(a < Inf) - | !(v > 0) | !(v < Inf)); - if (any (k)) - inv(k) = NaN; - endif - - k = find ((x == 1) & (a > 0) & (a < Inf) & (v > 0) & (v < Inf)); - if (any (k)) - inv(k) = Inf; - endif - - k = find ((x > 0) & (x < 1) & (a > 0) & (a < Inf) & (v > 0) & (v < Inf)); - if (any (k)) - if (isscalar (a) && isscalar (v)) - inv(k) = a .* exp (sqrt (v) .* stdnormal_inv (x(k))); - else - inv(k) = a(k) .* exp (sqrt (v(k)) .* stdnormal_inv (x(k))); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/lognormal_pdf.m --- a/scripts/statistics/distributions/lognormal_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} lognormal_pdf (@var{x}, @var{a}, @var{v}) -## For each element of @var{x}, compute the probability density function -## (PDF) at @var{x} of the lognormal distribution with parameters -## @var{a} and @var{v}. If a random variable follows this distribution, -## its logarithm is normally distributed with mean @code{log (@var{a})} -## and variance @var{v}. -## -## Default values are @var{a} = 1, @var{v} = 1. -## @end deftypefn - -## Author: KH -## Description: PDF of the log normal distribution - -function pdf = lognormal_pdf (x, a, v) - - if (! ((nargin == 1) || (nargin == 3))) - usage ("lognormal_pdf (x, a, v)"); - endif - - if (nargin == 1) - a = 1; - v = 1; - endif - - ## The following "straightforward" implementation unfortunately does - ## not work for the special cases (Inf, ...) - ## pdf = (x > 0) ./ x .* normal_pdf (log (x), log (a), v); - ## Hence ... - - if (!isscalar (a) || !isscalar (v)) - [retval, x, a, v] = common_size (x, a, v); - if (retval > 0) - error ("lognormal_pdf: x, a and v must be of common size or scalars"); - endif - endif - - pdf = zeros (size (x)); - - k = find (isnan (x) | !(a > 0) | !(a < Inf) | !(v > 0) | !(v < Inf)); - if (any (k)) - pdf(k) = NaN; - endif - - k = find ((x > 0) & (x < Inf) & (a > 0) & (a < Inf) & (v > 0) & (v < Inf)); - if (any (k)) - if (isscalar (a) && isscalar (v)) - pdf(k) = normal_pdf (log (x(k)), log (a), v) ./ x(k); - else - pdf(k) = normal_pdf (log (x(k)), log (a(k)), v(k)) ./ x(k); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/lognormal_rnd.m --- a/scripts/statistics/distributions/lognormal_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} lognormal_rnd (@var{a}, @var{v}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} lognormal_rnd (@var{a}, @var{v}, @var{sz}) -## Return an @var{r} by @var{c} matrix of random samples from the -## lognormal distribution with parameters @var{a} and @var{v}. Both -## @var{a} and @var{v} must be scalar or of size @var{r} by @var{c}. -## Or if @var{sz} is a vector, create a matrix of size @var{sz}. -## -## If @var{r} and @var{c} are omitted, the size of the result matrix is -## the common size of @var{a} and @var{v}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the log normal distribution - -function rnd = lognormal_rnd (a, v, r, c) - - if (nargin > 1) - if (!isscalar(a) || !isscalar(v)) - [retval, a, v] = common_size (a, v); - if (retval > 0) - error ("lognormal_rnd: a and v must be of common size or scalar"); - endif - endif - endif - - if (nargin == 4) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("lognormal_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("lognormal_rnd: c must be a positive integer"); - endif - sz = [r, c]; - - if (any (size (a) != 1) && - ((length (size (a)) != length (sz)) || any (size (a) != sz))) - error ("lognormal_rnd: a and b must be scalar or of size [r, c]"); - endif - - elseif (nargin == 3) - if (isscalar (r) && (r > 0)) - sz = [r, r]; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("lognormal_rnd: r must be a postive integer or vector"); - endif - - if (any (size (a) != 1) && - ((length (size (a)) != length (sz)) || any (size (a) != sz))) - error ("lognormal_rnd: a and b must be scalar or of size sz"); - endif - elseif (nargin == 2) - sz = size(a); - else - usage ("lognormal_rnd (a, v, r, c)"); - endif - - if (isscalar (a) && isscalar (v)) - if (!(a > 0) | !(a < Inf) | !(v > 0) | !(v < Inf)) - rnd = NaN * ones (sz); - elseif find ((a > 0) & (a < Inf) & (v > 0) & (v < Inf)); - rnd = a * exp (sqrt (v) .* randn (sz)); - else - rnd = zeros (sz); - endif - else - rnd = zeros (sz); - k = find (!(a > 0) | !(a < Inf) | !(v > 0) | !(v < Inf)); - if (any (k)) - rnd(k) = NaN * ones (1, length (k)); - endif - - k = find ((a > 0) & (a < Inf) & (v > 0) & (v < Inf)); - if (any (k)) - rnd(k) = a(k) .* exp (sqrt (v(k)) .* randn (1, length (k))); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/lognpdf.m --- a/scripts/statistics/distributions/lognpdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/lognpdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} lognormal_pdf (@var{x}, @var{a}, @var{v}) +## @deftypefn {Function File} {} lognpdf (@var{x}, @var{a}, @var{v}) ## For each element of @var{x}, compute the probability density function ## (PDF) at @var{x} of the lognormal distribution with parameters ## @var{a} and @var{v}. If a random variable follows this distribution, @@ -31,10 +31,10 @@ ## Author: KH ## Description: PDF of the log normal distribution -function pdf = lognormal_pdf (x, a, v) +function pdf = lognpdf (x, a, v) if (! ((nargin == 1) || (nargin == 3))) - usage ("lognormal_pdf (x, a, v)"); + usage ("lognpdf (x, a, v)"); endif if (nargin == 1) @@ -50,7 +50,7 @@ if (!isscalar (a) || !isscalar (v)) [retval, x, a, v] = common_size (x, a, v); if (retval > 0) - error ("lognormal_pdf: x, a and v must be of common size or scalars"); + error ("lognpdf: x, a and v must be of common size or scalars"); endif endif @@ -64,9 +64,9 @@ k = find ((x > 0) & (x < Inf) & (a > 0) & (a < Inf) & (v > 0) & (v < Inf)); if (any (k)) if (isscalar (a) && isscalar (v)) - pdf(k) = normal_pdf (log (x(k)), log (a), v) ./ x(k); + pdf(k) = normpdf (log (x(k)), log (a), v) ./ x(k); else - pdf(k) = normal_pdf (log (x(k)), log (a(k)), v(k)) ./ x(k); + pdf(k) = normpdf (log (x(k)), log (a(k)), v(k)) ./ x(k); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/lognrnd.m --- a/scripts/statistics/distributions/lognrnd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/lognrnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,8 +18,8 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} lognormal_rnd (@var{a}, @var{v}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} lognormal_rnd (@var{a}, @var{v}, @var{sz}) +## @deftypefn {Function File} {} lognrnd (@var{a}, @var{v}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} lognrnd (@var{a}, @var{v}, @var{sz}) ## Return an @var{r} by @var{c} matrix of random samples from the ## lognormal distribution with parameters @var{a} and @var{v}. Both ## @var{a} and @var{v} must be scalar or of size @var{r} by @var{c}. @@ -32,29 +32,29 @@ ## Author: KH ## Description: Random deviates from the log normal distribution -function rnd = lognormal_rnd (a, v, r, c) +function rnd = lognrnd (a, v, r, c) if (nargin > 1) if (!isscalar(a) || !isscalar(v)) [retval, a, v] = common_size (a, v); if (retval > 0) - error ("lognormal_rnd: a and v must be of common size or scalar"); + error ("lognrnd: a and v must be of common size or scalar"); endif endif endif if (nargin == 4) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("lognormal_rnd: r must be a positive integer"); + error ("lognrnd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("lognormal_rnd: c must be a positive integer"); + error ("lognrnd: c must be a positive integer"); endif sz = [r, c]; if (any (size (a) != 1) && ((length (size (a)) != length (sz)) || any (size (a) != sz))) - error ("lognormal_rnd: a and b must be scalar or of size [r, c]"); + error ("lognrnd: a and b must be scalar or of size [r, c]"); endif elseif (nargin == 3) @@ -63,17 +63,17 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("lognormal_rnd: r must be a postive integer or vector"); + error ("lognrnd: r must be a postive integer or vector"); endif if (any (size (a) != 1) && ((length (size (a)) != length (sz)) || any (size (a) != sz))) - error ("lognormal_rnd: a and b must be scalar or of size sz"); + error ("lognrnd: a and b must be scalar or of size sz"); endif elseif (nargin == 2) sz = size(a); else - usage ("lognormal_rnd (a, v, r, c)"); + usage ("lognrnd (a, v, r, c)"); endif if (isscalar (a) && isscalar (v)) diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/normal_cdf.m --- a/scripts/statistics/distributions/normal_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} normal_cdf (@var{x}, @var{m}, @var{v}) -## For each element of @var{x}, compute the cumulative distribution -## function (CDF) at @var{x} of the normal distribution with mean -## @var{m} and variance @var{v}. -## -## Default values are @var{m} = 0, @var{v} = 1. -## @end deftypefn - -## Author: TT -## Description: CDF of the normal distribution - -function cdf = normal_cdf (x, m, v) - - if (! ((nargin == 1) || (nargin == 3))) - usage ("normal_cdf (x, m, v)"); - endif - - if (nargin == 1) - m = 0; - v = 1; - endif - - if (!isscalar (m) || !isscalar(v)) - [retval, x, m, v] = common_size (x, m, v); - if (retval > 0) - error ("normal_cdf: x, m and v must be of common size or scalar"); - endif - endif - - sz = size (x); - cdf = zeros (sz); - - if (isscalar (m) && isscalar(v)) - if (find (isinf (m) | isnan (m) | !(v >= 0) | !(v < Inf))) - cdf = NaN * ones (sz); - else - cdf = stdnormal_cdf ((x - m) ./ sqrt (v)); - endif - else - k = find (isinf (m) | isnan (m) | !(v >= 0) | !(v < Inf)); - if (any (k)) - cdf(k) = NaN; - endif - - k = find (!isinf (m) & !isnan (m) & (v >= 0) & (v < Inf)); - if (any (k)) - cdf(k) = stdnormal_cdf ((x(k) - m(k)) ./ sqrt (v(k))); - endif - endif - - cdf((v == 0) & (x == m)) = 0.5; - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/normal_inv.m --- a/scripts/statistics/distributions/normal_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} normal_inv (@var{x}, @var{m}, @var{v}) -## For each element of @var{x}, compute the quantile (the inverse of the -## CDF) at @var{x} of the normal distribution with mean @var{m} and -## variance @var{v}. -## -## Default values are @var{m} = 0, @var{v} = 1. -## @end deftypefn - -## Author: KH -## Description: Quantile function of the normal distribution - -function inv = normal_inv (x, m, v) - - if (nargin != 1 && nargin != 3) - usage ("normal_inv (x, m, v)"); - endif - - if (nargin == 1) - m = 0; - v = 1; - endif - - if (!isscalar (m) || !isscalar(v)) - [retval, x, m, v] = common_size (x, m, v); - if (retval > 0) - error ("normal_inv: x, m and v must be of common size or scalars"); - endif - endif - - sz = size (x); - inv = zeros (sz); - - if (isscalar (m) && isscalar(v)) - if (find (isinf (m) | isnan (m) | !(v > 0) | !(v < Inf))) - inv = NaN * ones (sz); - else - inv = m + sqrt (v) .* stdnormal_inv (x); - endif - else - k = find (isinf (m) | isnan (m) | !(v > 0) | !(v < Inf)); - if (any (k)) - inv(k) = NaN; - endif - - k = find (!isinf (m) & !isnan (m) & (v > 0) & (v < Inf)); - if (any (k)) - inv(k) = m(k) + sqrt (v(k)) .* stdnormal_inv (x(k)); - endif - endif - - k = find ((v == 0) & (x > 0) & (x < 1)); - if (any (k)) - inv(k) = m(k); - endif - - inv((v == 0) & (x == 0)) = -Inf; - inv((v == 0) & (x == 1)) = Inf; - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/normal_pdf.m --- a/scripts/statistics/distributions/normal_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} normal_pdf (@var{x}, @var{m}, @var{v}) -## For each element of @var{x}, compute the probability density function -## (PDF) at @var{x} of the normal distribution with mean @var{m} and -## variance @var{v}. -## -## Default values are @var{m} = 0, @var{v} = 1. -## @end deftypefn - -## Author: TT -## Description: PDF of the normal distribution - -function pdf = normal_pdf (x, m, v) - - if (nargin != 1 && nargin != 3) - usage ("normal_pdf (x, m, v)"); - endif - - if (nargin == 1) - m = 0; - v = 1; - endif - - if (!isscalar (m) || !isscalar(v)) - [retval, x, m, v] = common_size (x, m, v); - if (retval > 0) - error ("normal_pdf: x, m and v must be of common size or scalars"); - endif - endif - - sz = size (x); - pdf = zeros (sz); - - if (isscalar (m) && isscalar(v)) - if (find (isinf (m) | isnan (m) | !(v >= 0) | !(v < Inf))) - pdf = NaN * ones (sz); - else - pdf = stdnormal_pdf ((x - m) ./ sqrt (v)) ./ sqrt (v); - endif - else - k = find (isinf (m) | isnan (m) | !(v >= 0) | !(v < Inf)); - if (any (k)) - pdf(k) = NaN; - endif - - k = find (!isinf (m) & !isnan (m) & (v >= 0) & (v < Inf)); - if (any (k)) - pdf(k) = stdnormal_pdf ((x(k) - m(k)) ./ sqrt (v(k))) ./ sqrt (v(k)); - endif - endif - - pdf((v == 0) & (x == m)) = Inf; - pdf((v == 0) & ((x < m) | (x > m))) = 0; - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/normal_rnd.m --- a/scripts/statistics/distributions/normal_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} normal_rnd (@var{m}, @var{v}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} normal_rnd (@var{m}, @var{v}, @var{sz}) -## Return an @var{r} by @var{c} or @code{size (@var{sz})} matrix of -## random samples from the normal distribution with parameters @var{m} -## and @var{v}. Both @var{m} and @var{v} must be scalar or of size -## @var{r} by @var{c}. -## -## If @var{r} and @var{c} are omitted, the size of the result matrix is -## the common size of @var{m} and @var{v}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the normal distribution - -function rnd = normal_rnd (m, v, r, c) - - if (nargin > 1) - if (!isscalar(m) || !isscalar(v)) - [retval, m, v] = common_size (m, v); - if (retval > 0) - error ("normal_rnd: m and v must be of common size or scalar"); - endif - endif - endif - - if (nargin == 4) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("normal_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("normal_rnd: c must be a positive integer"); - endif - sz = [r, c]; - - if (any (size (m) != 1) - && (length (size (m)) != length (sz) || any (size (m) != sz))) - error ("normal_rnd: m and v must be scalar or of size [r, c]"); - endif - elseif (nargin == 3) - if (isscalar (r) && (r > 0)) - sz = [r, r]; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("normal_rnd: r must be a postive integer or vector"); - endif - - if (any (size (m) != 1) - && (length (size (m)) != length (sz) || any (size (m) != sz))) - error ("normal_rnd: m and v must be scalar or of size sz"); - endif - elseif (nargin == 2) - sz = size(m); - else - usage ("normal_rnd (m, v, r, c)"); - endif - - if (isscalar (m) && isscalar (v)) - if (find (isnan (m) | isinf (m) | !(v > 0) | !(v < Inf))) - rnd = NaN * ones (sz); - else - rnd = m + sqrt (v) .* randn (sz); - endif - else - rnd = m + sqrt (v) .* randn (sz); - k = find (isnan (m) | isinf (m) | !(v > 0) | !(v < Inf)); - if (any (k)) - rnd(k) = NaN; - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/normcdf.m --- a/scripts/statistics/distributions/normcdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/normcdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} normal_cdf (@var{x}, @var{m}, @var{v}) +## @deftypefn {Function File} {} normcdf (@var{x}, @var{m}, @var{v}) ## For each element of @var{x}, compute the cumulative distribution ## function (CDF) at @var{x} of the normal distribution with mean ## @var{m} and variance @var{v}. @@ -29,10 +29,10 @@ ## Author: TT ## Description: CDF of the normal distribution -function cdf = normal_cdf (x, m, v) +function cdf = normcdf (x, m, v) if (! ((nargin == 1) || (nargin == 3))) - usage ("normal_cdf (x, m, v)"); + usage ("normcdf (x, m, v)"); endif if (nargin == 1) @@ -43,7 +43,7 @@ if (!isscalar (m) || !isscalar(v)) [retval, x, m, v] = common_size (x, m, v); if (retval > 0) - error ("normal_cdf: x, m and v must be of common size or scalar"); + error ("normcdf: x, m and v must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/norminv.m --- a/scripts/statistics/distributions/norminv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/norminv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} normal_inv (@var{x}, @var{m}, @var{v}) +## @deftypefn {Function File} {} norminv (@var{x}, @var{m}, @var{v}) ## For each element of @var{x}, compute the quantile (the inverse of the ## CDF) at @var{x} of the normal distribution with mean @var{m} and ## variance @var{v}. @@ -29,10 +29,10 @@ ## Author: KH ## Description: Quantile function of the normal distribution -function inv = normal_inv (x, m, v) +function inv = norminv (x, m, v) if (nargin != 1 && nargin != 3) - usage ("normal_inv (x, m, v)"); + usage ("norminv (x, m, v)"); endif if (nargin == 1) @@ -43,7 +43,7 @@ if (!isscalar (m) || !isscalar(v)) [retval, x, m, v] = common_size (x, m, v); if (retval > 0) - error ("normal_inv: x, m and v must be of common size or scalars"); + error ("norminv: x, m and v must be of common size or scalars"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/normpdf.m --- a/scripts/statistics/distributions/normpdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/normpdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} normal_pdf (@var{x}, @var{m}, @var{v}) +## @deftypefn {Function File} {} normpdf (@var{x}, @var{m}, @var{v}) ## For each element of @var{x}, compute the probability density function ## (PDF) at @var{x} of the normal distribution with mean @var{m} and ## variance @var{v}. @@ -29,10 +29,10 @@ ## Author: TT ## Description: PDF of the normal distribution -function pdf = normal_pdf (x, m, v) +function pdf = normpdf (x, m, v) if (nargin != 1 && nargin != 3) - usage ("normal_pdf (x, m, v)"); + usage ("normpdf (x, m, v)"); endif if (nargin == 1) @@ -43,7 +43,7 @@ if (!isscalar (m) || !isscalar(v)) [retval, x, m, v] = common_size (x, m, v); if (retval > 0) - error ("normal_pdf: x, m and v must be of common size or scalars"); + error ("normpdf: x, m and v must be of common size or scalars"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/normrnd.m --- a/scripts/statistics/distributions/normrnd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/normrnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,8 +18,8 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} normal_rnd (@var{m}, @var{v}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} normal_rnd (@var{m}, @var{v}, @var{sz}) +## @deftypefn {Function File} {} normrnd (@var{m}, @var{v}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} normrnd (@var{m}, @var{v}, @var{sz}) ## Return an @var{r} by @var{c} or @code{size (@var{sz})} matrix of ## random samples from the normal distribution with parameters @var{m} ## and @var{v}. Both @var{m} and @var{v} must be scalar or of size @@ -32,29 +32,29 @@ ## Author: KH ## Description: Random deviates from the normal distribution -function rnd = normal_rnd (m, v, r, c) +function rnd = normrnd (m, v, r, c) if (nargin > 1) if (!isscalar(m) || !isscalar(v)) [retval, m, v] = common_size (m, v); if (retval > 0) - error ("normal_rnd: m and v must be of common size or scalar"); + error ("normrnd: m and v must be of common size or scalar"); endif endif endif if (nargin == 4) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("normal_rnd: r must be a positive integer"); + error ("normrnd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("normal_rnd: c must be a positive integer"); + error ("normrnd: c must be a positive integer"); endif sz = [r, c]; if (any (size (m) != 1) && (length (size (m)) != length (sz) || any (size (m) != sz))) - error ("normal_rnd: m and v must be scalar or of size [r, c]"); + error ("normrnd: m and v must be scalar or of size [r, c]"); endif elseif (nargin == 3) if (isscalar (r) && (r > 0)) @@ -62,17 +62,17 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("normal_rnd: r must be a postive integer or vector"); + error ("normrnd: r must be a postive integer or vector"); endif if (any (size (m) != 1) && (length (size (m)) != length (sz) || any (size (m) != sz))) - error ("normal_rnd: m and v must be scalar or of size sz"); + error ("normrnd: m and v must be scalar or of size sz"); endif elseif (nargin == 2) sz = size(m); else - usage ("normal_rnd (m, v, r, c)"); + usage ("normrnd (m, v, r, c)"); endif if (isscalar (m) && isscalar (v)) diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/poisscdf.m --- a/scripts/statistics/distributions/poisscdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/poisscdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} poisson_cdf (@var{x}, @var{lambda}) +## @deftypefn {Function File} {} poisscdf (@var{x}, @var{lambda}) ## For each element of @var{x}, compute the cumulative distribution ## function (CDF) at @var{x} of the Poisson distribution with parameter ## lambda. @@ -27,16 +27,16 @@ ## Author: KH ## Description: CDF of the Poisson distribution -function cdf = poisson_cdf (x, l) +function cdf = poisscdf (x, l) if (nargin != 2) - usage ("poisson_cdf (x, lambda)"); + usage ("poisscdf (x, lambda)"); endif if (!isscalar (l)) [retval, x, l] = common_size (x, l); if (retval > 0) - error ("poisson_cdf: x and lambda must be of common size or scalar"); + error ("poisscdf: x and lambda must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/poissinv.m --- a/scripts/statistics/distributions/poissinv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/poissinv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} poisson_inv (@var{x}, @var{lambda}) +## @deftypefn {Function File} {} poissinv (@var{x}, @var{lambda}) ## For each component of @var{x}, compute the quantile (the inverse of ## the CDF) at @var{x} of the Poisson distribution with parameter ## @var{lambda}. @@ -27,16 +27,16 @@ ## Author: KH ## Description: Quantile function of the Poisson distribution -function inv = poisson_inv (x, l) +function inv = poissinv (x, l) if (nargin != 2) - usage ("poisson_inv (x, lambda)"); + usage ("poissinv (x, lambda)"); endif if (!isscalar (l)) [retval, x, l] = common_size (x, l); if (retval > 0) - error ("poisson_inv: x and lambda must be of common size or scalar"); + error ("poissinv: x and lambda must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/poisson_cdf.m --- a/scripts/statistics/distributions/poisson_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} poisson_cdf (@var{x}, @var{lambda}) -## For each element of @var{x}, compute the cumulative distribution -## function (CDF) at @var{x} of the Poisson distribution with parameter -## lambda. -## @end deftypefn - -## Author: KH -## Description: CDF of the Poisson distribution - -function cdf = poisson_cdf (x, l) - - if (nargin != 2) - usage ("poisson_cdf (x, lambda)"); - endif - - if (!isscalar (l)) - [retval, x, l] = common_size (x, l); - if (retval > 0) - error ("poisson_cdf: x and lambda must be of common size or scalar"); - endif - endif - - cdf = zeros (size (x)); - - k = find (isnan (x) | !(l > 0)); - if (any (k)) - cdf(k) = NaN; - endif - - k = find ((x == Inf) & (l > 0)); - if (any (k)) - cdf(k) = 1; - endif - - k = find ((x >= 0) & (x < Inf) & (l > 0)); - if (any (k)) - if (isscalar (l)) - cdf(k) = 1 - gammainc (l, floor (x(k)) + 1); - else - cdf(k) = 1 - gammainc (l(k), floor (x(k)) + 1); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/poisson_inv.m --- a/scripts/statistics/distributions/poisson_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} poisson_inv (@var{x}, @var{lambda}) -## For each component of @var{x}, compute the quantile (the inverse of -## the CDF) at @var{x} of the Poisson distribution with parameter -## @var{lambda}. -## @end deftypefn - -## Author: KH -## Description: Quantile function of the Poisson distribution - -function inv = poisson_inv (x, l) - - if (nargin != 2) - usage ("poisson_inv (x, lambda)"); - endif - - if (!isscalar (l)) - [retval, x, l] = common_size (x, l); - if (retval > 0) - error ("poisson_inv: x and lambda must be of common size or scalar"); - endif - endif - - inv = zeros (size (x)); - - k = find ((x < 0) | (x > 1) | isnan (x) | !(l > 0)); - if (any (k)) - inv(k) = NaN; - endif - - k = find ((x == 1) & (l > 0)); - if (any (k)) - inv(k) = Inf; - endif - - k = find ((x > 0) & (x < 1) & (l > 0)); - if (any (k)) - if (isscalar (l)) - cdf = exp (-l) * ones (size (k)); - else - cdf = exp (-l(k)); - endif - while (1) - m = find (cdf < x(k)); - if (any (m)) - inv(k(m)) = inv(k(m)) + 1; - if (isscalar (l)) - cdf(m) = cdf(m) + poisson_pdf (inv(k(m)), l); - else - cdf(m) = cdf(m) + poisson_pdf (inv(k(m)), l(k(m))); - endif - else - break; - endif - endwhile - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/poisson_pdf.m --- a/scripts/statistics/distributions/poisson_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} poisson_pdf (@var{x}, @var{lambda}) -## For each element of @var{x}, compute the probability density function -## (PDF) at @var{x} of the poisson distribution with parameter @var{lambda}. -## @end deftypefn - -## Author: KH -## Description: PDF of the Poisson distribution - -function pdf = poisson_pdf (x, l) - - if (nargin != 2) - usage ("poisson_pdf (x, lambda)"); - endif - - if (!isscalar (l)) - [retval, x, l] = common_size (x, l); - if (retval > 0) - error ("poisson_pdf: x and lambda must be of common size or scalar"); - endif - endif - - pdf = zeros (size (x)); - - k = find (!(l > 0) | isnan (x)); - if (any (k)) - pdf(k) = NaN; - endif - - k = find ((x >= 0) & (x < Inf) & (x == round (x)) & (l > 0)); - if (any (k)) - if (isscalar (l)) - pdf(k) = exp (x(k) .* log (l) - l - gammaln (x(k) + 1)); - else - pdf(k) = exp (x(k) .* log (l(k)) - l(k) - gammaln (x(k) + 1)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/poisson_rnd.m --- a/scripts/statistics/distributions/poisson_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} poisson_rnd (@var{lambda}, @var{r}, @var{c}) -## Return an @var{r} by @var{c} matrix of random samples from the -## Poisson distribution with parameter @var{lambda}, which must be a -## scalar or of size @var{r} by @var{c}. -## -## If @var{r} and @var{c} are omitted, the size of the result matrix is -## the size of @var{lambda}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the Poisson distribution - -function rnd = poisson_rnd (l, r, c) - - if (nargin == 3) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("poisson_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("poisson_rnd: c must be a positive integer"); - endif - sz = [r, c]; - - if (any (size (l) != 1) && - ((length (size (l)) != length (sz)) || any (size (l) != sz))) - error ("poisson_rnd: lambda must be scalar or of size [r, c]"); - endif - elseif (nargin == 2) - if (isscalar (r) && (r > 0)) - sz = [r, r]; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("poisson_rnd: r must be a postive integer or vector"); - endif - - if (any (size (l) != 1) && - ((length (size (l)) != length (sz)) || any (size (l) != sz))) - error ("poisson_rnd: lambda must be scalar or of size sz"); - endif - elseif (nargin == 1) - sz = size (l); - else - usage ("poisson_rnd (lambda, r, c)"); - endif - - if (isscalar (l)) - - if (!(l >= 0) | !(l < Inf)) - rnd = NaN * ones (sz); - elseif ((l > 0) & (l < Inf)) - num = zeros (sz); - sum = - log (1 - rand (sz)) ./ l; - while (1) - ind = find (sum < 1); - if (any (ind)) - sum(ind) = (sum(ind) - log (1 - rand (size (ind))) / l); - num(ind) = num(ind) + 1; - else - break; - endif - endwhile - rnd = num; - else - rnd = zeros (sz); - endif - else - rnd = zeros (sz); - - k = find (!(l >= 0) | !(l < Inf)); - if (any (k)) - rnd(k) = NaN; - endif - - k = find ((l > 0) & (l < Inf)); - if (any (k)) - l = l(k); - num = zeros (size (k)); - sum = - log (1 - rand (size (k))) ./ l; - while (1) - ind = find (sum < 1); - if (any (ind)) - sum(ind) = (sum(ind) - - log (1 - rand (size (ind))) ./ l(ind)); - num(ind) = num(ind) + 1; - else - break; - endif - endwhile - rnd(k) = num; - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/poisspdf.m --- a/scripts/statistics/distributions/poisspdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/poisspdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} poisson_pdf (@var{x}, @var{lambda}) +## @deftypefn {Function File} {} poisspdf (@var{x}, @var{lambda}) ## For each element of @var{x}, compute the probability density function ## (PDF) at @var{x} of the poisson distribution with parameter @var{lambda}. ## @end deftypefn @@ -26,16 +26,16 @@ ## Author: KH ## Description: PDF of the Poisson distribution -function pdf = poisson_pdf (x, l) +function pdf = poisspdf (x, l) if (nargin != 2) - usage ("poisson_pdf (x, lambda)"); + usage ("poisspdf (x, lambda)"); endif if (!isscalar (l)) [retval, x, l] = common_size (x, l); if (retval > 0) - error ("poisson_pdf: x and lambda must be of common size or scalar"); + error ("poisspdf: x and lambda must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/poissrnd.m --- a/scripts/statistics/distributions/poissrnd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/poissrnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} poisson_rnd (@var{lambda}, @var{r}, @var{c}) +## @deftypefn {Function File} {} poissrnd (@var{lambda}, @var{r}, @var{c}) ## Return an @var{r} by @var{c} matrix of random samples from the ## Poisson distribution with parameter @var{lambda}, which must be a ## scalar or of size @var{r} by @var{c}. @@ -30,20 +30,20 @@ ## Author: KH ## Description: Random deviates from the Poisson distribution -function rnd = poisson_rnd (l, r, c) +function rnd = poissrnd (l, r, c) if (nargin == 3) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("poisson_rnd: r must be a positive integer"); + error ("poissrnd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("poisson_rnd: c must be a positive integer"); + error ("poissrnd: c must be a positive integer"); endif sz = [r, c]; if (any (size (l) != 1) && ((length (size (l)) != length (sz)) || any (size (l) != sz))) - error ("poisson_rnd: lambda must be scalar or of size [r, c]"); + error ("poissrnd: lambda must be scalar or of size [r, c]"); endif elseif (nargin == 2) if (isscalar (r) && (r > 0)) @@ -51,17 +51,17 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("poisson_rnd: r must be a postive integer or vector"); + error ("poissrnd: r must be a postive integer or vector"); endif if (any (size (l) != 1) && ((length (size (l)) != length (sz)) || any (size (l) != sz))) - error ("poisson_rnd: lambda must be scalar or of size sz"); + error ("poissrnd: lambda must be scalar or of size sz"); endif elseif (nargin == 1) sz = size (l); else - usage ("poisson_rnd (lambda, r, c)"); + usage ("poissrnd (lambda, r, c)"); endif if (isscalar (l)) diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/t_cdf.m --- a/scripts/statistics/distributions/t_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} t_cdf (@var{x}, @var{n}) -## For each element of @var{x}, compute the CDF at @var{x} of the -## t (Student) distribution with @var{n} degrees of freedom, i.e., -## PROB (t(@var{n}) <= @var{x}). -## @end deftypefn - -## Author: KH -## Description: CDF of the t distribution - -function cdf = t_cdf (x, n) - - if (nargin != 2) - usage ("t_cdf (x, n)"); - endif - - if (!isscalar (n)) - [retval, x, n] = common_size (x, n); - if (retval > 0) - error ("t_cdf: x and n must be of common size or scalar"); - endif - endif - - cdf = zeros (size (x)); - - k = find (isnan (x) | !(n > 0)); - if (any (k)) - cdf(k) = NaN; - endif - - k = find ((x == Inf) & (n > 0)); - if (any (k)) - cdf(k) = 1; - endif - - k = find ((x > -Inf) & (x < Inf) & (n > 0)); - if (any (k)) - if (isscalar (n)) - cdf(k) = betainc (1 ./ (1 + x(k) .^ 2 ./ n), n / 2, 1 / 2) / 2; - else - cdf(k) = betainc (1 ./ (1 + x(k) .^ 2 ./ n(k)), n(k) / 2, 1 / 2) / 2; - endif - ind = find (x(k) > 0); - if (any (ind)) - cdf(k(ind)) = 1 - cdf(k(ind)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/t_inv.m --- a/scripts/statistics/distributions/t_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} t_inv (@var{x}, @var{n}) -## For each component of @var{x}, compute the quantile (the inverse of -## the CDF) at @var{x} of the t (Student) distribution with parameter -## @var{n}. -## @end deftypefn - -## For very large n, the "correct" formula does not really work well, -## and the quantiles of the standard normal distribution are used -## directly. - -## Author: KH -## Description: Quantile function of the t distribution - -function inv = t_inv (x, n) - - if (nargin != 2) - usage ("t_inv (x, n)"); - endif - - if (!isscalar (n)) - [retval, x, n] = common_size (x, n); - if (retval > 0) - error ("t_inv: x and n must be of common size or scalar"); - endif - endif - - inv = zeros (size (x)); - - k = find ((x < 0) | (x > 1) | isnan (x) | !(n > 0)); - if (any (k)) - inv(k) = NaN; - endif - - k = find ((x == 0) & (n > 0)); - if (any (k)) - inv(k) = -Inf; - endif - - k = find ((x == 1) & (n > 0)); - if (any (k)) - inv(k) = Inf; - endif - - k = find ((x > 0) & (x < 1) & (n > 0) & (n < 10000)); - if (any (k)) - if (isscalar (n)) - inv(k) = (sign (x(k) - 1/2) - .* sqrt (n .* (1 ./ beta_inv (2*min (x(k), 1 - x(k)), - n/2, 1/2) - 1))); - else - inv(k) = (sign (x(k) - 1/2) - .* sqrt (n(k) .* (1 ./ beta_inv (2*min (x(k), 1 - x(k)), - n(k)/2, 1/2) - 1))); - endif - endif - - ## For large n, use the quantiles of the standard normal - k = find ((x > 0) & (x < 1) & (n >= 10000)); - if (any (k)) - inv(k) = stdnormal_inv (x(k)); - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/t_pdf.m --- a/scripts/statistics/distributions/t_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} t_pdf (@var{x}, @var{n}) -## For each element of @var{x}, compute the probability density function -## (PDF) at @var{x} of the @var{t} (Student) distribution with @var{n} -## degrees of freedom. -## @end deftypefn - -## Author: KH -## Description: PDF of the t distribution - -function pdf = t_pdf (x, n) - - if (nargin != 2) - usage ("t_pdf (x, n)"); - endif - - if (!isscalar (n)) - [retval, x, n] = common_size (x, n); - if (retval > 0) - error ("t_pdf: x and n must be of common size or scalar"); - endif - endif - - pdf = zeros (size (x)); - - k = find (isnan (x) | !(n > 0) | !(n < Inf)); - if (any (k)) - pdf(k) = NaN; - endif - - k = find (!isinf (x) & !isnan (x) & (n > 0) & (n < Inf)); - if (any (k)) - if (isscalar (n)) - pdf(k) = (exp (- (n + 1) .* log (1 + x(k) .^ 2 ./ n)/2) - / (sqrt (n) * beta (n/2, 1/2))); - else - pdf(k) = (exp (- (n(k) + 1) .* log (1 + x(k) .^ 2 ./ n(k))/2) - ./ (sqrt (n(k)) .* beta (n(k)/2, 1/2))); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/t_rnd.m --- a/scripts/statistics/distributions/t_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} t_rnd (@var{n}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} t_rnd (@var{n}, @var{sz}) -## Return an @var{r} by @var{c} matrix of random samples from the t -## (Student) distribution with @var{n} degrees of freedom. @var{n} must -## be a scalar or of size @var{r} by @var{c}. Or if @var{sz} is a -## vector create a matrix of size @var{sz}. -## -## If @var{r} and @var{c} are omitted, the size of the result matrix is -## the size of @var{n}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the t distribution - -function rnd = t_rnd (n, r, c) - - if (nargin == 3) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("t_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("t_rnd: c must be a positive integer"); - endif - sz = [r, c]; - - if (any (size (n) != 1) && - ((length (size (n)) != length (sz)) || any (size (n) != sz))) - error ("t_rnd: n must be scalar or of size sz"); - endif - elseif (nargin == 2) - if (isscalar (r) && (r > 0)) - sz = [r, r]; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("t_rnd: r must be a postive integer or vector"); - endif - - if (any (size (n) != 1) && - ((length (size (n)) != length (sz)) || any (size (n) != sz))) - error ("t_rnd: n must be scalar or of size sz"); - endif - elseif (nargin == 1) - sz = size (n); - else - usage ("t_rnd (n, r, c)"); - endif - - if (isscalar (n)) - if (!(n > 0) || !(n < Inf)) - rnd = NaN * ones (sz); - elseif ((n > 0) && (n < Inf)) - rnd = t_inv (rand (sz), n); - else - rnd = zeros (size (n)); - endif - else - rnd = zeros (size (n)); - - k = find (!(n > 0) | !(n < Inf)); - if (any (k)) - rnd(k) = NaN; - endif - - k = find ((n > 0) & (n < Inf)); - if (any (k)) - rnd(k) = t_inv (rand (size (k)), n(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/tcdf.m --- a/scripts/statistics/distributions/tcdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/tcdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} t_cdf (@var{x}, @var{n}) +## @deftypefn {Function File} {} tcdf (@var{x}, @var{n}) ## For each element of @var{x}, compute the CDF at @var{x} of the ## t (Student) distribution with @var{n} degrees of freedom, i.e., ## PROB (t(@var{n}) <= @var{x}). @@ -27,16 +27,16 @@ ## Author: KH ## Description: CDF of the t distribution -function cdf = t_cdf (x, n) +function cdf = tcdf (x, n) if (nargin != 2) - usage ("t_cdf (x, n)"); + usage ("tcdf (x, n)"); endif if (!isscalar (n)) [retval, x, n] = common_size (x, n); if (retval > 0) - error ("t_cdf: x and n must be of common size or scalar"); + error ("tcdf: x and n must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/tinv.m --- a/scripts/statistics/distributions/tinv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/tinv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} t_inv (@var{x}, @var{n}) +## @deftypefn {Function File} {} tinv (@var{x}, @var{n}) ## For each component of @var{x}, compute the quantile (the inverse of ## the CDF) at @var{x} of the t (Student) distribution with parameter ## @var{n}. @@ -31,16 +31,16 @@ ## Author: KH ## Description: Quantile function of the t distribution -function inv = t_inv (x, n) +function inv = tinv (x, n) if (nargin != 2) - usage ("t_inv (x, n)"); + usage ("tinv (x, n)"); endif if (!isscalar (n)) [retval, x, n] = common_size (x, n); if (retval > 0) - error ("t_inv: x and n must be of common size or scalar"); + error ("tinv: x and n must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/tpdf.m --- a/scripts/statistics/distributions/tpdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/tpdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} t_pdf (@var{x}, @var{n}) +## @deftypefn {Function File} {} tpdf (@var{x}, @var{n}) ## For each element of @var{x}, compute the probability density function ## (PDF) at @var{x} of the @var{t} (Student) distribution with @var{n} ## degrees of freedom. @@ -27,16 +27,16 @@ ## Author: KH ## Description: PDF of the t distribution -function pdf = t_pdf (x, n) +function pdf = tpdf (x, n) if (nargin != 2) - usage ("t_pdf (x, n)"); + usage ("tpdf (x, n)"); endif if (!isscalar (n)) [retval, x, n] = common_size (x, n); if (retval > 0) - error ("t_pdf: x and n must be of common size or scalar"); + error ("tpdf: x and n must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/trnd.m --- a/scripts/statistics/distributions/trnd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/trnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,8 +18,8 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} t_rnd (@var{n}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} t_rnd (@var{n}, @var{sz}) +## @deftypefn {Function File} {} trnd (@var{n}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} trnd (@var{n}, @var{sz}) ## Return an @var{r} by @var{c} matrix of random samples from the t ## (Student) distribution with @var{n} degrees of freedom. @var{n} must ## be a scalar or of size @var{r} by @var{c}. Or if @var{sz} is a @@ -32,20 +32,20 @@ ## Author: KH ## Description: Random deviates from the t distribution -function rnd = t_rnd (n, r, c) +function rnd = trnd (n, r, c) if (nargin == 3) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("t_rnd: r must be a positive integer"); + error ("trnd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("t_rnd: c must be a positive integer"); + error ("trnd: c must be a positive integer"); endif sz = [r, c]; if (any (size (n) != 1) && ((length (size (n)) != length (sz)) || any (size (n) != sz))) - error ("t_rnd: n must be scalar or of size sz"); + error ("trnd: n must be scalar or of size sz"); endif elseif (nargin == 2) if (isscalar (r) && (r > 0)) @@ -53,17 +53,17 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("t_rnd: r must be a postive integer or vector"); + error ("trnd: r must be a postive integer or vector"); endif if (any (size (n) != 1) && ((length (size (n)) != length (sz)) || any (size (n) != sz))) - error ("t_rnd: n must be scalar or of size sz"); + error ("trnd: n must be scalar or of size sz"); endif elseif (nargin == 1) sz = size (n); else - usage ("t_rnd (n, r, c)"); + usage ("trnd (n, r, c)"); endif if (isscalar (n)) diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/unifcdf.m --- a/scripts/statistics/distributions/unifcdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/unifcdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} uniform_cdf (@var{x}, @var{a}, @var{b}) +## @deftypefn {Function File} {} unifcdf (@var{x}, @var{a}, @var{b}) ## Return the CDF at @var{x} of the uniform distribution on [@var{a}, ## @var{b}], i.e., PROB (uniform (@var{a}, @var{b}) <= x). ## @@ -28,10 +28,10 @@ ## Author: KH ## Description: CDF of the uniform distribution -function cdf = uniform_cdf (x, a, b) +function cdf = unifcdf (x, a, b) if (nargin != 1 && nargin != 3) - usage ("uniform_cdf (x, a, b)"); + usage ("unifcdf (x, a, b)"); endif if (nargin == 1) @@ -42,7 +42,7 @@ if (!isscalar (a) || !isscalar(b)) [retval, x, a, b] = common_size (x, a, b); if (retval > 0) - error ("uniform_cdf: x, a and b must be of common size or scalar"); + error ("unifcdf: x, a and b must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/unifinv.m --- a/scripts/statistics/distributions/unifinv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/unifinv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} uniform_inv (@var{x}, @var{a}, @var{b}) +## @deftypefn {Function File} {} unifinv (@var{x}, @var{a}, @var{b}) ## For each element of @var{x}, compute the quantile (the inverse of the ## CDF) at @var{x} of the uniform distribution on [@var{a}, @var{b}]. ## @@ -28,10 +28,10 @@ ## Author: KH ## Description: Quantile function of the uniform distribution -function inv = uniform_inv (x, a, b) +function inv = unifinv (x, a, b) if (nargin != 1 && nargin != 3) - usage ("uniform_inv (x, a, b)"); + usage ("unifinv (x, a, b)"); endif if (nargin == 1) diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/uniform_cdf.m --- a/scripts/statistics/distributions/uniform_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} uniform_cdf (@var{x}, @var{a}, @var{b}) -## Return the CDF at @var{x} of the uniform distribution on [@var{a}, -## @var{b}], i.e., PROB (uniform (@var{a}, @var{b}) <= x). -## -## Default values are @var{a} = 0, @var{b} = 1. -## @end deftypefn - -## Author: KH -## Description: CDF of the uniform distribution - -function cdf = uniform_cdf (x, a, b) - - if (nargin != 1 && nargin != 3) - usage ("uniform_cdf (x, a, b)"); - endif - - if (nargin == 1) - a = 0; - b = 1; - endif - - if (!isscalar (a) || !isscalar(b)) - [retval, x, a, b] = common_size (x, a, b); - if (retval > 0) - error ("uniform_cdf: x, a and b must be of common size or scalar"); - endif - endif - - sz = size (x); - cdf = zeros (sz); - - k = find (isnan (x) | !(a < b)); - if (any (k)) - cdf(k) = NaN; - endif - - k = find ((x >= b) & (a < b)); - if (any (k)) - cdf(k) = 1; - endif - - k = find ((x > a) & (x < b)); - if (any (k)) - if (isscalar (a) && isscalar(b)) - cdf(k) = (x(k) < b) .* (x(k) - a) ./ (b - a); - else - cdf(k) = (x(k) < b(k)) .* (x(k) - a(k)) ./ (b(k) - a(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/uniform_inv.m --- a/scripts/statistics/distributions/uniform_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} uniform_inv (@var{x}, @var{a}, @var{b}) -## For each element of @var{x}, compute the quantile (the inverse of the -## CDF) at @var{x} of the uniform distribution on [@var{a}, @var{b}]. -## -## Default values are @var{a} = 0, @var{b} = 1. -## @end deftypefn - -## Author: KH -## Description: Quantile function of the uniform distribution - -function inv = uniform_inv (x, a, b) - - if (nargin != 1 && nargin != 3) - usage ("uniform_inv (x, a, b)"); - endif - - if (nargin == 1) - a = 0; - b = 1; - endif - - if (!isscalar (a) || !isscalar(b)) - [retval, x, a, b] = common_size (x, a, b); - if (retval > 0) - error ("uniform_cdf: x, a and b must be of common size or scalar"); - endif - endif - - sz = size (x); - inv = zeros (sz); - - k = find ((x < 0) | (x > 1) | isnan (x) | !(a < b)); - if (any (k)) - inv(k) = NaN; - endif - - k = find ((x >= 0) & (x <= 1) & (a < b)); - if (any (k)) - if (isscalar (a) && isscalar(b)) - inv(k) = a + x(k) .* (b - a); - else - inv(k) = a(k) + x(k) .* (b(k) - a(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/uniform_pdf.m --- a/scripts/statistics/distributions/uniform_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} uniform_pdf (@var{x}, @var{a}, @var{b}) -## For each element of @var{x}, compute the PDF at @var{x} of the uniform -## distribution on [@var{a}, @var{b}]. -## -## Default values are @var{a} = 0, @var{b} = 1. -## @end deftypefn - -## Author: KH -## Description: PDF of the uniform distribution - -function pdf = uniform_pdf (x, a, b) - - if (nargin != 1 && nargin != 3) - usage ("uniform_pdf (x, a, b)"); - endif - - if (nargin == 1) - a = 0; - b = 1; - endif - - if (!isscalar (a) || !isscalar(b)) - [retval, x, a, b] = common_size (x, a, b); - if (retval > 0) - error ("uniform_pdf: x, a and b must be of common size or scalars"); - endif - endif - - sz = size (x); - pdf = zeros (sz); - - k = find (isnan (x) | !(a < b)); - if (any (k)) - pdf(k) = NaN; - endif - - k = find ((x > a) & (x < b)); - if (any (k)) - if (isscalar (a) && isscalar(b)) - pdf(k) = 1 ./ (b - a); - else - pdf(k) = 1 ./ (b(k) - a(k)); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/uniform_rnd.m --- a/scripts/statistics/distributions/uniform_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} uniform_rnd (@var{a}, @var{b}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} uniform_rnd (@var{a}, @var{b}, @var{sz}) -## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of -## random samples from the uniform distribution on [@var{a}, @var{b}]. -## Both @var{a} and @var{b} must be scalar or of size @var{r} by @var{c}. -## -## If @var{r} and @var{c} are omitted, the size of the result matrix is -## the common size of @var{a} and @var{b}. -## @end deftypefn - -## Author: KH -## Description: Random deviates from the uniform distribution - -function rnd = uniform_rnd (a, b, r, c) - - if (nargin > 1) - if (!isscalar(a) || !isscalar(b)) - [retval, a, b] = common_size (a, b); - if (retval > 0) - error ("uniform_rnd: a and b must be of common size or scalar"); - endif - endif - endif - - if (nargin == 4) - if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("uniform_rnd: r must be a positive integer"); - endif - if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("uniform_rnd: c must be a positive integer"); - endif - sz = [r, c]; - - if (any (size (a) != 1) - && (length (size (a)) != length (sz) || any (size (a) != sz))) - error ("uniform_rnd: a and b must be scalar or of size [r, c]"); - endif - elseif (nargin == 3) - if (isscalar (r) && (r > 0)) - sz = [r, r]; - elseif (isvector(r) && all (r > 0)) - sz = r(:)'; - else - error ("uniform_rnd: r must be a postive integer or vector"); - endif - - if (any (size (a) != 1) - && (length (size (a)) != length (sz) || any (size (a) != sz))) - error ("uniform_rnd: a and b must be scalar or of size sz"); - endif - elseif (nargin == 2) - sz = size(a); - else - usage ("uniform_rnd (a, b, r, c)"); - endif - - if (isscalar(a) && isscalar(b)) - if (find (!(-Inf < a) | !(a < b) | !(b < Inf))) - rnd = NaN * ones(sz); - else - rnd = a + (b - a) .* rand (sz); - endif - else - rnd = a + (b - a) .* rand (sz); - - k = find (!(-Inf < a) | !(a < b) | !(b < Inf)); - if (any (k)) - rnd(k) = NaN; - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/unifpdf.m --- a/scripts/statistics/distributions/unifpdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/unifpdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} uniform_pdf (@var{x}, @var{a}, @var{b}) +## @deftypefn {Function File} {} unifpdf (@var{x}, @var{a}, @var{b}) ## For each element of @var{x}, compute the PDF at @var{x} of the uniform ## distribution on [@var{a}, @var{b}]. ## @@ -28,10 +28,10 @@ ## Author: KH ## Description: PDF of the uniform distribution -function pdf = uniform_pdf (x, a, b) +function pdf = unifpdf (x, a, b) if (nargin != 1 && nargin != 3) - usage ("uniform_pdf (x, a, b)"); + usage ("unifpdf (x, a, b)"); endif if (nargin == 1) @@ -42,7 +42,7 @@ if (!isscalar (a) || !isscalar(b)) [retval, x, a, b] = common_size (x, a, b); if (retval > 0) - error ("uniform_pdf: x, a and b must be of common size or scalars"); + error ("unifpdf: x, a and b must be of common size or scalars"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/unifrnd.m --- a/scripts/statistics/distributions/unifrnd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/unifrnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,8 +18,8 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} uniform_rnd (@var{a}, @var{b}, @var{r}, @var{c}) -## @deftypefnx {Function File} {} uniform_rnd (@var{a}, @var{b}, @var{sz}) +## @deftypefn {Function File} {} unifrnd (@var{a}, @var{b}, @var{r}, @var{c}) +## @deftypefnx {Function File} {} unifrnd (@var{a}, @var{b}, @var{sz}) ## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of ## random samples from the uniform distribution on [@var{a}, @var{b}]. ## Both @var{a} and @var{b} must be scalar or of size @var{r} by @var{c}. @@ -31,29 +31,29 @@ ## Author: KH ## Description: Random deviates from the uniform distribution -function rnd = uniform_rnd (a, b, r, c) +function rnd = unifrnd (a, b, r, c) if (nargin > 1) if (!isscalar(a) || !isscalar(b)) [retval, a, b] = common_size (a, b); if (retval > 0) - error ("uniform_rnd: a and b must be of common size or scalar"); + error ("unifrnd: a and b must be of common size or scalar"); endif endif endif if (nargin == 4) if (! (isscalar (r) && (r > 0) && (r == round (r)))) - error ("uniform_rnd: r must be a positive integer"); + error ("unifrnd: r must be a positive integer"); endif if (! (isscalar (c) && (c > 0) && (c == round (c)))) - error ("uniform_rnd: c must be a positive integer"); + error ("unifrnd: c must be a positive integer"); endif sz = [r, c]; if (any (size (a) != 1) && (length (size (a)) != length (sz) || any (size (a) != sz))) - error ("uniform_rnd: a and b must be scalar or of size [r, c]"); + error ("unifrnd: a and b must be scalar or of size [r, c]"); endif elseif (nargin == 3) if (isscalar (r) && (r > 0)) @@ -61,17 +61,17 @@ elseif (isvector(r) && all (r > 0)) sz = r(:)'; else - error ("uniform_rnd: r must be a postive integer or vector"); + error ("unifrnd: r must be a postive integer or vector"); endif if (any (size (a) != 1) && (length (size (a)) != length (sz) || any (size (a) != sz))) - error ("uniform_rnd: a and b must be scalar or of size sz"); + error ("unifrnd: a and b must be scalar or of size sz"); endif elseif (nargin == 2) sz = size(a); else - usage ("uniform_rnd (a, b, r, c)"); + usage ("unifrnd (a, b, r, c)"); endif if (isscalar(a) && isscalar(b)) diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/weibcdf.m --- a/scripts/statistics/distributions/weibcdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/weibcdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} weibull_cdf (@var{x}, @var{alpha}, @var{sigma}) +## @deftypefn {Function File} {} weibcdf (@var{x}, @var{alpha}, @var{sigma}) ## Compute the cumulative distribution function (CDF) at @var{x} of the ## Weibull distribution with shape parameter @var{alpha} and scale ## parameter @var{sigma}, which is @@ -34,16 +34,16 @@ ## Author: KH ## Description: CDF of the Weibull distribution -function cdf = weibull_cdf (x, shape, scale) +function cdf = weibcdf (x, shape, scale) if (nargin != 3) - usage ("weibull_cdf (x, alpha, sigma)"); + usage ("weibcdf (x, alpha, sigma)"); endif if (!isscalar (shape) || !isscalar (scale)) [retval, x, shape, scale] = common_size (x, shape, scale); if (retval > 0) - error ("weibull_cdf: x, alpha and sigma must be of common size or scalar"); + error ("weibcdf: x, alpha and sigma must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/weibinv.m --- a/scripts/statistics/distributions/weibinv.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/weibinv.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} weibull_inv (@var{x}, @var{lambda}, @var{alpha}) +## @deftypefn {Function File} {} weibinv (@var{x}, @var{lambda}, @var{alpha}) ## Compute the quantile (the inverse of the CDF) at @var{x} of the ## Weibull distribution with shape parameter @var{alpha} and scale ## parameter @var{sigma}. @@ -27,16 +27,16 @@ ## Author: KH ## Description: Quantile function of the Weibull distribution -function inv = weibull_inv (x, shape, scale) +function inv = weibinv (x, shape, scale) if (nargin != 3) - usage ("weibull_inv (x, alpha, sigma)"); + usage ("weibinv (x, alpha, sigma)"); endif if (!isscalar (shape) || !isscalar (scale)) [retval, x, shape, scale] = common_size (x, shape, scale); if (retval > 0) - error ("weibull_inv: x, alpha and sigma must be of common size or scalar"); + error ("weibinv: x, alpha and sigma must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/weibpdf.m --- a/scripts/statistics/distributions/weibpdf.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/weibpdf.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} weibull_pdf (@var{x}, @var{alpha}, @var{sigma}) +## @deftypefn {Function File} {} weibpdf (@var{x}, @var{alpha}, @var{sigma}) ## Compute the probability density function (PDF) at @var{x} of the ## Weibull distribution with shape parameter @var{alpha} and scale ## parameter @var{sigma} which is given by @@ -34,16 +34,16 @@ ## Author: KH ## Description: PDF of the Weibull distribution -function pdf = weibull_pdf (x, shape, scale) +function pdf = weibpdf (x, shape, scale) if (nargin != 3) - usage ("weibull_pdf (x, alpha, sigma)"); + usage ("weibpdf (x, alpha, sigma)"); endif if (!isscalar (shape) || !isscalar (scale)) [retval, x, shape, scale] = common_size (x, shape, scale); if (retval > 0) - error ("weibull_pdf: x, alpha and sigma must be of common size or scalar"); + error ("weibpdf: x, alpha and sigma must be of common size or scalar"); endif endif diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/weibull_cdf.m --- a/scripts/statistics/distributions/weibull_cdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} weibull_cdf (@var{x}, @var{alpha}, @var{sigma}) -## Compute the cumulative distribution function (CDF) at @var{x} of the -## Weibull distribution with shape parameter @var{alpha} and scale -## parameter @var{sigma}, which is -## -## @example -## 1 - exp(-(x/sigma)^alpha) -## @end example -## -## @noindent -## for @var{x} >= 0. -## @end deftypefn - -## Author: KH -## Description: CDF of the Weibull distribution - -function cdf = weibull_cdf (x, shape, scale) - - if (nargin != 3) - usage ("weibull_cdf (x, alpha, sigma)"); - endif - - if (!isscalar (shape) || !isscalar (scale)) - [retval, x, shape, scale] = common_size (x, shape, scale); - if (retval > 0) - error ("weibull_cdf: x, alpha and sigma must be of common size or scalar"); - endif - endif - - cdf = NaN * ones (size (x)); - - ok = ((shape > 0) & (shape < Inf) & (scale > 0) & (scale < Inf)); - - k = find ((x <= 0) & ok); - if (any (k)) - cdf(k) = 0; - endif - - k = find ((x > 0) & (x < Inf) & ok); - if (any (k)) - if (isscalar (shape) && isscalar (scale)) - cdf(k) = 1 - exp (- (x(k) / scale) .^ shape); - else - cdf(k) = 1 - exp (- (x(k) ./ scale(k)) .^ shape(k)); - endif - endif - - k = find ((x == Inf) & ok); - if (any (k)) - cdf(k) = 1; - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/weibull_inv.m --- a/scripts/statistics/distributions/weibull_inv.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} weibull_inv (@var{x}, @var{lambda}, @var{alpha}) -## Compute the quantile (the inverse of the CDF) at @var{x} of the -## Weibull distribution with shape parameter @var{alpha} and scale -## parameter @var{sigma}. -## @end deftypefn - -## Author: KH -## Description: Quantile function of the Weibull distribution - -function inv = weibull_inv (x, shape, scale) - - if (nargin != 3) - usage ("weibull_inv (x, alpha, sigma)"); - endif - - if (!isscalar (shape) || !isscalar (scale)) - [retval, x, shape, scale] = common_size (x, shape, scale); - if (retval > 0) - error ("weibull_inv: x, alpha and sigma must be of common size or scalar"); - endif - endif - - inv = NaN * ones (size (x)); - - ok = ((shape > 0) & (shape < Inf) & (scale > 0) & (scale < Inf)); - - k = find ((x == 0) & ok); - if (any (k)) - inv(k) = -Inf; - endif - - k = find ((x > 0) & (x < 1) & ok); - if (any (k)) - if (isscalar (shape) && isscalar (scale)) - inv(k) = scale * (- log (1 - x(k))) .^ (1 / shape); - else - inv(k) = scale(k) .* (- log (1 - x(k))) .^ (1 ./ shape(k)); - endif - endif - - k = find ((x == 1) & ok); - if (any (k)) - inv(k) = Inf; - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/weibull_pdf.m --- a/scripts/statistics/distributions/weibull_pdf.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Kurt Hornik -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} weibull_pdf (@var{x}, @var{alpha}, @var{sigma}) -## Compute the probability density function (PDF) at @var{x} of the -## Weibull distribution with shape parameter @var{alpha} and scale -## parameter @var{sigma} which is given by -## -## @example -## alpha * sigma^(-alpha) * x^(alpha-1) * exp(-(x/sigma)^alpha) -## @end example -## -## @noindent -## for @var{x} > 0. -## @end deftypefn - -## Author: KH -## Description: PDF of the Weibull distribution - -function pdf = weibull_pdf (x, shape, scale) - - if (nargin != 3) - usage ("weibull_pdf (x, alpha, sigma)"); - endif - - if (!isscalar (shape) || !isscalar (scale)) - [retval, x, shape, scale] = common_size (x, shape, scale); - if (retval > 0) - error ("weibull_pdf: x, alpha and sigma must be of common size or scalar"); - endif - endif - - pdf = NaN * ones (size (x)); - ok = ((shape > 0) & (shape < Inf) & (scale > 0) & (scale < Inf)); - - k = find ((x > -Inf) & (x <= 0) & ok); - if (any (k)) - pdf(k) = 0; - endif - - k = find ((x > 0) & (x < Inf) & ok); - if (any (k)) - if (isscalar (shape) && isscalar (scale)) - pdf(k) = (shape .* (scale .^ -shape) - .* (x(k) .^ (shape - 1)) - .* exp(- (x(k) / scale) .^ shape)); - else - pdf(k) = (shape(k) .* (scale(k) .^ -shape(k)) - .* (x(k) .^ (shape(k) - 1)) - .* exp(- (x(k) ./ scale(k)) .^ shape(k))); - endif - endif - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/wiener_rnd.m --- a/scripts/statistics/distributions/wiener_rnd.m Wed Jul 13 17:43:35 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -## Copyright (C) 1995, 1996, 1997 Friedrich Leisch -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} wiener_rnd (@var{t}, @var{d}, @var{n}) -## Return a simulated realization of the @var{d}-dimensional Wiener Process -## on the interval [0, @var{t}]. If @var{d} is omitted, @var{d} = 1 is -## used. The first column of the return matrix contains time, the -## remaining columns contain the Wiener process. -## -## The optional parameter @var{n} gives the number of summands used for -## simulating the process over an interval of length 1. If @var{n} is -## omitted, @var{n} = 1000 is used. -## @end deftypefn - -## Author: FL -## Description: Simulate a Wiener process - -function retval = wiener_rnd (t, d, n) - - if (nargin == 1) - d = 1; - n = 1000; - elseif (nargin == 2) - n = 1000; - elseif (nargin > 3) - usage ("wiener_rnd (t, d, n)"); - endif - - if (!isscalar (t) || !isscalar (d) || !isscalar (n)) - error ("wiener_rnd: t, d and n must all be positive integers"); - endif - - retval = randn (n * t, d); - retval = cumsum (retval) / sqrt (n); - - retval = [((1: n*t)' / n), retval]; - -endfunction diff -r 56e066f5efc1 -r bee21f388110 scripts/statistics/distributions/wienrnd.m --- a/scripts/statistics/distributions/wienrnd.m Wed Jul 13 17:43:35 2005 +0000 +++ b/scripts/statistics/distributions/wienrnd.m Wed Jul 13 17:53:49 2005 +0000 @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} wiener_rnd (@var{t}, @var{d}, @var{n}) +## @deftypefn {Function File} {} wienrnd (@var{t}, @var{d}, @var{n}) ## Return a simulated realization of the @var{d}-dimensional Wiener Process ## on the interval [0, @var{t}]. If @var{d} is omitted, @var{d} = 1 is ## used. The first column of the return matrix contains time, the @@ -32,7 +32,7 @@ ## Author: FL ## Description: Simulate a Wiener process -function retval = wiener_rnd (t, d, n) +function retval = wienrnd (t, d, n) if (nargin == 1) d = 1; @@ -40,11 +40,11 @@ elseif (nargin == 2) n = 1000; elseif (nargin > 3) - usage ("wiener_rnd (t, d, n)"); + usage ("wienrnd (t, d, n)"); endif if (!isscalar (t) || !isscalar (d) || !isscalar (n)) - error ("wiener_rnd: t, d and n must all be positive integers"); + error ("wienrnd: t, d and n must all be positive integers"); endif retval = randn (n * t, d);