% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nmf.ffb.R, R/nmf.sem.R
\name{nmf.ffb.split}
\alias{nmf.ffb.split}
\alias{nmf.sem.split}
\title{Heuristic Variable Splitting for NMF-FFB}
\usage{
nmf.ffb.split(x, ...)

nmf.sem.split(
  x,
  n.exogenous = NULL,
  threshold = 0.1,
  auto.flipped = TRUE,
  verbose = FALSE
)
}
\arguments{
\item{x}{A numeric matrix or data frame with
\strong{rows = samples} and \strong{columns = observed variables}.}

\item{...}{Reserved for future use; currently unused (also accepted
by the \code{\link{nmf.ffb.split}} alias for argument forwarding).}

\item{n.exogenous}{Optional integer specifying the number of exogenous variables
(\eqn{Y_2}). If \code{NULL}, the number is inferred automatically by the
coefficient cut-off rule.}

\item{threshold}{Standardized regression-coefficient threshold used in the
automatic exogenous–endogenous split. A variable is treated as endogenous
once its maximum standardized parent coefficient exceeds this value.
(Default: \code{0.1})}

\item{auto.flipped}{Logical; if \code{TRUE}, applies PC1-based automatic
sign flipping after standardization to ensure consistent orientation.
(Default: \code{TRUE})}

\item{verbose}{Logical; if \code{TRUE}, prints progress messages and the
resulting variable split. (Default: \code{FALSE})}
}
\value{
A list with:
\item{endogenous.variables}{
Character vector of variables selected as endogenous (\eqn{Y_1}).}
\item{exogenous.variables}{
Character vector of variables selected as exogenous (\eqn{Y_2}).}
\item{ordered.variables}{
Variables in inferred causal order (from exogenous to endogenous).}
\item{is.flipped}{
Logical vector indicating which variables were sign-flipped during processing.}
\item{n.exogenous}{
Integer giving the number of exogenous variables.}
}
\description{
Infers a heuristic partition of observed variables into exogenous (\eqn{Y_2})
and endogenous (\eqn{Y_1}) blocks for use in NMF-FFB.
The method is based on positive-SEM logic, causal ordering, and optional
sign alignment using the first principal component (PC1).

The procedure:
\itemize{
\item internally standardizes variables (mean 0, sd 1),
\item optionally flips signs so that most variables align positively with PC1,
\item infers a causal ordering by repeatedly regressing each variable on the
remaining ones and selecting the variable with the largest minimum
standardized coefficient,
\item determines an exogenous block by scanning the ordering from upstream
and stopping at the first variable whose strongest parent coefficient
exceeds \code{threshold}.
}

If \code{n.exogenous} is supplied, it overrides the automatic threshold rule.
}
\examples{
# Infer exogenous/endogenous split from iris
sp <- nmf.sem.split(iris[, -5], n.exogenous = 2)
sp$endogenous.variables
sp$exogenous.variables

}
\seealso{
\code{\link{nmf.sem}}
}
