Learn R Programming

sharpPen (version 2.0)

dpilc_PTW: dpilc_PTW: Local Polynomial Bandwith Estimation with Blockwise Selection and Pointwise Results

Description

The function uses raw or trimmed data, applies grid-based binning, and estimates local bandwidth based on the provided parameters.

Usage

dpilc_PTW(xx, yy, blockmax = 5, divisor = 20, trim = 0.01, proptrun = 0.05, 
          gridsize = 401L, range.x = range(x), use_raw_data = FALSE)

Value

A list with three elements:

x

A numeric vector of x-values.

y

A numeric vector of y-values.

h

A numeric vector of bandwidth values computed for each corresponding x-value.

Arguments

xx

A numeric vector of x-values.

yy

A numeric vector of y-values, corresponding to the x-values in xx.

blockmax

An integer specifying the maximum number of blocks to be used in the blockwise selection. Default is 5.

divisor

An integer that controls the block size. Default is 20.

trim

A numeric value between 0 and 1 specifying the proportion of data to be trimmed from the extremes. Default is 0.01.

proptrun

A numeric value between 0 and 1 indicating the proportion of data to be excluded from the running procedure. Default is 0.05.

gridsize

An integer specifying the number of grid points to be used. Default is 401L.

range.x

A numeric vector of length 2 indicating the range over which the smoothing is applied. Default is the range of xx.

use_raw_data

A logical value indicating whether to use the raw data (TRUE) or trimmed data (FALSE) for analysis (default is FALSE).

Author

D.Wang and W.J.Braun

Details

This function provides a point-wise calculation of the functional theta(4,4) at each data point \(x_i\). It employs various auxiliary functions for binning the data, calculating local polynomial estimations, and performing necessary cross-validation. The function returns a point-wise estimate of the relevant quantity, which is used for localized analysis of the data distribution.

The core methodology used in this function is based on the nonparametric regression framework. For detailed information on the theoretical aspects and derivations, refer to Chapter 3 of Fan and Gijbels (1996).

References

Fan, J., & Gijbels, I. (1996). Local Polynomial Modelling and its Applications. Chapman and Hall/CRC.

See Also

Examples

Run this code
  # Example usage:
  x <- rnorm(100)
  y <- rnorm(100)

  # Run the pointwise estimation
  result <- dpilc_PTW(x, y, blockmax = 5, divisor = 20, trim = 0.01, 
                      proptrun = 0.05, gridsize = 40, range.x = range(x), 
                      use_raw_data = TRUE)
  
  # Inspect the result
  plot(result$x, result$h, type = "l", col = "blue", xlab = "X", ylab = "Bandwidth Estimate")

Run the code above in your browser using DataLab