Last chance! 50% off unlimited learning
Sale ends in
dfoldnorm(x, mean = 0, sd = 1, a1 = 1, a2 = 1, log = FALSE)
pfoldnorm(q, mean = 0, sd = 1, a1 = 1, a2 = 1)
qfoldnorm(p, mean = 0, sd = 1, a1 = 1, a2 = 1, ...)
rfoldnorm(n, mean = 0, sd = 1, a1 = 1, a2 = 1)
rnorm
.rnorm
.foldnormal
.TRUE
then the log density is returned.uniroot
.dfoldnorm
gives the density,
pfoldnorm
gives the distribution function,
qfoldnorm
gives the quantile function, and
rfoldnorm
generates random deviates.foldnormal
, the foldnormal
,
uniroot
.m <- 1.5; SD <- exp(0)
x <- seq(-1, 4, len = 501)
plot(x, dfoldnorm(x, m = m, sd = SD), type = "l", ylim = 0:1, las = 1,
ylab = paste("foldnorm(m = ", m, ", sd = ", round(SD, digits = 3), ")"),
main = "Blue is density, orange is cumulative distribution function",
sub = "Purple lines are the 10,20,...,90 percentiles", col = "blue")
lines(x, pfoldnorm(x, m = m, sd = SD), col = "orange")
abline(h = 0)
probs <- seq(0.1, 0.9, by = 0.1)
Q <- qfoldnorm(probs, m = m, sd = SD)
lines(Q, dfoldnorm(Q, m = m, sd = SD), col = "purple", lty = 3, type = "h")
lines(Q, pfoldnorm(Q, m = m, sd = SD), col = "purple", lty = 3, type = "h")
abline(h = probs, col = "purple", lty = 3)
max(abs(pfoldnorm(Q, m = m, sd = SD) - probs)) # Should be 0
Run the code above in your browser using DataLab