cgeneric_graphpcor: Build an 'cgeneric' for a (graph based) correlation matrix...

View source: R/cgeneric_graphpcor.R

cgeneric_graphpcorR Documentation

Build an cgeneric for a (graph based) correlation matrix PC-prior.

Description

From either a graphpcor (see graphpcor()) or a square matrix (used as a graph), creates an cgeneric (see INLAtools::cgeneric()) to implement the Penalized Complexity prior using the Kullback-Leibler divergence - KLD from a base graphpcor.

Usage

cgeneric_graphpcor(
  model,
  lambda,
  base,
  sigma.prior.reference,
  sigma.prior.probability,
  iparams,
  cfixed,
  d0,
  ...
)

Arguments

model

a graphpcor (see graphpcor()) or a square matrix (to be used as a graph) to define the precision structure of the model.

lambda

the parameter for the exponential prior on the radius of the sphere, see details in the PC-multivariate vignette.

base

numeric vector, correlation matrix or basepcor object. See basepcor() for details. If the output of a basepcor() is provided, iLtheta will be considered from it, and iparams for the correlation parameters as well.

sigma.prior.reference

numeric vector to set the reference for each standard deviation parameter for its PC-prior. If missing, the model will be assumed as for a correlation. Note: iparams will be applied here as sigma.prior.reference[iparams[1:n]].

sigma.prior.probability

numeric vector with to set the probability statement of the PC prior for each marginal variance parameters. The probability statement is P(sigma < sigma.prior.reference) = p. If missing, all the marginal variances are considered as known. If a vector is given and a probability is NA, 0 or 1, the corresponding sigma.prior.reference will be used as fixed. Note: iparams will be applied here as sigma.prior.probability[iparams[1:n]].

iparams

integer vector with length equal n+m, where m is the number of correlation parameters, to identify (possible) common parameters in the model. Default is 1:(n+m). Note: c(1,2,1) is allowed, but c(2,1,2) is not.

cfixed

integer vector to specify which correlation parameters are treated as known and fixed. By default all correlation parameters are treated as unknown. Example: if cfixed = c(1,3), the first and third correlation parameters will be treated as fixed and the Hessian will be computed for the second correlation parameter. Please see the examples in basepcor(). Note: consider iparams[n+1:m]-iparams[n].

d0

numeric vector to specify the diagonal of the Cholesky factor for the initial precision matrix Q0, passed on to basepcor(). Default is d0 = n:1.

...

additional arguments passed on to INLAtools::cgeneric(), such as debug, shlib and useINLAprecomp.

Details

The parametrization is set as in basepcor() and the base is used to define an informative prior, as derived in the pcmultivariate vignette.

Value

cgeneric object.

See Also

graphpcor() and basepcor()


graphpcor documentation built on March 23, 2026, 9:07 a.m.