[Deprecated] since 23.08.18. Use fmesher::fm_raw_basis() instead.

Calculate basis functions on a 1d or 2d inla.mesh()

inla.mesh.basis(
  mesh,
  type = "b.spline",
  n = 3,
  degree = 2,
  knot.placement = "uniform.area",
  rot.inv = TRUE,
  boundary = "free",
  free.clamped = TRUE,
  ...
)

Arguments

mesh

An inla.mesh.1d or inla.mesh object.

type

b.spline (default) for B-spline basis functions, sph.harm for spherical harmonics (available only for meshes on the sphere)

n

For B-splines, the number of basis functions in each direction (for 1d meshes n must be a scalar, and for planar 2d meshes a 2-vector). For spherical harmonics, n is the maximal harmonic order.

degree

Degree of B-spline polynomials. See inla.mesh.1d().

knot.placement

For B-splines on the sphere, controls the latitudinal placements of knots. "uniform.area" (default) gives uniform spacing in sin(latitude), "uniform.latitude" gives uniform spacing in latitudes.

rot.inv

For spherical harmonics on a sphere, rot.inv=TRUE gives the rotationally invariant subset of basis functions.

boundary

Boundary specification, default is free boundaries. See inla.mesh.1d() for more information.

free.clamped

If TRUE and boundary is "free", the boundary basis functions are clamped to 0/1 at the interval boundary by repeating the boundary knots.

...

Unused

Author

Finn Lindgren finn.lindgren@gmail.com

Examples


n <- 100
loc <- matrix(runif(n * 2), n, 2)
mesh <- inla.mesh.2d(loc, max.edge = 0.05)
basis <- inla.mesh.basis(mesh, n = c(4, 5))
#> Warning: `inla.mesh.basis()` was deprecated in INLA 23.08.18.
#>  Please use `fmesher::fm_raw_basis()` instead.
#>  For more information, see
#>   https://inlabru-org.github.io/fmesher/articles/inla_conversion.html
#>  To silence these deprecation messages in old legacy code, set
#>   `inla.setOption(fmesher.evolution.warn = FALSE)`.
#>  To ensure visibility of these messages in package tests, also set
#>   `inla.setOption(fmesher.evolution.verbosity = 'warn')`.

proj <- inla.mesh.projector(mesh)
#> Warning: `inla.mesh.projector()` was deprecated in INLA 23.06.07.
#>  Please use `fmesher::fm_evaluator()` instead.
#>  For more information, see
#>   https://inlabru-org.github.io/fmesher/articles/inla_conversion.html
#>  To silence these deprecation messages in old legacy code, set
#>   `inla.setOption(fmesher.evolution.warn = FALSE)`.
#>  To ensure visibility of these messages in package tests, also set
#>   `inla.setOption(fmesher.evolution.verbosity = 'warn')`.
image(proj$x, proj$y, inla.mesh.project(proj, basis[, 7]))
#> Warning: `inla.mesh.project()` was deprecated in INLA 23.06.07.
#>  Please use `fmesher::fm_evaluate()` instead.
#>  For more information, see
#>   https://inlabru-org.github.io/fmesher/articles/inla_conversion.html
#>  To silence these deprecation messages in old legacy code, set
#>   `inla.setOption(fmesher.evolution.warn = FALSE)`.
#>  To ensure visibility of these messages in package tests, also set
#>   `inla.setOption(fmesher.evolution.verbosity = 'warn')`.

# \donttest{
if (require(rgl)) {
  plot(mesh, rgl = TRUE, col = basis[, 7], draw.edges = FALSE, draw.vertices = FALSE)
}
#> Loading required package: rgl
#> Warning: RGL: unable to open X11 display
#> Warning: 'rgl.init' failed, will use the null device.
#> See '?rgl.useNULL' for ways to avoid this warning.
#> Error: The `rgl` argument of `plot.fm_mesh_2d()` was deprecated in fmesher
#> 0.1.0 and is now defunct.
#>  Please use `plot_rgl()` instead.
# }