deviance: deviance

Description Usage Arguments Value Examples

View source: R/deviance.R

Description

Given two models, compute the deviance between the two

Usage

1
deviance(reference_model, fitted_model)

Arguments

reference_model

The model to act as the reference

fitted_model

The model that you want to compare to the reference model

Value

The deviance between the two models

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{
libraries.data <- AdvancedRegression::libraries

#specifying reference category
location.rel <- relevel(libraries.data$location, ref = "rural")

#fitting beta regression model
fitted.model <- betareg::betareg(propontime ~ nbooks + ncardholders + location.rel,
                                 data = libraries.data, link = "logit")

#checking model fit
intercept.only.model <- betareg::betareg(propontime ~ 1,
                                         data = libraries.data, link = "logit")

deviance(intercept.only.model, fitted.model)
}

ocrug/AdvancedRegression documentation built on Nov. 4, 2019, 10:13 p.m.