For a function \(f(t), t\in\Omega\), and a basis function sequence \(\{\rho_k\}_{k\in\kappa}\),
basis expansion is to compute \(\int_\Omega f(t)\rho_k(t) dt\).
Here we do basis expansion for all \(f_i(t), t\in\Omega = [t_0,t_0+T]\) in functional variable data, \(i=1,\dots,n\).
We compute a matrix \((b_{ik})_{n\times p}\), where \(b_{ik} = \int_\Omega f(t)\rho_k(t) dt\).
The basis we use here is the functional principal component (FPC) basis induced by
the covariance function of the functional variable.
Suppose \(K(s,t)\in L^2(\Omega\times \Omega)\), \(f(t)\in L^2(\Omega)\).
Then \(K\) induces an linear operator \(\mathcal{K}\) by
$$(\mathcal{K}f)(x) = \int_{\Omega} K(t,x)f(t)dt$$
If \(\xi(\cdot)\in L^2(\Omega)\) such that
$$\mathcal{K}\xi = \lambda \xi$$
where \(\lambda\in {C}\),
we call \(\xi\) an eigenfunction/eigenvector of
\(\mathcal{K}\), and \(\lambda\) an eigenvalue associated with \(\xi\).
For a stochastic process \(\{X(t),t\in\Omega\}\)
we call the orthogonal basis \(\{\xi_k\}_{k=1}^\infty\)
corresponding to eigenvalues \(\{\lambda_k\}_{k=1}^\infty\)
(\(\lambda_1\geq\lambda_2\geq\dots\)),
induced by
$$K(s,t)=\text{Cov}(X(t),X(s))$$
a functional principal component (FPC) basis for \(L^2(\Omega)\).
FPC_basis_expansion(object, npc)# S4 method for functional_variable,integer
FPC_basis_expansion(object, npc)
Returns a numeric matrix, \((b_{ik})_{n\times p}\),
with an extra attribute numeric_basis
, which represents the FPC basis.
The attribute numeric_basis
is a numeric_basis
object. See numeric_basis
.
The slot basis_function
is also a numeric matrix, denoted as \((\zeta_{jk})_{m\times p}\)
$$b_{ik} = \int_\Omega f(t)\xi_k(t) dt$$
$$\zeta_{jk} = \xi_k(t_j)$$
a functional_variable
class object.
The minimum and maximum of the slot t_points
should be respectively
equal to the slot t_0
and slot t_0
plus slot period
.
The number of functional principal components. See npc
in fpca.sc
.
Heyang Ji
n<-50; ti<-seq(0,1,length.out=101)
X<-t(sin(2*pi*ti)%*%t(rnorm(n,0,1)))
object = functional_variable(X = X, t_0 = 0, period = 1, t_points = ti)
a = FPC_basis_expansion(object,3L)
dim(a)
Run the code above in your browser using DataLab