biogeme.latent_variables.likert_indicators module¶
Utilities for Likert-type indicators used in Biogeme latent-variable models.
This module defines small helper data structures to work with Likert-scale survey items in Biogeme measurement equations.
Two concepts are separated:
LikertTypedescribes a category of indicators of the same type (number of categories, symmetry, and how ordered thresholds are parameterized).LikertIndicatordescribes an item (statement / variable name) and provides consistent parameter naming for the measurement equation.
LikertType.get_thresholds returns the ordered cut-points (thresholds) corresponding to the type definition. Symmetric scales build thresholds as cumulative sums of strictly positive increments on the positive side, mirrored around zero (and optionally inserting a central 0 for an even number of categories). Non-symmetric scales build thresholds as a monotone sequence.
The concrete creation of strictly positive parameters (for increments and measurement scales) is delegated to factories, so the same code can be used in maximum-likelihood and Bayesian contexts.
Michel Bierlaire Tue Dec 23 2025, 15:08:48
- class biogeme.latent_variables.likert_indicators.LikertIndicator(name, statement, type, sigma_factory=None, positive_parameter_factory=None)[source]¶
Bases:
objectRepresent a Likert indicator and provide helpers for measurement parameters.
The class does not store the scale definition itself (categories, thresholds, etc.). Those are described by
LikertType. This class focuses on consistent naming and creation of parameters used in the measurement equation.- Parameters:
name (
str) – Short identifier of the indicator, used to construct parameter names.statement (
str) – Text of the statement that respondents evaluate on the Likert scale.type (
str) – Optional indicator-type label (for example to implement threshold sharing policies by type).sigma_factory (
SigmaFactory|None) – Factory creating strictly positive measurement scale parameters.positive_parameter_factory (
PositiveParameterFactory|None) – Factory creating strictly positive parameters (kept for API symmetry with other components; may be unused depending on the model design).
- get_lv_coefficient_parameter(latent_variable_name)[source]¶
Return the Biogeme parameter for the coefficient of a latent variable in this indicator’s measurement equation.
- Parameters:
latent_variable_name (
str) – Name of the latent variable appearing in the measurement equation.- Return type:
- Returns:
A
Betaobject representing the corresponding coefficient.
- get_lv_coefficient_parameter_name(latent_variable_name)[source]¶
Build the name of the coefficient linking a latent variable to this indicator.
- Parameters:
latent_variable_name (
str) – Name of the latent variable appearing in the measurement equation.- Return type:
str- Returns:
The parameter name used for the corresponding coefficient.
- property intercept_parameter: Beta¶
Return the Biogeme parameter corresponding to the measurement intercept.
- Returns:
A
Betaobject representing the intercept parameter.
- property intercept_parameter_name: str¶
Return the name of the intercept parameter for this indicator.
- Returns:
The parameter name used for the measurement intercept.
-
name:
str¶
-
positive_parameter_factory:
PositiveParameterFactory|None= None¶
- property scale_parameter: Expression¶
Return the measurement scale parameter for this indicator.
- Returns:
An expression representing a strictly positive scale parameter.
- Raises:
ValueError – If
sigma_factoryis undefined.
-
sigma_factory:
SigmaFactory|None= None¶
-
statement:
str¶
-
type:
str¶
- class biogeme.latent_variables.likert_indicators.LikertType(type, symmetric, categories, neutral_labels, scale_normalization, sigma_factory=None, positive_parameter_factory=None, fix_first_cut_point_for_non_symmetric_thresholds=None)[source]¶
Bases:
objectDescribe a Likert scale and build its ordered thresholds.
A
LikertTyperepresents the definition of a Likert scale shared by one or several indicators (items).- Parameters:
type (
str) – Short label used as prefix for threshold-parameter names.symmetric (
bool) – If True, thresholds are symmetric around 0. If False, thresholds are only constrained to be strictly increasing.categories (
list[int]) – Ordered list of distinct category codes used in the data (for example[-2, -1, 0, 1, 2]).neutral_labels (
list[int]) – Category codes considered neutral for this scale (for example[0]). This metadata is not used to build thresholds, but can be used by downstream code.sigma_factory (
SigmaFactory|None) – Factory creating strictly positive measurement scale parameters.positive_parameter_factory (
PositiveParameterFactory|None) – Factory creating strictly positive parameters used for threshold increments.fix_first_cut_point_for_non_symmetric_thresholds (
float|None) – If not None andsymmetricis False, fix the first cut-point to this numeric value; otherwise the first cut-point is a free parameter.scale_normalization (str)
-
categories:
list[int]¶
-
fix_first_cut_point_for_non_symmetric_thresholds:
float|None= None¶
- get_thresholds()[source]¶
Construct and return the ordered cut-points (thresholds).
- Return type:
list[Expression]- Returns:
A list of
K-1expressions, whereKis the number of categories, representing strictly increasing cut-points.
-
neutral_labels:
list[int]¶
-
positive_parameter_factory:
PositiveParameterFactory|None= None¶
-
scale_normalization:
str¶
-
sigma_factory:
SigmaFactory|None= None¶
-
symmetric:
bool¶
-
type:
str¶