# ComputeBW: Data-driven bandwidth vector In curstatCI: Confidence Intervals for the Current Status Model

## Description

The function ComputeBW computes the bandwidth that minimizes the pointwise Mean Squared Error using the subsampling principle in combination with undersmoothing.

## Usage

 `1` ```ComputeBW(data, x) ```

## Arguments

 `data` Dataframe with three variables: tObservation points t sorted in ascending order. All observations need to be positive. The total number of unique observation points equals `length(t)`. freq1Frequency of observation t satisfying x ≤ t. The total number of observations with censoring indicator δ =1 equals `sum(freq1)`. freq2Frequency of observation t. The sample size equals `sum(freq2)`. If no tied observations are present in the data `length(t)` equals `sum(freq2)`. `x` numeric vector containing the points where the confidence intervals are computed.

## Value

bw data-driven bandwidth vector of size `length(x)` containing the bandwidth value for each point in x.

## References

Groeneboom, P. and Hendrickx, K. (2017). The nonparametric bootstrap for the current status model. Electronic Journal of Statistics 11(2):3446-3848.

`vignette("curstatCI")`
 ``` 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``` ```library(Rcpp) library(curstatCI) # sample size n <- 1000 # truncated exponential distribution on (0,2) set.seed(100) t <- rep(NA, n) delta <- rep(NA, n) for(i in (1:n) ){ x<-runif(1) y<--log(1-(1-exp(-2))*x) t[i]<-2*runif(1); if(y<=t[i]){ delta[i]<-1} else{delta[i]<-0}} A<-cbind(t[order(t)], delta[order(t)], rep(1,n)) # x vector grid<-seq(0.1,1.9 ,by = 0.1) # data-driven bandwidth vector bw <- ComputeBW(data =A, x = grid) plot(grid, bw) ```