% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/LogBip.R
\name{LogBip}
\alias{LogBip}
\title{Fit a Binary Logistic Biplot}
\usage{
LogBip(
  x,
  k = 5,
  method = "MM",
  type = NULL,
  plot = TRUE,
  maxit = NULL,
  endsegm = 0.9,
  label.ind = FALSE,
  col.ind = NULL,
  draw = c("biplot", "ind", "var"),
  random_start = FALSE,
  L = 0,
  cv_LogBip = FALSE
)
}
\arguments{
\item{x}{A binary matrix (or a matrix with \code{NA} values when
\code{method = "PDLB"}).}

\item{k}{Number of dimensions. Default is \code{k = 5}.}

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

\item{type}{Update formula for the conjugate gradient method: \code{1} =
Fletcher--Reeves, \code{2} = Polak--Ribiere, \code{3} = Beale--Sorenson.
Ignored for other methods.}

\item{plot}{Logical; if \code{TRUE} (default), the logistic biplot is plotted
after fitting.}

\item{maxit}{Maximum number of iterations. Defaults to \code{100} for gradient
methods and \code{500} for derivative-free methods.}

\item{endsegm}{End point of the variable segment on the probability scale.
The segment starts at 0.5 and ends at this value. Default is \code{0.90}.}

\item{label.ind}{Logical; if \code{TRUE}, row points are labelled. Default is
\code{FALSE}.}

\item{col.ind}{Color for the row markers. Passed to \code{\link{plotBLB}}.}

\item{draw}{Which graph to draw: \code{"biplot"} (default) for both rows and
columns, \code{"ind"} for individuals only, or \code{"var"} for variables
only.}

\item{random_start}{Logical; if \code{TRUE}, parameters are initialised
randomly. If \code{FALSE} (default), an SVD-based initialisation is used.}

\item{L}{Ridge penalization parameter. Default is \code{L = 0} (no penalty).}

\item{cv_LogBip}{Logical; indicates whether the function is being called
internally by \code{\link{cv_LogBip}}. Users should leave this as
\code{FALSE} (default).}
}
\value{
An object of class \code{BiplotML} (a named list) containing:
  \describe{
    \item{\code{Ahat}}{Data frame of row-marker coordinates.}
    \item{\code{Bhat}}{Data frame of column-marker coordinates, including the
      intercept column \code{bb0}.}
    \item{\code{method}}{Character string identifying the fitting method used.}
    \item{\code{loss_function}}{Vector of loss-function values at each
      iteration (MM and PDLB methods only).}
    \item{\code{iterations}}{Number of iterations performed (MM and PDLB
      methods only).}
    \item{\code{impute_x}}{Imputed binary matrix (PDLB method only).}
  }
}
\description{
Estimates the intercept vector \eqn{\mu}, the row-marker matrix \strong{A}, and the
column-marker matrix \strong{B} of a logistic biplot model using the optimization
algorithm selected by the user.
}
\details{
The following fitting methods are available:

\strong{Conjugate gradient (CG):} Set \code{method = "CG"} and choose the update
formula via \code{type}:
\itemize{
  \item \code{type = 1} --- Fletcher--Reeves
  \item \code{type = 2} --- Polak--Ribiere
  \item \code{type = 3} --- Hestenes--Stiefel
  \item \code{type = 4} --- Dai--Yuan
}

\strong{Coordinate descent MM:} Set \code{method = "MM"} to use the iterative
coordinate descent Majorization-Minimization algorithm.

\strong{Projection-based algorithm (PDLB):} Set \code{method = "PDLB"} when the
binary matrix contains missing values, or when the row coordinates of new
(supplementary) individuals need to be estimated without refitting the model.
See Babativa-Marquez & Vicente-Villardon (2022) for details.

\strong{BFGS:} Set \code{method = "BFGS"} to use the Broyden--Fletcher--
Goldfarb--Shanno quasi-Newton method.
}
\examples{
\donttest{
data("Methylation")

# Fit using the coordinate descent MM algorithm
res_MM <- LogBip(x = Methylation, method = "MM", maxit = 1000)

# Fit using the PDLB algorithm with simulated missing data
set.seed(12345)
n <- nrow(Methylation); p <- ncol(Methylation)
miss <- matrix(rbinom(n * p, 1, 0.2), n, p)
miss <- ifelse(miss == 1, NA, miss)
x_miss <- Methylation + miss
res_PDLB <- LogBip(x = x_miss, method = "PDLB", maxit = 1000)
}
}
\references{
Babativa-Marquez, J. G., & Vicente-Villardon, J. L. (2026). Logistic biplot
with missing data. \emph{In process}.

Babativa-Marquez, J. G., & Vicente-Villardon, J. L. (2021). Logistic biplot
by conjugate gradient algorithms and iterated SVD. \emph{Mathematics},
\emph{9}(16), 2015. \doi{10.3390/math9162015}

Nash, J. C. (2011). Unifying optimization algorithms to aid software system
users: optimx for R. \emph{Journal of Statistical Software}, \emph{43}(9),
1--14.

Nash, J. C. (2014). On best practice optimization methods in R.
\emph{Journal of Statistical Software}, \emph{60}(2), 1--14.

Nocedal, J., & Wright, S. (2006). \emph{Numerical Optimization} (2nd ed.).
Springer.

Vicente-Villardon, J. L., & Galindo, M. P. (2006). Logistic biplots. In
M. Greenacre & J. Blasius (Eds.), \emph{Multiple Correspondence Analysis and
Related Methods} (pp. 503--521). Chapman & Hall.
}
\seealso{
\code{\link{plotBLB}}, \code{\link{pred_LB}}, \code{\link{fitted_LB}}
}
\author{
Giovany Babativa <jgbabativam@unal.edu.co>
}
