Categories &

Functions List

Function Reference: stdrrnd

statistics: r = stdrrnd (k, df)

statistics: r = stdrrnd (k, df, rows)

statistics: r = stdrrnd (k, df, rows, cols, …)

statistics: r = stdrrnd (k, df, [sz])

Random arrays from the studentized range distribution.

r = stdrrnd (k, df) returns an array of random numbers chosen from the studentized range distribution for k groups and df degrees of freedom: the range of k standard normal variables divided by an independent sqrt (chi2 / df). The size of r is the common size of k and df. A scalar input functions as a constant matrix of the same size as the other input. k must be an integer of at least 2 and df positive, Inf included; otherwise NaN is returned.

When called with a single size argument, stdrrnd 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.

MATLAB has no public counterpart of this function.

Further information about the studentized range distribution can be found at https://en.wikipedia.org/wiki/Studentized_range_distribution

See also: stdrcdf, stdrinv, stdrpdf, stdrstat

Source Code: stdrrnd

Compare random samples with the density they are drawn from

 rng (42);
 r = stdrrnd (4, 10, 1, 10000);
 x = 0:0.05:10;
 hist (r, x, 1 / 0.05)
 hold on
 plot (x, stdrpdf (x, 4, 10), '-r', 'linewidth', 2)
 hold off
 xlim ([0, 10])
 legend ({'10000 samples', 'k = 4, df = 10'}, 'location', 'northeast')
 title ('Studentized range random samples')
 xlabel ('values in r')
 ylabel ('density')
plotted figure