prepare.sts: Prepare 'starray' for sandwich smooth

View source: R/prepare.sts.R

prepare.stsR Documentation

Prepare starray for sandwich smooth

Description

prepare.starray prepares a spatio-temporal array for the sandwich smooth.

Usage

## S3 method for class 'sts'
prepare(
  data,
  coords,
  times,
  rs,
  bs,
  m = 2,
  sparse = TRUE,
  spdiffpen = TRUE,
  ...
)

Arguments

data

An starray

coords

A two-dimensional matrix-like object with non-NULL dimensions.

times

The vector of times at which the data were observed.

rs

A hero_radspline produced by the radspline or connect functions.

bs

A hero_bspline produced by the bspline function.

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.

...

Not currently implemented.

Value

A prepared_sts object.

Author(s)

Joshua French. Based off code by Luo Xiao (see References).

References

Xiao, L. , Li, Y. and Ruppert, D. (2013), Fast bivariate P-splines: the sandwich smoother. J. R. Stat. Soc. B, 75: 577-599. <doi:10.1111/rssb.12007>

See Also

bspline, radspline

Examples

# construct basis functions
border = border.grid(lon, lat)
rs = radspline(nknots = 36, poverlap = 3,
               border = border, longlat = TRUE)
bs = bspline(c(1, 30), nbasis = 6)
splines = list(rs, bs)
data = as.sts(tasmax)
p = prepare(data, coords = cbind(c(lon), c(lat)),
            times = 1:30, rs = rs, bs = bs)

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