The distribution has PDF (probability density function)
nag_rand_dist_students_t (g05sn) calculates the values
where the
are generated by
nag_rand_dist_normal (g05sk) from a Normal distribution with mean
and variance
, and the
are generated by
nag_rand_dist_gamma (g05sj) from a gamma distribution with parameters
and
(i.e., from a
-distribution with
degrees of freedom).
One of the initialization functions
nag_rand_init_repeat (g05kf) (for a repeatable sequence if computed sequentially) or
nag_rand_init_nonrepeat (g05kg) (for a non-repeatable sequence) must be called prior to the first call to
nag_rand_dist_students_t (g05sn).
None.
Not applicable.
This example prints five pseudorandom numbers from a Student's
-distribution with five degrees of freedom, generated by a single call to
nag_rand_dist_students_t (g05sn), after initialization by
nag_rand_init_repeat (g05kf).
function g05sn_example
fprintf('g05sn example results\n\n');
seed = [int64(1762543)];
genid = int64(1);
subid = int64(1);
[state, ifail] = g05kf( ...
genid, subid, seed);
n = int64(5);
df = int64(5);
[state, x, ifail] = g05sn( ...
n, df, state);
disp('Variates');
disp(x);