biogeme.latent_variables.structural_equation module¶
Structural equations for latent variables.
This module defines StructuralEquation, a lightweight specification of
latent-variable structural equations. A structural equation consists of:
a latent variable name,
a set of explanatory variables entering the deterministic part,
a stochastic error term built from simulation draws, scaled by a strictly positive parameter (sigma).
The deterministic part is a linear-in-parameters expression built with one coefficient per explanatory variable.
The full structural equation returned by StructuralEquation.expression()
creates a DistributedParameter whose child is the
sum of the deterministic component and a random term
sigma * Draws(draw_type=...).
Michel Bierlaire Tue Dec 23 2025, 16:00:07
- class biogeme.latent_variables.structural_equation.StructuralEquation(name, explanatory_variables, sigma_factory=None)[source]¶
Bases:
objectSpecification of a latent-variable structural equation.
The structural equation defines the deterministic part as a linear utility over the explanatory variables and adds a stochastic term based on draws.
- Parameters:
name (
str) – Name of the latent variable.explanatory_variables (
Iterable[str]) – Iterable of variable names entering the deterministic part.sigma_factory (
SigmaFactory|None) – Factory creating a strictly positive scale parameter (sigma) used to scale the draw-based stochastic term. Required unless an explicitscale_parameteris provided toexpression().
-
explanatory_variables:
Iterable[str]¶
- expression(*, draw_type, scale_parameter=None)[source]¶
Construct the full structural equation including the stochastic term.
If
scale_parameteris not provided, the method usessigma_factoryto create a strictly positive sigma parameter named withprefix.The returned expression is a
DistributedParameterwith child expression:deterministic + scale_parameter * Draws(draw_type=draw_type).- Parameters:
draw_type (
str) – Draw type identifier used byDraws.scale_parameter (
Expression|None) – Optional scale parameter (sigma). If None, it is created throughsigma_factory.
- Return type:
- Returns:
Expression representing the full structural equation.
- Raises:
ValueError – If
scale_parameteris None andsigma_factoryis undefined.
- get_expression_deterministic_part()[source]¶
Construct the deterministic part of the structural equation.
A coefficient
Betais created for each explanatory variable and assembled into aLinearUtility.- Return type:
- Returns:
A linear expression representing the deterministic component.
-
name:
str¶
- property prefix: str¶
Prefix used to namespace parameters belonging to this structural equation.
-
sigma_factory:
SigmaFactory|None= None¶