Learn R Programming

BGGM (version 1.0.0)

mse: Mean Squared Error

Description

Compute mean squared error for either the observed data or future data. The former is computed by plugging in the observed y (the predicted node). The latter is computed from replicated data sets (posterior predictive y), which results in the posterior predictive mean squared error. Both provide a measure of uncertainty, as the error is computed from the posterior samples. However, the posterior predictive approach fully captures uncertainty.

Usage

mse(object, ...)

Arguments

object

object of class post.pred or predict.estimate

...

currently ignored

Value

object of class metric

Examples

Run this code
# NOT RUN {
# data
Y <- subset(tas, gender == "M")[,-ncol(tas)]

# fit model
fit <- estimate(Y)

# predict (note summary = FALSE)
pred <- predict(fit, iter = 50, summary = FALSE)

mse(pred)
# }

Run the code above in your browser using DataLab