% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_pcb.R
\name{plot_pcb}
\alias{plot_pcb}
\title{Naive pointwise confidence band for mean loss difference}
\usage{
plot_pcb(
  df,
  grid = "grid",
  L = "L",
  var = "sigma2",
  title = "Pointwise mean loss difference (A vs B)",
  subtitle = "Naive normal band (95\%); use calc_pval() for global test",
  caption = NULL,
  xlab = "Normalized time (grid)",
  ylab = "Mean squared loss difference"
)
}
\arguments{
\item{df}{Output of \code{\link[=calc_L_s2]{calc_L_s2()}} (or compatible tibble with \code{grid}, \code{L},
\code{sigma2}, \code{n}).}

\item{grid}{Name of the x-axis column (default \code{"grid"}).}

\item{L}{Name of the pointwise mean difference column (default \code{"L"}).}

\item{var}{Name of the variance column (default \code{"sigma2"}).}

\item{title, subtitle, caption}{Passed to \code{\link[ggplot2:labs]{ggplot2::labs()}}. Defaults describe
the plot when \code{NULL} (some labels are omitted if \code{NULL}).}

\item{xlab, ylab}{Axis labels (see \code{\link[ggplot2:labs]{ggplot2::labs()}}).}
}
\value{
A \strong{ggplot2} object.
}
\description{
Plots the pointwise mean loss difference from \code{\link[=calc_L_s2]{calc_L_s2()}} (column \code{L})
against time, with a normal-theory band using \code{sigma2} and the point sample
size \code{n}. This is the \strong{naive} \(t\)-style band from the paper; global
inference uses \code{\link[=calc_Z]{calc_Z()}} / \code{\link[=calc_pval]{calc_pval()}} instead.
}
\details{
This plot summarizes \strong{relative skill} (loss difference) over time — not a
classical \strong{calibration} plot (forecast vs observed event rate). For a
simple reliability-style view from the same long-format data, see the package
vignette example that bins \code{phat} and plots mean \code{Y} vs mean forecast.
}
\examples{
library(dplyr)
library(rtForecastEval)
ngame <- 8L
nsamp <- 6L
gr <- seq(0, 1, length.out = nsamp)
df <- tidyr::expand_grid(grid = gr, game = seq_len(ngame)) \%>\%
  mutate(
    phat_A = stats::runif(dplyr::n()),
    phat_B = stats::runif(dplyr::n()),
    Y = stats::rbinom(dplyr::n(), 1L, 0.5)
  )
tmp <- calc_L_s2(df, "phat_A", "phat_B", "Y", "grid")
plot_pcb(tmp)

}
\references{
Yeh, C.-K., Rice, G., & Dubin, J. A. (2022). \emph{The American Statistician},
\emph{76}, 214--223. \doi{10.1080/00031305.2021.1967781}

Preprint: \url{https://arxiv.org/abs/2010.00781}
}
