mean_squared_error()
estimates the mean squared error for the desired
loss unit.
mean_squared_error(pred, data.valid, y, L2.unit)
Returns a tibble containing two mean squared prediction errors. The first is measured at the level of individuals and the second is measured at the context level. The tibble dimensions are 2x3 with variables: measure, value and level.
Predictions of outcome. A numeric vector of outcome predictions.
Test data set. A tibble of data that was not used for prediction.
Outcome variable. A character vector containing the column names of the outcome variable.
Geographic unit. A character scalar containing the column name
of the geographic unit in survey
and census
at which outcomes
should be aggregated.