diff --git a/inst/dist_fit/ricefit.m b/inst/dist_fit/ricefit.m
index eb1f0536..cd02967a 100644
--- a/inst/dist_fit/ricefit.m
+++ b/inst/dist_fit/ricefit.m
@@ -29,7 +29,7 @@
## @code{@var{paramhat} = ricefit (@var{x})} returns the maximum likelihood
## estimates of the parameters of the Rician distribution given the data in
## @var{x}. @qcode{@var{paramhat}(1)} is the non-centrality (distance)
-## parameter, @math{nu}, and @qcode{@var{paramhat}(2)} is the scale parameter,
+## parameter, @math{s}, and @qcode{@var{paramhat}(2)} is the scale parameter,
## @math{sigma}.
##
## @code{[@var{paramhat}, @var{paramci}] = ricefit (@var{x})} returns the 95%
@@ -217,28 +217,28 @@
%! hold on
%!
%! ## Estimate their α and β parameters
-%! nu_sigmaA = ricefit (r(:,1));
-%! nu_sigmaB = ricefit (r(:,2));
-%! nu_sigmaC = ricefit (r(:,3));
+%! s_sigmaA = ricefit (r(:,1));
+%! s_sigmaB = ricefit (r(:,2));
+%! s_sigmaC = ricefit (r(:,3));
%!
%! ## Plot their estimated PDFs
%! x = [0.01,0.1:0.2:18];
-%! y = ricepdf (x, nu_sigmaA(1), nu_sigmaA(2));
+%! y = ricepdf (x, s_sigmaA(1), s_sigmaA(2));
%! plot (x, y, "-pr");
-%! y = ricepdf (x, nu_sigmaB(1), nu_sigmaB(2));
+%! y = ricepdf (x, s_sigmaB(1), s_sigmaB(2));
%! plot (x, y, "-sg");
-%! y = ricepdf (x, nu_sigmaC(1), nu_sigmaC(2));
+%! y = ricepdf (x, s_sigmaC(1), s_sigmaC(2));
%! plot (x, y, "-^c");
%! hold off
-%! legend ({"Normalized HIST of sample 1 with ν=1 and σ=2", ...
-%! "Normalized HIST of sample 2 with ν=2 and σ=4", ...
-%! "Normalized HIST of sample 3 with ν=7.5 and σ=1", ...
-%! sprintf("PDF for sample 1 with estimated ν=%0.2f and σ=%0.2f", ...
-%! nu_sigmaA(1), nu_sigmaA(2)), ...
-%! sprintf("PDF for sample 2 with estimated ν=%0.2f and σ=%0.2f", ...
-%! nu_sigmaB(1), nu_sigmaB(2)), ...
-%! sprintf("PDF for sample 3 with estimated ν=%0.2f and σ=%0.2f", ...
-%! nu_sigmaC(1), nu_sigmaC(2))})
+%! legend ({"Normalized HIST of sample 1 with s=1 and σ=2", ...
+%! "Normalized HIST of sample 2 with s=2 and σ=4", ...
+%! "Normalized HIST of sample 3 with s=7.5 and σ=1", ...
+%! sprintf("PDF for sample 1 with estimated s=%0.2f and σ=%0.2f", ...
+%! s_sigmaA(1), s_sigmaA(2)), ...
+%! sprintf("PDF for sample 2 with estimated s=%0.2f and σ=%0.2f", ...
+%! s_sigmaB(1), s_sigmaB(2)), ...
+%! sprintf("PDF for sample 3 with estimated s=%0.2f and σ=%0.2f", ...
+%! s_sigmaC(1), s_sigmaC(2))})
%! title ("Three population samples from different Rician distibutions")
%! hold off
diff --git a/inst/dist_fit/ricelike.m b/inst/dist_fit/ricelike.m
index 3bb803a5..cf9e95f7 100644
--- a/inst/dist_fit/ricelike.m
+++ b/inst/dist_fit/ricelike.m
@@ -26,7 +26,7 @@
##
## @code{@var{nlogL} = ricelike (@var{params}, @var{x})} returns the negative
## log likelihood of the data in @var{x} corresponding to the Rician
-## distribution with (1) non-centrality (distance) parameter @math{nu} and (2)
+## distribution with (1) non-centrality (distance) parameter @math{s} and (2)
## scale parameter @math{sigma} given in the two-element vector @var{params}.
##
## @code{[@var{nlogL}, @var{acov}] = ricelike (@var{params}, @var{x})} also
diff --git a/inst/dist_fun/ricecdf.m b/inst/dist_fun/ricecdf.m
index d611d831..1385a49e 100644
--- a/inst/dist_fun/ricecdf.m
+++ b/inst/dist_fun/ricecdf.m
@@ -16,20 +16,20 @@
## this program; if not, see .
## -*- texinfo -*-
-## @deftypefn {statistics} {@var{p} =} ricecdf (@var{x}, @var{nu}, @var{sigma})
-## @deftypefnx {statistics} {@var{p} =} ricecdf (@var{x}, @var{nu}, @var{sigma}, @qcode{"upper"})
+## @deftypefn {statistics} {@var{p} =} ricecdf (@var{x}, @var{s}, @var{sigma})
+## @deftypefnx {statistics} {@var{p} =} ricecdf (@var{x}, @var{s}, @var{sigma}, @qcode{"upper"})
##
## Rician cumulative distribution function (CDF).
##
## For each element of @var{x}, compute the cumulative distribution function
## (CDF) of the Rician distribution with non-centrality (distance) parameter
-## @var{nu} and scale parameter @var{sigma}. The size of @var{p} is the common
-## size of @var{x}, @var{nu}, and @var{sigma}. A scalar input functions as a
+## @var{s} and scale parameter @var{sigma}. The size of @var{p} is the common
+## size of @var{x}, @var{s}, and @var{sigma}. A scalar input functions as a
## constant matrix of the same size as the other inputs.
##
-## @code{@var{p} = ricecdf (@var{x}, @var{nu}, @var{sigma}, "upper")} computes
+## @code{@var{p} = ricecdf (@var{x}, @var{s}, @var{sigma}, "upper")} computes
## the upper tail probability of the Rician distribution with parameters
-## @var{nu} and @var{sigma}, at the values in @var{x}.
+## @var{s} and @var{sigma}, at the values in @var{x}.
##
## Further information about the Rician distribution can be found at
## @url{https://en.wikipedia.org/wiki/Rice_distribution}
@@ -37,7 +37,7 @@
## @seealso{riceinv, ricepdf, ricernd, ricefit, ricelike, ricestat}
## @end deftypefn
-function p = ricecdf (x, nu, sigma, uflag)
+function p = ricecdf (x, s, sigma, uflag)
## Check for valid number of input arguments
if (nargin < 3)
@@ -53,39 +53,39 @@
uflag = false;
endif
- ## Check for common size of X and SIGMA
- if (! isscalar (x) || ! isscalar (nu) || ! isscalar (sigma))
- [retval, x, nu, sigma] = common_size (x, nu, sigma);
+ ## Check for common size of X, S, and SIGMA
+ if (! isscalar (x) || ! isscalar (s) || ! isscalar (sigma))
+ [retval, x, s, sigma] = common_size (x, s, sigma);
if (retval > 0)
- error ("ricecdf: X, NU, and SIGMA must be of common size or scalars.");
+ error ("ricecdf: X, S, and SIGMA must be of common size or scalars.");
endif
endif
- ## Check for X and SIGMA being reals
- if (iscomplex (x) || iscomplex (nu) || iscomplex (sigma))
- error ("ricecdf: X, NU, and SIGMA must not be complex.");
+ ## Check for X, S, and SIGMA being reals
+ if (iscomplex (x) || iscomplex (s) || iscomplex (sigma))
+ error ("ricecdf: X, S, and SIGMA must not be complex.");
endif
## Check for class type
- if (isa (x, "single") || isa (nu, "single") || isa (sigma, "single"));
+ if (isa (x, "single") || isa (s, "single") || isa (sigma, "single"));
p = zeros (size (x), "single");
else
p = zeros (size (x));
endif
## Force 1 for upper flag and X <= 0
- k0 = nu >= 0 & sigma > 0 & x < 0;
+ k0 = s >= 0 & sigma > 0 & x < 0;
if (uflag && any (k0(:)))
p(k0) = 1;
end
## Calculate Rayleigh CDF for valid parameter and data range
- k = nu >= 0 & sigma > 0 & x >= 0;
+ k = s >= 0 & sigma > 0 & x >= 0;
if (any (k(:)))
if (uflag)
- p(k) = marcumQ1 (nu(k) ./ sigma(k), x(k) ./ sigma(k));
+ p(k) = marcumQ1 (s(k) ./ sigma(k), x(k) ./ sigma(k));
else
- p(k) = 1 - marcumQ1 (nu(k) ./ sigma(k), x(k) ./ sigma(k));
+ p(k) = 1 - marcumQ1 (s(k) ./ sigma(k), x(k) ./ sigma(k));
endif
endif
@@ -150,8 +150,8 @@
%! grid on
%! ylim ([0, 1])
%! xlim ([0, 8])
-%! legend ({"ν = 0, σ = 1", "ν = 0.5, σ = 1", "ν = 1, σ = 1", ...
-%! "ν = 2, σ = 1", "ν = 4, σ = 1"}, "location", "southeast")
+%! legend ({"s = 0, σ = 1", "s = 0.5, σ = 1", "s = 1, σ = 1", ...
+%! "s = 2, σ = 1", "s = 4, σ = 1"}, "location", "southeast")
%! title ("Rician CDF")
%! xlabel ("values in x")
%! ylabel ("probability")
@@ -177,8 +177,8 @@
## Test output
%!test
%! x = 0:0.5:2.5;
-%! nu = 1:6;
-%! p = ricecdf (x, nu, 1);
+%! s = 1:6;
+%! p = ricecdf (x, s, 1);
%! expected_p = [0.0000, 0.0179, 0.0108, 0.0034, 0.0008, 0.0001];
%! assert (p, expected_p, 0.001);
%!test
@@ -209,12 +209,12 @@
%!error ricecdf (1, 2)
%!error ricecdf (1, 2, 3, "uper")
%!error ricecdf (1, 2, 3, 4)
-%!error ...
+%!error ...
%! ricecdf (ones (3), ones (2), ones (2))
-%!error ...
+%!error ...
%! ricecdf (ones (2), ones (3), ones (2))
-%!error ...
+%!error ...
%! ricecdf (ones (2), ones (2), ones (3))
-%!error ricecdf (i, 2, 3)
-%!error ricecdf (2, i, 3)
-%!error ricecdf (2, 2, i)
+%!error ricecdf (i, 2, 3)
+%!error ricecdf (2, i, 3)
+%!error ricecdf (2, 2, i)
diff --git a/inst/dist_fun/riceinv.m b/inst/dist_fun/riceinv.m
index 651e8e6a..90a55c03 100644
--- a/inst/dist_fun/riceinv.m
+++ b/inst/dist_fun/riceinv.m
@@ -16,14 +16,14 @@
## this program; if not, see .
## -*- texinfo -*-
-## @deftypefn {statistics} {@var{x} =} riceinv (@var{p}, @var{nu}, @var{sigma})
+## @deftypefn {statistics} {@var{x} =} riceinv (@var{p}, @var{s}, @var{sigma})
##
## Inverse of the Rician distribution (iCDF).
##
## For each element of @var{p}, compute the quantile (the inverse of the CDF)
-## of the Rician distribution with non-centrality (distance) parameter @var{nu}
+## of the Rician distribution with non-centrality (distance) parameter @var{s}
## and scale parameter @var{sigma}. The size of @var{x} is the common size of
-## @var{x}, @var{nu}, and @var{sigma}. A scalar input functions as a constant
+## @var{x}, @var{s}, and @var{sigma}. A scalar input functions as a constant
## matrix of the same size as the other inputs.
##
## Further information about the Rician distribution can be found at
@@ -32,39 +32,39 @@
## @seealso{ricecdf, ricepdf, ricernd, ricefit, ricelike, ricestat}
## @end deftypefn
-function x = riceinv (p, nu, sigma)
+function x = riceinv (p, s, sigma)
## Check for valid number of input arguments
if (nargin < 3)
error ("riceinv: function called with too few input arguments.");
endif
- ## Check for common size of P, NU, and B
- if (! isscalar (p) || ! isscalar (nu) || ! isscalar (sigma))
- [retval, p, nu, sigma] = common_size (p, nu, sigma);
+ ## Check for common size of P, S, and B
+ if (! isscalar (p) || ! isscalar (s) || ! isscalar (sigma))
+ [retval, p, s, sigma] = common_size (p, s, sigma);
if (retval > 0)
- error ("riceinv: P, NU, and B must be of common size or scalars.");
+ error ("riceinv: P, S, and B must be of common size or scalars.");
endif
endif
- ## Check for P, NU, and B being reals
- if (iscomplex (p) || iscomplex (nu) || iscomplex (sigma))
- error ("riceinv: P, NU, and B must not be complex.");
+ ## Check for P, S, and B being reals
+ if (iscomplex (p) || iscomplex (s) || iscomplex (sigma))
+ error ("riceinv: P, S, and B must not be complex.");
endif
## Check for class type
- if (isa (p, "single") || isa (nu, "single") || isa (sigma, "single"))
+ if (isa (p, "single") || isa (s, "single") || isa (sigma, "single"))
x = zeros (size (p), "single");
else
x = zeros (size (p));
endif
- k = nu < 0 | sigma <= 0 | p < 0 | p > 1 | ...
- isnan (p) | isnan (nu) | isnan (sigma);
+ k = s < 0 | sigma <= 0 | p < 0 | p > 1 | ...
+ isnan (p) | isnan (s) | isnan (sigma);
x(k) = NaN;
k = ! k;
- x(k) = sigma(k) .* sqrt (ncx2inv (p(k), 2, (nu(k) ./ sigma(k)) .^ 2));
+ x(k) = sigma(k) .* sqrt (ncx2inv (p(k), 2, (s(k) ./ sigma(k)) .^ 2));
endfunction
@@ -78,8 +78,8 @@
%! x5 = riceinv (p, 4, 1);
%! plot (p, x1, "-b", p, x2, "-g", p, x3, "-r", p, x4, "-m", p, x5, "-k")
%! grid on
-%! legend ({"ν = 0, σ = 1", "ν = 0.5, σ = 1", "ν = 1, σ = 1", ...
-%! "ν = 2, σ = 1", "ν = 4, σ = 1"}, "location", "northwest")
+%! legend ({"s = 0, σ = 1", "s = 0.5, σ = 1", "s = 1, σ = 1", ...
+%! "s = 2, σ = 1", "s = 4, σ = 1"}, "location", "northwest")
%! title ("Rician iCDF")
%! xlabel ("probability")
%! ylabel ("values in x")
@@ -108,12 +108,12 @@
%!error riceinv (1)
%!error riceinv (1,2)
%!error riceinv (1,2,3,4)
-%!error ...
+%!error ...
%! riceinv (ones (3), ones (2), ones (2))
-%!error ...
+%!error ...
%! riceinv (ones (2), ones (3), ones (2))
-%!error ...
+%!error ...
%! riceinv (ones (2), ones (2), ones (3))
-%!error riceinv (i, 2, 2)
-%!error riceinv (2, i, 2)
-%!error riceinv (2, 2, i)
+%!error riceinv (i, 2, 2)
+%!error riceinv (2, i, 2)
+%!error riceinv (2, 2, i)
diff --git a/inst/dist_fun/ricepdf.m b/inst/dist_fun/ricepdf.m
index f69f4bc4..ef5528bf 100644
--- a/inst/dist_fun/ricepdf.m
+++ b/inst/dist_fun/ricepdf.m
@@ -16,14 +16,14 @@
## this program; if not, see .
## -*- texinfo -*-
-## @deftypefn {statistics} {@var{y} =} ricepdf (@var{x}, @var{nu}, @var{sigma})
+## @deftypefn {statistics} {@var{y} =} ricepdf (@var{x}, @var{s}, @var{sigma})
##
## Rician probability density function (PDF).
##
## For each element of @var{x}, compute the probability density function (PDF)
-## of the Rician distribution with non-centrality (distance) parameter @var{nu}
+## of the Rician distribution with non-centrality (distance) parameter @var{s}
## and scale parameter @var{sigma}. The size of @var{y} is the common size of
-## @var{x}, @var{nu}, and @var{sigma}. A scalar input functions as a constant
+## @var{x}, @var{s}, and @var{sigma}. A scalar input functions as a constant
## matrix of the same size as the other inputs.
##
## Further information about the Rician distribution can be found at
@@ -32,40 +32,40 @@
## @seealso{ricecdf, riceinv, ricernd, ricefit, ricelike, ricestat}
## @end deftypefn
-function y = ricepdf (x, nu, sigma)
+function y = ricepdf (x, s, sigma)
## Check for valid number of input arguments
if (nargin < 3)
error ("ricepdf: function called with too few input arguments.");
endif
- ## Check for common size of X, NU, and SIGMA
- if (! isscalar (x) || ! isscalar (nu) || ! isscalar (sigma))
- [retval, x, nu, sigma] = common_size (x, nu, sigma);
+ ## Check for common size of X, S, and SIGMA
+ if (! isscalar (x) || ! isscalar (s) || ! isscalar (sigma))
+ [retval, x, s, sigma] = common_size (x, s, sigma);
if (retval > 0)
- error ("ricepdf: X, NU, and SIGMA must be of common size or scalars.");
+ error ("ricepdf: X, S, and SIGMA must be of common size or scalars.");
endif
endif
- ## Check for X, NU, and SIGMA being reals
- if (iscomplex (x) || iscomplex (nu) || iscomplex (sigma))
- error ("ricepdf: X, NU, and SIGMA must not be complex.");
+ ## Check for X, S, and SIGMA being reals
+ if (iscomplex (x) || iscomplex (s) || iscomplex (sigma))
+ error ("ricepdf: X, S, and SIGMA must not be complex.");
endif
## Check for class type
- if (isa (x, "single") || isa (nu, "single") || isa (sigma, "single"));
+ if (isa (x, "single") || isa (s, "single") || isa (sigma, "single"));
y = zeros (size (x), "single");
else
y = zeros (size (x));
endif
- k = nu < 0 | sigma <= 0 | x < 0 | isnan (x) | isnan (nu) | isnan (sigma);
+ k = s < 0 | sigma <= 0 | x < 0 | isnan (x) | isnan (s) | isnan (sigma);
y(k) = NaN;
k = ! k;
## Do the math
x_k = x(k);
- n_k = nu(k);
+ n_k = s(k);
s_sq = sigma(k) .^ 2;
x_s2 = x_k ./ s_sq;
xnsq = (x_k .^ 2 + n_k .^ 2) ./ (2 .* s_sq);
@@ -93,8 +93,8 @@
%! grid on
%! ylim ([0, 0.65])
%! xlim ([0, 8])
-%! legend ({"ν = 0, σ = 1", "ν = 0.5, σ = 1", "ν = 1, σ = 1", ...
-%! "ν = 2, σ = 1", "ν = 4, σ = 1"}, "location", "northeast")
+%! legend ({"s = 0, σ = 1", "s = 0.5, σ = 1", "s = 1, σ = 1", ...
+%! "s = 2, σ = 1", "s = 4, σ = 1"}, "location", "northeast")
%! title ("Rician PDF")
%! xlabel ("values in x")
%! ylabel ("density")
@@ -120,12 +120,12 @@
%!error ricepdf (1)
%!error ricepdf (1,2)
%!error ricepdf (1,2,3,4)
-%!error ...
+%!error ...
%! ricepdf (ones (3), ones (2), ones (2))
-%!error ...
+%!error ...
%! ricepdf (ones (2), ones (3), ones (2))
-%!error ...
+%!error ...
%! ricepdf (ones (2), ones (2), ones (3))
-%!error ricepdf (i, 2, 2)
-%!error ricepdf (2, i, 2)
-%!error ricepdf (2, 2, i)
+%!error ricepdf (i, 2, 2)
+%!error ricepdf (2, i, 2)
+%!error ricepdf (2, 2, i)
diff --git a/inst/dist_fun/ricernd.m b/inst/dist_fun/ricernd.m
index 3fb459a3..c29c33b2 100644
--- a/inst/dist_fun/ricernd.m
+++ b/inst/dist_fun/ricernd.m
@@ -16,18 +16,18 @@
## this program; if not, see .
## -*- texinfo -*-
-## @deftypefn {statistics} {@var{r} =} ricernd (@var{nu}, @var{sigma})
-## @deftypefnx {statistics} {@var{r} =} ricernd (@var{nu}, @var{sigma}, @var{rows})
-## @deftypefnx {statistics} {@var{r} =} ricernd (@var{nu}, @var{sigma}, @var{rows}, @var{cols}, @dots{})
-## @deftypefnx {statistics} {@var{r} =} ricernd (@var{nu}, @var{sigma}, [@var{sz}])
+## @deftypefn {statistics} {@var{r} =} ricernd (@var{s}, @var{sigma})
+## @deftypefnx {statistics} {@var{r} =} ricernd (@var{s}, @var{sigma}, @var{rows})
+## @deftypefnx {statistics} {@var{r} =} ricernd (@var{s}, @var{sigma}, @var{rows}, @var{cols}, @dots{})
+## @deftypefnx {statistics} {@var{r} =} ricernd (@var{s}, @var{sigma}, [@var{sz}])
##
## Random arrays from the Rician distribution.
##
-## @code{@var{r} = ricernd (@var{nu}, @var{sigma})} returns an array of random
-## numbers chosen from the Rician distribution with shape parameters @var{nu}
-## and @var{sigma}. The size of @var{r} is the common size of @var{nu} and
-## @var{sigma}. A scalar input functions as a constant matrix of the same size
-## as the other inputs.
+## @code{@var{r} = ricernd (@var{s}, @var{sigma})} returns an array of random
+## numbers chosen from the Rician distribution with noncentrality parameter
+## @var{s} and scale parameter @var{sigma}. The size of @var{r} is the common
+## size of @var{s} and @var{sigma}. A scalar input functions as a constant
+## matrix of the same size as the other inputs.
##
## When called with a single size argument, @code{ricernd} returns a square
## matrix with the dimension specified. When called with more than one scalar
@@ -41,29 +41,29 @@
## @seealso{ricecdf, riceinv, ricepdf, ricefit, ricelike, ricestat}
## @end deftypefn
-function r = ricernd (nu, sigma, varargin)
+function r = ricernd (s, sigma, varargin)
## Check for valid number of input arguments
if (nargin < 2)
error ("ricernd: function called with too few input arguments.");
endif
- ## Check for common size of NU and SIGMA
- if (! isscalar (nu) || ! isscalar (sigma))
- [retval, nu, sigma] = common_size (nu, sigma);
+ ## Check for common size of S and SIGMA
+ if (! isscalar (s) || ! isscalar (sigma))
+ [retval, s, sigma] = common_size (s, sigma);
if (retval > 0)
- error ("ricernd: NU and SIGMA must be of common size or scalars.");
+ error ("ricernd: S and SIGMA must be of common size or scalars.");
endif
endif
- ## Check for NU and SIGMA being reals
- if (iscomplex (nu) || iscomplex (sigma))
- error ("ricernd: NU and SIGMA must not be complex.");
+ ## Check for S and SIGMA being reals
+ if (iscomplex (s) || iscomplex (sigma))
+ error ("ricernd: S and SIGMA must not be complex.");
endif
## Parse and check SIZE arguments
if (nargin == 2)
- sz = size (nu);
+ sz = size (s);
elseif (nargin == 3)
if (isscalar (varargin{1}) && varargin{1} >= 0 ...
&& varargin{1} == fix (varargin{1}))
@@ -84,31 +84,31 @@
endif
## Check that parameters match requested dimensions in size
- if (! isscalar (nu) && ! isequal (size (nu), sz))
- error ("ricernd: NU and SIGMA must be scalars or of size SZ.");
+ if (! isscalar (s) && ! isequal (size (s), sz))
+ error ("ricernd: S and SIGMA must be scalars or of size SZ.");
endif
## Check for class type
- if (isa (nu, "single") || isa (sigma, "single"))
+ if (isa (s, "single") || isa (sigma, "single"))
cls = "single";
else
cls = "double";
endif
- ## Return NaNs for out of range values of NU and SIGMA
- nu(nu < 0) = NaN;
+ ## Return NaNs for out of range values of S and SIGMA
+ s(s < 0) = NaN;
sigma(sigma <= 0) = NaN;
- ## Force NU and SIGMA into the same size as SZ (if necessary)
- if (isscalar (nu))
- nu = repmat (nu, sz);
+ ## Force S and SIGMA into the same size as SZ (if necessary)
+ if (isscalar (s))
+ s = repmat (s, sz);
endif
if (isscalar (sigma))
sigma = repmat (sigma, sz);
endif
## Generate random sample from the Rician distribution
- r = sigma .* sqrt (ncx2rnd (2, (nu ./ sigma) .^ 2, sz));
+ r = sigma .* sqrt (ncx2rnd (2, (s ./ sigma) .^ 2, sz));
## Cast to appropriate class
r = cast (r, cls);
@@ -142,12 +142,12 @@
## Test input validation
%!error ricernd ()
%!error ricernd (1)
-%!error ...
+%!error ...
%! ricernd (ones (3), ones (2))
-%!error ...
+%!error ...
%! ricernd (ones (2), ones (3))
-%!error ricernd (i, 2)
-%!error ricernd (1, i)
+%!error ricernd (i, 2)
+%!error ricernd (1, i)
%!error ...
%! ricernd (1, 1/2, -1)
%!error ...
@@ -162,15 +162,15 @@
%! ricernd (1, 1/2, 2, -1, 5)
%!error ...
%! ricernd (1, 1/2, 2, 1.5, 5)
-%!error ...
+%!error ...
%! ricernd (2, 1/2 * ones (2), 3)
-%!error ...
+%!error ...
%! ricernd (2, 1/2 * ones (2), [3, 2])
-%!error ...
+%!error ...
%! ricernd (2, 1/2 * ones (2), 3, 2)
-%!error ...
+%!error ...
%! ricernd (2 * ones (2), 1/2, 3)
-%!error ...
+%!error ...
%! ricernd (2 * ones (2), 1/2, [3, 2])
-%!error ...
+%!error ...
%! ricernd (2 * ones (2), 1/2, 3, 2)
diff --git a/inst/dist_stat/ricestat.m b/inst/dist_stat/ricestat.m
index 225d62f2..3c25de77 100644
--- a/inst/dist_stat/ricestat.m
+++ b/inst/dist_stat/ricestat.m
@@ -16,13 +16,13 @@
## this program; if not, see .
## -*- texinfo -*-
-## @deftypefn {statistics} {[@var{m}, @var{v}] =} ricestat (@var{nu}, @var{sigma})
+## @deftypefn {statistics} {[@var{m}, @var{v}] =} ricestat (@var{s}, @var{sigma})
##
## Compute statistics of the Rician distribution.
##
-## @code{[@var{m}, @var{v}] = ricestat (@var{nu}, @var{sigma})} returns the mean
+## @code{[@var{m}, @var{v}] = ricestat (@var{s}, @var{sigma})} returns the mean
## and variance of the Rician distribution with non-centrality (distance)
-## parameter @var{nu} and scale parameter @var{sigma}.
+## parameter @var{s} and scale parameter @var{sigma}.
##
## The size of @var{m} (mean) and @var{v} (variance) is the common size of the
## input arguments. A scalar input functions as a constant matrix of the
@@ -34,47 +34,47 @@
## @seealso{ricecdf, riceinv, ricepdf, ricernd, ricefit, ricelike}
## @end deftypefn
-function [m, v] = ricestat (nu, sigma)
+function [m, v] = ricestat (s, sigma)
## Check for valid number of input arguments
if (nargin < 2)
error ("ricestat: function called with too few input arguments.");
endif
- ## Check for NU and SIGMA being numeric
- if (! (isnumeric (nu) && isnumeric (sigma)))
- error ("ricestat: NU and SIGMA must be numeric.");
+ ## Check for S and SIGMA being numeric
+ if (! (isnumeric (s) && isnumeric (sigma)))
+ error ("ricestat: S and SIGMA must be numeric.");
endif
- ## Check for NU and SIGMA being real
- if (iscomplex (nu) || iscomplex (sigma))
- error ("ricestat: NU and SIGMA must not be complex.");
+ ## Check for S and SIGMA being real
+ if (iscomplex (s) || iscomplex (sigma))
+ error ("ricestat: S and SIGMA must not be complex.");
endif
- ## Check for common size of NU and SIGMA
- if (! isscalar (nu) || ! isscalar (sigma))
- [retval, nu, sigma] = common_size (nu, sigma);
+ ## Check for common size of S and SIGMA
+ if (! isscalar (s) || ! isscalar (sigma))
+ [retval, s, sigma] = common_size (s, sigma);
if (retval > 0)
- error ("ricestat: NU and SIGMA must be of common size or scalars.");
+ error ("ricestat: S and SIGMA must be of common size or scalars.");
endif
endif
## Initialize mean and variance
- if (isa (nu, "single") || isa (sigma, "single"))
- m = NaN (size (nu), "single");
+ if (isa (s, "single") || isa (sigma, "single"))
+ m = NaN (size (s), "single");
v = m;
else
- m = NaN (size (nu));
+ m = NaN (size (s));
v = m;
endif
## Compute mean and variance for valid parameter values.
- k = (nu >= 0 & sigma > 0);
+ k = (s >= 0 & sigma > 0);
if (any (k(:)))
- thetasq = (nu(k) .^ 2) ./ (sigma(k) .^ 2);
+ thetasq = (s(k) .^ 2) ./ (sigma(k) .^ 2);
L = Laguerre_half (-0.5 .* thetasq);
m(k) = sigma(k) .* sqrt (pi / 2) .* L;
- v(k) = 2 * (sigma(k) .^ 2) + nu(k) .^ 2 - ...
+ v(k) = 2 * (sigma(k) .^ 2) + s(k) .^ 2 - ...
(0.5 .* pi .* sigma(k) .^ 2) .* L .^ 2;
endif
@@ -87,23 +87,23 @@
## Input validation tests
%!error ricestat ()
%!error ricestat (1)
-%!error ricestat ({}, 2)
-%!error ricestat (1, "")
-%!error ricestat (i, 2)
-%!error ricestat (1, i)
-%!error ...
+%!error ricestat ({}, 2)
+%!error ricestat (1, "")
+%!error ricestat (i, 2)
+%!error ricestat (1, i)
+%!error ...
%! ricestat (ones (3), ones (2))
-%!error ...
+%!error ...
%! ricestat (ones (2), ones (3))
## Output validation tests
-%!shared nu, sigma
-%! nu = [2, 0, -1, 1, 4];
+%!shared s, sigma
+%! s = [2, 0, -1, 1, 4];
%! sigma = [1, NaN, 3, -1, 2];
-%!assert (ricestat (nu, sigma), [2.2724, NaN, NaN, NaN, 4.5448], 1e-4);
-%!assert (ricestat ([nu(1:2), nu(4:5)], 1), [2.2724, 1.2533, 1.5486, 4.1272], 1e-4);
-%!assert (ricestat ([nu(1:2), nu(4:5)], 3), [4.1665, 3.7599, 3.8637, 5.2695], 1e-4);
-%!assert (ricestat ([nu(1:2), nu(4:5)], 2), [3.0971, 2.5066, 2.6609, 4.5448], 1e-4);
+%!assert (ricestat (s, sigma), [2.2724, NaN, NaN, NaN, 4.5448], 1e-4);
+%!assert (ricestat ([s(1:2), s(4:5)], 1), [2.2724, 1.2533, 1.5486, 4.1272], 1e-4);
+%!assert (ricestat ([s(1:2), s(4:5)], 3), [4.1665, 3.7599, 3.8637, 5.2695], 1e-4);
+%!assert (ricestat ([s(1:2), s(4:5)], 2), [3.0971, 2.5066, 2.6609, 4.5448], 1e-4);
%!assert (ricestat (2, [sigma(1), sigma(3:5)]), [2.2724, 4.1665, NaN, 3.0971], 1e-4);
%!assert (ricestat (0, [sigma(1), sigma(3:5)]), [1.2533, 3.7599, NaN, 2.5066], 1e-4);
%!assert (ricestat (1, [sigma(1), sigma(3:5)]), [1.5486, 3.8637, NaN, 2.6609], 1e-4);