plot.calibrationband {calibrationband} | R Documentation |
Plotting monotone confidence bands
Description
Uses the ggplot2 package to illustrate monotone confidence bands to assess calibration of prediction methods that issue probability forecasts.
Usage
## S3 method for class 'calibrationband'
autoplot(
object,
...,
approx.equi = NULL,
cut.bands = FALSE,
p_ribbon = NULL,
p_isoreg = NULL,
p_diag = NULL
)
## S3 method for class 'calibrationband'
autolayer(
object,
...,
approx.equi = NULL,
cut.bands = FALSE,
p_diag = NA,
p_isoreg = NA,
p_ribbon = NA
)
## S3 method for class 'calibrationband'
plot(x, ...)
Arguments
object |
object of class |
... |
Further arguments to be passed to or from methods. |
approx.equi |
If In large data sets, Note, we add important additional points the initial scalar of
|
cut.bands |
Cut the bands at most extreme prediction values. Bands will not be extended to 0 and 1 respectively if option is set equal to true. |
p_ribbon |
If non |
p_isoreg |
If non |
p_diag |
If non |
x |
object of class |
Details
When plotting the monotone confidence band, the upper bound should be
extended to the left, that is, the bound at x[i]
is valid on the
interval (x[i-1],x[i]]
. The lower bound should be extended to the
right, i.e. the bound at x[i] is extended to the interval [x[i],x[i +
1])
. This function creates x and y values for correct plotting of these
bounds.
autoplot
behaves like any ggplot() + layer()
combination.
That means, customized plots should be created using autoplot
and
autolayer
.
Setting any of the p_*
arguments to NA
disables that layer.
Default parameter values for p_*
p_isoreg | list(color = "darkgray") |
p_diag | list(color = "black", fill="blue", alpha = .1) |
p_ribbon | list(low = "gray", high = "red", guide = "none", limits=c(0,1))
|
Value
An object inheriting from class 'ggplot'
.
Examples
s=.8
n=10000
x <- sort(runif(n))
p <- function(x,s){p = 1/(1+((1/x*(1-x))^(s+1)));return(p)}
dat <- data.frame(pr=x, y=rbinom(n,1,p(x,s)))
cb <- calibration_bands(x=dat$pr, y=dat$y,alpha=0.05, method="round", digits =3)
#simple plotting
plot(cb)
autoplot(cb)
#customize the plot using ggplot2::autolayer
autoplot(
cb,
approx.equi=NULL,
p_ribbon = NA
)+
ggplot2::autolayer(
cb,
p_ribbon = list(alpha = .3, fill = "gray", colour = "blue"),
)