MeanEst {KFPCA} | R Documentation |
Local linear estimates of mean function
Description
Local linear estimates of mean function.
Usage
MeanEst(Lt, Ly, kern, bw, gridout)
Arguments
Lt |
A |
Ly |
A |
kern |
A |
bw |
A scalar denoting the bandwidth. |
gridout |
A |
Value
A list
containing the following components:
Grid |
A |
mean |
A |
Examples
# Generate data
n <- 100
interval <- c(0, 10)
lambda_1 <- 9 #the first eigenvalue
lambda_2 <- 1.5 #the second eigenvalue
eigfun <- list()
eigfun[[1]] <- function(x){cos(pi * x/10)/sqrt(5)}
eigfun[[2]] <- function(x){sin(pi * x/10)/sqrt(5)}
score <- cbind(rnorm(n, 0, sqrt(lambda_1)), rnorm(n, 0, sqrt(lambda_2)))
DataNew <- GenDataKL(n, interval = interval, sparse = 6:8, regular = FALSE,
meanfun = function(x){x}, score = score,
eigfun = eigfun, sd = sqrt(0.1))
# Mean function estimate at all observation time points
bwOpt <- GetGCVbw1D(DataNew$Lt, DataNew$Ly, kern = "epan")
meanest <- MeanEst(DataNew$Lt, DataNew$Ly, kern = "epan", bw = bwOpt,
gridout = sort(unique(unlist(DataNew$Lt))))
plot(meanest$Grid, meanest$mean)
[Package KFPCA version 2.0 Index]