50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

kader (version 0.0.8)

mse_hat: MSE Estimator

Description

Vectorized (in σ) function of the MSE estimator in eq. (2.3) of Srihera & Stute (2011), and of the analogous estimator in the paragraph after eq. (6) in Eichner & Stute (2013).

Usage

mse_hat(sigma, Ai, Bj, h, K, fnx, ticker = FALSE)

Arguments

sigma

Numeric vector (σ1,,σs) with s1.

Ai

Numeric vector expecting (x0X1,,x0Xn)/h, where (usually) x0 is the point at which the density is to be estimated for the data X1,,Xn with h=n1/5.

Bj

Numeric vector expecting (J(1/n),,J(n/n)) in case of the rank transformation method, but (θ^X1,,θ^Xn) in case of the non-robust Srihera-Stute-method. (Note that this the same as argument Bj of adaptive_fnhat!)

h

Numeric scalar, where (usually) h=n1/5.

K

Kernel function with vectorized in- & output.

fnx

fn(x0)= mean(K(Ai))/h, where here typically h=n1/5.

ticker

Logical; determines if a 'ticker' documents the iteration progress through sigma. Defaults to FALSE.

Value

A vector with corresponding MSE values for the values in sigma.

See Also

For details see bias_AND_scaledvar.

Examples

Run this code
# NOT RUN {
require(stats)

set.seed(2017);     n <- 100;     Xdata <- sort(rnorm(n))
x0 <- 1;      Sigma <- seq(0.01, 10, length = 11)

h <- n^(-1/5)
Ai <- (x0 - Xdata)/h
fnx0 <- mean(dnorm(Ai)) / h   # Parzen-Rosenblatt estimator at x0.

 # non-robust method:
theta.X <- mean(Xdata) - Xdata
kader:::mse_hat(sigma = Sigma, Ai = Ai, Bj = theta.X,
  h = h, K = dnorm, fnx = fnx0, ticker = TRUE)

 # rank transformation-based method (requires sorted data):
negJ <- -J_admissible(1:n / n)   # rank trafo
kader:::mse_hat(sigma = Sigma, Ai = Ai, Bj = negJ,
  h = h, K = dnorm, fnx = fnx0, ticker = TRUE)

# }

Run the code above in your browser using DataLab