create.prepared_list {hero} | R Documentation |
Manually create a prepared_list
Description
create.prepared_list
creates a
prepared_list
manually. Typically, one would
simply use the prepare.list
, but there are
situations where the data
argument would be too
large to read into memory.
This function assumes that
the user has used the assemble
function to
construct a list of the relevant assembled_splines
and manually computed Ytilde
for a number of
relevant data
observations and stored them in a
list. The user should also manually compute the sum of
the squared data
for each data
observation.
The user must also specify the dimensions of each data
set (which are assumed to be the same) as a vector and
provide the relevant set of values at which each
data
object is observed. See Examples.
Usage
create.prepared_list(assembled, x, Ytilde, sum_ysq, n)
Arguments
assembled |
A list of |
x |
The list of arguments at which to evaluate each
of the splines used to construct |
Ytilde |
A list of |
sum_ysq |
A vector with the sum of squared |
n |
The dimensions of the |
Value
A prepared list.
Examples
# generate and prepare 3d data
set.seed(9)
dat = generate.data3d()
# list giving the locations to evaluate the basis functions
x = dat$x
# construct a set of basic B-splines for each dimension
splines = default.splines(x)
# construct assembled splines from splines list
a = assemble(splines, x)
# imagine there are 4 data obsevations we want to smooth
# but that they can't be loaded into memory
Ytilde = vector("list", 4)
sum_ysq = numeric(4)
# prepare each data set manually
# notice the use of the assembled arguments so that
# the splines are not "assembled" again for each data set
for(i in seq_along(Ytilde)) {
data = generate.data3d()$data3d
Ytilde[[i]] = prepare(data, x = x, splines = splines,
assembled = a)
sum_ysq[i] = sum(data^2)
}
n = dim(data)
p = create.prepared_list(assembled = a, x = x,
Ytilde = Ytilde, sum_ysq = sum_ysq,
n = n)