Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Interval

Interval calculations


Description

Calculations to handle censoring

Usage

dinterval(x, t, c, log = FALSE)

rinterval(n = 1, t, c)

Arguments

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.

Details

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.

Value

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.

Author(s)

Christopher Paciorek

See Also

Distributions for other standard distributions

Examples

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)

nimble

MCMC, Particle Filtering, and Programmable Hierarchical Modeling

v0.11.0
BSD_3_clause + file LICENSE | GPL (>= 2)
Authors
Perry de Valpine [aut], Christopher Paciorek [aut, cre], Daniel Turek [aut], Nick Michaud [aut], Cliff Anderson-Bergman [aut], Fritz Obermeyer [aut], Claudia Wehrhahn Cortes [aut] (Bayesian nonparametrics system), Abel Rodrìguez [aut] (Bayesian nonparametrics system), Duncan Temple Lang [aut] (packaging configuration), Sally Paganin [aut] (reversible jump MCMC), Jagadish Babu [ctb] (code for the compilation system for an early version of NIMBLE), Lauren Ponisio [ctb] (contributions to the cross-validation code), Peter Sujan [ctb] (multivariate t distribution code)
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.