Description Usage Arguments Details Value Author(s) References See Also Examples
This function is used to perform cross-validation and build the final model using the signal compression approach for the following linear function-on-function regression model with main effects, two-way interaction effects and quadratic effects. Let {X_i(s), 1≤ i ≤ p} be p potential functional predictors. The model is given by
Y(t)= μ(t)+∑_{i \in M}\int_{a_i}^{b_i} X_i(s)β_i(s,t)ds+∑_{(i,j) \in I}\int_{a_i}^{b_i}\int_{a_j}^{b_j} X_i(u)X_j(v)γ_{ij}(u,v,t)dudv+ε(t),
where μ(t) is the intercept function. The index set M of main effects is a subset of {1,...,p}, and the index set I of interactions and quadratic effects is a subset of the collection of all possible pairs {(i,j), 1≤ i≤ j≤ p}. The {β_i(s,t), i\in M} and {γ_{ij}(u,v,t),(i,j)\in I} are the corresponding coefficient functions. The ε(t) is the noise function.
1 2 3 4 | cv.ff.interaction(X, Y, t.x, t.y, main.effect, interaction.effect=NULL,
adaptive=FALSE, s.n.basis=40, t.n.basis=40, inter.n.basis=20,
basis.type.x="Bspline", basis.type.y="Bspline", K.cv=5,
upper.comp=8, thresh=0.01)
|
X |
a list of p potential functional predictors. Its i-th element is the n*m_i data matrix for the i-th potential functional predictor X_i(s), where n is the sample size and m_i is the number of observation time points for X_i(s). |
Y |
the n*m data matrix for the functional response Y(t), where n is the sample size and m is the number of the observation time points for Y(t). |
t.x |
a list of length p. Its i-th element is the vector of observation time points of the i-th functional predictor X_i(s), 1≤ i≤ p. |
t.y |
the vector of observation time points of the functional response Y(t). |
main.effect |
a vector of indices for main effects. It is a subset of {1,2,...,p}. |
interaction.effect |
a matrix of two columns. Each row of this matrix specifies the index of a two-way interaction or a quadratic effect. Default is NULL. |
adaptive |
a logic value indicating whether using adaptive penalty that has different smoothness tuning parameters for different target functions (see Details). Default is FALSE. |
s.n.basis |
the number of basis functions used for estimating the functions ψ_{ik}(s)'s (see Details). Default is 40. |
t.n.basis |
the number of basis functions used for estimating the functions w_{k}(t)'s. Default is 40. |
inter.n.basis |
the number of one-dimensional basis functions used to construct the tensor product basis functions for estimating the functions φ_{ijk}(u,v)'s. Default is 20. |
basis.type.x |
the type of basis functions ψ_{ik}(s)'s. Only "BSpline" (default) and "Fourier" are supported. |
basis.type.y |
the type of basis functions w_{k}(t)'s. Only "BSpline" (default) and "Fourier" are supported. |
K.cv |
the number of CV folds. Default is 5. |
upper.comp |
the upper bound for the maximum number of components to be calculated. Default is 10. |
thresh |
a number between 0 and 1 used to determine the maximum number of components we need to calculate. The maximum number is between one and the "upp.comp" above. The optimal number of components will be chosen between 1 and this maximum number, together with other tuning parameters by cross-validation. A smaller thresh value leads to a larger maximum number of components and a longer running time. A larger thresh value needs less running time, but may miss some important components and lead to a larger prediction error. Default is 0.01. |
This method uses the decomposition of the coefficient functions
β_i(s,t)=ψ_{i1}(s)w_1(t)+...+ψ_{iK}(s)w_K(t), i\in M,
and
γ_i(s,t)=φ_{ij,1}(s)w_1(t)+...+φ_{ij,K}(s)w_K(t), (i, j) \in I.
where for each k>0, {ψ_{ik}(s), i\in M}, {φ_{ij,k}(s), (i,j)\in I} are estimated by solving a generalized functional eigenvalue problem with the nonadaptive penalty
λ∑_{i\in M} \{|| ψ_{ik}||^2+ τ ||ψ''_{ik}||^2\} + λ∑_{(i,j)\in I} \{|| φ_{ij,k}||^2+ τ (||\partial_{uu}ψ_{ij,k}||^2+||\partial_{uv}ψ_{ij,k}||^2+||\partial_{vv}ψ_{ij,k}||^2)\}
or the adaptive penalty
λ∑_{i\in M} \{ω_{ik}^{(0)}||ψ_{ik}||^2+ τ ω_{ik}^{(2)}||ψ''_{ik}||^2\}+
+ λ∑_{(i,j)\in I} \{ω_{ij,k}^{(00)}|| φ_{ij,k}||^2+ τ (ω_{ij,k}^{(20)}||\partial_{uu}ψ_{ij,k}||^2+ω_{ij,k}^{(11)}||\partial_{uv}ψ_{ij,k}||^2+ω_{ij,k}^{(02)}||\partial_{vv}ψ_{ij,k}||^2)\}
and then {w_{k}(t), k>0} are estimate by regressing Y(t) on \{\hat{z}_{1},... \hat{z}_{K}\} with nonadaptive penalty κ ∑_{k=0}^K \|w''_k\|^2 or adaptive penalty κ ∑_{k=0}^K ω_k^{(t)}\|w''_k\|^2 tuned by the smoothness parameter κ. Here \hat{z}_{k}= ∑_{i \in M}\int_{a_i}^{b_i} X_{i}(s)\hat{ψ}_{ik}(s)ds +∑_{(i,j) \in I}\int_{a_i}^{b_i}\int_{a_j}^{b_j} X_{i}(u)X_{j}(v)\hat{φ}_{ij,k}(u,v)dudv and then centered around its sample mean.
An object of the “cv.ff.interaction” class, which is used in the function pred.ff.interaction
for prediction and getcoef.ff.interaction
for extracting the estimated coefficient functions.
fitted_model |
a list for interval use. |
y_penalty_inv |
a list for internal use. |
X |
the input |
Y |
the input |
x.smooth.params |
a list for internal use. |
y.smooth.params |
a list for internal use. |
basis.types |
a vector including |
Xin Qi and Ruiyan Luo
Ruiyan Luo and Xin Qi (2018) Interaction model and model selection for function-on-function regression, Journal of Computational and Graphical Statistics. https://doi.org/10.1080/10618600.2018.1514310
pred.ff.interaction
, getcoef.ff.interaction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
#################################################################################
# Example: interaction function-on-function model with
# specified effects
###############################################################################
ptm <- proc.time()
library(FRegSigCom)
data(ocean)
Y=ocean[[1]]
Y.train=Y[1:50,]
Y.test=Y[-(1:50),]
t.y=seq(0,1, length.out = ncol(Y))
X.list=list()
X.train.list=list()
X.test.list=list()
t.x.list=list()
for(i in 1:4)
{
X.list[[i]]=ocean[[i+1]]
X.train.list[[i]]=X.list[[i]][1:50,]
X.test.list[[i]]=X.list[[i]][-(1:50),]
t.x.list[[i]]=seq(0,1, length.out = ncol(X.list[[i]]))
}
main.effect=1:2
inter.effect=rbind(c(1,1), c(1,2), c(2,2))
fit.fix.adaptive=cv.ff.interaction(X.train.list, Y.train, t.x.list, t.y,
adaptive=TRUE, main.effect, inter.effect)
Y.pred=pred.ff.interaction(fit.fix.adaptive, X.test.list)
error<- mean((Y.pred-Y.test)^2)
print(c(" prediction error=", error))
print(proc.time()-ptm)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.