Description Usage Arguments Value Examples
Binary Calibration Plots
1 2 | binary_calibration_plot(response, model, breaks = 0:10/10,
point.color = "blue", line.color = "red")
|
response |
The response variable from the data |
model |
A model object |
breaks |
The number of bins used to create the error bars that will be displayed |
point.color |
The color of the points in the scatterplot |
line.color |
The color of the line y = x |
A ggplot2 object
1 2 3 4 5 6 7 | ch <- read.csv("http://www.stat.cmu.edu/~cshalizi/uADA/15/hw/06/ch.csv")
ch.clean <- na.omit(ch)
lr.ch <- glm(start ~ . -country -year +I(exports^2), data=ch, family="binomial") # logistic regression
binary_calibration_plot(y = ch.clean$start, model = lr.ch, breaks = 0:7/10, point.color = "blue", line.color = "red")
library(mgcv)
gam.ch <- gam(start~s(exports)+s(schooling)+s(growth)+s(peace)+s(concentration)+s(lnpop)+s(fractionalization)+dominance, # GAM
binary_calibration_plot(ch.clean$start, gam.ch, breaks=0:9/10, blue, red)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.