cgeneric_generic0 {INLAtools}R Documentation

Build an cgeneric object for a generic0 model. See details.

Description

Build data needed to implement a model whose precision has a conditional precision parameter. This uses the C interface in the 'INLA' package, that can be used as a linear predictor model component with an 'f' term.

Usage

cgeneric_generic0(R, param, constr = TRUE, scale = TRUE, ...)

cgeneric_iid(n, param, constr = FALSE, ...)

Arguments

R

the structure matrix for the model definition.

param

length two vector with the parameters a and p for the PC-prior distribution defined from

P(\sigma > a) = p

where \sigma can be interpreted as marginal standard deviation of the process if scale = TRUE. See details.

constr

logical indicating if it is to add a sum-to-zero constraint. Default is TRUE.

scale

logical indicating if it is to scale the model. See detais.

...

arguments (debug,useINLAprecomp,libpath) passed on to cgeneric().

n

integer required to specify the model size

Details

The precision matrix is defined as

Q = \tau R

where the structure matrix R is supplied by the user and \tau is the precision parameter. Following Sørbie and Rue (2014), if scale = TRUE the model is scaled so that

Q = \tau s R

where s is the geometric mean of the diagonal elements of the generalized inverse of R.

s = \exp{\sum_i \log((R^{-})_{ii})/n}

If the model is scaled, the geometric mean of the marginal variances, the diagonal of Q^{-1}, is one. Therefore, when the model is scaled, \tau is the marginal precision, otherwise \tau is the conditional precision.

Value

a cgeneric object, see cgeneric().

Functions

References

Sigrunn Holbek Sørbye and Håvard Rue (2014). Scaling intrinsic Gaussian Markov random field priors in spatial modelling. Spatial Statistics, vol. 8, p. 39-51.

See Also

prior.cgeneric()

Examples

## structured precision matrix model definition
R <- Matrix(toeplitz(c(2,-1,0,0,0)))
R
mR <- cgeneric("generic0", R = R,
  param = c(1, 0.05), scale = FALSE)
graph(mR)
prec(mR, theta = 0)

[Package INLAtools version 0.0.4 Index]