% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lin_interp.R
\name{lin_interp}
\alias{lin_interp}
\title{Linear interpolation of a forecast trajectory onto a grid}
\usage{
lin_interp(prob, grid, outcome)
}
\arguments{
\item{prob}{Numeric vector of forecast probabilities.}

\item{grid}{Numeric vector of time points (same length as \code{prob}) between 0
and 1.}

\item{outcome}{Scalar binary outcome \(Y\) to attach to every interpolated row.}
}
\value{
A tibble with columns \code{phat_approx}, \code{grid}, and \code{Y}.
}
\description{
Maps a vector of probabilities \code{prob} observed at times \code{grid} onto an
equally spaced grid of length \code{length(grid)} between 0 and 1 using linear
interpolation (\code{stats::approx}). Useful when aligning ESPN or model outputs
to the common grid used in the NBA analysis (see replication \code{pre_process} /
\code{utility.R}).
}
\examples{
library(rtForecastEval)
g <- seq(0, 1, length.out = 9L)
lin_interp(prob = seq(0.1, 0.9, length.out = 9L), grid = g, outcome = 1L)

}
\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}
}
