assemble: Assemble spline ingredients for sandwich smooth

View source: R/assemble.R

assembleR Documentation

Assemble spline ingredients for sandwich smooth

Description

Assemble computations from a spline-related object x in order to implement the sandwich smoother. This is essentially an internal function, but could be useful for performing a manual implementation of the sandwich smoother.

Usage

assemble(object, ...)

## S3 method for class 'hero_bspline'
assemble(object, x, m = 2, sparse = TRUE, ...)

## S3 method for class 'hero_radspline'
assemble(object, x, m = 2, sparse = TRUE, spdiffpen = TRUE, digits = 1, ...)

## S3 method for class 'list'
assemble(object, x, m = 2, sparse = TRUE, spdiffpen = TRUE, digits = 1, ...)

Arguments

object

A spline-related object (e.g, a hero_bspline from the bspline function), or a list of spline-related objects.

...

Not implemented

x

Values at which to evaluate the basis functions. This should be a numeric vector if object is a hero_bspline. This should be a numeric matrix of coordinates if object is a hero_radspline. If object is a list comprised of hero_bspline and hero_radspline objects, then x should be a list where each element of the list corresponds to the appropriate x argument for each element.

m

A positive integer indicating order of the difference penalty.

sparse

A logical value indicating if the result should be a sparse version of the Matrix-class.

spdiffpen

A logical value indicating whether spdiffpen should be used to compute the difference penalty. The default is FALSE.

digits

The number of digits to use when applying round to the distances.

Value

A list with the necessary components (ingredients)

Examples

# construct b-spline
object1 = bspline(nbasis = 10)
# sequence to evaluate
x1 = seq(0, 1, len = 11)
# assemble b-spline information
spline1 = assemble(object1, x1)

# assemble radial spline information
border = border.grid(lon, lat)
object2 = radspline(nknots = 16, border)
x2 = cbind(c(lon), c(lat))
spline2 = assemble(object2, x = x2)

# assemble for list of splines
object = list(object1, object2)
x = list(x1, x2)
splines = assemble(object, x)

hero documentation built on July 26, 2023, 5:11 p.m.