Interval | R Documentation |
Calculations to handle censoring
dinterval(x, t, c, log = FALSE)
rinterval(n = 1, t, c)
x |
vector of interval indices. |
t |
vector of values. |
c |
vector of one or more values delineating the intervals. |
log |
logical; if TRUE, probability density is returned on the log scale. |
n |
number of observations. |
Used for working with censoring in BUGS code.
Taking c
to define the endpoints of two or more intervals (with implicit endpoints of plus/minus infinity), x
(or the return value of rinterval
) gives the non-negative integer valued index of the interval in which t
falls. See the NIMBLE manual for additional details.
dinterval
gives the density and rinterval
generates random deviates,
but these are unusual as the density is 1 if x
indicates the interval in which t
falls and 0 otherwise and the deviates are simply the interval(s) in which t
falls.
Christopher Paciorek
Distributions for other standard distributions
endpoints <- c(-3, 0, 3)
vals <- c(-4, -1, 1, 5)
x <- rinterval(4, vals, endpoints)
dinterval(x, vals, endpoints)
dinterval(c(1, 5, 2, 3), vals, endpoints)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.