sampleDensity: Sample density

Description Usage Arguments Details Value

View source: R/kersplat-simulate.R

Description

Sample from a density object using rejection sampling

Usage

1
sampleDensity(n, dens, lower = 0)

Arguments

n

Number of values to sample

dens

Density object to sample from

lower

Lower x-axis bound on sampled values

Details

Random points (x and y) are generated inside the range of the density object. If they value is less than the density for that x value (and x is greater than lower) then that x value is retained. Ten thousand points are generated at a time until enough valid values have been sampled.

Value

Vector of sampled values


splatter documentation built on Dec. 3, 2020, 2:01 a.m.