# Create functional data
t <- seq(0, 1, length.out = 50)
X <- matrix(0, 20, 50)
for (i in 1:20) X[i, ] <- sin(2*pi*t) + rnorm(50, sd = 0.1)
fd <- fdata(X, argvals = t)
# Bootstrap CI for the mean function (returns numeric vector)
ci_mean <- fdata.bootstrap.ci(fd,
statistic = function(x) as.numeric(mean(x)$data),
n.boot = 100)
# Bootstrap CI for depth values
ci_depth <- fdata.bootstrap.ci(fd,
statistic = function(x) depth.FM(x),
n.boot = 100)
Run the code above in your browser using DataLab