distributionInfo: Get information about a distribution

Description Usage Arguments Details Author(s) Examples

Description

Give information about each BUGS distribution

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
getDistributionInfo(dist)

isUserDefined(dist)

pqDefined(dist)

getType(dist, params = NULL, valueOnly = is.null(params) && !includeParams,
  includeParams = !is.null(params))

getParamNames(dist, includeValue = TRUE)

Arguments

dist

a character vector of length one, giving the name of the distribution (as used in BUGS code), e.g. 'dnorm'

params

an optional character vector of names of parameters for which dimensions are desired (possibly including \'value\' and alternate parameters)

valueOnly

a logical indicating whether to only return the dimension of the value of the node

includeParams

a logical indicating whether to return dimensions of parameters. If TRUE and \'params\' is NULL then dimensions of all parameters, including the dimension of the value of the node, are returned

includeValue

a logical indicating whether to return the string 'value', which is the name of the node value

Details

NIMBLE provides various functions to give information about a BUGS distribution. In some cases, functions of the same name and similar functionality operate on the node(s) of a model as well (see help(modelBaseClass)).

getDistributionInfo returns an internal data structure (a reference class object) providing various information about the distribution. The output is not very user-friendly, but does contain all of the information that NIMBLE has about the distribution.

isDiscrete tests if a BUGS distribution is a discrete distribution.

isUserDefined tests if a BUGS distribution is a user-defined distribution.

pqAvail tests if a BUGS distribution provides distribution ('p') and quantile ('q') functions.

getDimension provides the dimension of the value and/or parameters of a BUGS distribution. The return value is a numeric vector with an element for each parameter/value requested.

getType provides the type (numeric, logical, integer) of the value and/or parameters of a BUGS distribution. The return value is a character vector with an element for each parameter/value requested. At present, all quantities are stored as numeric (double) values, so this function is of little practical use but could be exploited in the future.

getParamNames provides the value and/or parameter names of a BUGS distribution.

Author(s)

Christopher Paciorek

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
distInfo <- getDistributionInfo('dnorm')
distInfo
distInfo$range

isDiscrete('dbin')

isUserDefined('dbin')

pqDefined('dgamma')
pqDefined('dmnorm')

getDimension('dnorm')
getDimension('dnorm', includeParams = TRUE)
getDimension('dnorm', c('var', 'sd'))
getDimension('dcat', includeParams = TRUE)
getDimension('dwish', includeParams = TRUE)

getType('dnorm')
getType('dnorm', includeParams = TRUE)
getType('dnorm', c('var', 'sd'))
getType('dcat', includeParams = TRUE)
getType('dwish', includeParams = TRUE)

getParamNames('dnorm', includeValue = FALSE)
getParamNames('dmnorm')

nimble documentation built on May 23, 2021, 5:07 p.m.