spde_mesh_1d: Default mesh for a one-dimensional SPDE smooth

View source: R/spde.R

spde_mesh_1dR Documentation

Default mesh for a one-dimensional SPDE smooth

Description

k quadratic B-spline basis functions on evenly spaced knots, over the range of the covariate widened by a fifth on each side. The widening is the one-dimensional counterpart of the outer extension of a two-dimensional mesh: fmesher's default boundary condition is Neumann, under which a field whose knots stop at the data has its variance inflated by a third or more at the two ends. A fifth of the spread of the covariate is about one range at the starting value used in smooth.construct.spde.smooth.spec(), which is the same rule of thumb used for the offset in two dimensions.

Usage

spde_mesh_1d(x, k)

Arguments

x

The covariate

k

Basis dimension, as passed to s(); negative when the user gave none, in which case 15 is used

Details

A degree-2 mesh has one basis function fewer than it has knots, so k knots would not give k of them; k keeps its mgcv meaning of a basis dimension here, and k + 1 knots are laid down.

The default of 15 is above mgcv's 10, because k is a resolution here and not a cap on wiggliness: with the widening, 15 knots put the knot spacing at about half the range the smoother starts from, in the spirit of max.edge in two dimensions. Ten of them leave the knots further apart than that range, and it collapses towards zero as a result.

Value

An fm_mesh_1d with k basis functions


hmmTMB documentation built on Nov. 10, 2026, 5:09 p.m.