% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shash.R
\name{autoselect.shash}
\alias{autoselect.shash}
\title{Automatic model selection for SinH-ArcSinH continuous norming via BIC}
\usage{
autoselect.shash(
  age,
  score,
  weights = NULL,
  max_mu = 4,
  max_sigma = 3,
  max_epsilon = 3,
  max_delta = 1,
  min_mu = 1,
  min_sigma = 1,
  min_epsilon = 1,
  min_delta = 0,
  delta = 1,
  control = NULL,
  scale = "T",
  parallel = TRUE,
  n_cores = NULL,
  plot = TRUE,
  verbose = TRUE
)
}
\arguments{
\item{age, score}{Numeric vectors of predictor and response values.}

\item{weights}{Optional numeric vector of observation weights.}

\item{max_mu, max_sigma, max_epsilon, max_delta}{Maximum polynomial degrees for
the four shash parameters. Defaults: \code{4, 3, 3, 1}.}

\item{min_mu, min_sigma, min_epsilon}{Minimum polynomial degrees (default 1).}

\item{min_delta}{Minimum degree for \eqn{\delta}. \code{0} (default) means
the fixed-delta variant is included in the search.}

\item{delta}{Value of \eqn{\delta} used whenever the candidate uses
\code{delta_degree = 0} (i.e. fixed delta). Default 1.}

\item{control}{Optional control list passed to \code{\link[stats]{optim}}.}

\item{scale}{Norm scale (default \code{"T"}).}

\item{parallel}{Logical; attempt parallel execution. Default \code{TRUE}.}

\item{n_cores}{Number of cores. Defaults to all logical cores.}

\item{plot}{Logical; plot the selected model. Default \code{TRUE}.}

\item{verbose}{Logical; print progress. Default \code{TRUE}.}
}
\value{
The selected fitted \code{cnormShash} model with an additional
  element \code{$selection} containing:
  \itemize{
    \item \code{evaluated}: data frame of every combination tried, sorted by BIC.
    \item \code{selected}: list with the chosen degrees and BIC.
  }
}
\description{
Selects the polynomial degrees for the four components of a
\code{\link{cnorm.shash}} model (\eqn{\mu}, \eqn{\sigma}, \eqn{\epsilon},
\eqn{\delta}) by minimizing BIC over a full grid.
}
\details{
A degree of \code{0} for \eqn{\delta} is interpreted as a **fixed**
\eqn{\delta} (passed to \code{\link{cnorm.shash}} as \code{delta_degree = NULL})
with value taken from the \code{delta} argument. This allows the grid
search to choose between a fixed and a varying tail-weight model.

Parallel execution is attempted by default. If the workers cannot access
the \pkg{cNORM} namespace, the function transparently falls
back to sequential execution.
}
\examples{
\dontrun{
m <- autoselect.shash(elfe$group, elfe$raw)
m$selection$evaluated
summary(m, age = elfe$group, score = elfe$raw)
}

}
\seealso{
\code{\link{cnorm.shash}}, \code{\link{autoselect.betabinomial}}
}
