Skip to contents

For known true rates \(\theta\) and noise \(e\), the weighted squared error of \((1-B)(\theta+e) + B\bar y\) against \(\theta\), next to the closed form \((1-B)^2 S_e + B^2 S_\theta\) (Research.P19Shrinkage.loss_eq), which holds exactly when the noise law \(\sum w e = 0\), \(\sum w \theta e = 0\) does; the minimiser \(B^*\) and its loss (loss_min, loss_bstar_eq).

Usage

morie_shrinkage_loss(theta, noise, weights = NULL, B)

Arguments

theta

True rates.

noise

Noise, same length.

weights

Optional non-negative weights.

B

Shrinkage factor to evaluate.

Value

A list with loss (direct), closed_form, noise_law (whether both sums vanish to \(10^{-10}\)), Se, Stheta, B_star, loss_star, loss_raw and theorems.

Examples

theta <- c(10, 20, 30, 40)
e <- c(3, -3, -3, 3)       # mean zero and uncorrelated with theta
l <- morie_shrinkage_loss(theta, e, B = 0.5)
c(loss = l$loss, closed = l$closed_form, B_star = l$B_star, loss_star = l$loss_star, raw = l$loss_raw)
#>         loss       closed       B_star    loss_star          raw 
#> 134.00000000 134.00000000   0.06716418  33.58208955  36.00000000