Description Usage Arguments Value References Examples
It computes the cross-validation for a given lambda and k or find the optimal lambda for a given k (see below).
1 2 3 4 5 6 7 | funcregCV(form, create_basis=create.bspline.basis, LD=2, lambda,
k, CstInt=FALSE, regularized=TRUE, alpha=1e-5, data=NULL,
obj=NULL, ...)
getFuncregLam(form, create_basis=create.bspline.basis, LD=2, lam0,
k, regularized=TRUE, CstInt=FALSE, data=NULL, loglam=FALSE,
method="BFGS", alpha=1e-5, optimArg=list(), ...)
|
obj |
An object of class "funcreg". If |
form |
A formula for the functional regression. Arguments are
objects of class "myfda" obtained either by |
create_basis |
The function used to create the basis object (see
|
LD |
Either a nonnegative integer defining an order of a
derivative or a linear differential operator (see
|
data |
An optional list of |
lambda |
A vector of regularization parameters that penalizes for the absence of
smoothness. The dimention is 2 times the number of regressors plus 1
if there is an intercept and if |
lam0 |
Initial value of lambda for the minimization of the cross-validation |
k |
A vector of integers representing the number of basis for each
functional parameter. The first is for the intercept (if there is an
intercept and that |
regularized |
If |
CstInt |
If |
loglam |
If |
method |
The algorithm used by |
optimArg |
A list of additional arguments to pass to
|
alpha |
The regularization parameter. The value is added to the diagonal of the regression matrix to make sure it is positive definite. |
... |
Additional arguments to be passed to |
'funregCV' returns the value of the leave-one-out cross-validation. The attributes 'convergence', returns convergence code for each estimation.
'getFuncregLam' returns the fitted object of class 'funcreg' using the
optimal lambda. The argument 'optimRes' gives the optim
output from the minimization of the cross-validation.
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 32 33 34 | data(GDPv56)
## We just create response and a covariate artificialy from the GDP
## series
y <- GDPv56[,1:30]
x <- GDPv56[,31:60]
t <- seq(0,1,len=nrow(y))
## First we create the "myfda" objects
yfd <- coefEst(y, t, .0004, 15, 2)
xfd <- coefEst(x, t, .0004, 15, 2)
## with the object
res <- funcreg(yfd~xfd, k=c(5,5), lambda=c(.001,.001,.001))
funcregCV(obj=res)
## without object
funcregCV(yfd~xfd, k=c(5,5), lambda=c(.001,.001,.001))
## With the default values
getFuncregLam(yfd~xfd, k=c(5,5), lam0=c(.001,.001,.001))
## With upper and lower bound
getFuncregLam(yfd~xfd, k=c(5,5), lam0=c(.001,.001,.001), method="L-BFGS-B",
optimArg=list(lower=c(0,0,0),upper=c(200,200,200)))
## With loglam
res <- getFuncregLam(yfd~xfd, k=c(5,5), lam0=c(-3,-3,-3), loglam=TRUE)
res
## Get info about the optim()
res$optimRes
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.