Computes the Bias
metric_bias(estimate, oracle, na.rm = FALSE)
estimate | Estimated values from the model. |
---|---|
oracle | Known values used to generate the model. |
na.rm | A |
A numeric
value for each parameter comparison.
The bias measures the difference between expected value of an estimated parameter and its true value.
The metric is computed under: $$\operatorname{Bias}(\hat \theta, \theta) = E\left[\hat\theta\right] - \theta$$
The bias may be used to understand the difference between \(\hat\theta\) matrix and the oracle \(\theta\) matrix.
# Construct data estimate = matrix(c(1,1,2,4,3,6), nrow = 2, ncol = 3) truth = matrix(c(1,2,3,4,5,6), nrow = 2, ncol = 3) # Compute the bias metric_bias(estimate, truth)#> [,1] [,2] [,3] #> [1,] 1.8333333 -0.1666667 -2.166667 #> [2,] 0.8333333 -1.1666667 -3.166667