prepare.list {hero} | R Documentation |
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 class 'list'
prepare(data, x, splines, m = 2, sparse = TRUE, ...)
Arguments
data |
A list of |
x |
A list of values at which to evaluate the basis functions. See Examples and Details. |
splines |
A list of spline objects
( |
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
|
... |
Not currently implemented. |
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.
Value
A prepared_list
object.
Author(s)
Joshua French.
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
prepare.numeric
, prepare.matrix
,
prepare.array
Examples
# generate and prepare 3d data
set.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)