prepare.list: Prepare data array for sandwich smooth
Description
prepare.list prepares a list of data for the
sandwich smooth. The class of each element of
the list must be identical.
The dimensionality of data[[i]] and
the length of x must match. Specifically,
length(dim(data[[i]])) must equal
length(x). The dimensionality of
data[[i]] and the length of splines must match.
Specifically, length(dim(data[[i]])) must equal
length(splines). Note: If the splines
are preassembled, these can be passed using the argument
assembled so that this computation is not reperformed.
Usage
# S3 method for list
prepare(data, x, splines, m = 2, sparse = TRUE, ...)
Value
A prepared_list object.
Arguments
data
A list of numeric, matrix, or
array objects.
x
A list of values at which to evaluate the basis
functions. See Examples and Details.
splines
A list of spline objects
(hero_bspline and hero_radspline). See
Examples and Details.
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.
...
Not currently implemented.
Author
Joshua French.
Details
This function applies the functions
prepare.numeric,
prepare.matrix, and
prepare.array to each element of the list,
so relevant restrictions in the arguments may be
found there.
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>
# generate and prepare 3d dataset.seed(9)
dat = lapply(1:3, function (i) generate.data3d())
x = dat[[1]]$x
data = lapply(dat, getElement, name = "data3d")
obj = prepare(data, x = x)
h = hero(obj)