% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/select_ncomp.R
\name{select_ncomp}
\alias{select_ncomp}
\title{Select the number of PLS components}
\usage{
select_ncomp(
  x,
  y,
  method = c("complete", "nipals_standard", "nipals_adaptative"),
  criterion = c("Q2-LOO", "Q2-10fold", "AIC", "AIC-DoF", "BIC", "BIC-DoF"),
  max_ncomp,
  seed = NULL,
  folds = 10L,
  threshold = 0.0975
)
}
\arguments{
\item{x}{Predictor matrix, dataset object, or \code{misspls_imputation} object.}

\item{y}{Numeric response vector. This may be omitted when \code{x} already
contains a response.}

\item{method}{Selection workflow: \code{"complete"}, \code{"nipals_standard"}, or
\code{"nipals_adaptative"}.}

\item{criterion}{Selection criterion: \code{"Q2-LOO"}, \code{"Q2-10fold"}, \code{"AIC"},
\code{"AIC-DoF"}, \code{"BIC"}, or \code{"BIC-DoF"}.}

\item{max_ncomp}{Maximum number of components to consider.}

\item{seed}{Optional random seed used by the cross-validation and imputation
aggregation steps.}

\item{folds}{Number of cross-validation folds used by \code{"Q2-10fold"}.}

\item{threshold}{Threshold applied to \code{Q2} criteria.}
}
\value{
A one-row data frame describing the selected component count.
}
\description{
Select the number of components for complete, imputed, or incomplete-data
PLS workflows.
}
\examples{
sim <- simulate_pls_data(n = 25, p = 10, true_ncomp = 2, seed = 1)
select_ncomp(sim$x, sim$y, method = "complete", criterion = "AIC", max_ncomp = 4, seed = 2)
}
