% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/process_input.R
\name{process_input}
\alias{process_input}
\title{Process Input Arguments for lgspline}
\usage{
process_input(
  predictors = NULL,
  y = NULL,
  formula = NULL,
  response = NULL,
  data = NULL,
  weights = NULL,
  observation_weights = NULL,
  family = gaussian(),
  K = NULL,
  custom_knots = NULL,
  auto_encode_factors = TRUE,
  include_2way_interactions = TRUE,
  include_3way_interactions = TRUE,
  just_linear_with_interactions = NULL,
  just_linear_without_interactions = NULL,
  exclude_interactions_for = NULL,
  exclude_these_expansions = NULL,
  offset = c(),
  no_intercept = FALSE,
  do_not_cluster_on_these = c(),
  include_quartic_terms = NULL,
  cluster_args = c(custom_centers = NA, nstart = 10),
  include_warnings = TRUE,
  dummy_fit = FALSE,
  include_constrain_second_deriv = TRUE,
  standardize_response = TRUE,
  ...
)
}
\arguments{
\item{predictors}{Default: NULL. Formula or numeric matrix/data frame
of predictor variables.}

\item{y}{Default: NULL. Numeric response vector.}

\item{formula}{Default: NULL. Optional formula; alias for predictors
when a formula object.}

\item{response}{Default: NULL. Alternative name for \code{y}.}

\item{data}{Default: NULL. Data frame for formula interface.}

\item{weights}{Default: NULL. Alias for \code{observation_weights}.}

\item{observation_weights}{Default: NULL. Numeric observation weight
vector.}

\item{family}{Default: \code{gaussian()}. GLM family object.}

\item{K}{Default: NULL. Number of interior knots.}

\item{custom_knots}{Default: NULL. Custom knot matrix.}

\item{auto_encode_factors}{Default: TRUE. Logical; auto one-hot encode
factor and character columns when using the formula interface.}

\item{include_2way_interactions}{Default: TRUE. Logical.}

\item{include_3way_interactions}{Default: TRUE. Logical.}

\item{just_linear_with_interactions}{Default: NULL. Integer vector or
character vector of column names.}

\item{just_linear_without_interactions}{Default: NULL. Integer vector or
character vector of column names.}

\item{exclude_interactions_for}{Default: NULL. Integer vector or character
vector of column names.}

\item{exclude_these_expansions}{Default: NULL. Character vector of
expansion names to exclude.}

\item{offset}{Default: \code{c()}. Vector of column indices or names
to include as offsets.}

\item{no_intercept}{Default: FALSE. Logical; remove intercept.}

\item{do_not_cluster_on_these}{Default: \code{c()}. Vector of column
indices or names to exclude from clustering.}

\item{include_quartic_terms}{Default: NULL. Logical or NULL.}

\item{cluster_args}{Default: \code{c(custom_centers = NA, nstart = 10)}.
Named vector of clustering arguments.}

\item{include_warnings}{Default: TRUE. Logical.}

\item{dummy_fit}{Default: FALSE. Logical; run the full preprocessing path but stop short of fitting nonzero coefficients.}

\item{include_constrain_second_deriv}{Default: TRUE. Logical.}

\item{standardize_response}{Default: TRUE. Logical.}

\item{...}{Additional arguments (checked for depreciated names).}
}
\value{
A named list containing:
\describe{
  \item{predictors}{Numeric matrix of predictor variables with column
    names stripped for positional indexing.}
  \item{y}{Numeric response vector.}
  \item{og_cols}{Character vector of original predictor column names,
    or NULL if none were available.}
  \item{replace_colnames}{Logical; TRUE if og_cols is available and
    column renaming should be applied post-fit.}
  \item{just_linear_with_interactions}{Integer vector of column indices,
    or NULL.}
  \item{just_linear_without_interactions}{Integer vector of column indices,
    or NULL.}
  \item{exclude_interactions_for}{Integer vector of column indices,
    or NULL.}
  \item{exclude_these_expansions}{Character vector of positional-notation
    expansion names, or NULL.}
  \item{offset}{Integer vector of column indices, or \code{c()}.}
  \item{no_intercept}{Logical.}
  \item{do_not_cluster_on_these}{Numeric vector of column indices,
    or \code{c()}.}
  \item{observation_weights}{Numeric vector or NULL.}
  \item{K}{Integer or NULL, possibly updated by cluster_args or
    all-linear detection.}
  \item{include_3way_interactions}{Logical, possibly updated by
    formula parsing.}
  \item{include_quartic_terms}{Logical or NULL, possibly updated
    by number of predictors.}
  \item{data}{Data frame, possibly with factor columns one-hot encoded.}
  \item{include_constrain_second_deriv}{Logical, possibly set FALSE
    when no numeric predictors remain.}
  \item{factor_groups}{Named list mapping original factor column names to
    integer vectors of their one-hot indicator column positions within
    the predictor matrix. Used by lgspline.fit to impose sum-to-zero
    constraints on encoded factor levels. NULL when no factors were
    encoded, or when the formula interface was not used.}
}
}
\description{
Parses formula and data arguments, performs factor encoding,
resolves variable roles (spline, linear-with-interactions,
linear-without-interactions), constructs exclusion patterns,
and validates inputs. Called internally by \code{\link{lgspline}}.

Users may call this function directly to inspect how their formula
and data are interpreted before fitting.
}
\examples{
\dontrun{
data("Theoph")
df <- Theoph[, c("Time", "Dose", "conc", "Subject")]
processed <- process_input(
  predictors = conc ~ spl(Time) + Time*Dose,
  data = df,
  auto_encode_factors = TRUE,
  include_warnings = TRUE
)
str(processed$predictors)
processed$og_cols
processed$just_linear_without_interactions
processed$factor_groups
}

}
\seealso{
\code{\link{lgspline}} for the main fitting interface.
}
\keyword{internal}
