% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/crossval.R
\name{cv_arvind}
\alias{cv_arvind}
\title{K-Fold and Rolling-Window Cross-Validation}
\usage{
cv_arvind(fit, k_folds = 5, rolling = TRUE, n0_frac = 0.5, seed = 42)
}
\arguments{
\item{fit}{an object of class \code{"ArvindFit"}.}

\item{k_folds}{integer; number of cross-validation folds (default: 5).}

\item{rolling}{logical; if \code{TRUE} (default), also performs
rolling-window cross-validation.}

\item{n0_frac}{numeric; fraction of data used as initial training window
for rolling CV (default: 0.5).}

\item{seed}{integer; random seed for reproducibility (default: 42).}
}
\value{
A list with components:
\describe{
\item{cv_rmse}{numeric vector of length \code{k_folds}; per-fold RMSE.}
\item{cv_mae}{numeric vector of length \code{k_folds}; per-fold MAE.}
\item{mean_cv_rmse}{numeric; average k-fold RMSE.}
\item{mean_cv_mae}{numeric; average k-fold MAE.}
\item{roll_rmse}{numeric; rolling-window RMSE (or \code{NA}).}
}
}
\description{
Performs k-fold cross-validation and optionally rolling-window
(expanding-window) cross-validation for an \code{ArvindFit} model.
}
\examples{
dat <- simulate_arvind_data(n = 50, seed = 1)
m1 <- fit_rw1(Y ~ X1 + X2 + X3, dat, seed = 42)
cv <- cv_arvind(m1, k_folds = 3, rolling = FALSE, seed = 42)
cv$mean_cv_rmse

}
\seealso{
\code{\link[=diagnostics_arvind]{diagnostics_arvind()}}, \code{\link[=forecast_arvind]{forecast_arvind()}}
}
