diff --git a/README.md b/README.md index 844bfb8c..376aadf2 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ You can find its documentation at [https://gnu-octave.github.io/statistics/](htt ## 2. Install statistics -To install the latest version (1.5.4) you need Octave (>=6.1.0) installed on your system. If you have Octave (>=7.2.0) you can install it by typing: +To install the latest version (1.6.0) you need Octave (>=7.2.0) installed on your system. Install it by typing: `pkg install -forge statistics` @@ -33,7 +33,7 @@ or alternatively type: `pkg install "https://github.com/gnu-octave/statistics/archive/refs/heads/main.zip"` -to download and install it. +to automatically download and install it. If you need to install a specific release, for example `1.4.2`, type: @@ -42,9 +42,9 @@ If you need to install a specific release, for example `1.4.2`, type: After installation, type: - `pkg load statistics` to load the **statistics** package. - `news statistics` to review all the user visible changes since last version. -- `pkg test statistics` to run a test suite for all[^1] functions in the package and ensure that they work properly on your system. +- `pkg test statistics` to run a test suite for all 365 [^1] functions currently available and ensure that they work properly on your system. -[^1]: Some functions are missing BISTs, these are not included in the test suite. But you are welcome to [contribute](https://github.com/gnu-octave/statistics/blob/main/CONTRIBUTING.md)! +[^1]: Several functions are still missing from the statistics package, but you are welcome to [contribute](https://github.com/gnu-octave/statistics/blob/main/CONTRIBUTING.md)! ## 3. Provide feedback @@ -62,5 +62,5 @@ If you find a bug and fix it, just [clone](https://github.com/gnu-octave/statist Make sure you follow the coding style already used in the **statistics** package (similar to GNU Octave). For a summary of the coding style rules used in the package see [Contribute](https://github.com/gnu-octave/statistics/blob/main/CONTRIBUTING.md). -Contributing is not only about fixing bugs. Improving the texinfo of the functions help files or adding BISTs and demos at the end of the function files is also important. Out of a total of 315 functions, there are still 18 functions missing BISTs and it would be invaluable to add tests to these. Fixing a typo in the help file is still of value though. So don't hesitate to contribute! :+1: +Contributing is not only about fixing bugs or implementing new functions. Improving the texinfo of the functions help files or adding BISTs and demos at the end of the function files is also important. Fixing a typo in the help file is still of value though. So don't hesitate to contribute! :+1: diff --git a/docs/assets/dcov_101.png b/docs/assets/dcov_101.png index e63f84db..95508d3f 100644 Binary files a/docs/assets/dcov_101.png and b/docs/assets/dcov_101.png differ diff --git a/docs/assets/dendrogram_201.png b/docs/assets/dendrogram_201.png index 42bc6ff8..e810575d 100644 Binary files a/docs/assets/dendrogram_201.png and b/docs/assets/dendrogram_201.png differ diff --git a/docs/assets/fitgmdist_101.png b/docs/assets/fitgmdist_101.png index a41151ee..ae285f87 100644 Binary files a/docs/assets/fitgmdist_101.png and b/docs/assets/fitgmdist_101.png differ diff --git a/docs/assets/geofit_101.png b/docs/assets/geofit_101.png new file mode 100644 index 00000000..4605c7be Binary files /dev/null and b/docs/assets/geofit_101.png differ diff --git a/docs/assets/gscatter_101.png b/docs/assets/gscatter_101.png index d5402e7a..1466be9f 100644 Binary files a/docs/assets/gscatter_101.png and b/docs/assets/gscatter_101.png differ diff --git a/docs/assets/raylcdf_101.png b/docs/assets/raylcdf_101.png index ebd14d43..9f50ae8a 100644 Binary files a/docs/assets/raylcdf_101.png and b/docs/assets/raylcdf_101.png differ diff --git a/docs/assets/silhouette_101.png b/docs/assets/silhouette_101.png index ce4d906a..e3568f27 100644 Binary files a/docs/assets/silhouette_101.png and b/docs/assets/silhouette_101.png differ diff --git a/docs/assets/tcdf_101.png b/docs/assets/tcdf_101.png new file mode 100644 index 00000000..bbfd8ce4 Binary files /dev/null and b/docs/assets/tcdf_101.png differ diff --git a/docs/assets/tinv_101.png b/docs/assets/tinv_101.png new file mode 100644 index 00000000..7e45cf7a Binary files /dev/null and b/docs/assets/tinv_101.png differ diff --git a/docs/assets/tpdf_101.png b/docs/assets/tpdf_101.png new file mode 100644 index 00000000..47869572 Binary files /dev/null and b/docs/assets/tpdf_101.png differ diff --git a/docs/assets/unidcdf_101.png b/docs/assets/unidcdf_101.png new file mode 100644 index 00000000..5bf38963 Binary files /dev/null and b/docs/assets/unidcdf_101.png differ diff --git a/docs/assets/unidfit_101.png b/docs/assets/unidfit_101.png new file mode 100644 index 00000000..a44e0bfe Binary files /dev/null and b/docs/assets/unidfit_101.png differ diff --git a/docs/assets/unidinv_101.png b/docs/assets/unidinv_101.png new file mode 100644 index 00000000..28a772d1 Binary files /dev/null and b/docs/assets/unidinv_101.png differ diff --git a/docs/assets/unidpdf_101.png b/docs/assets/unidpdf_101.png new file mode 100644 index 00000000..3f3266f2 Binary files /dev/null and b/docs/assets/unidpdf_101.png differ diff --git a/docs/assets/unifcdf_101.png b/docs/assets/unifcdf_101.png new file mode 100644 index 00000000..b9edcad7 Binary files /dev/null and b/docs/assets/unifcdf_101.png differ diff --git a/docs/assets/unifinv_101.png b/docs/assets/unifinv_101.png new file mode 100644 index 00000000..4981ffb1 Binary files /dev/null and b/docs/assets/unifinv_101.png differ diff --git a/docs/assets/unifit_101.png b/docs/assets/unifit_101.png new file mode 100644 index 00000000..2709db52 Binary files /dev/null and b/docs/assets/unifit_101.png differ diff --git a/docs/assets/unifpdf_101.png b/docs/assets/unifpdf_101.png new file mode 100644 index 00000000..793119bf Binary files /dev/null and b/docs/assets/unifpdf_101.png differ diff --git a/docs/chi2gof.html b/docs/chi2gof.html index 766b679e..48f30c79 100644 --- a/docs/chi2gof.html +++ b/docs/chi2gof.html @@ -280,26 +280,26 @@
Source Code: diff --git a/docs/geofit.html b/docs/geofit.html new file mode 100644 index 00000000..0b7484da --- /dev/null +++ b/docs/geofit.html @@ -0,0 +1,186 @@ + + +
+geofit
+ Estimate parameter and confidence intervals for the geometric distribution. +
+ pshat = geofit (x)
returns the maximum likelihood estimate
+ (MLE) of the probability of success for the geometric distribution. x
+ must be a vector.
+
[pshat, psci] = geofit (x, alpha)
also returns
+ the 100 * (1 - alpha)
percent confidence intervals of the
+ estimated parameter. By default, the optional argument alpha is 0.05
+ corresponding to 95% confidence intervals. Pass in []
for
+ alpha to use the default values.
+
[…] = geofit (x, alpha, freq)
accepts a
+ frequency vector, freq, of the same size as x. freq
+ typically contains integer frequencies for the corresponding elements in
+ x, but it can contain any non-integer non-negative values. By default,
+ or if left empty, freq = ones (size (x))
.
+
The geometric distribution models the number of failures (x) of a + Bernoulli trial with probability ps before the first success. +
+Further information about the geometric distribution can be found at + https://en.wikipedia.org/wiki/Geometric_distribution +
+See also: + geocdf, + geoinv, + geopdf, + geornd, + geostat +
+Source Code: + geofit +
+ | + + ## Sample 2 populations from different geometric distibutions + rande ("seed", 1); # for reproducibility + r1 = geornd (0.15, 1000, 1); + rande ("seed", 2); # for reproducibility + r2 = geornd (0.5, 1000, 1); + r = [r1, r2]; + + ## Plot them normalized and fix their colors + hist (r, 0:0.5:20.5, 1); + h = findobj (gca, "Type", "patch"); + set (h(1), "facecolor", "c"); + set (h(2), "facecolor", "g"); + hold on + + ## Estimate their probability of success + pshatA = geofit (r(:,1)); + pshatB = geofit (r(:,2)); + + ## Plot their estimated PDFs + x = [0:15]; + y = geopdf (x, pshatA); + plot (x, y, "-pg"); + y = geopdf (x, pshatB); + plot (x, y, "-sc"); + xlim ([0, 15]) + ylim ([0, 0.6]) + legend ({"Normalized HIST of sample 1 with ps=0.15", ... + "Normalized HIST of sample 2 with ps=0.50", ... + sprintf("PDF for sample 1 with estimated ps=%0.2f", ... + mean (pshatA)), ... + sprintf("PDF for sample 2 with estimated ps=%0.2f", ... + mean (pshatB))}) + title ("Two population samples from different geometric distibutions") + hold off + + |
Source Code: diff --git a/docs/geopdf.html b/docs/geopdf.html index 486d8432..bf9e6019 100644 --- a/docs/geopdf.html +++ b/docs/geopdf.html @@ -92,6 +92,7 @@
Source Code: diff --git a/docs/geornd.html b/docs/geornd.html index 6a23b79f..00d6b20f 100644 --- a/docs/geornd.html +++ b/docs/geornd.html @@ -100,6 +100,7 @@
Source Code: diff --git a/docs/index.html b/docs/index.html index 5e9b8cd5..ec2a81a1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1726,7 +1726,7 @@
+ geofit
+
+
@@ -2193,6 +2203,24 @@
+ unidfit
+
+
+ unifit
+
+
diff --git a/docs/poissrnd.html b/docs/poissrnd.html
index 96068128..589550c7 100644
--- a/docs/poissrnd.html
+++ b/docs/poissrnd.html
@@ -84,7 +84,8 @@
chosen from the Poisson distribution with parameter lambda. The size
of r is the common size of lambda. A scalar input functions as a
constant matrix of the same size as the other inputs. lambda must be a
- finite real number and greater or equal to 0, otherwise NaN is returned.
+ finite real number and greater or equal to 0, otherwise NaN
is
+ returned.
When called with a single size argument, poissrnd
returns a square
matrix with the dimension specified. When called with more than one scalar
diff --git a/docs/raylcdf.html b/docs/raylcdf.html
index 5ceafdd3..0959da99 100644
--- a/docs/raylcdf.html
+++ b/docs/raylcdf.html
@@ -129,7 +129,7 @@
plot (x, p1, "-b", x, p2, "g", x, p3, "-r", x, p4, "-m", x, p5, "-k")
grid on
ylim ([0, 1])
- legend ({"σ = 0,5", "σ = 1", "σ = 2", ...
+ legend ({"σ = 0.5", "σ = 1", "σ = 2", ...
"σ = 3", "σ = 4"}, "location", "southeast")
title ("Rayleigh CDF")
xlabel ("values in x")
diff --git a/docs/raylinv.html b/docs/raylinv.html
index a8cd638e..c67520dc 100644
--- a/docs/raylinv.html
+++ b/docs/raylinv.html
@@ -79,7 +79,7 @@
For each element of p, compute the quantile (the inverse of the CDF) of
the Rayleigh distribution with scale parameter sigma. The size of
- p is the common size of x and sigma. A scalar input
+ x is the common size of p and sigma. A scalar input
functions as a constant matrix of the same size as the other inputs.
Further information about the Rayleigh distribution can be found at
diff --git a/docs/raylrnd.html b/docs/raylrnd.html
index 57b823d8..4d10c8e6 100644
--- a/docs/raylrnd.html
+++ b/docs/raylrnd.html
@@ -82,8 +82,9 @@
r = raylrnd (sigma)
returns an array of random numbers
chosen from the Rayleigh distribution with scale parameter sigma. The
- size of r is the size of sigma. sigma must be a finite
- real number greater than 0, otherwise NaN is returned.
+ size of r is the size of sigma. A scalar input functions as a
+ constant matrix of the same size as the other inputs. sigma must be a
+ finite real number greater than 0, otherwise NaN
is returned.
When called with a single size argument, raylrnd
returns a square
matrix with the dimension specified. When called with more than one scalar
diff --git a/docs/ridge.html b/docs/ridge.html
index d68af423..6c54be46 100644
--- a/docs/ridge.html
+++ b/docs/ridge.html
@@ -108,12 +108,14 @@
Further information about Ridge regression can be found at
https://en.wikipedia.org/wiki/Ridge_regression
- @seealso {lasso, stepwisefit, regress
-
+ See also:
+lasso,
+ stepwisefit,
+ regress
+
Source Code:
ridge
-
diff --git a/docs/tcdf.html b/docs/tcdf.html
index d2b06a47..fd01018c 100644
--- a/docs/tcdf.html
+++ b/docs/tcdf.html
@@ -79,16 +79,17 @@
For each element of x, compute the cumulative distribution function
- (CDF) at x of the Student’s T distribution with df degrees of
- freedom.
-
- The size of p is the common size of x and df. A scalar
- input functions as a constant matrix of the same size as the other input.
+ (CDF) of the Student’s T distribution with df degrees of freedom. The
+ size of p is the common size of x and df. A scalar input
+ functions as a constant matrix of the same size as the other input.
p = tcdf (x, df, "upper")
computes the upper tail
probability of the Student’s T distribution with df degrees of freedom,
at the values in x.
+ Further information about the Student’s T distribution can be found at
+ https://en.wikipedia.org/wiki/Student%27s_t-distribution
+
See also:
tinv,
tpdf,
@@ -98,6 +99,52 @@
Source Code:
tcdf
+
+
+
+
+
+
+ Example: 1
+
+
+
+
+
+
+
+
+
+
+
+ ## Plot various CDFs from the Student's T distribution
+ x = -5:0.01:5;
+ p1 = tcdf (x, 1);
+ p2 = tcdf (x, 2);
+ p3 = tcdf (x, 5);
+ p4 = tcdf (x, Inf);
+ plot (x, p1, "-b", x, p2, "-g", x, p3, "-r", x, p4, "-m")
+ grid on
+ xlim ([-5, 5])
+ ylim ([0, 1])
+ legend ({"df = 1", "df = 2", ...
+ "df = 5", 'df = \infty'}, "location", "southeast")
+ title ("Student's T CDF")
+ xlabel ("values in x")
+ ylabel ("probability")
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/tinv.html b/docs/tinv.html
index 3bbeed70..4db2c6d8 100644
--- a/docs/tinv.html
+++ b/docs/tinv.html
@@ -77,16 +77,18 @@
Inverse of the Student’s T cumulative distribution function (iCDF).
- For each element of p, compute the quantile (the inverse of the CDF)
- at p of the Student’s T distribution with df degrees of freedom.
-
- The size of p is the common size of x and df. A scalar
- input functions as a constant matrix of the same size as the other input.
+
For each element of p, compute the quantile (the inverse of the CDF) of
+ the Student’s T distribution with df degrees of freedom. The size of
+ x is the common size of x and df. A scalar input functions
+ as a constant matrix of the same size as the other input.
This function is analogous to looking in a table for the t-value of a
single-tailed distribution. For very large df (>10000), the inverse of
the standard normal distribution is used.
+ Further information about the Student’s T distribution can be found at
+ https://en.wikipedia.org/wiki/Student%27s_t-distribution
+
See also:
tcdf,
tpdf,
@@ -96,6 +98,52 @@
Source Code:
tinv
+
+
+
+
+
+
+ Example: 1
+
+
+
+
+
+
+
+
+
+
+
+ ## Plot various iCDFs from the Student's T distribution
+ p = 0.001:0.001:0.999;
+ x1 = tinv (p, 1);
+ x2 = tinv (p, 2);
+ x3 = tinv (p, 5);
+ x4 = tinv (p, Inf);
+ plot (p, x1, "-b", p, x2, "-g", p, x3, "-r", p, x4, "-m")
+ grid on
+ xlim ([0, 1])
+ ylim ([-5, 5])
+ legend ({"df = 1", "df = 2", ...
+ "df = 5", 'df = \infty'}, "location", "northwest")
+ title ("Student's T iCDF")
+ xlabel ("probability")
+ ylabel ("values in x")
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/tpdf.html b/docs/tpdf.html
index 208f0917..6e44f6eb 100644
--- a/docs/tpdf.html
+++ b/docs/tpdf.html
@@ -78,10 +78,12 @@
For each element of x, compute the probability density function (PDF)
- at x of the Student’s T distribution with df degrees of freedom.
+ of the Student’s T distribution with df degrees of freedom. The size
+ of y is the common size of x and df. A scalar input
+ functions as a constant matrix of the same size as the other input.
- The size of y is the common size of x and df. A scalar
- input functions as a constant matrix of the same size as the other input.
+
Further information about the Student’s T distribution can be found at
+ https://en.wikipedia.org/wiki/Student%27s_t-distribution
See also:
tcdf,
@@ -92,6 +94,52 @@
Source Code:
tpdf
+
+
+
+
+
+
+ Example: 1
+
+
+
+
+
+
+
+
+
+
+
+ ## Plot various PDFs from the Student's T distribution
+ x = -5:0.01:5;
+ y1 = tpdf (x, 1);
+ y2 = tpdf (x, 2);
+ y3 = tpdf (x, 5);
+ y4 = tpdf (x, Inf);
+ plot (x, y1, "-b", x, y2, "-g", x, y3, "-r", x, y4, "-m")
+ grid on
+ xlim ([-5, 5])
+ ylim ([0, 0.41])
+ legend ({"df = 1", "df = 2", ...
+ "df = 5", 'df = \infty'}, "location", "northeast")
+ title ("Student's T PDF")
+ xlabel ("values in x")
+ ylabel ("density")
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/tricdf.html b/docs/tricdf.html
index 947aeb1a..08f9b8c8 100644
--- a/docs/tricdf.html
+++ b/docs/tricdf.html
@@ -79,14 +79,14 @@
For each element of x, compute the cumulative distribution function
- (CDF) at x of the triangular distribution with parameters a,
- b, and c on the interval [a, b]
. The size of
- p is the common size of the input arguments. A scalar input functions
- as a constant matrix of the same size as the other inputs.
+ (CDF) of the triangular distribution with parameters a, b, and
+ c on the interval [a, b]
. The size of p is
+ the common size of the input arguments. A scalar input functions as a
+ constant matrix of the same size as the other inputs.
p = tricdf (x, a, b, c, "upper")
computes the upper tail probability of the triangular distribution with
- parameters a, b, and c at the values in x.
+ parameters a, b, and c, at the values in x.
Further information about the triangular distribution can be found at
https://en.wikipedia.org/wiki/Triangular_distribution
diff --git a/docs/triinv.html b/docs/triinv.html
index 1da728a3..b38b5b31 100644
--- a/docs/triinv.html
+++ b/docs/triinv.html
@@ -77,11 +77,11 @@
Inverse of the triangular cumulative distribution function (iCDF).
- For each element of p, compute the quantile (the inverse of the CDF)
- at p of the triangular distribution with parameters a, b,
- and c on the interval [a, b]
. The size of x
- is the common size of the input arguments. A scalar input functions as a
- constant matrix of the same size as the other inputs.
+
For each element of p, compute the quantile (the inverse of the CDF) of
+ the triangular distribution with parameters a, b, and c on
+ the interval [a, b]
. The size of x is the common
+ size of the input arguments. A scalar input functions as a constant matrix
+ of the same size as the other inputs.
Further information about the triangular distribution can be found at
https://en.wikipedia.org/wiki/Triangular_distribution
diff --git a/docs/tripdf.html b/docs/tripdf.html
index b50e48a3..825d447a 100644
--- a/docs/tripdf.html
+++ b/docs/tripdf.html
@@ -78,10 +78,10 @@
For each element of x, compute the probability density function (PDF)
- at x of the triangular distribution with parameters a, b,
- and c on the interval [a, b]
. The size of y
- is the common size of the input arguments. A scalar input functions as a
- constant matrix of the same size as the other inputs.
+ of the triangular distribution with parameters a, b, and c
+ on the interval [a, b]
. The size of y is the
+ common size of the input arguments. A scalar input functions as a constant
+ matrix of the same size as the other inputs.
Further information about the triangular distribution can be found at
https://en.wikipedia.org/wiki/Triangular_distribution
diff --git a/docs/trirnd.html b/docs/trirnd.html
index ed116cfe..57fc3836 100644
--- a/docs/trirnd.html
+++ b/docs/trirnd.html
@@ -80,17 +80,17 @@
Random arrays from the triangular distribution.
- r = raylrnd (sigma)
returns an array of random numbers
+
r = trirnd (sigma)
returns an array of random numbers
chosen from the triangular distribution with parameters a, b, and
c on the interval [a, b]. The size of r is the
- common size of the input arguments. A scalar input functions as a constant
- matrix of the same size as the other inputs.
+ common size of a, b, and c. A scalar input functions as a
+ constant matrix of the same size as the other inputs.
- When called with a single size argument, return a square matrix with
- the dimension specified. When called with more than one scalar argument the
- first two arguments are taken as the number of rows and columns and any
- further arguments specify additional matrix dimensions. The size may also
- be specified with a vector of dimensions sz.
+
When called with a single size argument, trirnd
returns a square
+ matrix with the dimension specified. When called with more than one scalar
+ argument, the first two arguments are taken as the number of rows and columns
+ and any further arguments specify additional matrix dimensions. The size may
+ also be specified with a row vector of dimensions, sz.
Further information about the triangular distribution can be found at
https://en.wikipedia.org/wiki/Triangular_distribution
diff --git a/docs/trnd.html b/docs/trnd.html
index 2c01684f..50dd4899 100644
--- a/docs/trnd.html
+++ b/docs/trnd.html
@@ -85,14 +85,18 @@
r = trnd (df)
returns an array of random numbers chosen
from the Student’s T distribution with df degrees of freedom. The size
- of r is the size of df. df must be a finite real number
- greater than 0, otherwise NaN is returned.
+ of r is the size of df. A scalar input functions as a constant
+ matrix of the same size as the other inputs. df must be a finite real
+ number greater than 0, otherwise NaN is returned.
- When called with a single size argument, return a square matrix with
- the dimension specified. When called with more than one scalar argument the
- first two arguments are taken as the number of rows and columns and any
- further arguments specify additional matrix dimensions. The size may also
- be specified with a vector of dimensions sz.
+
When called with a single size argument, trnd
returns a square matrix
+ with the dimension specified. When called with more than one scalar
+ argument, the first two arguments are taken as the number of rows and columns
+ and any further arguments specify additional matrix dimensions. The size may
+ also be specified with a row vector of dimensions, sz.
+
+ Further information about the Student’s T distribution can be found at
+ https://en.wikipedia.org/wiki/Student%27s_t-distribution
See also:
tcdf,
diff --git a/docs/unidcdf.html b/docs/unidcdf.html
index d54760eb..b76527ce 100644
--- a/docs/unidcdf.html
+++ b/docs/unidcdf.html
@@ -71,31 +71,87 @@
-- statistics: p = unidcdf (x, df)
-- statistics: p = unidcdf (x, df,
"upper"
)
+- statistics: p = unidcdf (x, N)
+- statistics: p = unidcdf (x, N,
"upper"
)
Discrete uniform cumulative distribution function (CDF).
For each element of x, compute the cumulative distribution function
- (CDF) at x of a discrete uniform distribution which assumes the integer
- values 1–df with equal probability. The size of p is the common
- size of x and df. A scalar input functions as a constant matrix
- of the same size as the other inputs.
+ (CDF) of a discrete uniform distribution with parameter N, which
+ corresponds to the maximum observable value. unidcdf
assumes the
+ integer values in the range with equal probability. The size of
+ p is the common size of x and N. A scalar input functions
+ as a constant matrix of the same size as the other inputs.
- […] = logncdf (…, "upper")
computes the upper tail
- probability of the lognormal distribution.
+
The maximum observable values in N must be positive integers, otherwise
+ NaN
is returned.
+
+ […] = unidcdf (x, N, "upper")
computes the upper
+ tail probability of the discrete uniform distribution with maximum observable
+ value N, at the values in x.
+
+ Warning: The underlying implementation uses the double class and will only
+ be accurate for N < flintmax
( on
+ IEEE 754 compatible systems).
+
+ Further information about the discrete uniform distribution can be found at
+ https://en.wikipedia.org/wiki/Discrete_uniform_distribution
See also:
unidinv,
unidpdf,
unidrnd,
+ unidfit,
unidstat
Source Code:
unidcdf
+
+
+
+
+
+
+ Example: 1
+
+
+
+
+
+
+
+
+
+
+
+ ## Plot various CDFs from the discrete uniform distribution
+ x = 0:10;
+ p1 = unidcdf (x, 5);
+ p2 = unidcdf (x, 9);
+ plot (x, p1, "*b", x, p2, "*g")
+ grid on
+ xlim ([0, 10])
+ ylim ([0, 1])
+ legend ({"N = 5", "N = 9"}, "location", "southeast")
+ title ("Discrete uniform CDF")
+ xlabel ("values in x")
+ ylabel ("probability")
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/unidfit.html b/docs/unidfit.html
new file mode 100644
index 00000000..eb8ceec6
--- /dev/null
+++ b/docs/unidfit.html
@@ -0,0 +1,181 @@
+
+
+
+ Statistics: unidfit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Function Reference: unidfit
+
+
+
+
+
+
+- statistics: Nhat = unidfit (x)
+- statistics: [Nhat, Nci] = unidfit (x)
+- statistics: [Nhat, Nci] = unidfit (x, alpha)
+- statistics: [Nhat, Nci] = unidfit (x, alpha, freq)
+
+
+ Estimate parameter and confidence intervals for the discrete uniform distribution.
+
+
+ Nhat = unidfit (x)
returns the maximum likelihood estimate
+ (MLE) of the maximum observable value for the discrete uniform distribution.
+ x must be a vector.
+
+ [Nhat, Nci] = unidfit (x, alpha)
also
+ returns the 100 * (1 - alpha)
percent confidence intervals of
+ the estimated parameter. By default, the optional argument alpha is
+ 0.05 corresponding to 95% confidence intervals. Pass in []
for
+ alpha to use the default values.
+
+ […] = unidfit (x, alpha, freq)
accepts a
+ frequency vector, freq, of the same size as x. freq
+ typically contains integer frequencies for the corresponding elements in
+ x, but it can contain any non-integer non-negative values. By default,
+ or if left empty, freq = ones (size (x))
.
+
+ Further information about the discrete uniform distribution can be found at
+ https://en.wikipedia.org/wiki/Discrete_uniform_distribution
+
+ See also:
+ unidcdf,
+ unidinv,
+ unidpdf,
+ unidrnd,
+ unidstat
+
+Source Code:
+ unidfit
+
+
+
+
+
+
+
+ Example: 1
+
+
+
+
+
+
+
+
+
+
+
+ ## Sample 2 populations from different discrete uniform distibutions
+ rand ("seed", 1); # for reproducibility
+ r1 = unidrnd (5, 1000, 1);
+ rand ("seed", 2); # for reproducibility
+ r2 = unidrnd (9, 1000, 1);
+ r = [r1, r2];
+
+ ## Plot them normalized and fix their colors
+ hist (r, 0:0.5:20.5, 1);
+ h = findobj (gca, "Type", "patch");
+ set (h(1), "facecolor", "c");
+ set (h(2), "facecolor", "g");
+ hold on
+
+ ## Estimate their probability of success
+ NhatA = unidfit (r(:,1));
+ NhatB = unidfit (r(:,2));
+
+ ## Plot their estimated PDFs
+ x = [0:10];
+ y = unidpdf (x, NhatA);
+ plot (x, y, "-pg");
+ y = unidpdf (x, NhatB);
+ plot (x, y, "-sc");
+ xlim ([0, 10])
+ ylim ([0, 0.4])
+ legend ({"Normalized HIST of sample 1 with N=5", ...
+ "Normalized HIST of sample 2 with N=9", ...
+ sprintf("PDF for sample 1 with estimated N=%0.2f", NhatA), ...
+ sprintf("PDF for sample 2 with estimated N=%0.2f", NhatB)})
+ title ("Two population samples from different discrete uniform distibutions")
+ hold off
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/unidinv.html b/docs/unidinv.html
index c0a7832c..d1c43db2 100644
--- a/docs/unidinv.html
+++ b/docs/unidinv.html
@@ -71,27 +71,82 @@
-- statistics: x = unidinv (p, df)
+- statistics: x = unidinv (p, N)
Inverse of the discrete uniform cumulative distribution function (iCDF).
- For each element of p, compute the quantile (the inverse of the CDF)
- at p of the discrete uniform distribution which assumes the integer
- values 1–df with equal probability. The size of p is the common
- size of x and df. A scalar input functions as a constant matrix
- of the same size as the other inputs.
+
For each element of p, compute the quantile (the inverse of the CDF) of
+ the discrete uniform distribution with parameter N, which corresponds
+ to the maximum observable value. unidinv
assumes the integer values
+ in the range with equal probability. The size of x is the
+ common size of p and N. A scalar input functions as a constant
+ matrix of the same size as the other inputs.
+
+ The maximum observable values in N must be positive integers, otherwise
+ NaN
is returned.
+
+ Warning: The underlying implementation uses the double class and will only
+ be accurate for N < flintmax
( on
+ IEEE 754 compatible systems).
+
+ Further information about the discrete uniform distribution can be found at
+ https://en.wikipedia.org/wiki/Discrete_uniform_distribution
See also:
unidcdf,
unidpdf,
unidrnd,
+ unidfit,
unidstat
Source Code:
unidinv
+
+
+
+
+
+
+ Example: 1
+
+
+
+
+
+
+
+
+
+
+
+ ## Plot various iCDFs from the discrete uniform distribution
+ p = 0.001:0.001:0.999;
+ x1 = unidinv (p, 5);
+ x2 = unidinv (p, 9);
+ plot (p, x1, "-b", p, x2, "-g")
+ grid on
+ xlim ([0, 1])
+ ylim ([0, 10])
+ legend ({"N = 5", "N = 9"}, "location", "northwest")
+ title ("Discrete uniform iCDF")
+ xlabel ("probability")
+ ylabel ("values in x")
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/unidpdf.html b/docs/unidpdf.html
index 758dd169..031685a2 100644
--- a/docs/unidpdf.html
+++ b/docs/unidpdf.html
@@ -71,31 +71,82 @@
-- statistics: y = unidpdf (x, df)
+- statistics: y = unidpdf (x, N)
Discrete uniform probability density function (PDF).
For each element of x, compute the probability density function (PDF)
- at x of a discrete uniform distribution which assumes the integer
- values 1–df with equal probability. The size of p is the common
- size of x and df. A scalar input functions as a constant matrix
- of the same size as the other inputs.
+ of the discrete uniform distribution with parameter N, which
+ corresponds to the maximum observable value. unidpdf
assumes the
+ integer values in the range with equal probability. The size of
+ x is the common size of p and N. A scalar input functions
+ as a constant matrix of the same size as the other inputs.
+
+ The maximum observable values in N must be positive integers, otherwise
+ NaN
is returned.
Warning: The underlying implementation uses the double class and will only
- be accurate for df < flintmax
( on
+ be accurate for N < flintmax
( on
IEEE 754 compatible systems).
+ Further information about the discrete uniform distribution can be found at
+ https://en.wikipedia.org/wiki/Discrete_uniform_distribution
+
See also:
unidcdf,
unidinv,
unidrnd,
+ unidfit,
unidstat
Source Code:
unidpdf
+
+
+
+
+
+
+ Example: 1
+
+
+
+
+
+
+
+
+
+
+
+ ## Plot various PDFs from the discrete uniform distribution
+ x = 0:10;
+ y1 = unidpdf (x, 5);
+ y2 = unidpdf (x, 9);
+ plot (x, y1, "*b", x, y2, "*g")
+ grid on
+ xlim ([0, 10])
+ ylim ([0, 0.25])
+ legend ({"N = 5", "N = 9"}, "location", "northeast")
+ title ("Descrete uniform PDF")
+ xlabel ("values in x")
+ ylabel ("density")
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/unidrnd.html b/docs/unidrnd.html
index e3cfaed3..d91426d1 100644
--- a/docs/unidrnd.html
+++ b/docs/unidrnd.html
@@ -71,32 +71,43 @@
-- statistics: r = unidrnd (df)
-- statistics: r = unidrnd (df, rows)
-- statistics: r = unidrnd (df, rows, cols, …)
-- statistics: r = unidrnd (df, [sz])
+- statistics: r = unidrnd (N)
+- statistics: r = unidrnd (N, rows)
+- statistics: r = unidrnd (N, rows, cols, …)
+- statistics: r = unidrnd (N, [sz])
Random arrays from the discrete uniform distribution.
- r = unidrnd (df)
returns an array of random numbers chosen
- from the discrete uniform distribution with df degrees of freedom. The
- size of r is the size of df. sigma must be a finite
- integer greater than 0, otherwise NaN is returned.
+
r = unidrnd (N)
returns an array of random numbers chosen
+ from the discrete uniform distribution with parameter N, which
+ corresponds to the maximum observable value. unidrnd
assumes the
+ integer values in the range with equal probability. The size of
+ r is the size of N. A scalar input functions as a constant
+ matrix of the same size as the other inputs.
- df may be a scalar or a multi-dimensional array.
+
The maximum observable values in N must be positive integers, otherwise
+ NaN
is returned.
- When called with a single size argument, return a square matrix with
- the dimension specified. When called with more than one scalar argument the
- first two arguments are taken as the number of rows and columns and any
- further arguments specify additional matrix dimensions. The size may also
- be specified with a vector of dimensions sz.
+
When called with a single size argument, unidrnd
returns a square
+ matrix with the dimension specified. When called with more than one scalar
+ argument, the first two arguments are taken as the number of rows and columns
+ and any further arguments specify additional matrix dimensions. The size may
+ also be specified with a row vector of dimensions, sz.
+
+ Warning: The underlying implementation uses the double class and will only
+ be accurate for N < flintmax
( on
+ IEEE 754 compatible systems).
+
+ Further information about the discrete uniform distribution can be found at
+ https://en.wikipedia.org/wiki/Discrete_uniform_distribution
See also:
unidcdf,
unidinv,
unidrnd,
+ unidfit,
unidstat
Source Code:
diff --git a/docs/unifcdf.html b/docs/unifcdf.html
index 3a269a8b..64703a10 100644
--- a/docs/unifcdf.html
+++ b/docs/unifcdf.html
@@ -71,35 +71,79 @@
-- statistics: p = unifcdf (x)
-- statistics: p = unifcdf (x, a)
- statistics: p = unifcdf (x, a, b)
-- statistics: p = unifcdf (…,
"upper"
)
+- statistics: p = unifcdf (x, a, b,
"upper"
)
- Uniform cumulative distribution function (CDF).
+
Continuous uniform cumulative distribution function (CDF).
For each element of x, compute the cumulative distribution function
- (CDF) at x of the uniform distribution on the interval [a,
- b]. The size of p is the common size of the input arguments.
- A scalar input functions as a constant matrix of the same size as the other
- inputs.
+ (CDF) of the continuous uniform distribution on the interval [a,
+ b]
. The size of p is the common size of x, a, and
+ b. A scalar input functions as a constant matrix of the same size as
+ the other inputs.
- Default values are a = 0, b = 1.
+
[…] = unifcdf (x, a, b, "upper")
computes the
+ upper tail probability of the continuous uniform distribution with parameters
+ a, and b, at the values in x.
- […] = unifcdf (…, "upper")
computes the upper tail
- probability of the lognormal distribution.
+
Further information about the continuous uniform distribution can be found at
+ https://en.wikipedia.org/wiki/Continuous_uniform_distribution
See also:
unifinv,
unifpdf,
unifrnd,
+ unifit,
unifstat
Source Code:
unifcdf
+
+
+
+
+
+
+ Example: 1
+
+
+
+
+
+
+
+
+
+
+
+ ## Plot various CDFs from the continuous uniform distribution
+ x = 0:0.1:10;
+ p1 = unifcdf (x, 2, 5);
+ p2 = unifcdf (x, 3, 9);
+ plot (x, p1, "-b", x, p2, "-g")
+ grid on
+ xlim ([0, 10])
+ ylim ([0, 1])
+ legend ({"a = 2, b = 5", "a = 3, b = 9"}, "location", "southeast")
+ title ("Continuous uniform CDF")
+ xlabel ("values in x")
+ ylabel ("probability")
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/unifinv.html b/docs/unifinv.html
index 4585062c..f0f750d0 100644
--- a/docs/unifinv.html
+++ b/docs/unifinv.html
@@ -76,25 +76,71 @@
statistics: x = unifcdf (p, a, b)
-
Inverse of the uniform cumulative distribution function (iCDF).
+
Inverse of the continuous uniform cumulative distribution function (iCDF).
- For each element of p, compute the quantile (the inverse of the CDF)
- at p of the uniform distribution on the interval [a, b].
- The size of x is the common size of the input arguments. A scalar
- input functions as a constant matrix of the same size as the other inputs.
+
For each element of p, compute the quantile (the inverse of the CDF) of
+ the continuous uniform distribution on the interval [a,
+ b]
. The size of x is the common size of p, a, and
+ b. A scalar input functions as a constant matrix of the same size as
+ the other inputs.
- Default values are a = 0, b = 1.
+
Further information about the continuous uniform distribution can be found at
+ https://en.wikipedia.org/wiki/Continuous_uniform_distribution
See also:
unifcdf,
unifpdf,
unifrnd,
+ unifit,
unifstat
Source Code:
unifinv
+
+
+
+
+
+
+ Example: 1
+
+
+
+
+
+
+
+
+
+
+
+ ## Plot various iCDFs from the continuous uniform distribution
+ p = 0.001:0.001:0.999;
+ x1 = unifinv (p, 2, 5);
+ x2 = unifinv (p, 3, 9);
+ plot (p, x1, "-b", p, x2, "-g")
+ grid on
+ xlim ([0, 1])
+ ylim ([0, 10])
+ legend ({"a = 2, b = 5", "a = 3, b = 9"}, "location", "northwest")
+ title ("Continuous uniform iCDF")
+ xlabel ("probability")
+ ylabel ("values in x")
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/unifit.html b/docs/unifit.html
new file mode 100644
index 00000000..a5f5239c
--- /dev/null
+++ b/docs/unifit.html
@@ -0,0 +1,183 @@
+
+
+
+ Statistics: unifit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Function Reference: unifit
+
+
+
+
+
+
+- statistics: paramhat = unifit (x)
+- statistics: [paramhat, paramci] = unifit (x)
+- statistics: [paramhat, paramci] = unifit (x, alpha)
+- statistics: [paramhat, paramci] = unifit (x, alpha, freq)
+
+
+ Estimate parameter and confidence intervals for the continuous uniform distribution.
+
+
+ paramhat = unifit (x)
returns the maximum likelihood
+ estimate (MLE) of the parameters a and b of the continuous
+ uniform distribution given the data in x. x must be a vector.
+
+ [paramhat, paramci] = unifit (x, alpha)
also
+ returns the 100 * (1 - alpha)
percent confidence intervals of
+ the estimated parameter. By default, the optional argument alpha is
+ 0.05 corresponding to 95% confidence intervals. Pass in []
for
+ alpha to use the default values.
+
+ […] = unifit (x, alpha, freq)
accepts a
+ frequency vector, freq, of the same size as x. freq
+ typically contains integer frequencies for the corresponding elements in
+ x, but it can contain any non-integer non-negative values. By default,
+ or if left empty, freq = ones (size (x))
.
+
+ Further information about the continuous uniform distribution can be found at
+ https://en.wikipedia.org/wiki/Discrete_uniform_distribution
+
+ See also:
+ unifcdf,
+ unifinv,
+ unifpdf,
+ unifrnd,
+ unifstat
+
+Source Code:
+ unifit
+
+
+
+
+
+
+
+ Example: 1
+
+
+
+
+
+
+
+
+
+
+
+ ## Sample 2 populations from different continuous uniform distibutions
+ rand ("seed", 5); # for reproducibility
+ r1 = unifrnd (2, 5, 2000, 1);
+ rand ("seed", 6); # for reproducibility
+ r2 = unifrnd (3, 9, 2000, 1);
+ r = [r1, r2];
+
+ ## Plot them normalized and fix their colors
+ hist (r, 0:0.5:10, 2);
+ h = findobj (gca, "Type", "patch");
+ set (h(1), "facecolor", "c");
+ set (h(2), "facecolor", "g");
+ hold on
+
+ ## Estimate their probability of success
+ a_bA = unifit (r(:,1));
+ a_bB = unifit (r(:,2));
+
+ ## Plot their estimated PDFs
+ x = [0:10];
+ y = unifpdf (x, a_bA(1), a_bA(2));
+ plot (x, y, "-pg");
+ y = unifpdf (x, a_bB(1), a_bB(2));
+ plot (x, y, "-sc");
+ xlim ([1, 10])
+ ylim ([0, 0.5])
+ legend ({"Normalized HIST of sample 1 with a=2 and b=5", ...
+ "Normalized HIST of sample 2 with a=3 and b=9", ...
+ sprintf("PDF for sample 1 with estimated a=%0.2f and b=%0.2f", ...
+ a_bA(1), a_bA(2)), ...
+ sprintf("PDF for sample 2 with estimated a=%0.2f and b=%0.2f", ...
+ a_bB(1), a_bB(2))})
+ title ("Two population samples from different continuous uniform distibutions")
+ hold off
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/unifpdf.html b/docs/unifpdf.html
index 3cc6e22c..f4f86f8b 100644
--- a/docs/unifpdf.html
+++ b/docs/unifpdf.html
@@ -76,25 +76,71 @@
statistics: y = unifpdf (x, a, b)
-
Uniform probability density function (PDF).
+
Continuous uniform probability density function (PDF).
For each element of x, compute the probability density function (PDF)
- at x of the uniform distribution on the interval [a, b].
- The size of y is the common size of the input arguments. A scalar
- input functions as a constant matrix of the same size as the other inputs.
+ of the continuous uniform distribution on the interval [a,
+ b]
. The size of y is the common size of x, a, and
+ b. A scalar input functions as a constant matrix of the same size as
+ the other inputs.
- Default values are a = 0, b = 1.
+
Further information about the continuous uniform distribution can be found at
+ https://en.wikipedia.org/wiki/Continuous_uniform_distribution
See also:
unifcdf,
unifinv,
unifrnd,
+ unifit,
unifstat
Source Code:
unifpdf
+
+
+
+
+
+
+ Example: 1
+
+
+
+
+
+
+
+
+
+
+
+ ## Plot various PDFs from the continuous uniform distribution
+ x = 0:0.001:10;
+ y1 = unifpdf (x, 2, 5);
+ y2 = unifpdf (x, 3, 9);
+ plot (x, y1, "-b", x, y2, "-g")
+ grid on
+ xlim ([0, 10])
+ ylim ([0, 0.4])
+ legend ({"a = 2, b = 5", "a = 3, b = 9"}, "location", "northeast")
+ title ("Continuous uniform PDF")
+ xlabel ("values in x")
+ ylabel ("density")
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/unifrnd.html b/docs/unifrnd.html
index 282ee654..f0d883ea 100644
--- a/docs/unifrnd.html
+++ b/docs/unifrnd.html
@@ -77,25 +77,29 @@
statistics: r = unifrnd (a, b, [sz])
-
Random arrays from the uniform distribution.
+
Random arrays from the continuous uniform distribution.
r = unifrnd (a, b)
returns an array of random
- numbers chosen from a uniform distribution on the interval [a,
- b]. The size of y is the common size of the input arguments.
- A scalar input functions as a constant matrix of the same size as the other
- inputs.
+ numbers chosen from the continuous uniform distribution on the interval
+ [a, b]
. The size of r is the common size of
+ a and b. A scalar input functions as a constant matrix of the
+ same size as the other inputs.
- When called with a single size argument, return a square matrix with
- the dimension specified. When called with more than one scalar argument the
- first two arguments are taken as the number of rows and columns and any
- further arguments specify additional matrix dimensions. The size may also
- be specified with a vector of dimensions sz.
+
When called with a single size argument, unifrnd
returns a square
+ matrix with the dimension specified. When called with more than one scalar
+ argument, the first two arguments are taken as the number of rows and columns
+ and any further arguments specify additional matrix dimensions. The size may
+ also be specified with a row vector of dimensions, sz.
+
+ Further information about the continuous uniform distribution can be found at
+ https://en.wikipedia.org/wiki/Continuous_uniform_distribution
See also:
unifcdf,
unifinv,
unifpdf,
+ unifit,
unifstat
Source Code: