Description Usage Arguments Value Examples
View source: R/deviance_pvalue.R
Given a reference model and the fitted model and the degrees of freedom compute the deviance and the p-value. Then print them.
1 | deviance_pvalue(reference_model, fitted_model, df, lower.tail = FALSE)
|
reference_model |
The model to act as the reference |
fitted_model |
The model that you want to compare to the reference model |
df |
degrees of freedom |
lower.tail |
Compute the p-value using the lower tail. Default = FALSE (optional) |
Nothing
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_pvalue(intercept.only.model, fitted.model, df = 3)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.