View source: R/quantile-pred.R
quantile_pred | R Documentation |
quantile_pred()
is a special vector class used to efficiently store
predictions from a quantile regression model. It requires the same quantile
levels for each row being predicted.
quantile_pred(values, quantile_levels = double())
extract_quantile_levels(x)
## S3 method for class 'quantile_pred'
as_tibble(x, ..., .rows = NULL, .name_repair = "minimal", rownames = NULL)
## S3 method for class 'quantile_pred'
as.matrix(x, ...)
values |
A matrix of values. Each column should correspond to one of the quantile levels. |
quantile_levels |
A vector of probabilities corresponding to |
x |
An object produced by |
... |
Not currently used. |
.rows , .name_repair , rownames |
Arguments not used but required by the original S3 method. |
quantile_pred()
returns a vector of values associated with the
quantile levels.
extract_quantile_levels()
returns a numeric vector of levels.
as_tibble()
returns a tibble with rows ".pred_quantile"
,
".quantile_levels"
, and ".row"
.
as.matrix()
returns an unnamed matrix with rows as samples, columns as
quantile levels, and entries are predictions.
.pred_quantile <- quantile_pred(matrix(rnorm(20), 5), c(.2, .4, .6, .8))
unclass(.pred_quantile)
# Access the underlying information
extract_quantile_levels(.pred_quantile)
# Matrix format
as.matrix(.pred_quantile)
# Tidy format
library(tibble)
as_tibble(.pred_quantile)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.