% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/forecast_panel.R
\name{obr_forecast_panel}
\alias{obr_forecast_panel}
\title{Build a wide real-time panel of OBR forecasts}
\usage{
obr_forecast_panel(
  series = "PSNB",
  refresh = FALSE,
  order_chronologically = TRUE
)
}
\arguments{
\item{series}{Character. Series to return; see \code{\link[=list_forecast_series]{list_forecast_series()}}.
Defaults to \code{"PSNB"}.}

\item{refresh}{Logical. If \code{TRUE}, re-download the underlying database.}

\item{order_chronologically}{Logical. If \code{TRUE} (the default), rows are
ordered from earliest to latest forecast vintage. If \code{FALSE}, rows
appear in the order returned by \code{\link[=get_forecasts]{get_forecasts()}}.}
}
\value{
An \code{obr_tbl} whose first column (\code{forecast_date}) is character
and whose remaining columns are numeric forecast values, one per
fiscal year. Provenance is inherited from the underlying call to
\code{\link[=get_forecasts]{get_forecasts()}} and a \code{notes} field describes the panel.
}
\description{
Takes the long-format Historical Forecasts Database output of
\code{\link[=get_forecasts]{get_forecasts()}} and pivots it to a wide panel with one row per
forecast vintage (e.g. \code{"March 2024"}) and one column per fiscal year
being forecast (e.g. \code{"2024-25"}). The first column is the forecast
vintage; remaining columns are numeric forecast values.
}
\details{
This format mirrors how the OBR's own Historical Forecasts Database is
laid out and how forecast-error studies (e.g. the OBR's own Forecast
Evaluation Report) decompose performance: each row is one forecast
published at a fiscal event, each column is the target year being
forecast, and the diagonal-like structure lets you read the h-step
ahead forecast for any vintage.
}
\examples{
\donttest{
op <- options(obr.cache_dir = tempdir())
try({
  panel <- obr_forecast_panel("PSNB")
  # PSNB forecast for 2024-25 across every vintage
  panel[, c("forecast_date", "2024-25")]
})
options(op)
}

}
\seealso{
Other forecasts: 
\code{\link{get_forecast_revisions}()},
\code{\link{get_forecasts}()},
\code{\link{list_forecast_series}()},
\code{\link{obr_actual_vs_forecast}()},
\code{\link{obr_compare_vintages}()}
}
\concept{forecasts}
