dev_expl | R Documentation |
This function calculates the percent deviance explained by a model, such as a generalised linear model (GLM) or generalised additive model (GAM).
dev_expl(model)
model |
A model object. |
Percent deviance explained is given by (model$null.deviance - model$deviance)/model$null.deviance) * 100
.
The function returns the percent deviance explained as a number.
Edward Lavender
n <- 100
x <- stats::runif(n, 0, 10)
y <- stats::rpois(n, x*2)
m1 <- stats::glm(y ~ x)
dev_expl(m1)
m2 <- mgcv::gam(y ~ s(x))
dev_expl(m2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.