Structured Models¶
Introduction¶
VOR Stream models support two definition modes:
- Freeform — Write custom model code in Go, Python, or SAS. This gives full flexibility to implement any computation. See the Models page for details.
- Structured — Define a regression model declaratively by specifying predictors, coefficients, and a normalization method. No custom code is required.
Structured models are ideal when a model can be expressed as a regression equation. The UI guides you through building the formula, and the system computes the output at run time.
| Feature | Freeform | Structured |
|---|---|---|
| Definition method | Custom code (Go / Python / SAS) | Declarative (UI-driven) |
| Flexibility | Any computation | Regression equations |
| Requires coding | Yes | No |
| Normalization options | Implemented in code | Built-in (None, Logit, Probit) |
| Predictor management | Manual in code | UI table with coefficients and exponents |
Key Concepts¶
- Regression Model
- The top-level structured definition. It specifies the function type, normalization method, and dependent variable (the target output).
- Regression Table
- Contains the intercept (baseline constant) and a list of numeric predictors that make up the regression equation.
- Numeric Predictor
- A single term in the regression equation. Each predictor has a coefficient, an exponent, and a field reference that identifies the data source.
- Field Reference
- The data source for a predictor. There are four types: Factor Reference, Dictionary Reference, Local Transformation, and Lookup Reference. These are described in detail in the Field Reference Types section.
Creating a Structured Model¶
- Navigate to the Models tab.
-
Create a new model by clicking the Model icon on the Models list panel on the left.
-
In the Model Details section, enter a Model Name, select a Model Type, and select a Model LOB from the drop-down menus.
-
Click the Structured toggle button above the editor area to switch from freeform mode to structured mode. The structured model editor appears.
-
(Optional) In the Dynamic Fields panel on the right, define any Local Transformations that compute derived values from other fields. See Local Transformation for details.
-
(Optional) In the Dynamic Fields panel, define any Lookup References that select a field based on a categorical variable. See Lookup Reference for details.
-
Select the Dependent Variable from the drop-down. This is the output (target) variable for the regression.
- Select the Function type. Currently,
Regressionis the supported function type. - Select the Normalization Method from the drop-down (
None,Logit, orProbit). -
Enter the Intercept value (the baseline constant).
-
Add predictors by clicking the button in the regression table. For each predictor:
- Select the Source field (a factor, dictionary column, local transformation, or lookup reference).
- Enter the Coefficient value.
- Enter the Exponent value (defaults to 1 for linear terms).
-
Review the formula preview to verify the equation.
-
Save the model by clicking the icon in the upper right corner. The model is saved and appears in the sidebar model list.
Mathematical Formula¶
A structured regression model computes:
Y = f( β₀ + Σ(βᵢ × Xᵢ^eᵢ) )
where:
- Y is the dependent variable (model output)
- β₀ is the intercept
- βᵢ is the coefficient for predictor i
- Xᵢ is the value of predictor i
- eᵢ is the exponent for predictor i
- f() is the normalization function
Normalization Methods¶
The normalization function f() transforms the raw linear combination into the final output:
| Method | Formula | Description |
|---|---|---|
| None | f(x) = x |
No transformation. Returns the raw linear combination. |
| Logit | f(x) = 1/(1 + e^(-x)) |
Logistic function. Maps output to the (0, 1) range. |
| Probit | f(x) = CDF(x) |
Cumulative standard normal distribution. Maps output to (0, 1). |
Info
Use Logit or Probit normalization when the model output represents a probability (e.g., probability of default). Use None for models where the raw linear combination is the desired output.
Field Reference Types¶
Every numeric predictor in the regression table requires a field reference that tells the system where to get the input value. There are four types of field references.
Factor Reference¶
A factor reference links a predictor to a risk factor — an external or macroeconomic variable such as GDP growth, unemployment rate, or a house price index (HPI).
Factors are managed separately in the Scenarios section and are made available to models through the scenario attached to a study run.
Dictionary Reference¶
A dictionary reference links a predictor to a dictionary column — a field from the portfolio or instrument data. Examples include loan-to-value (LTV), credit score, debt-to-income ratio (DTI), or account balance.
Dictionary columns are defined in the playpen's data dictionary and are populated from the input data at run time.
Local Transformation¶
A local transformation is a computed field defined within the structured model itself. It lets you create derived values using a formula expression before referencing them as predictors.
Formula syntax:
- Reference other fields using curly braces:
{FieldName} - Field names resolve in order: local transformations, then dictionary columns, then factors (first match wins)
Supported operators:
| Operator | Description |
|---|---|
+ |
Addition |
- |
Subtraction |
* |
Multiplication |
/ |
Division |
^ |
Exponentiation |
% |
Modulo |
Supported functions:
| Category | Functions |
|---|---|
| Math | abs, cbrt, ceil, exp, floor, ln, log, mod, pi, power, round, sign, sqrt, trunc |
| Aggregation | min, max, sum, coalesce |
| String | hasPrefix, hasSuffix, indexOf, lastIndexOf, len, lower, replace, split, substring, trim, trimPrefix, trimSuffix, upper |
| Date | dateadd, datediff, getdate |
| Control | if(condition, then, else) |
| Utility | float, int, isnull, string |
Example formulas:
ln({LTV})
{Income} * 12
{xG} / max({Minutes}, 1) * 90
if({CreditScore} > 700, 1, 0)
Note
The system detects circular references between local transformations. A transformation cannot reference itself, either directly or through a chain of other transformations.
Lookup Reference¶
A lookup reference performs conditional field selection based on the value of a categorical dictionary variable (the selector). It maps each category to a different field reference, with an optional default for unmapped values.
This is useful when different segments of the portfolio should use different data sources for the same predictor. For example, a model might need a regional house price index where the specific HPI factor depends on the borrower's province.
Components:
- Selector — A categorical dictionary column (e.g., Province)
- Mappings — A set of category-to-field pairs. Each mapping specifies a
category value (e.g.,
"ON") and a target field reference (which can be a factor, dictionary column, local transformation, or even another lookup). - Default Target — The field reference used when the selector value does not match any mapping.
Example — Regional HPI by Province:
| Selector Value | Target Field |
|---|---|
ON |
Factor: Ontario HPI |
BC |
Factor: BC HPI |
AB |
Factor: Alberta HPI |
| (default) | Factor: National HPI |
Examples¶
Example 1: Simple PD Model¶
A basic probability of default model with two predictors from the dictionary and one macroeconomic factor.
| Setting | Value |
|---|---|
| Dependent Variable | PD |
| Function | Regression |
| Normalization | Logit |
| Intercept | -3.5 |
Predictors:
| Source (Field Reference) | Type | Coefficient | Exponent |
|---|---|---|---|
| Credit Score | Dictionary | -0.008 | 1 |
| LTV | Dictionary | 0.015 | 1 |
| Unemployment Rate | Factor | 0.42 | 1 |
Resulting formula:
PD = 1 / (1 + exp(-(-3.5 + (-0.008 × CreditScore) + (0.015 × LTV) + (0.42 × UnemploymentRate))))
Example 2: Model with Local Transformations¶
A model that uses computed interaction terms as predictors.
Local Transformations:
| Name | Formula |
|---|---|
| LogLTV | ln({LTV}) |
| DTI_Adj | {DTI} / 100 * {Income} |
Regression:
| Setting | Value |
|---|---|
| Dependent Variable | LGD |
| Function | Regression |
| Normalization | Logit |
| Intercept | -1.2 |
Predictors:
| Source | Type | Coefficient | Exponent |
|---|---|---|---|
| LogLTV | Local Transformation | 0.85 | 1 |
| DTI_Adj | Local Transformation | 0.003 | 1 |
| HPI | Factor | -0.12 | 1 |
Example 3: Model with Lookup References¶
A model where the HPI factor varies by province using a lookup reference.
Lookup Reference:
| Name | Selector | Default Target |
|---|---|---|
| Regional_HPI | Province | National HPI |
Mappings:
| Province | Target Factor |
|---|---|
| ON | Ontario HPI |
| BC | BC HPI |
| AB | Alberta HPI |
| QC | Quebec HPI |
Regression:
| Setting | Value |
|---|---|
| Dependent Variable | PD |
| Function | Regression |
| Normalization | Logit |
| Intercept | -2.8 |
Predictors:
| Source | Type | Coefficient | Exponent |
|---|---|---|---|
| Credit Score | Dictionary | -0.006 | 1 |
| Regional_HPI | Lookup | 0.35 | 1 |
| Age | Dictionary | -0.001 | 2 |
In this model, the Age predictor uses exponent 2, creating a quadratic
term: -0.001 × Age².
Switching Between Modes¶
A model can be switched between freeform and structured modes using the toggle button in the model editor.
Freeform to Structured: When switching from freeform to structured mode, freeform data (model script, series) is preserved but becomes inactive. The structured editor appears and you can define the regression. If you switch back to freeform, your previous script and series are still there.
Structured to Freeform: When switching from structured to freeform mode, the structured model definition is deleted when the model is saved. A warning dialog confirms this action before proceeding.
Note
Switching modes does not take effect until the model is saved. You can freely toggle between modes to compare, but only the active mode's data is included in the saved model.























