Skip to contents

Returns a named list with an element called observations and one element for every random effect. The random effect components use the name of the random effect.

Usage

get_anomaly(object, n = 10)

# S4 method for class 'inla'
get_anomaly(object, n = 20)

Arguments

object

the INLA model

n

the number of anomalies per criterion. Defaults to 10.

Details

observations is a subset of the original data.frame. It contains the rows with the n largest and n smallest values of the Pearson residuals. The random effect components contain a subset of the random effects. Here we select the rows with the n largest and n lowest values of the mean.

Examples

library(INLA)
set.seed(20181202)
model <- inla(
  poisson ~ 1,
  family = "poisson",
  data = data.frame(
    poisson = rpois(20, lambda = 10),
    base = 1
  ),
  control.predictor = list(compute = TRUE)
)
dc <- get_anomaly(model, n = 2)
str(dc)
#> List of 1
#>  $ observations:'data.frame':	4 obs. of  8 variables:
#>   ..$ poisson   : int [1:4] 6 7 15 16
#>   ..$ base      : num [1:4] 1 1 1 1
#>   ..$ mean      : num [1:4] 11 11 11 11
#>   ..$ sd        : num [1:4] 0.744 0.744 0.744 0.744
#>   ..$ 0.025quant: num [1:4] 9.66 9.66 9.66 9.66
#>   ..$ 0.5quant  : num [1:4] 11 11 11 11
#>   ..$ 0.975quant: num [1:4] 12.6 12.6 12.6 12.6
#>   ..$ mode      : num [1:4] 11 11 11 11