optim.np {fda.usc}R Documentation

Smoothing of functional data using nonparametric kernel estimation

Description

Smoothing of functional data using nonparametric kernel estimation with cross-validation (CV) or generalized cross-validation (GCV) methods.

Usage

optim.np(
  fdataobj,
  h = NULL,
  W = NULL,
  Ker = Ker.norm,
  type.CV = GCV.S,
  type.S = S.NW,
  par.CV = list(trim = 0, draw = FALSE),
  par.S = list(),
  correl = TRUE,
  verbose = FALSE,
  ...
)

Arguments

fdataobj

fdata class object.

h

Smoothing parameter or bandwidth.

W

Matrix of weights.

Ker

Type of kernel used, by default normal kernel.

type.CV

Type of cross-validation. By default generalized cross-validation (GCV) method. Possible values are GCV.S and CV.S

type.S

Type of smothing matrix S. By default S is calculated by Nadaraya-Watson kernel estimator (S.NW). Possible values are S.KNN, S.LLR, S.LPR and S.LCR.

par.CV

List of parameters for type.CV: trim, the alpha of the trimming and draw=TRUE

par.S

List of parameters for type.S: tt for argvals, h for bandwidth, Ker for kernel, etc.

correl

logical. If TRUE the bandwidth parameter h is computed following the procedure described for De Brabanter et al. (2018). (option avalaible since v1.6.0 version)

verbose

If TRUE information about GCV values and input parameters is printed. Default is FALSE.

...

Further arguments passed to or from other methods. Arguments to be passed for kernel method.

Details

Calculate the minimum GCV for a vector of values of the smoothing parameter h. Nonparametric smoothing is performed by the kernel function. The type of kernel to use with the parameter Ker and the type of smothing matrix S to use with the parameter type.S can be selected by the user, see function Kernel. W is the matrix of weights of the discretization points.

Value

Returns GCV or CV values calculated for input parameters.

Note

min.np deprecated.

Author(s)

Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@udc.es

References

Ferraty, F. and Vieu, P. (2006). Nonparametric functional data analysis. Springer Series in Statistics, New York.

Wasserman, L. All of Nonparametric Statistics. Springer Texts in Statistics, 2006.

Hardle, W. Applied Nonparametric Regression. Cambridge University Press, 1994.

De Brabanter, K., Cao, F., Gijbels, I., Opsomer, J. (2018). Local polynomial regression with correlated errors in random design and unknown correlation structure. Biometrika, 105(3), 681-69.

Febrero-Bande, M., Oviedo de la Fuente, M. (2012). Statistical Computing in Functional Data Analysis: The R Package fda.usc. Journal of Statistical Software, 51(4), 1-28. https://www.jstatsoft.org/v51/i04/

See Also

Alternative method: optim.basis

Examples

## Not run: 
# Exemple, phoneme DATA
data(phoneme)
mlearn<-phoneme$learn[1:100]

out1<-optim.np(mlearn,type.CV=CV.S,type.S=S.NW)
np<-ncol(mlearn)
# variance calculations
y<-mlearn
out<-out1
i<-1
z=qnorm(0.025/np)
fdata.est<-out$fdata.est
tt<-y[["argvals"]]
var.e<-Var.e(y,out$S.opt)
var.y<-Var.y(y,out$S.opt)
var.y2<-Var.y(y,out$S.opt,var.e)

# plot estimated fdata and point confidence interval
upper.var.e<-fdata.est[i,]-z*sqrt(diag(var.e))
lower.var.e<-fdata.est[i,]+z*sqrt(diag(var.e))
dev.new()
plot(y[i,],lwd=1, 
ylim=c(min(lower.var.e$data),max(upper.var.e$data)),xlab="t")
lines(fdata.est[i,],col=gray(.1),lwd=1)
lines(fdata.est[i,]+z*sqrt(diag(var.y)),col=gray(0.7),lwd=2)
lines(fdata.est[i,]-z*sqrt(diag(var.y)),col=gray(0.7),lwd=2)
lines(upper.var.e,col=gray(.3),lwd=2,lty=2)
lines(lower.var.e,col=gray(.3),lwd=2,lty=2)
legend("bottom",legend=c("Var.y","Var.error"),
col = c(gray(0.7),gray(0.3)),lty=c(1,2))

## End(Not run)


[Package fda.usc version 2.1.0 Index]