Description Usage Arguments Details Value Examples
Mean Squared Error, or MSE, measures the extent to which point estimates (including forecasts) from a model come close to the truth. It is commonly used in simulation studies, where the true values are generated by the analyst, and hence known.
1 2 3 4 |
point |
A |
truth |
A |
If p
is a point estimate and t
is the truth
then the MSE is (p - t)^2
.
MSE
is stricter about the compatibility
of its arguments than most functions in dembase
.
Although it reorders dimensions and categories
in point
and truth
, it does not collapse
or expand dimensions, or drop any levels.
An object with the same class as truth
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | point <- Values(array(c(10.2, 8.7, 3.4, 8.1),
dim = c(2, 2),
dimnames = list(region = c("A", "B"),
sex = c("F", "M"))))
truth <- Values(array(c(9.8, 8.3, 3.7, 7.9),
dim = c(2, 2),
dimnames = list(region = c("A", "B"),
sex = c("F", "M"))))
point
truth
MSE(point = point,
truth = truth)
## calculations with MSE
m <- MSE(point = point,
truth = truth)
class(m) # same as 'truth'
## mean
collapseDimension(m,
dimension = "sex",
weights = 1)
## sum
m <- as(m, "Counts")
collapseDimension(m,
dimension = "sex")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.