% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/stats_cv_sets_methods.R
\name{.kFoldStratified}
\alias{.kFoldStratified}
\title{Stratified k-fold cross-validation index generator}
\usage{
.kFoldStratified(k, stratified)
}
\arguments{
\item{k}{Integer. Number of folds.}

\item{stratified}{List with three elements:
\itemize{
\item \code{type}: Character. Either \code{"R"} for regression or \code{"DA"} for discriminant analysis.
\item \code{Y}: Matrix. Outcome matrix with a single column.
\item \code{probs}: Numeric vector. Probabilities used for stratification of numeric \code{Y} (regression only).
}}
}
\value{
A list of length \code{k}, each element containing the training set row indices (integers) for one CV fold.
Returns \code{NULL} and a warning if stratification is not feasible due to class imbalance.
}
\description{
Generates a list of training set indices for stratified k-fold cross-validation (CV).
Stratification is performed based on the first column of \code{Y}. For regression tasks,
\code{Y} is binned by quantiles to emulate class balance. Ensures class proportions are
preserved across folds when possible.
}
\keyword{internal}
