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(...)

mapper1(model)

cgeneric_shlib_path(package, useINLAprecomp, debug)

## S3 method for class 'cgeneric'
print(x, ...)

## S3 method for class 'cgeneric'
summary(object, ...)

## S3 method for class 'cgeneric'
plot(x, y, ...)

Arguments

model

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

...

additional arguments passed on to methods It should include n and debug. For cgenericBuild and 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 cgeneric_shlib_path for the package (character with the R package containing it), in which useINLAprecomp (logical) indicates if it is to use the one contained within INLA or in the package. When using the inlabru package, one can also provide a mapper which will be evaluated by the bru_get_mapper inlabru's function.

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.

debug

integer, used as verbose in debug.

x

a cgeneric object

object

a cgeneric object

y

not used

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.

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

Functions

  • cgeneric(character): Call a function named as cgeneric_[model] to build a cgeneric.

  • cgeneric(`function`): The cgeneric method for function.

  • cgeneric(cgeneric): Check, append cgeneric class, returns model unchanged.

  • cgeneric(inla.cgeneric): Check and converts a regular inla.cgeneric object to cgeneric.

  • cgenericBuilder(): Build a cgeneric from a list of arguments.

  • mapper1(): A default mapper for a cgeneric/rgeneric model

  • cgeneric_shlib_path(): Make the lib path for the shared lib of a package.

  • print(cgeneric): Print the cgeneric object

  • summary(cgeneric): A summary for a cgeneric object

  • plot(cgeneric): A plot for a cgeneric object

Note

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


INLAtools documentation built on May 4, 2026, 5:07 p.m.