Learn R Programming

kernDeepStackNet (version 2.0.2)

devStandard: Predictive deviance of a linear model

Description

Calculates the deviance on new data observations. The predictive deviance measures how far the predicted values are apart from the saturated model in the test set.

Usage

devStandard(preds, ytest, RMSE=TRUE)

Arguments

preds

Predictions of the specified model (numeric vector).

ytest

Data values of the response in the test data.

RMSE

Should the default sum of squares be computed or the RMSE? Default is RMSE.

Value

Predictive deviance of the linear model, given predictions of test data (numeric scalar).

Details

In the "Gaussian" case it is defined to be the residual sum of squares. ytest are the test observations and preds are the predicted values of the model on the test data.

References

Simon N. Wood, (2006), Generalized Additive Models: An Introduction with R, Taylor \& Francis Group LLC

Examples

Run this code
##################
# Fit Gaussian glm

set.seed(10)
x <- matrix(rnorm(100*20),100,20)
set.seed(100)
y <- rnorm(100)
fit1 <- glm(formula=y ~ ., data=data.frame(x))
preds <- predict(fit1, type="response")
# Performance on training data
all.equal(devStandard(preds=preds, ytest=y, RMSE=FALSE), fit1$deviance)
# Performance on random test data
set.seed(100)
yTest <- simulate(fit1)
devStandard(preds=preds, ytest=yTest)

Run the code above in your browser using DataLab