predict.FRESHD {FRESHD}R Documentation

Make Prediction From a FRESHD Object

Description

Given covariate data this function computes the linear predictors based on the estimated model coefficients in an object produced by the function maximin or magging. Note that the data can be supplied in two different formats: i) for wavelet based models as a string indicating the wavelet used to produce the model object. ii) for models with custom design as a list of one, two or three Kronecker component matrices each of size n_i' \times p_i, i = 1, 2, 3. Note x will typically be the original design (covariate data) that was used to produce object using maximin or magging so n_i' is the number of marginal data points in the ith dimension i.e. n_i' = n_i.

Usage

## S3 method for class 'FRESHD'
predict(object, x, ...)

Arguments

object

An object of class FRESHD, produced with maximin or magging.

x

An object that should be like the input to the call that produced object. For models with custom design a list like the one supplied to produce object and for a wavelet design the name of the wavelet used to produce object.

...

ignored.

Value

If x is a string indicating a wavelet an array of the same size as the input data used to produce object. Otherwise an array of size n'_1 \times \cdots \times n'_d, with d\in \{1,2,3\}.

Author(s)

Adam Lund

Examples

##size of example
set.seed(42)
G = 50; N1 = 2^10; p = 101; J = 3; amp = 20; sigma2 = 10
y <- matrix(0, N1, G)
z <- seq(0, 2, length.out = N1)
sig <- cos(10 * pi * z) + 1.5 * sin(5 * pi * z)
for (i in 1:G){
freqs <- sample(1:100, size = J, replace = TRUE)
y[, i] <- sig * 2 + rnorm(N1, sd = sqrt(sigma2))
for (j in 1:J){
y[, i] <- y[, i] + amp * sin(freqs[j] * pi * z + runif(1, -pi, pi))
}
}
system.time(fitmm <- maximin(y, "la8", alg = "aradmm", kappa = 0.95))
mmy <- predict(fitmm, "la8")
plot(mmy[, 2], type = "l")
lines(sig, col = "red")


[Package FRESHD version 1.0 Index]