Learn R Programming

rv (version 2.3.1)

rvt: Generate Random Variables from a Student-t Sampling Model

Description

Generates a random variable from a Student-t sampling model.

Usage

rvt(n=1, mu=0, scale=1, df, ncp, Sigma)

Arguments

n
integer, number of scalars to generate
mu
location, may be a rv
scale
scale, may be a rv
ncp
non-centrality parameter
df
degrees of freedom, may be a rv
Sigma
(optional) scaling matrix for multivariate generation

Details

This function generates both univariate (independent and identically distributed) Student-t random variables and multivariate Student-t distributed vectors (with a given scaling matrix).

For details of the parameters, see the entry on mvt in the mvtnorm package.

References

Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.

See also vignette("rv").

Examples

Run this code
  df <- 3
  x <- rvt(n=1, df=df)
  y <- rvnorm(1)/sqrt(rvchisq(1, df=df)/df) # Same distribution as above
  print(c(x,y))

Run the code above in your browser using DataLab