cgeneric: 'inla.cgeneric' class, short 'cgeneric', to define a...

View source: R/cgeneric.R

inla.cgeneric-classR Documentation

inla.cgeneric class, short cgeneric, to define a INLA::cgeneric() latent model

Description

This organize data needed on the C interface for building latent models, which are characterized from a given model parameters \theta and the the following model elements.

  • graph to define the non-zero precision matrix pattern. only the upper triangle including the diagonal is needed. The order should be by line.

  • 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.

See details in INLA::cgeneric()

Usage

cgeneric(model, ...)

## Default S3 method:
cgeneric(model, debug = FALSE, useINLAprecomp = TRUE, libpath = NULL, ...)

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

cgeneric_get(
  model,
  cmd = c("graph", "Q", "initial", "mu", "log_prior"),
  theta,
  optimize = TRUE
)

initial(model)

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

mu(model, theta)

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

prior(model, theta)

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

graph(model, ...)

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

Q(model, ...)

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

## S3 method for class 'graphpcor'
cgeneric(...)

## S4 method for signature 'inla.cgeneric,inla.cgeneric'
kronecker(X, Y, FUN = "*", make.dimnames = FALSE, ...)

## S3 method for class 'treepcor'
cgeneric(...)

Arguments

model

an object inla.cgeneric object.

...

arguments passed on.

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.

cmd

an string to specify which model element to get

theta

numeric vector with the model parameters. If missing, the initial() will be used.

optimize

logical. If missing or FALSE, the graph and precision are as a sparse matrix. If TRUE, graph only return the row/col indexes and precision return only the elements as a vector.

X

inla.cgeneric or inla.rgeneric

Y

inla.cgeneric or inla.rgeneric

FUN

see kronecker

make.dimnames

see kronecker

Value

a inla.cgeneric, cgeneric() object.

depends on cmd

Methods (by class)

  • cgeneric(default): This calls INLA::inla.cgeneric.define()

  • cgeneric(character): Method for when model is a character. E.g. cgeneric(model = "generic0") calls cgeneric_generic0

  • cgeneric(graphpcor): The cgeneric method for graphpcor uses cgeneric_graphpcor()

  • cgeneric(treepcor): The cgeneric method for treepcor, uses cgeneric_treepcor()

Functions

  • cgeneric_get(): cgeneric_get is an internal function used by graph, prec, initial, mu or prior methods for inla.cgeneric

  • initial(): Retrieve the initial model parameter(s).

  • initial(inla.cgeneric): Retrive the initial parameter(s) of an inla.cgeneric model.

  • mu(): Evaluate the mean.

  • mu(inla.cgeneric): Evaluate the mean for an inla.cgeneric model.

  • prior(): Evaluate the log-prior.

  • prior(inla.cgeneric): Evaluate the prior for an inla.cgeneric model

  • graph(): Retrieve the graph

  • graph(inla.cgeneric): Retrieve the graph of an inla.cgeneric object

  • Q(): Evaluate prec() on a model

  • prec(inla.cgeneric): Evaluate prec() on an inla.cgeneric object

  • kronecker(X = inla.cgeneric, Y = inla.cgeneric): Kronecker (product) between two inla.cgeneric models as a method for kronecker()

See Also

INLA::cgeneric()


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