% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/prior_sensitivity.R
\name{prior_sensitivity}
\alias{prior_sensitivity}
\title{Prior sensitivity analysis for an ML-UMR fit}
\usage{
prior_sensitivity(
  fit,
  prior_beta_scales = c(0.5, 1, 2.5, 5, 10),
  probs = c(0.025, 0.5, 0.975),
  verbose = TRUE,
  ...
)
}
\arguments{
\item{fit}{A fitted \code{mlumr_fit} object to re-fit under alternative priors.}

\item{prior_beta_scales}{Numeric vector of scales for \code{prior_beta}.
Default \code{c(0.5, 1, 2.5, 5, 10)}.}

\item{probs}{Quantiles for summarizing each posterior
(default \code{c(0.025, 0.5, 0.975)}).}

\item{verbose}{Logical; if \code{FALSE}, suppresses progress messages and final
printed summary table.}

\item{...}{Additional arguments forwarded to \code{\link[=mlumr]{mlumr()}} on each refit
(e.g. \code{chains}, \code{iter}, \code{refresh}). Sampling defaults otherwise inherit
from the original fit.}
}
\value{
A data frame (tibble-style) with one row per
(scale, population, quantile) combination and columns \code{scale},
\code{parameter}, \code{mean}, \code{sd}, and the requested quantiles. Side effect:
prints a summary table at the end.
}
\description{
Refit an \code{\link[=mlumr]{mlumr()}} model across a grid of \code{prior_beta} scales (keeping the
family, mean, and df fixed) and summarize how the posterior for the
marginal treatment effects (\code{delta_index}, \code{delta_comparator}) moves. This
is the workflow recommended by Vehtari et al.'s prior-choice wiki for
judging how much of the posterior is driven by the data versus the prior.
}
\details{
Only the scale of the \code{prior_beta} family is varied; its distribution
(normal / student_t) and mean are preserved so comparisons are apples to
apples. \code{prior_intercept} and \code{prior_sigma} are carried through
unchanged from the original fit. Each value in \code{prior_beta_scales} is
used as the \strong{absolute} scale for every coefficient at that refit --- if
the original fit used per-coefficient priors, all coefficients are set
to the same scale (the sweep is deliberately homogeneous so the grid
reflects a single level of prior informativeness per refit, not a
rescaling of existing relative differences). If the original
\code{prior_beta} used an exponential family, it is swapped for a
\code{prior_normal(0, scale)} at each grid point since exponential has no
scale parameter to vary.
}
\examples{
\dontrun{
sens <- prior_sensitivity(fit_spfa, prior_beta_scales = c(1, 2.5, 5))
}
}
\seealso{
\code{\link[=prior_summary]{prior_summary()}} for a one-shot description of the priors on
a fit; \code{\link[=marginal_effects]{marginal_effects()}} for the posterior summary quantities this
sweep tracks.
}
