Learn R Programming

activity (version 1.3)

redf: Random numbers from empirical distribution function.

Description

Random numbers drawn from an empirical distribution defined by paired values and probabilities.

Usage

redf(n, fit)

Arguments

n

Integer number of random numbers to return.

fit

Data frame defining the emprical distribution (see details).

Value

A numeric vector.

Details

The distribution function is defined by fit, which must be a dataframe containing (at least) columns named: x: a regular sequence of values from which to draw; y: corresponding pdf values.

Examples

Run this code
# NOT RUN {
data(BCItime)
tm <- 2*pi*subset(BCItime, species=="paca")$time
mod <- fitact(tm)
rn <- redf(1000, as.data.frame(mod@pdf))
# }

Run the code above in your browser using DataLab