Description Usage Arguments Details Value References Examples
The functions compute the leave-one-out cross-validation of functional data. It applies also to already estimated models.
1 2 3 4 5 6 7 |
y |
A T \times n matrix of data points, when T is the number of periods and n the number of individuals. |
t |
A numeric vector of time units. The number of elements is equal to the
number of rows of |
lamvec |
A vector of regularization parameters that penalizes for the absence of smoothness. |
kvec |
A vector of integers that indicates the number of basis. |
L |
Either a
nonnegative integer defining an order of a derivative or a linear
differential operator (see |
create_basis |
The function used to create the basis object (see
|
maxit |
The maximum number of iteration for the Newton method |
tol |
The tolerance parameter for the stopping rule of the Newton method |
obj |
Object of class "myfda" if we want the cross-validation of an already fitted model |
typels |
The |
addDat |
If TRUE, fake observations are added before and after assuming stationarity. for the estimation, the time span is expanded accordingly. |
... |
Other argument that is passed to |
It returns a matrix of cross-validations. The rows are for the lambda, and the columns for the number of basis.
fdaCV
returns a matrix of cross-validations. The rows are for the lambda,
and the columns for the number of basis.
nlFdaCV
returns a list with the following items:
cv |
The cross-validation matrix (see details) |
convergence |
A matrix returning |
kvec |
The vector of integers that indicates the number of basis. |
lamvec |
The vector of regularization parameters. |
info |
An array of convergence codes for all estimations in the process of computing the cross-validations |
Ramsay, James O., & Silverman, Bernard W. (2005), Functional Data Analysis, Springer, New York.
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 | data(GDPv56)
t <- seq(0,1,len=nrow(GDPv56))
## Linear estimation
####################
# From an object
res <- coefEst(y=GDPv56, t=t, lam=0.003, k=15)
fdaCV(obj=res)
# CV with the estimation
cv <- fdaCV(y=GDPv56,t,10^seq(-5,1,len=4), k=5:7)
cv
## Nonlinear Estimation
#######################
res <- nlCoefEst(y=GDPv56, t=t, lam=0.003, k=10)
nlFdaCV(obj=res)
# CV with the estimation
cv <- nlFdaCV(y=GDPv56,t,10^seq(-5,1,len=4), k=5:7)
## Nonlinear Estimation with zeros
##################################
data(simData)
t <- seq(0,1,length.out=5)
cv <- nlFdaCV(y=simData, t=t, lam=c(1e-5, 1e-2), k=c(6:8), addDat=TRUE)
print(cv, conv=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.