Learn R Programming

stochLAB (version 1.1.2)

sample_qtls: Generate random draws based on empirical c.d.f.

Description

Generate random draws from a set of quantiles, based on the empirical cumulative density function

Usage

sample_qtls(n, probs, qtls)

Value

a numeric vector, with random draws of the approximated distribution underpinning the provided quantiles

Arguments

n

integer, the number of draws to generate

probs

numeric vector, the probabilities

qtls

numeric vector, the quantiles for the probabilities specified in probs

Details

Based on the Inverse Transform Sampling technique, by sampling random probabilities from a uniform distribution and interpolate (cubic) the count samples from the percentiles provided by the user (taken as the empirical cumulative density function)

Examples

Run this code
 sample_qtls(10,c(0.1,0.2,0.3),qtls=c(0.05,0.1,0.95))

Run the code above in your browser using DataLab