m: Define the IGMRF model assumed on a main effect (e.g. space...

Description Usage Arguments Value Examples

View source: R/define_interaction.R

Description

The output of this function is often used as an input for the function control.interaction().

Usage

1
m(x, igmrf.type = "rw1", R = NULL, g, p.spline = FALSE, n.bsplines = 20, deg.bsplines = 3)

Arguments

x

vector of covariate values; it can be either a vector of the same length of the data or a vector containing the unique covariate values; typically, it is a vector of increasing integers indexing time points or spatial locations (for time main effect, it can also be a vector of not equally spaced time locations)

igmrf.type

the main effect model, e.g. "rw2", "besag"

R

optional; an obj of class 'Cmatrix' with the structure matrix

g

only for gmrf.type='besag'; the structure matrix defined through obj 'inla.graph'

p.spline

experimental; TRUE of FALSE, whether we want or not to define a P-spline (default FALSE)

n.bsplines

experimental; only for p.spline=TRUE, number of b-spline basis function (default is 20)

deg.bsplines

experimental; only for p.spline=TRUE, degree of the b-splines (default is 3, cubic b-splines)

Value

A list of several objects

R

the structure matrix of the IGMRF

rankdef

rank deficiency of the structure matrix

idx

a vector of length(x) indicating the ordering of the covariate vector x (OBSOLETE; when the dataset is properly ordered - as it has to be for the package to work fine - idx is not needed)

A

experimental; the B-spline desgin amtrix (need to check if this works)

cc.id

a vector indicating which cc a node belongs to (if igmrf.type="besag"); NULL id igmrf.type="rw1" or "rw2"

Examples

1
2
x <- 1:50
m1 <- m(x, igmrf.type='rw1')

massimoventrucci/inlaVP documentation built on Dec. 21, 2021, 2:51 p.m.