Learn R Programming

hisemi (version 1.1-0)

rt: Pseudo-random number generation from t-distribution

Description

This is a slightly modified implementation of stats:rt.

Usage

rt(n, df, ncp)

Arguments

n, df

Exactly as in stats:rt.

ncp

A numeric vector of non-centrality parameters.

Value

A numeric vector of length n which are pseudo-random numbers from the requested t-distribution.

Details

This function corrects the bug in stats:rt that causes trouble when ncp is a vector. See Bug 17306.

See Also

stats:rt

Examples

Run this code
# NOT RUN {
set.seed(99927220)
rt(5,1)  # central t
rt(5,1, 1:5*5) # noncetral t where stats:rt throws warnings
# }
# NOT RUN {
rt(5,1, c(NA, 1:4*5)) # noncetral t where stats:rt returns all NaN's
rt(5,1, c(1:4*5, NA)) # noncetral t where stats:rt throws extra warnings 
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab