% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/adaptive_khaos2.R
\name{adaptive_khaos}
\alias{adaptive_khaos}
\title{Bayesian Adaptive Polynomial Chaos Expansion}
\usage{
adaptive_khaos(
  X,
  y,
  prior_type = "ridge",
  nmcmc = 10000,
  nburn = 9000,
  thin = 1,
  legacy = TRUE,
  verbose = TRUE,
  ...
)
}
\arguments{
\item{X}{A data frame or matrix of predictors scaled to lie between 0 and 1.}

\item{y}{A numeric response vector of length \code{nrow(X)}.}

\item{prior_type}{Character string specifying the coefficient-prior formulation.
Currently one of \code{"ridge"} or \code{"gprior"}.}

\item{nmcmc}{Number of MCMC iterations.}

\item{nburn}{Number of initial MCMC iterations to discard.}

\item{thin}{Keep every \code{thin}-th retained MCMC sample.}

\item{legacy}{Logical. If \code{TRUE}, reproduces the historical storage behavior
of earlier implementations, which may retain stale values in unused portions of
the internal \code{vars} and \code{degs} arrays. If \code{FALSE}, these unused
entries are cleared more carefully.}

\item{verbose}{Logical; if \code{TRUE}, progress messages are printed.}

\item{...}{Additional arguments passed to the prior-specific fitting routine.}
}
\value{
An object of class \code{"adaptive_khaos"} containing the fitted model.
The object is a list including sampled basis functions, coefficient samples,
variance parameters, and additional MCMC output. The specific structure depends
on the chosen \code{prior_type}.
}
\description{
A wrapper for adaptive Bayesian polynomial chaos expansion models with
different coefficient prior formulations.
}
\details{
Depending on \code{prior_type}, this function calls either
\code{adaptive_khaos_ridge()} or \code{adaptive_khaos_gprior()}.

This function dispatches to one of the prior-specific adaptive KHAOS fitting
routines:
\describe{
\item{\code{prior_type = "ridge"}}{Calls \code{\link{adaptive_khaos_ridge}}.}
\item{\code{prior_type = "gprior"}}{Calls \code{\link{adaptive_khaos_gprior}}.}
}

The wrapper exposes only the most commonly used arguments. Additional
prior-specific tuning parameters can be supplied through \code{...}; see
\code{\link{adaptive_khaos_ridge}} and \code{\link{adaptive_khaos_gprior}}
for full documentation.
}
\examples{
\donttest{
X <- lhs::maximinLHS(100, 2)
f <- function(x) 10.391 * ((x[1] - 0.4) * (x[2] - 0.6) + 0.36)
y <- apply(X, 1, f) + stats::rnorm(100, 0, 0.1)

fit1 <- adaptive_khaos(X, y)
fit2 <- adaptive_khaos(X, y, prior_type = "gprior")
}
}
\references{
Francom, Devin, and Bruno Sanso. "BASS: An R package for fitting and performing
sensitivity analysis of Bayesian adaptive spline surfaces."
\emph{Journal of Statistical Software} 94.LA-UR-20-23587 (2020).

Rumsey, K.N., Francom, D., Gibson, G., Tucker, J. D., and Huerta, G. (2026).
Bayesian Adaptive Polynomial Chaos Expansions. \emph{Stat}, 15(1), e70151.
}
