1 | rCMP(n, lambda, mu, nu, tol = 0.01, x_max = 200)
|
n |
|
lambda |
|
mu |
|
nu |
|
tol |
|
x_max |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (n, lambda, mu, nu, tol = 0.01, x_max = 200)
{
loglike_x = rep(NA, x_max + 1)
for (x in 0:x_max) {
if (!missing(mu) & !missing(lambda))
stop("'mu' and 'lambda' both specified")
if (missing(mu) & !missing(lambda))
loglike_x[x + 1] = dCMP(x = x, lambda = lambda, mu = mu,
nu = nu, log = TRUE, tol = tol, iter.max = x_max)
if (!missing(mu) & missing(lambda))
loglike_x[x + 1] = dCMP(x = x, lambda = lambda, mu = mu,
nu = nu, log = TRUE, tol = tol, iter.max = x_max)
if (missing(mu) & missing(lambda))
stop("Neither 'mu' or 'lambda' is specified")
}
n = sample(x = 0:x_max, size = n, replace = TRUE, prob = exp(loglike_x))
return(n)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.