Learn R Programming

rv (version 1.1.0)

rvbeta: Generate Random Vectors from a Beta Sampling Model

Description

rvbeta generates a random vector from the beta sampling model;

rvnbeta(n, a, b) ("neutral" Beta distribution) is equivalent to rvbeta(n, 1/3+a, 1/3+b).

Usage

rvbeta(n=1, shape1, shape2)
  rvnbeta(n=1, shape1, shape2)

Arguments

n
integer, number of random variables to generate
shape1
positive number or rv, 1st shape parameter
shape2
positive number or rv, 2nd shape parameter

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
n <- 12         # sample size
   y <- (0:(n-1))  # observations
   a <- b <- 1/3   # the neutral beta prior
   rvbeta(1, shape1=a+y, shape2=b+n-y)
   rvnbeta(1, shape1=y, shape2=n-y)

Run the code above in your browser using DataLab