X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fstatistics-1.1.3%2Fjsucdf.m;fp=octave_packages%2Fstatistics-1.1.3%2Fjsucdf.m;h=59ffaf07c7f42a5ffb8f92bd9d9e21cc65b00bd4;hp=0000000000000000000000000000000000000000;hb=c880e8788dfc484bf23ce13fa2787f2c6bca4863;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/statistics-1.1.3/jsucdf.m b/octave_packages/statistics-1.1.3/jsucdf.m new file mode 100644 index 0000000..59ffaf0 --- /dev/null +++ b/octave_packages/statistics-1.1.3/jsucdf.m @@ -0,0 +1,61 @@ +## Copyright (C) 2006 Frederick (Rick) A Niles +## +## This program 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 3 of the License, or (at your option) any later +## version. +## +## This program 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 +## this program; if not, see . + +## -*- texinfo -*- +## @deftypefn {Function File} {} jsucdf (@var{x}, @var{alpha1}, @var{alpha2}) +## For each element of @var{x}, compute the cumulative distribution +## function (CDF) at @var{x} of the Johnson SU distribution with shape parameters +## @var{alpha1} and @var{alpha2}. +## +## Default values are @var{alpha1} = 1, @var{alpha2} = 1. +## @end deftypefn + +## Author: Frederick (Rick) A Niles +## Description: CDF of the Johnson SU distribution + +## This function is derived from normcdf.m + +## This is the TeX equation of this function: +## +## \[ F(x) = \Phi\left(\alpha_1 + \alpha_2 +## \log\left(x + \sqrt{x^2 + 1} \right)\right) \] +## +## where \[ -\infty < x < \infty ; \alpha_2 > 0 \] and $\Phi$ is the +## standard normal cumulative distribution function. $\alpha_1$ and +## $\alpha_2$ are shape parameters. + + +function cdf = jsucdf (x, alpha1, alpha2) + + if (! ((nargin == 1) || (nargin == 3))) + print_usage; + endif + + if (nargin == 1) + m = 0; + v = 1; + endif + + if (!isscalar (alpha1) || !isscalar(alpha2)) + [retval, x, alpha1, alpha2] = common_size (x, alpha1, alpha2); + if (retval > 0) + error ("normcdf: x, alpha1 and alpha2 must be of common size or scalar"); + endif + endif + + one = ones (size (x)); + cdf = stdnormal_cdf (alpha1 .* one + alpha2 .* log (x + sqrt(x.*x + one))); + +endfunction