comparison scripts/statistics/base/quantile.m @ 9051:1bf0ce0930be

Grammar check TexInfo in all .m files Cleanup documentation sources to follow a few consistent rules. Spellcheck was NOT done. (but will be in another changeset)
author Rik <rdrider0-list@yahoo.com>
date Fri, 27 Mar 2009 22:31:03 -0700
parents eb63fbe60fab
children 634274aaa183
comparison
equal deleted inserted replaced
9044:656ad518f385 9051:1bf0ce0930be
19 ## -*- texinfo -*- 19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} {@var{q} =} quantile (@var{x}, @var{p}) 20 ## @deftypefn {Function File} {@var{q} =} quantile (@var{x}, @var{p})
21 ## @deftypefnx {Function File} {@var{q} =} quantile (@var{x}, @var{p}, @var{dim}) 21 ## @deftypefnx {Function File} {@var{q} =} quantile (@var{x}, @var{p}, @var{dim})
22 ## @deftypefnx {Function File} {@var{q} =} quantile (@var{x}, @var{p}, @var{dim}, @var{method}) 22 ## @deftypefnx {Function File} {@var{q} =} quantile (@var{x}, @var{p}, @var{dim}, @var{method})
23 ## For a sample, @var{x}, calculate the quantiles, @var{q}, corresponding to 23 ## For a sample, @var{x}, calculate the quantiles, @var{q}, corresponding to
24 ## the cumulative probability values in @var{p}. All non-numeric values (NaNs) of 24 ## the cumulative probability values in @var{p}. All non-numeric values (NaNs) of
25 ## @var{x} are ignored. 25 ## @var{x} are ignored.
26 ## 26 ##
27 ## If @var{x} is a matrix, compute the quantiles for each column and 27 ## If @var{x} is a matrix, compute the quantiles for each column and
28 ## return them in a matrix, such that the i-th row of @var{q} contains 28 ## return them in a matrix, such that the i-th row of @var{q} contains
29 ## the @var{p}(i)th quantiles of each column of @var{x}. 29 ## the @var{p}(i)th quantiles of each column of @var{x}.
30 ## 30 ##
31 ## The optional argument @var{dim} determines the dimension along which 31 ## The optional argument @var{dim} determines the dimension along which
32 ## the percentiles are calculated. If @var{dim} is omitted, and @var{x} is 32 ## the percentiles are calculated. If @var{dim} is omitted, and @var{x} is
33 ## a vector or matrix, it defaults to 1 (column wise quantiles). In the 33 ## a vector or matrix, it defaults to 1 (column wise quantiles). In the
34 ## instance that @var{x} is a N-d array, @var{dim} defaults to the first 34 ## instance that @var{x} is a N-d array, @var{dim} defaults to the first
35 ## dimension whose size greater than unity. 35 ## dimension whose size greater than unity.
36 ## 36 ##
37 ## The methods available to calculate sample quantiles are the nine methods 37 ## The methods available to calculate sample quantiles are the nine methods
38 ## used by R (http://www.r-project.org/). The default value is METHOD = 5. 38 ## used by R (http://www.r-project.org/). The default value is METHOD = 5.
39 ## 39 ##
40 ## Discontinuous sample quantile methods 1, 2, and 3 40 ## Discontinuous sample quantile methods 1, 2, and 3
41 ## 41 ##
42 ## @enumerate 1 42 ## @enumerate 1
43 ## @item Method 1: Inverse of empirical distribution function. 43 ## @item Method 1: Inverse of empirical distribution function.
52 ## @item Method 4: p(k) = k / n. That is, linear interpolation of the empirical cdf. 52 ## @item Method 4: p(k) = k / n. That is, linear interpolation of the empirical cdf.
53 ## @item Method 5: p(k) = (k - 0.5) / n. That is a piecewise linear function where 53 ## @item Method 5: p(k) = (k - 0.5) / n. That is a piecewise linear function where
54 ## the knots are the values midway through the steps of the empirical cdf. 54 ## the knots are the values midway through the steps of the empirical cdf.
55 ## @item Method 6: p(k) = k / (n + 1). 55 ## @item Method 6: p(k) = k / (n + 1).
56 ## @item Method 7: p(k) = (k - 1) / (n - 1). 56 ## @item Method 7: p(k) = (k - 1) / (n - 1).
57 ## @item Method 8: p(k) = (k - 1/3) / (n + 1/3). The resulting quantile estimates 57 ## @item Method 8: p(k) = (k - 1/3) / (n + 1/3). The resulting quantile estimates
58 ## are approximately median-unbiased regardless of the distribution of @var{x}. 58 ## are approximately median-unbiased regardless of the distribution of @var{x}.
59 ## @item Method 9: p(k) = (k - 3/8) / (n + 1/4). The resulting quantile estimates 59 ## @item Method 9: p(k) = (k - 3/8) / (n + 1/4). The resulting quantile estimates
60 ## are approximately unbiased for the expected order statistics if @var{x} is 60 ## are approximately unbiased for the expected order statistics if @var{x} is
61 ## normally distributed. 61 ## normally distributed.
62 ## @end enumerate 62 ## @end enumerate
63 ## 63 ##
64 ## Hyndman and Fan (1996) recommend method 8. Maxima, S, and R 64 ## Hyndman and Fan (1996) recommend method 8. Maxima, S, and R
65 ## (versions prior to 2.0.0) use 7 as their default. Minitab and SPSS 65 ## (versions prior to 2.0.0) use 7 as their default. Minitab and SPSS
66 ## use method 6. Matlab uses method 5. 66 ## use method 6. @sc{matlab} uses method 5.
67 ## 67 ##
68 ## References: 68 ## References:
69 ## 69 ##
70 ## @itemize @bullet 70 ## @itemize @bullet
71 ## @item Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New 71 ## @item Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New