| MSE {dembase} | R Documentation |
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.
MSE(point, truth) ## S4 method for signature 'DemographicArray,DemographicArray' MSE(point, truth)
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.
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")