cgeneric_graphpcor: Build an 'inla.cgeneric' for a graph, see 'graphpcor()'

View source: R/cgeneric_graphpcor.R

cgeneric_graphpcorR Documentation

Build an inla.cgeneric for a graph, see graphpcor()

Description

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

Usage

cgeneric_graphpcor(
  graph,
  lambda,
  base,
  sigma.prior.reference,
  sigma.prior.probability,
  params.id,
  low.params.fixed,
  debug = FALSE,
  useINLAprecomp = TRUE,
  libpath = NULL
)

Arguments

graph

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.

base

numeric vector with length m, m is the number of edges in the graph, or matrix with the reference correlation model against what the KLD will be evaluated. If it is a vector, a correlation matrix is defined considering the graph model and this vector as the parameters in the lower triangle matrix L. If it is a matrix, it will be checked if the graph model can generates this.

sigma.prior.reference

numeric vector with length n, n is the number of nodes (variables) in the graph, as the reference standard deviation to define the PC prior for each marginal variance parameters. If missing, the model will be assumed for a correlation. If a length n vector is given and sigma.prior.reference is missing, it will be used as known square root of the variances. NOTE: params.id will be applied here as sigma.prior.reference[params.id[1:n]].

sigma.prior.probability

numeric vector with length n 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, as described in sigma.prior.reference. If a vector is given and a probability is NA, 0 or 1, the corresponding sigma.prior.reference will be used as fixed. NOTE: params.id will be applied here as sigma.prior.probability[params.id[1:n]].

params.id

integer ordered vector with length equals to n+m to specify common parameter values. If missing it is assumed 1:(n+m) and all parameters are assumed distinct. The first n indexes the square root of the marginal variances and the remaining indexes the edges parameters. Example: By setting params.id = c(1,1,2,3, 4,5,5,6), the first two standard deviations are common and the second and third edges parameters are common as well, giving 6 unknown parameters in the model.

low.params.fixed

numeric vector of length m providing the value(s) at which the lower parameter(s) of the L matrix to be fixed and not estimated. NA indicates not fixed and all are set to be estimated by default. Example: with low.params.fixed = c(NA, -1, NA, 1) the first and the third of these parameters will be estimated while the second is fixed and equal to -1 and the forth is fixed and equal to 1. NOTE: params.id will be applied here as low.params.fixed[params.id[(n+1:m)]-n+1], thus the provided examples give ⁠NA -1 -1 NA⁠ and so the second and third low L parameters are fixed to -1.

debug

integer, default is zero, indicating the verbose level. Will be used as logical by INLA.

useINLAprecomp

logical, default is TRUE, indicating if it is to be used the shared object pre-compiled by INLA. This is not considered if 'libpath' is provided.

libpath

string, default is NULL, with the path to the shared object.

Value

a inla.cgeneric, cgeneric() object.


graphpcor documentation built on June 8, 2025, 10:37 a.m.