taper: Compute the Function a(x; rho).

View source: R/tapered_estimator.R

taperR Documentation

Compute the Function a(x; \rho).

Description

This helper function computes the taper function for a given window function as

a(x; \rho) = \left\{ \begin{array}{ll} w(2x/\rho) & 0 \leq x < \frac{1}{2} \rho, \\ 1 & \frac{1}{2}\rho \leq x \leq \frac{1}{2} \\ a(1 - x; \rho) & \frac{1}{2} < x \leq 1 \end{array} , \right.

where w(\cdot) is a continuous increasing function with w(0)=0, w(1)=1, \rho \in (0, 1], and x \in [0, 1]. The possible window function choices are found in window_ec.

Usage

taper(
  x,
  rho,
  window_name = c("tukey", "triangular", "sine", "power_sine", "blackman",
    "hann_poisson", "welch"),
  window_params = c(1),
  custom_window = FALSE
)

Arguments

x

A vector of numbers between 0 and 1 (inclusive).

rho

A scale parameter in (0, 1].

window_name

The name of the window_ec function to be used. Possible values are: tukey, triangular, power_sine, blackman_window, hann_poisson, welch. Alternatively, a custom window function can be provided, see the example.

window_params

A vector of parameters of the window function.

custom_window

If a custom window is to be used or not. Defaults to FALSE.

Value

A vector of taper values.

Examples

X <- c(0.1, 0.2, 0.3)
taper(X, 0.5, "tukey")
curve(taper(x, 1, "tukey"), from = 0, to = 1)
curve(taper(x, 1, "power_sine", c(4)), from = 0, to = 1)
my_taper <- function(x, ...) {
  return(x)
}
taper(X, 0.5, my_taper, custom_window = TRUE)

CovEsts documentation built on April 19, 2026, 5:06 p.m.

Related to taper in CovEsts...