GetMeanCI: Bootstrap pointwise confidence intervals for the mean...

GetMeanCIR Documentation

Bootstrap pointwise confidence intervals for the mean function for densely observed data.

Description

Note that bootstrap pointwise confidence intervals do not work for sparsely observed data.

Usage

GetMeanCI(Ly, Lt, level = 0.95, R = 999, optns = list())

Arguments

Ly

A list of n vectors containing the observed values for each individual. Missing values specified by NAs are supported for dense case (dataType='dense').

Lt

A list of n vectors containing the observation time points for each individual corresponding to each element in Ly. Each vector should be sorted in ascending order.

level

A number taking values in [0,1] determing the confidence level. Default: 0.95.

R

An integer holding the number of bootstrap replicates. Default: 999.

optns

A list of options; see FPCA for details.

Value

A list of two elements:

CI

A data frame holding three variables: CIgrid — the time grid where the CIs are evaluated; lower and upper — the lower and upper bounds of the CIs on CIgrid.

level

The confidence level of the CIs

.

Examples

n <- 30
tgrid <- seq(0,1,length.out=21)
phi1 <- function(t) sqrt(2)*sin(2*pi*t)
phi2 <- function(t) sqrt(2)*sin(4*pi*t)
Lt <- rep(list(tgrid), n)
Ly <- lapply(1:n, function(i){
 tgrid + rnorm(1,0,2) * phi1(tgrid) + rnorm(1,0,0.5) * phi2(tgrid) + rnorm(1,0,0.01)
 })
res <- GetMeanCI(Lt = Lt, Ly = Ly, level = 0.9)

fdapace documentation built on July 3, 2024, 5:08 p.m.