Learn R Programming

hero (version 0.6)

prepare.starray: Prepare starray for sandwich smooth

Description

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

Usage

# S3 method for starray
prepare(data, x, y, times, rs, bs, m = 2, sparse = TRUE, spdiffpen = TRUE, ...)

Value

A prepared_starray object.

Arguments

data

An starray

x

A vector or matrix of x coordinates. See Details.

y

A vector or matrix of y coordinates. See Details.

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.

Author

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

Run this code
# 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)
data = starray(tasmax)
p = prepare(data, x = lon, y = lat, times = 1:30,
            rs = rs, bs = bs)

Run the code above in your browser using DataLab