Learn R Programming

nimble (version 1.2.1)

Interval: Interval calculations

Description

Calculations to handle censoring

Usage

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

rinterval(n = 1, t, c)

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.

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.

Author

Christopher Paciorek

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.

See Also

Distributions for other standard distributions

Examples

Run this code
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)

Run the code above in your browser using DataLab