Description Usage Arguments Details Value Examples
Generates samples from the pms parametrization.
1 | rhurdle1d_pms(n, log_odds, mu, sigmasq)
|
n |
The number of observations to be drawn. |
log_odds |
The log odds, the |
mu |
The conditional mean of the Gaussian part, the |
sigmasq |
The conditional variance of the Gaussian part, the |
Generates samples from the Hurdle 1d distribution, with probability 1-p for y == 0, and density p*dnorm(x, m, sqrt(s)) for y != 0.
A vector of size n
.
1 2 3 4 5 6 7 8 | set.seed(1)
log_odds <- stats::rnorm(1)
mu <- stats::rnorm(1)
sigmasq <- abs(stats::rnorm(1))
x <- rhurdle1d_pms(1e5, log_odds, mu, sigmasq)
c(mean(x != 0), exp(log_odds) / (exp(log_odds) + 1))
hist(x[x != 0], freq=FALSE, breaks=200)
curve(dnorm(x, mu, sqrt(sigmasq)), 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.