# 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)
Run the code above in your browser using DataLab