% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gbass.R
\name{gbass}
\alias{gbass}
\title{Generalized Bayesian MARS}
\usage{
gbass(
  X,
  y,
  w_prior = list(type = "GIG", p = 0, a = 0, b = 0),
  v_prior = list(type = "GIG", p = -15, a = 0, b = 30),
  maxInt = 3,
  maxBasis = 1000,
  npart = NULL,
  nmcmc = 10000,
  nburn = 9000,
  thin = 1,
  moveProbs = rep(1/3, 3),
  a_tau = 1/2,
  b_tau = NULL,
  a_lambda = 1,
  b_lambda = 1,
  m_beta = 0,
  s_beta = 0,
  scale = 1,
  Iw0 = rep(1, maxInt),
  Zw0 = rep(1, ncol(X)),
  verbose = TRUE
)
}
\arguments{
\item{X}{An \eqn{N \times p} numeric matrix of predictors. A numeric vector is
treated as a single-column matrix.}

\item{y}{A numeric response vector of length \eqn{N}.}

\item{w_prior}{A named list specifying the prior for the global variance
component. See Details.}

\item{v_prior}{A named list specifying the shared prior for the local variance
components. See Details.}

\item{maxInt}{Integer giving the maximum interaction degree in proposed basis
functions.}

\item{maxBasis}{Maximum number of basis functions.}

\item{npart}{Minimum number of nonzero points required for a proposed basis
function. Defaults to \code{min(20, 0.1 * N)}.}

\item{nmcmc}{Total number of MCMC iterations.}

\item{nburn}{Number of initial iterations discarded as burn-in.}

\item{thin}{Thinning interval for retained draws.}

\item{moveProbs}{A length-3 vector giving probabilities for birth, death, and
mutation moves.}

\item{a_tau}{Prior hyperparameter for \code{tau}.}

\item{b_tau}{Prior hyperparameter for \code{tau}. Defaults to \code{N / 2}.}

\item{a_lambda}{Prior hyperparameter for \code{lambda}.}

\item{b_lambda}{Prior hyperparameter for \code{lambda}.}

\item{m_beta}{Prior mean for \code{beta}.}

\item{s_beta}{Prior standard deviation for \code{beta}.}

\item{scale}{Fixed variance-scale parameter. Defaults to \code{1}.}

\item{Iw0}{Vector of positive nominal weights for interaction order in proposed
basis functions. Must have length \code{maxInt}.}

\item{Zw0}{Vector of positive nominal weights for variable selection in
proposed basis functions. Must have length \code{ncol(X)}.}

\item{verbose}{Logical; should progress be printed?}
}
\value{
An object of class \code{"gbass"} containing posterior draws and fitted model
information.
}
\description{
Fits a generalized Bayesian MARS (GBASS) model for nonlinear regression under
flexible latent-scale likelihoods.
}
\details{
The priors for \code{w} and \code{v_i} must belong to the generalized inverse
Gaussian (\code{"GIG"}) or generalized beta prime (\code{"GBP"}) families.

Each prior list may contain:
\enumerate{
\item \code{type}: either \code{"GIG"} or \code{"GBP"}.
\item \code{p}, \code{a}, \code{b}: prior hyperparameters.
\item \code{lower_bound}: optional lower bound for the parameter support.
For backward compatibility, \code{lb} is also accepted.
\item \code{prop_sigma}: proposal standard deviation on the log scale for
Metropolis updates, when applicable.
\item \code{adapt}, \code{adapt_delay}, \code{adapt_thin}: optional controls
for adaptive Metropolis updates when applicable.
}

For \code{w}, \code{prop_sigma} and the adaptive Metropolis fields are mainly
relevant when \code{w_prior$type = "GBP"}. In the \code{"GIG"} case with
nonzero \code{beta}, \code{w} is sampled using the modified half-normal
formulation rather than a random-walk Metropolis step.

Retained draws are taken at iterations
\code{nburn + 1, nburn + 1 + thin, ...}. Thus \code{nburn} is interpreted as
the number of initial iterations discarded as burn-in.
}
\note{
Current implementation notes:
\enumerate{
\item Basis function parameters are stored as lists.
\item Knot locations use continuous uniform proposals.
\item Basis coefficients use a ridge-type prior.
}
}
\examples{
ff1 <- function(x) 10.391*((x[1]-0.4)*(x[2]-0.6) + 0.36)

n <- 100
p <- 4
X <- matrix(runif(n * p), nrow = n)
y <- apply(X, 1, ff1)
mod <- gbass(X, y, nmcmc = 1000, nburn = 900, thin = 2)
}
