rdensity: Distribution methods for density objects

Description Usage Arguments Author(s) References See Also Examples

View source: R/rdensity.R

Description

Density, distribution function, quantile function and random generation from a kernel density estimate (using linear approximation).

Usage

1
2
3
4
5
6
7
ddensity(x, d)

pdensity(q, d)

qdensity(p, d)

rdensity(n, d)

Arguments

x

a vector

d

a density object

q

a vector

p

a vector of probabilities

n

number of observations. If length(n) > 1, the length is taken to be the number of required

Author(s)

user295691, Neal Fultz

References

http://stackoverflow.com/questions/32871602/r-generate-data-from-a-probability-density-distribution

See Also

density

approxfun

rkde

Examples

1
2
3
4
5
x <- rnorm(100, mean=0:5)
d <- density(x)
r <- rdensity(10000, d)
plot(d)
lines(density(r), new=TRUE, col='blue', lty='dashed')

stackoverflow documentation built on Jan. 10, 2020, 9:07 a.m.