Skip to contents

p. 158 states IN WORDS that the generalization error is the sum of bias, variance and irreducible error; NO formula is printed there. The decomposition computed here is stated explicitly rather than attributed to the book: MSE = mean_i (mean_b f_b(x_i) - y_i)^2 + mean_i var_b(f_b(x_i)) + noisevar.

Usage

morie_bvdecomp(preds, truth, noisevar = 0)

Arguments

preds

B-by-n matrix, one row per model, one column per point

truth

the n true values

noisevar

the irreducible error

Value

list(bias2, variance, noise, total, mse, residual, b, n)

Examples

preds <- rbind(c(1, 2, 3), c(1.5, 2.5, 2.5))   # two bootstrap models, three test points
morie_bvdecomp(preds, truth = c(1, 2, 3), noisevar = 0.1)
#> $bias2
#> [1] 0.0625
#> 
#> $variance
#> [1] 0.0625
#> 
#> $noise
#> [1] 0.1
#> 
#> $total
#> [1] 0.225
#> 
#> $mse
#> [1] 0.125
#> 
#> $residual
#> [1] 0
#> 
#> $b
#> [1] 2
#> 
#> $n
#> [1] 3
#>