step.ff.interaction: Stepwise variable selection procedure for FOF regression...

Description Usage Arguments Value Author(s) References Examples

Description

This function conducts the stepwise procedure to select main effects, two-way interaction and quadratic effects for the following family of linear function-on-function interaction models. Let {X_i(s),1≤ i≤ p} be p potential functional predictors. The family of models 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 the main effects is a subset of {1,...,p}, and the index set I of the interactions and quadratic effects is a subset of the collection of all possible pairs {(i,j), 1≤ i≤ j≤ p}. We require that the models in each step satisfy the hierarchy principle: if the interaction X_iX_j is included in the model, both the main effects X_i and X_j are included. 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. When the final model is selected, this function also fits the selected model.

Usage

1
2
3
step.ff.interaction(X, Y, t.x, t.y, 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)

Arguments

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 obesrvation 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).

adaptive

a logic value indicating whether using adaptive penalty that uses different smoothness tuning parameters for different target functions. Default is FALSE.

s.n.basis

the number of basis functions used for estimating the functions ψ_{ik}(s)'s (see details in cv.ff.interaction). 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 8.

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.

Value

An object of the “step.ff.interaction” class, which is used in the function pred.ff.interaction for prediction and getcoef.ff.interaction for extracting the estimated coefficient functions.

opt.main.effects

a vector of indices of the selected main effects.

opt.interaction.effects

a matrix of two columns. Each row specifies the indices of a selected two-way interaction or quadratic effect.

fitted_model

a list of the output of the fitted selected model and only for internal use.

y_penalty_inv

a list for interval use.

X

the input X.

Y

the input Y.

x.smooth.params

a list for internal use.

y.smooth.params

a list for internal use.

Author(s)

Xin Qi and Ruiyan Luo

References

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

Examples

 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
35
36
37
38
39
40
41
42
43
library(FRegSigCom)
data(ocean)

Y=ocean$Salinity
X=list()
X[[1]]=ocean$Potential.density
X[[2]]=ocean$Temperature
X[[3]]=ocean$Oxygen
n.curves=length(X)
ntot=dim(Y)[1]
ntrain=50
ntest=ntot-ntrain
X.uncent=X
for(i in 1:n.curves){
  X[[i]]=scale(X.uncent[[i]],center=TRUE, scale=FALSE)
}
lengthX=dim(X[[1]])[2]
lengthY=dim(Y)[2]
t.x=seq(0,1,length=lengthX)
t.y=seq(0,1,length=lengthY)
I.train=sample(1:ntot, ntrain)
X.train=list()
X.test=list()
t.x.all=list()
for(j in 1:n.curves){
  X.train[[j]]=X[[j]][I.train,]
  X.test[[j]]=X[[j]][-I.train,]
  t.x.all[[j]]=t.x
}
Y.train=Y[I.train, ]
Y.test=Y[-I.train, ]


###############################
#model selection
###############################

fit.step=step.ff.interaction(X.train, Y.train, t.x.all, t.y)
Y.pred=pred.ff.interaction(fit.step,  X.test)
error.selected=mean((Y.pred-Y.test)^2)
print(c("error.selected=", error.selected))
#coef.obj=getcoef.ff.interaction(fit.step)
#str(coef.obj)

FRegSigCom documentation built on May 1, 2019, 9:45 p.m.