Description Usage Arguments Details Value Examples
Generates samples from the abk parametrization.
1 | rhurdle1d_abk(n, a, b, k)
|
n |
The number of observations to be drawn. |
a |
The |
b |
The |
k |
The |
Generates samples from the Hurdle 1d distribution, whose log density with abk parametrization with respect to the sum of the Lebesgue measure and a point mass at 0 is
a*v+b*y-y^2*k/2-log(1+sqrt(2pi/k)*exp(a+b^2/(2k)))
where v = (y != 0)
.
A vector of size n
.
1 2 3 4 5 6 7 8 9 | set.seed(1)
a <- stats::rnorm(1)
b <- stats::rnorm(1)
k <- abs(stats::rnorm(1))
x <- rhurdle1d_abk(1e5, a, b, k)
c(mean(x != 0), 1 - 1 / (1 + sqrt(2*pi/k) * exp(a+b^2/(2*k))))
hist(x[x != 0], freq=FALSE, breaks=200)
curve(exp(b*x-x^2*k/2)/(1+sqrt(2*pi/k)*exp(a+b^2/(2*k))),
from=min(x), to=max(x), add=TRUE, col="red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.