% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/MeasureRegrRQR.R
\name{mlr_measures_regr.rqr}
\alias{mlr_measures_regr.rqr}
\alias{MeasureRegrRQR}
\title{R-Squared for Quantile Regression}
\description{
Measure to compare true observed response with predicted quantiles in regression tasks.
}
\details{
\eqn{R^1(\alpha)} is defined as \deqn{
  1 - \frac{\sum_{i=1}^n \rho_\alpha \left( t_i - r_i(\alpha) \right)}{
    \sum_{i=1}^n \rho_\alpha \left( t_i - q_{\alpha} \right)},
}{
  1 - sum(pinball(t - r(alpha))) / sum(pinball(t - quantile(t, alpha))),
}
where for a quantile \eqn{\alpha}, \eqn{\rho_\alpha} is the pinball function, \eqn{r_i(\alpha)} are the predictions
for the quantile and \eqn{q_{\alpha}} is the empirical \eqn{\alpha}-quantile of the test or training data.

\eqn{R^1(\alpha)} is analogous to \eqn{R^2} for regression tasks.
It compares the pinball function of the predictions relative to a naive model predicting the empirical quantile.

This measure is undefined for constant \eqn{t}.
}
\section{Dictionary}{

This \link{Measure} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_measures} or with the associated sugar function \code{\link[=msr]{msr()}}:

\if{html}{\out{<div class="sourceCode">}}\preformatted{mlr_measures$get("regr.rqr")
msr("regr.rqr")
}\if{html}{\out{</div>}}
}

\section{Meta Information}{

\itemize{
\item Task type: \dQuote{regr}
\item Range: \eqn{(-\infty, 1]}{(-Inf, 1]}
\item Minimize: FALSE
\item Average: macro
\item Required Prediction: \dQuote{quantiles}
\item Required Packages: \CRANpkg{mlr3}
}
}

\section{Parameters}{
\tabular{llll}{
   Id \tab Type \tab Default \tab Range \cr
   alpha \tab numeric \tab - \tab \eqn{[0, 1]}{[0, 1]} \cr
}
}

\references{
Koenker, Roger, Machado, F. JA (1999).
\dQuote{Goodness of Fit and Related Inference Processes for Quantile Regression.}
\emph{Journal of the American Statistical Association}, \bold{94}(448), 1296--1310.
\doi{10.1080/01621459.1999.10473882}.
}
\seealso{
\itemize{
\item Chapter in the \href{https://mlr3book.mlr-org.com/}{mlr3book}:
\url{https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-eval}
\item Package \CRANpkg{mlr3measures} for the scoring functions.
\link[mlr3misc:Dictionary]{Dictionary} of \link[=Measure]{Measures}: \link{mlr_measures}
\code{as.data.table(mlr_measures)} for a table of available \link[=Measure]{Measures} in the running session (depending on the loaded packages).
\item Extension packages for additional task types:
\itemize{
\item \CRANpkg{mlr3proba} for probabilistic supervised regression and survival analysis.
\item \CRANpkg{mlr3cluster} for unsupervised clustering.
}
}

Other Measure:
\code{\link{Measure}},
\code{\link{MeasureClassif}},
\code{\link{MeasureRegr}},
\code{\link{MeasureSimilarity}},
\code{\link{mlr_measures}},
\code{\link{mlr_measures_aic}},
\code{\link{mlr_measures_bic}},
\code{\link{mlr_measures_classif.costs}},
\code{\link{mlr_measures_debug_classif}},
\code{\link{mlr_measures_elapsed_time}},
\code{\link{mlr_measures_internal_valid_score}},
\code{\link{mlr_measures_oob_error}},
\code{\link{mlr_measures_regr.pinball}},
\code{\link{mlr_measures_regr.rsq}},
\code{\link{mlr_measures_selected_features}}
}
\concept{Measure}
\section{Super classes}{
\code{\link[mlr3:Measure]{Measure}} -> \code{\link[mlr3:MeasureRegr]{MeasureRegr}} -> \code{MeasureRegrRQR}
}
\section{Active bindings}{
  \if{html}{\out{<div class="r6-active-bindings">}}
  \describe{
    \item{\code{pred_set_mean}}{(\code{logical(1)})\cr
Whether the empirical quantile is calculated on the prediction set.
Set during construction.}
  }
  \if{html}{\out{</div>}}
}
\section{Methods}{
\subsection{Public methods}{
  \itemize{
    \item \href{#method-MeasureRegrRQR-initialize}{\code{MeasureRegrRQR$new()}}
    \item \href{#method-MeasureRegrRQR-clone}{\code{MeasureRegrRQR$clone()}}
  }
}
\if{html}{\out{<details><summary>Inherited methods</summary>
<ul>
  <li><span class="pkg-link" data-pkg="mlr3" data-topic="Measure" data-id="aggregate"><a href='../../mlr3/html/Measure.html#method-Measure-aggregate'><code>Measure$aggregate()</code></a></span></li>
  <li><span class="pkg-link" data-pkg="mlr3" data-topic="Measure" data-id="format"><a href='../../mlr3/html/Measure.html#method-Measure-format'><code>Measure$format()</code></a></span></li>
  <li><span class="pkg-link" data-pkg="mlr3" data-topic="Measure" data-id="help"><a href='../../mlr3/html/Measure.html#method-Measure-help'><code>Measure$help()</code></a></span></li>
  <li><span class="pkg-link" data-pkg="mlr3" data-topic="Measure" data-id="obs_loss"><a href='../../mlr3/html/Measure.html#method-Measure-obs_loss'><code>Measure$obs_loss()</code></a></span></li>
  <li><span class="pkg-link" data-pkg="mlr3" data-topic="Measure" data-id="print"><a href='../../mlr3/html/Measure.html#method-Measure-print'><code>Measure$print()</code></a></span></li>
  <li><span class="pkg-link" data-pkg="mlr3" data-topic="Measure" data-id="score"><a href='../../mlr3/html/Measure.html#method-Measure-score'><code>Measure$score()</code></a></span></li>
</ul>
</details>}}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-MeasureRegrRQR-initialize"></a>}}
\if{latex}{\out{\hypertarget{method-MeasureRegrRQR-initialize}{}}}
\subsection{\code{MeasureRegrRQR$new()}}{
  Creates a new instance of this \link[R6:R6Class]{R6} class.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{MeasureRegrRQR$new(alpha = 0.5, pred_set_mean = TRUE)}
    \if{html}{\out{</div>}}
  }
  \subsection{Arguments}{
    \if{html}{\out{<div class="arguments">}}
    \describe{
      \item{\code{alpha}}{\code{numeric(1)}\cr
The quantile for which to compute the measure.
Must be one of the quantiles that the Learner was trained on.}
      \item{\code{pred_set_mean}}{\code{logical(1)}\cr
If \code{TRUE}, the mean of the true values is calculated on the prediction set.
If \code{FALSE}, the mean of the true values is calculated on the training set.}
    }
    \if{html}{\out{</div>}}
  }
}

\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-MeasureRegrRQR-clone"></a>}}
\if{latex}{\out{\hypertarget{method-MeasureRegrRQR-clone}{}}}
\subsection{\code{MeasureRegrRQR$clone()}}{
  The objects of this class are cloneable with this method.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{MeasureRegrRQR$clone(deep = FALSE)}
    \if{html}{\out{</div>}}
  }
  \subsection{Arguments}{
    \if{html}{\out{<div class="arguments">}}
    \describe{
      \item{\code{deep}}{Whether to make a deep clone.}
    }
    \if{html}{\out{</div>}}
  }
}

}
