% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fix_coefficient.R
\name{fix_type_intercepts}
\alias{fix_type_intercepts}
\title{Fix type-specific intercepts to zero for a model component}
\usage{
fix_type_intercepts(component, types = NULL, choice = NULL)
}
\arguments{
\item{component}{A model_component object from define_model_component()}

\item{types}{Integer vector (optional). Which types to fix. Must be between 2 and n_types
(type 1 is the reference with no intercept). Default is NULL, meaning all
non-reference types.}

\item{choice}{Integer (optional). For multinomial logit models with num_choices > 2,
specifies which choice's type intercepts to fix. Must be between 1 and (num_choices - 1).
Default is NULL, meaning all choices.}
}
\value{
The modified model_component object with the fixed type intercept constraints added.
}
\description{
For models with n_types > 1, each component has type-specific intercepts
that shift the linear predictor for each non-reference type. This function
constrains those intercepts to zero, effectively removing the type-specific
shift for this component.
}
\details{
When n_types > 1, the model includes a latent type structure where different
types can have different intercepts in each measurement equation. By default,
these intercepts are freely estimated. Fixing them to zero constrains the
outcome equation to have no type-specific shifts (though the type model loadings
at the factor level may still differ).

This is useful when you want the type model to affect outcomes only through
factor loadings, not through direct type-specific intercepts.

Fixed type intercepts are stored in the component and used during:
\itemize{
\item Parameter initialization: fixed values are used directly (no estimation)
\item Optimization: fixed parameters are excluded from the optimization
\item Likelihood evaluation: fixed values are inserted into the parameter vector
}
}
\examples{
# Build a component with n_types = 2 and fix the type-2 intercept
dat <- data.frame(intercept = 1, y = rnorm(20))
fm <- define_factor_model(n_factors = 1, n_types = 2)
mc <- define_model_component(
  name = "y", data = dat, outcome = "y", factor = fm,
  covariates = "intercept", model_type = "linear",
  loading_normalization = 1, use_types = TRUE
)
mc <- fix_type_intercepts(mc)
length(mc$fixed_type_intercepts)

}
