% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cv_LogBip.R
\name{cv_LogBip}
\alias{cv_LogBip}
\title{Cross-Validation for Logistic Biplot}
\usage{
cv_LogBip(
  data,
  k = 0:5,
  K = 7,
  method = "MM",
  type = NULL,
  plot = TRUE,
  maxit = NULL
)
}
\arguments{
\item{data}{A binary matrix.}

\item{k}{Integer vector of dimensions to evaluate. Default is \code{0:5}.}

\item{K}{Number of folds. Default is \code{K = 7}.}

\item{method}{Fitting algorithm: \code{"MM"} (default), \code{"CG"},
\code{"PDLB"}, or \code{"BFGS"}.}

\item{type}{Update formula for the CG method (see \code{\link{LogBip}}).}

\item{plot}{Logical; if \code{TRUE} (default), the cross-validation error
curve is plotted.}

\item{maxit}{Maximum number of iterations. Defaults to \code{100} for
gradient methods and \code{2000} for the MM algorithm.}
}
\value{
A data frame with columns \code{k}, \code{cv-error} (mean
  cross-validation error, in percent), and \code{train-error} (mean training
  error, in percent).
}
\description{
Performs k-fold cross-validation for a logistic biplot model across a range
of dimensions, enabling selection of the optimal number of latent dimensions.
}
\examples{
\donttest{
set.seed(1234)
x <- simBin(n = 100, p = 50, k = 3, D = 0.5, C = 20)

# Cross-validation using the MM algorithm
cv_MM <- cv_LogBip(data = x$X, k = 0:5, method = "MM", maxit = 1000)

# Cross-validation using the PDLB algorithm
cv_PB <- cv_LogBip(data = x$X, k = 0:5, method = "PDLB", maxit = 1000)
}
}
\references{
Bro, R., Kjeldahl, K., & Smilde, A. K. (2008). Cross-validation of component
models: a critical look at current methods. \emph{Analytical and Bioanalytical
Chemistry}, \emph{390}(5), 1241--1251.

Wold, S. (1978). Cross-validatory estimation of the number of components in
factor and principal components models. \emph{Technometrics}, \emph{20}(4),
397--405.
}
\seealso{
\code{\link{LogBip}}, \code{\link{pred_LB}}, \code{\link{fitted_LB}},
  \code{\link{simBin}}
}
\author{
Giovany Babativa <jgbabativam@unal.edu.co>
}
