Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bru_mapper_methods

Implementation methods for mapper objects


Description

A bru_mapper sub-class implementation must provide an ibm_matrix() method. If the model size 'n' and definition values 'values' are stored in the object itself, default methods are available (see Details). Otherwise the ibm_n() and ibm_values() methods also need to be provided.

Usage

## Default S3 method:
ibm_n(mapper, ...)

## Default S3 method:
ibm_values(mapper, ...)

## Default S3 method:
ibm_amatrix(mapper, ...)

## Default S3 method:
ibm_valid_input(mapper, input, ...)

## S3 method for class 'bru_mapper_inla_mesh_2d'
ibm_n(mapper, ...)

## S3 method for class 'bru_mapper_inla_mesh_2d'
ibm_values(mapper, ...)

## S3 method for class 'bru_mapper_inla_mesh_2d'
ibm_amatrix(mapper, input, ...)

## S3 method for class 'bru_mapper_inla_mesh_1d'
ibm_n(mapper, ...)

## S3 method for class 'bru_mapper_inla_mesh_1d'
ibm_values(mapper, ...)

## S3 method for class 'bru_mapper_inla_mesh_1d'
ibm_amatrix(mapper, input, ...)

## S3 method for class 'bru_mapper_index'
ibm_valid_input(mapper, input, ...)

## S3 method for class 'bru_mapper_index'
ibm_amatrix(mapper, input, ...)

## S3 method for class 'bru_mapper_linear'
ibm_n(mapper, ...)

## S3 method for class 'bru_mapper_linear'
ibm_values(mapper, ...)

## S3 method for class 'bru_mapper_linear'
ibm_amatrix(mapper, input, ...)

## S3 method for class 'bru_mapper_factor'
ibm_n(mapper, ...)

## S3 method for class 'bru_mapper_factor'
ibm_values(mapper, ...)

## S3 method for class 'bru_mapper_factor'
ibm_amatrix(mapper, input, ...)

## S3 method for class 'bru_mapper_offset'
ibm_n(mapper, ...)

## S3 method for class 'bru_mapper_offset'
ibm_values(mapper, ...)

## S3 method for class 'bru_mapper_offset'
ibm_amatrix(mapper, input, ...)

## S3 method for class 'bru_mapper_multi'
ibm_n(mapper, multi = 0L, ...)

## S3 method for class 'bru_mapper_multi'
ibm_values(mapper, multi = 0L, ...)

## S3 method for class 'bru_mapper_multi'
ibm_amatrix(mapper, input, multi = 0L, ...)

## S3 method for class 'bru_mapper_multi'
ibm_valid_input(mapper, input, multi = 0L, ...)

## S3 method for class 'bru_mapper_multi'
x[i, drop = TRUE]

## S3 method for class 'bru_mapper_multi'
names(x)

## S3 replacement method for class 'bru_mapper_multi'
names(x) <- value

Arguments

mapper

A mapper S3 object, normally inheriting from bru_mapper

...

Arguments passed on to other methods

input

The values for which to produce a mapping matrix

multi

integer or logical; If positive, the number of levels to recurse in a bru_multi_mapper. If TRUE, equivalent to 1L. If FALSE, equivalent to 0L.

x

object from which to extract element(s)

i

indices specifying element(s) to extract

drop

logical; For [.bru_mapper_multi, whether to extract an individual mapper when i identifies a single element. Default: TRUE

value

a character vector of up to the same length as x

Details

  • The default ibm_n() method returns a non-null element 'n' from the mapper object, and gives an error if it doesn't exist.

  • The default ibm_values() method returns a non-null element 'values' from the mapper object, and seq_len(ibm_n(mapper)) if it doesn't exist.

  • The default ibm_amatrix() method calls the ibm_amatrix element function of the object if it exists.

  • The default ibm_valid_input() method returns an all-TRUE logical vector.

  • ibm_amatrix for bru_mapper_multi accepts a list with named entries, or a list with unnamed but ordered elements. The names must match the sub-mappers, see names.bru_mapper_multi(). Each list element should take a format accepted by the corresponding sub-mapper. In case each element is a vector, the input can be given as a data.frame with named columns, a matrix with named columns, or a matrix with unnamed but ordered columns.

  • ibm_valid_input for bru_mapper_multi accepts a list with named entries, or a list with unnamed but ordered elements. The names must match the sub-mappers, see names.bru_mapper_multi(). Each list element should take a format accepted by the corresponding sub-mapper. In case each element is a vector, the input can be given as a data.frame with named columns, a matrix with named columns, or a matrix with unnamed but ordered columns.

Value

  • [-indexing a bru_mapper_multi extracts a subset bru_mapper_multi object (for drop FALSE) or an individual sub-mapper (for drop TRUE, and i identifies a single element)

  • The names() method for bru_mapper_multi returns the names from the sub-mappers list

See Also


inlabru

Bayesian Latent Gaussian Modelling using INLA and Extensions

v2.3.1
GPL (>= 2)
Authors
Finn Lindgren [aut, cre, cph] (<https://orcid.org/0000-0002-5833-2011>, Finn Lindgren continued development of the main code), Fabian E. Bachl [aut, cph] (Fabian Bachl wrote the main code), David L. Borchers [ctb, dtc, cph] (David Borchers wrote code for Gorilla data import and sampling, multiplot tool), Daniel Simpson [ctb, cph] (Daniel Simpson wrote the basic LGCP sampling method), Lindesay Scott-Howard [ctb, dtc, cph] (Lindesay Scott-Howard provided MRSea data import code), Seaton Andy [ctb] (Andy Seaton provided testing and bugfixes)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.