% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cluster.R
\name{dpmix.cluster}
\alias{dpmix.cluster}
\title{Fit a clustering-only bulk model}
\usage{
dpmix.cluster(
  formula,
  data,
  type = c("weights", "param", "both"),
  default = "weights",
  mcmc = list(),
  ...
)
}
\arguments{
\item{formula}{Model formula. The response must be present in \code{data}.}

\item{data}{Data frame containing the response and optional predictors.}

\item{type}{Clustering mode:
\itemize{
\item \code{"weights"}: links mixture weights to predictors
\item \code{"param"}: links kernel parameters to predictors
\item \code{"both"}: links both weights and kernel parameters to predictors
}}

\item{default}{Default mode used when \code{type} is omitted.}

\item{mcmc}{MCMC control list passed into the cluster bundle.}

\item{...}{Additional arguments passed to \code{build_cluster_bundle()}, including kernel settings,
prior overrides, component counts, and monitoring controls.}
}
\value{
Object of class \code{dpmixgpd_cluster_fit}.
}
\description{
Build and fit a Dirichlet-process mixture for clustering without causal estimands or posterior
prediction for a response surface. This interface focuses on latent partition recovery from a
formula specification and returns a cluster-fit object that can be summarized, plotted, or
converted into labels and posterior similarity matrices with \code{\link[=predict.dpmixgpd_cluster_fit]{predict.dpmixgpd_cluster_fit()}}.
}
\details{
The fitted model targets a latent partition \eqn{z_1, \dots, z_n} with component-specific kernel
parameters. Depending on \code{type}, predictors can enter through the gating probabilities
\deqn{
\Pr(z_i = k \mid x_i) = \pi_k(x_i)
}
or through linked kernel parameters for each component. The returned fit stores posterior draws
of the latent cluster labels and associated parameters; the representative clustering is extracted
later by \code{\link[=predict.dpmixgpd_cluster_fit]{predict.dpmixgpd_cluster_fit()}} using Dahl's least-squares rule.

Use \code{type = "weights"} or \code{type = "both"} only when the formula includes predictors and when an
explicit number of \code{components} is supplied. Otherwise the builder stops before fitting.
}
\examples{
\donttest{
data("nc_realX100_p3_k2", package = "CausalMixGPD")
dat <- data.frame(y = nc_realX100_p3_k2$y[1:20],
                  nc_realX100_p3_k2$X[1:20, , drop = FALSE])
fit <- dpmix.cluster(
  y ~ x1 + x2 + x3,
  data = dat,
  kernel = "normal",
  type = "param",
  components = 3,
  mcmc = list(niter = 60, nburnin = 30, thin = 1, nchains = 1, seed = 1)
)
summary(fit)
}
}
\seealso{
\code{\link[=dpmgpd.cluster]{dpmgpd.cluster()}}, \code{\link[=predict.dpmixgpd_cluster_fit]{predict.dpmixgpd_cluster_fit()}},
\code{\link[=summary.dpmixgpd_cluster_fit]{summary.dpmixgpd_cluster_fit()}}, \code{\link[=plot.dpmixgpd_cluster_fit]{plot.dpmixgpd_cluster_fit()}},
\code{\link[=build_nimble_bundle]{build_nimble_bundle()}}, \code{\link[=dpmix]{dpmix()}}.

Other cluster workflow: 
\code{\link{cluster_profiles}()},
\code{\link{dpmgpd.cluster}()},
\code{\link{plot.dpmixgpd_cluster_bundle}()},
\code{\link{predict.dpmixgpd_cluster_fit}()},
\code{\link{print.dpmixgpd_cluster_bundle}()},
\code{\link{print.dpmixgpd_cluster_fit}()},
\code{\link{print.dpmixgpd_cluster_labels}()},
\code{\link{print.dpmixgpd_cluster_psm}()},
\code{\link{summary.dpmixgpd_cluster_bundle}()},
\code{\link{summary.dpmixgpd_cluster_fit}()},
\code{\link{summary.dpmixgpd_cluster_labels}()},
\code{\link{summary.dpmixgpd_cluster_psm}()}
}
\concept{cluster workflow}
