% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/roc_draws.R
\name{roc2_draws}
\alias{roc2_draws}
\alias{add_roc2_draws}
\alias{roc2_rvars}
\alias{add_roc2_rvars}
\title{Obtain posterior draws of the response-specific type 2 receiver operating characteristic (ROC) curves.}
\usage{
roc2_draws(object, newdata, ..., bounds = FALSE)

add_roc2_draws(newdata, object, ...)

roc2_rvars(object, newdata, ..., bounds = FALSE)

add_roc2_rvars(newdata, object, ...)
}
\arguments{
\item{object}{The \code{brms} model with the \code{metad} family}

\item{newdata}{A data frame from which to generate posterior predictions}

\item{...}{Additional parameters passed to \link[tidybayes:epred_draws]{tidybayes::epred_draws}}

\item{bounds}{If \code{TRUE}, include the endpoints of the ROC at \eqn{(0, 0)} and \eqn{(1, 1)}.
Otherwise, the endpoints are excluded.}
}
\value{
a tibble containing posterior draws of the pseudo type 1 ROC with the following
columns:
\itemize{
\item \code{.row}: the row of \code{newdata}
\item \code{.chain}, \code{.iteration}, \code{.draw}: for \code{roc2_draws} and \code{add_roc2_draws}, identifiers for the posterior sample
\item \code{response}: the type 1 response for perceived stimulus presence (\eqn{R \in \{0, 1\}})
\item \code{confidence}: the type 2 confidence response (\eqn{C \in [1, K]})
\item \code{p_fa2}: the cumulative probability of an incorrect response (\eqn{P(C\ge c \;\vert\; R\ne S)})
\item \code{p_hit2}: the cumulative probability of a correct response (\eqn{P(C\ge c \;\vert\; R = S)})
}
}
\description{
Given a data frame and a meta-d' model, adds estimates of the
cumulative probability over confidence for each type 1 response.
For \code{roc2_draws} and \code{add_roc2_draws}, estimates are returned in a tidy
tibble with one row per posterior draw and per joint response.
For \code{roc2_rvars} and \code{add_roc2_rvars}, parameters are returned as
\code{posterior::rvar}s, with one row per row in \code{newdata} and per joint response.
}
\examples{
\donttest{
newdata <- tidyr::tibble(.row = 1)

# compute type 2 ROC curve
# equivalent to `add_roc2_draws(newdata, example_model())`
roc2_draws(example_model(), newdata)

# use posterior::rvar for additional efficiency
# equivalent to `add_roc2_rvars(newdata, example_model())`
roc2_rvars(example_model(), newdata)

# include the ROC bounds
# equivalent to `roc2_draws(newdata, example_model(), bounds = TRUE)`
roc2_draws(example_model(), newdata, bounds = TRUE)
}
}
\seealso{
\code{\link[tidybayes:epred_draws]{tidybayes::epred_draws()}}, \code{\link[tidybayes:epred_rvars]{tidybayes::epred_rvars()}}
}
