% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xreg2_control.R
\name{xreg2_control}
\alias{xreg2_control}
\title{Create xreg2 Control Object}
\usage{
xreg2_control(
  formulas,
  start_values = numeric(),
  fixed_values = numeric(),
  p_fun = xreg2_cont_normal,
  grad_fun = function(par, ...) numDeriv::grad(func = p_fun, x = par, method = "simple",
    ...),
  p_aggregation_fun = function(d_df) return(-d_df$p * d_df$internal_count),
  weights_var = NA,
  name = NA,
  censor_bounds = c(-Inf, Inf),
  lower = NA,
  upper = NA
)
}
\arguments{
\item{formulas}{A formula or list of formulas. The left-hand side names the
dependent (or intermediate) variable; the right-hand side is evaluated in
the context of parameter values and data columns.}

\item{start_values}{Named numeric vector of starting values. An existing
\code{xreg2} fitted object may be supplied; coefficients are extracted.}

\item{fixed_values}{Named numeric vector of parameter values held fixed
during optimisation.}

\item{p_fun}{Log-likelihood function. Default \code{xreg2_cont_normal}.
Must accept \code{(par, dtalist, ...)} and return a scalar.}

\item{grad_fun}{Gradient function. Default uses \code{numDeriv::grad} with
method \code{"simple"}.}

\item{p_aggregation_fun}{Aggregation function applied to the likelihood
data-frame. Rarely changed by users.}

\item{weights_var}{Character name of a column in the data used as
observation weights. \code{NA} for unweighted.}

\item{name}{Optional character label for this component.}

\item{censor_bounds}{Numeric vector of length 2 giving lower and upper
censoring bounds. Default \code{c(-Inf, Inf)} (no censoring).}

\item{lower}{Named numeric vector of lower parameter bounds (for
bounded optimisers).}

\item{upper}{Named numeric vector of upper parameter bounds.}
}
\value{
An object of class \code{c("xreg2Control", "list")}.
}
\description{
Creates a control object specifying the model formula(s),
  likelihood function, gradient function, and starting values for one
  component of a joint \code{xreg2} model.
}
\details{
Create an xreg2 control object
}
\examples{
ctrl <- xreg2_control(
  formulas     = list(y ~ INTERCEPT + x * SLOPE),
  start_values = c(INTERCEPT = 0, SLOPE = 0),
  p_fun        = xreg2_cont_normal,
  name         = "continuous"
)

}
\seealso{
\code{\link{xreg2_fit}}, \code{\link{c.xreg2Control}}
}
