mosaic (version 0.14.4)

MSPE: Mean Squared Prediction Error

Description

A one-step calculation of mean square prediction error

Usage

MSPE(model, data, LL = TRUE)

Arguments

model

a model produced by lm, glm, or gwm.

data

a data frame.

LL

if TRUE, for categorical responses replace mean square error with minus mean log likelihood

Details

For categorical responses, the mean square prediction error is not ideal. Better to use the likelhood. LL = TRUE (the default) turns the calculation into the mean log likelihood per case, negated so that large values mean poor predictions

Examples

Run this code
# NOT RUN {
HELP <- HELPrct %>% sample_frac(.3)
MSPE( gwm( age ~ sex, data = HELP), HELPrct)
MSPE( gwm( age ~ 1, data = HELP), HELPrct)
MSPE( gwm( age ~ sex + homeless, data = HELP), HELPrct)
MSPE( gwm( sex ~ 1, data = HELP), HELPrct)
MSPE( gwm( sex ~ homeless, data = HELP), HELPrct)
MSPE( gwm( sex ~ homeless + substance, data = HELP), HELPrct)
# }

Run the code above in your browser using DataLab