remp: Random Number Generation from an Empirical Distribution

View source: R/remp.R

rempR Documentation

Random Number Generation from an Empirical Distribution

Description

Generates random numbers from a distribution created with empirical data

Usage

 remp(n,obs=NULL)

Arguments

n

number of random observations to generate.

obs

vector of empirical observations.

Details

An empirical probability distribution is formed from empirical data with each observation having 1/T probabililty of selection, where T is the number of data points. The cumulative distribution function (cdf) is then created so that cumulative probability of the smallest observation = 0 and the largest observation = 1. Random values are generated by applying the probability integral transform to the empirical cdf using uniformly distributed random variable (U) on the interval[0,1]. If U corresponds directly to the cdf probability of a particular empirical observation, then the actual observation is selected. If U falls between cdf probabilities of empirical observations, then an observation is obtained by linear interpolation.

Value

random observation(s)

Note

Jon Brodziak of the National Marine Fisheries Service, Honolulu, HI described this technique in his AGEPRO program.

Author(s)

Gary A. Nelson, Massachusetts Division of Marine Fisheries gary.nelson@mass.gov

Examples

# Striped bass recruits per spawning stock biomass ratios 
# for 2001-2011 from 2013 assessment
ratios<-c(799.22,794.78,969.81,1038.80,1101.45,1117.46,1126.16,
          1647.51,1882.30,1966.13,2189.25)
 # Select new recruits per SSB ratio for projection
 remp(1,ratios)

fishmethods documentation built on April 27, 2023, 9:10 a.m.