biogeme.latent_variables.latent_variables module

Latent-variable definitions and normalization utilities for structural equation models.

This module provides lightweight data structures used to define latent variables in Biogeme latent-variable models.

  • Normalization defines the anchor (indicator) and coefficient used to identify a latent variable.

  • LatentVariable combines a latent variable name, its StructuralEquation, the related indicators, and the information required to build a JAX-compatible structural expression.

Michel Bierlaire Thu Dec 11 2025, 15:30:00

class biogeme.latent_variables.latent_variables.LatentVariable(name, structural_equation, indicators, normalization, draw_type_jax=None, sigma_factory=None)[source]

Bases: object

Define a latent variable with its structural equation and metadata.

The structural equation is provided through a StructuralEquation. For JAX-based computations, the complete expression (including the stochastic error term) can be obtained via :pyattr:`structural_equation_jax`.

Parameters:
  • name (str) – Name of the latent variable.

  • structural_equation (StructuralEquation) – Structural equation specification (deterministic part and stochastic error term definition).

  • indicators (Iterable[str]) – Collection of indicator names linked to this latent variable.

  • normalization (Normalization) – Normalization information (anchor indicator and fixed coefficient).

  • draw_type_jax (str | None) – Identifier of the draw type used when constructing the stochastic error term for JAX (passed to structural_equation.expression(draw_type=...)). If None, :pyattr:`structural_equation_jax` cannot be evaluated.

  • sigma_factory (SigmaFactory | None) – Factory used to create the strictly positive scale parameter of the stochastic error term. If None, :pyattr:`structural_equation_jax` cannot be evaluated.

draw_type_jax: str | None = None
indicators: Iterable[str]
name: str
normalization: Normalization
sigma_factory: SigmaFactory | None = None
structural_equation: StructuralEquation
property structural_equation_jax: Expression

Return the full structural equation expression for JAX.

This property requires both draw_type_jax and sigma_factory to be defined. It injects sigma_factory into the underlying structural_equation before calling structural_equation.expression(draw_type=draw_type_jax).

Returns:

The complete structural equation expression including the stochastic error term.

Raises:
  • ValueError – If draw_type_jax is not defined.

  • ValueError – If sigma_factory is not defined.

class biogeme.latent_variables.latent_variables.Normalization(indicator, coefficient)[source]

Bases: object

Normalization information for a latent variable.

A normalization anchors a latent variable by fixing one measurement loading.

Parameters:
  • indicator (str) – Name of the indicator used as anchor for the normalization.

  • coefficient (float) – Numeric value of the fixed loading associated with the anchor indicator.

coefficient: float
indicator: str