intervalWidth {dembase} | R Documentation

## Calculate the widths of credible intervals

### Description

Calculate the widths of credible intervals stored in a `DemographicArray`. If `(l, u)`, is a credible interval, then the width of the interval equals `u - l`.

### Usage

    intervalWidth(interval)

    ## S4 method for signature 'DemographicArray'
    intervalWidth(interval)

### Arguments

`interval` | A `DemographicArray`.

### Details

`interval` must have a dimension of length 2 with `dimtype` `"quantile"` specifying the intervals. `interval` is typically calculated using function `credibleInterval`.

### Examples

    #' set.seed(0)
    object <- Values(array(runif(n = 20),
                           dim = c(2, 10),
                           dimnames = list(sex = c("F", "M"),
                                           iteration = 1:10)))
    interval <- credibleInterval(object)
    interval
    intervalWidth(interval)
    object <- Values(array(rpois(n = 20, lambda = 10),
                           dim = c(2, 10),
                           dimnames = list(sex = c("F", "M"),
                                           iteration = 1:10)))
    interval <- credibleInterval(object, width = 90)
    interval
    intervalWidth(interval)

[Package dembase version 0.0.0.119 Index]