tvgeom_nimble: The Time-Varying (Right-Truncated) Geometric Distribution in...

Description Usage Arguments Details

Description

Density (dtvgeom_nimble), distribution function (qtvgeom_nimble), quantile function (ptvgeom_nimble), and random number generation (rtvgeom_nimble for the time-varying, right-truncated geometric distribution with parameter prob. This distribution is identical to the one in the tvgeom package, but functions are implemented as nimbleFunctions, which allows them to be compiled to C++. For general use of the tvgeom distribution, it is recommended that you use the functions provided in the tvgeom package.

Usage

1
2
3
4
5
6
7
dtvgeom_nimble(x, prob, log = 0)

ptvgeom_nimble(q, prob, lower.tail = 1, log.p = 0)

qtvgeom_nimble(p, prob, lower.tail = 1, log.p = 0)

rtvgeom_nimble(n, prob)

Arguments

x, q

vector of quantiles representing the trial at which the first success occurred.

prob

vector of the probability of success for each trial.

log, log.p

logical; if TRUE, probabilities, p, are given as log(p). Defaults to FALSE.

lower.tail

logical; if FALSE, ptvgeom_nimble returns P(X > x) instead of P(X ≤ x). Defaults to TRUE.

p

vector of probabilities at which to evaluate the quantile function.

n

number of observations to sample. For *tvgeom_nimble functions, must be 1.

Details

The time-varying geometric distribution describes the number of independent Bernoulli trials needed to obtain one success. The probability of success, prob, may vary for each trial. It has mass

p(x) = prob[x] * prod(1 - prob[1:(x-1)])

with support x = 1, 2, ..., n. For i in prob, 0 ≤ i ≤ 1.


vlandau/tempo documentation built on March 18, 2020, 12:04 a.m.