
rSPDE inlabru mapper
Source:R/inla_rspde_intrinsic.R
, R/inlabru_rspde.R
bru_get_mapper.inla_rspde.Rd
rSPDE inlabru mapper
Usage
ibm_n.bru_mapper_inla_rspde_fintrinsic(mapper, ...)
ibm_values.bru_mapper_inla_rspde_fintrinsic(mapper, ...)
ibm_jacobian.bru_mapper_inla_rspde_fintrinsic(mapper, input, ...)
bru_get_mapper.inla_rspde(model, ...)
ibm_n.bru_mapper_inla_rspde(mapper, ...)
ibm_values.bru_mapper_inla_rspde(mapper, ...)
ibm_jacobian.bru_mapper_inla_rspde(mapper, input, ...)
Examples
# \donttest{
# devel version
if (requireNamespace("INLA", quietly = TRUE) &&
requireNamespace("inlabru", quietly = TRUE)) {
library(INLA)
library(inlabru)
set.seed(123)
m <- 100
loc_2d_mesh <- matrix(runif(m * 2), m, 2)
mesh_2d <- inla.mesh.2d(
loc = loc_2d_mesh,
cutoff = 0.05,
max.edge = c(0.1, 0.5)
)
sigma <- 1
range <- 0.2
nu <- 0.8
kappa <- sqrt(8 * nu) / range
op <- matern.operators(
mesh = mesh_2d, nu = nu,
range = range, sigma = sigma, m = 2,
parameterization = "matern"
)
u <- simulate(op)
A <- inla.spde.make.A(
mesh = mesh_2d,
loc = loc_2d_mesh
)
sigma.e <- 0.1
y <- A %*% u + rnorm(m) * sigma.e
y <- as.vector(y)
data_df <- data.frame(
y = y, x1 = loc_2d_mesh[, 1],
x2 = loc_2d_mesh[, 2]
)
rspde_model <- rspde.matern(
mesh = mesh_2d,
nu_upper_bound = 2
)
cmp <- y ~ Intercept(1) +
field(cbind(x1,x2), model = rspde_model)
rspde_fit <- bru(cmp, data = data_df)
summary(rspde_fit)
}
#> This is INLA_25.02.10 built 2025-02-09 19:59:04 UTC.
#> - See www.r-inla.org/contact-us for how to get help.
#> - List available models/likelihoods/etc with inla.list.models()
#> - Use inla.doc(<NAME>) to access documentation
#> Loading required package: fmesher
#> inlabru version: 2.12.0
#> INLA version: 25.02.10
#> Components:
#> Intercept: main = linear(1), group = exchangeable(1L), replicate = iid(1L), NULL
#> field: main = cgeneric(cbind(x1, x2)), group = exchangeable(1L), replicate = iid(1L), NULL
#> Likelihoods:
#> Family: 'gaussian'
#> Tag: ''
#> Data class: 'data.frame'
#> Response class: 'numeric'
#> Predictor: y ~ .
#> Used components: effects[Intercept, field], latent[]
#> Time used:
#> Pre = 0.404, Running = 7.22, Post = 0.366, Total = 7.99
#> Fixed effects:
#> mean sd 0.025quant 0.5quant 0.975quant mode kld
#> Intercept 0.286 0.168 -0.047 0.286 0.621 0.286 0
#>
#> Random effects:
#> Name Model
#> field CGeneric
#>
#> Model hyperparameters:
#> mean sd 0.025quant 0.5quant
#> Precision for the Gaussian observations 168.16 86.000 54.185 150.669
#> Theta1 for field -6.13 2.589 -12.130 -5.782
#> Theta2 for field 3.07 0.289 2.589 3.050
#> Theta3 for field 1.11 1.390 -0.953 0.926
#> 0.975quant mode
#> Precision for the Gaussian observations 383.30 119.194
#> Theta1 for field -2.29 -4.035
#> Theta2 for field 3.71 2.928
#> Theta3 for field 4.33 -0.009
#>
#> Deviance Information Criterion (DIC) ...............: -123.91
#> Deviance Information Criterion (DIC, saturated) ....: 195.68
#> Effective number of parameters .....................: 93.13
#>
#> Watanabe-Akaike information criterion (WAIC) ...: -142.74
#> Effective number of parameters .................: 55.56
#>
#> Marginal log-Likelihood: -108.20
#> is computed
#> Posterior summaries for the linear predictor and the fitted values are computed
#> (Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')
#>
# devel.tag
# }