% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/build-run.R
\name{build_inits_from_spec}
\alias{build_inits_from_spec}
\title{Build initial values from a compiled model spec}
\usage{
build_inits_from_spec(spec, seed = NULL, y = NULL, X = NULL)
}
\arguments{
\item{spec}{A compiled model specification produced by \code{compile_model_spec()}.}

\item{seed}{Optional seed (single integer or vector). If provided, the first element is used.}

\item{y}{Optional numeric vector of observed outcomes used for heuristic initializations.}

\item{X}{Optional numeric matrix of covariates used for link-mode parameter initializations.}
}
\value{
Named list of initial values.
}
\description{
Produces a list of initial values suitable for passing to \code{nimbleModel}.
The initial values are derived from \code{spec$plan} and are intended to be
stable and support-respecting (e.g., positive parameters start positive).
}
\details{
Notes:
\itemize{
\item Uses only \code{components} as the model size parameter.
\item SB: initializes stick breaks \code{v}; weights \code{w} are deterministic.
\item CRP: initializes memberships \code{z} in \code{1:components}.
\item Link-mode parameters initialize regression coefficients \code{beta_<param>}
with shape \code{components x P}.
\item Default GPD threshold under X is stochastic lognormal:
initializes \code{threshold[1:N]} and scalar \code{sdlog_u} (non-link thresholds are scalar).
}
}
\keyword{internal}
