cgeneric-class: Organize data for the latent GMRF C interface for 'INLA'.

cgeneric-classR Documentation

Organize data for the latent GMRF C interface for INLA.

Description

A GMRF is defined from model parameters \theta that would parametrize a (sparse) precision matrix.

The elements of a GMR are:

  • graph to define the non-zero precision matrix pattern. only the upper triangle including the diagonal is needed.

  • Q vector where the

    • first element (N) is the size of the matrix,

    • second element (M) is the number of non-zero elements in the upper part (including) diagonal

    • the remaining (M) elements are the actual precision (upper triangle plus diagonal) elements whose order shall follow the graph definition.

  • mu the mean vector,

  • initial vector with

    • first element as the number of the parameters in the model

    • remaining elements should be the initials for the model parameters.

  • log.norm.const log of the normalizing constant.

  • log.prior log of the prior for the model parameters.

Usage

cgeneric(model, ...)

## S3 method for class 'character'
cgeneric(model, ...)

## S3 method for class ''function''
cgeneric(model, ...)

## S3 method for class 'cgeneric'
cgeneric(model, ...)

## S3 method for class 'inla.cgeneric'
cgeneric(model, ...)

cgenericBuilder(...)

cgeneric_shlib(debug, package, useINLAprecomp)

Arguments

model

object class for what a cgeneric method exists. E.g., if it is a character, a specific function will be called. E.g. cgeneric("iid", ...") calls cgeneric_iid(...).

...

arguments passed from the cgeneric() methods. FIt should include n and debug. For cgenericBuild it should model as a character string with the name of the C function and shlib as the path to the shared object containing such function. If shlib is not provided it can be built using inla_shlib from the arguments, package (character with the R package containing it), useINLAprecomp (logical to indicate if INLA contains it and to use it).

debug

integer, used as verbose in debug.

package

character giving the name of the package that contains the cgeneric model.

useINLAprecomp

logical, indicating if it is to use the shared object previously copied and compiled by INLA.

Value

a method to build a cgeneric should return a named list of cgeneric class that contains a named list f that contains (at least):

  • model a character always equal to cgeneric,

  • n an integer greater than 0, and

  • cgeneric as a named list that contains the data needed to define the model. Each element on ...$f$cgeneric is also a named list containing ints, doubles, characters, matrices and smatrices.

  • (possible) extraconstr as a named list with: A as a n times k matrix and e as a length k vector.

  • (possible) bm_mapper (TO DO) mapper for inlabru package.

The cgeneric_shlib function returns a character with the path to the shared lib.

Functions

  • cgeneric(cgeneric): Returns the model object unchanged.

  • cgeneric(inla.cgeneric): Converts a regular inla.cgeneric object to cgeneric.

Note

The graph and Q non-zero pattern should match, its elements should be ordered by row, and only its upper part stored.

See Also

INLA::cgeneric() and methods()


INLAtools documentation built on Nov. 20, 2025, 5:07 p.m.