bru_index {inlabru}R Documentation

Extract predictor or component index information

Description

[Experimental] Extract the index vector for a bru_obs() predictor, or the whole or a subset of a full bru() predictor.

Usage

bru_index(object, ...)

## S3 method for class 'bru_obs'
bru_index(object, what = NULL, ...)

## S3 method for class 'bru'
bru_index(object, tag = NULL, what = NULL, ...)

## S3 method for class 'bru_comp'
bru_index(object, inla_f, ...)

## S3 method for class 'bru_comp_list'
bru_index(object, inla_f, ...)

## S3 method for class 'bru_model'
bru_index(object, used, ...)

index_eval(...)

Arguments

object

A component.

...

Arguments passed on to sub-methods.

what

character or NULL; One of NULL, "all", "observed", and "missing". If NULL (default) or "all", gives the index vector for the full sub-model predictor. If "observed", gives the index vector for the observed part (response is not NA). If "missing", gives the index vector for the missing part (response is NA) of the model.

tag

character or integer; Either a character vector identifying the tags of one or more of the bru_obs() observation models, or an integer vector identifying models by their bru() specification order. If NULL (default) computes indices for all sub-models.

inla_f

logical; when TRUE, must result in values compatible with INLA::f(...) an specification and corresponding INLA::inla.stack(...) constructions.

used

A bru_used() object

Value

Methods (by class)

Functions

Author(s)

Fabian E. Bachl bachlfab@gmail.com, Finn Lindgren finn.lindgren@gmail.com

Examples


fit <- bru(
  ~ 0 + x,
  bru_obs(
    y ~ .,
    data = data.frame(x = 1:3, y = 1:3 + rnorm(3)),
    tag = "A"
  ),
  bru_obs(
    y ~ .,
    data = data.frame(x = 1:4, y = c(NA, NA, 3:4) + rnorm(4)),
    tag = "B"
  )
)
bru_index(fit)
bru_index(fit, "A")
bru_index(fit, "B")
bru_index(fit, c("B", "A"))
bru_index(fit, what = "missing")


[Package inlabru version 2.13.0 Index]