rdc: Random samples from univariate Davidian curves

Description Usage Arguments Examples

View source: R/RcppExports.R

Description

Returns n samples from a univariate Davidian curve.

Usage

1
rdc(n, phi)

Arguments

n

Number of observations to be sampled.

phi

Davidian curve parameters. A maximum of 10 parameters is allowed.

Examples

1
2
3
4
5
6
7
8
9
# Sample from the standard normal Davidian curve:
hist(rdc(1000, 1.570789), xlim = c(-6, 6), ylim = c(0, 0.5), freq = FALSE, breaks = 20)
curve(dnorm(x), -6, 6, col = "blue", lwd = 1, add = TRUE)
curve(ddc(x, 1.570789), -6, 6, col = "red", lwd = 2, lty = 3, add = TRUE)

# Sample from a bimodal density:
phi <- c(77.32, 78.51, 76.33, 77.16)
hist(rdc(1000, phi), xlim = c(-6, 6), ylim = c(0, 0.4), freq = FALSE, breaks = "fd")
curve(ddc(x, phi), -6, 6, col = "red", lwd = 2, lty = 3, add = TRUE)

dcurver documentation built on Nov. 8, 2020, 4:34 p.m.