EGARCH
Install and import#
npm install fintech-algorithmsimport { calculate } from "fintech-algorithms/volatility-and-covariance/conditional-volatility/egarch";Signature#
calculate(data)Compare signed standardized shocks on the log-variance scale. Supplied-parameter educational reference; no fitted performance claim.
Parameters#
| Name | Type | Notes |
|---|---|---|
data | TopicInput | See data-contract/CONTRACT.md. |
Returns#
TopicResult
Structured result with readiness, values, parameters, and diagnostics.
Warm-up#
The first depends on window or model order positions are null prefix until minimum history exists.
Errors#
- When required data is missing, non-finite, malformed, or out of range — raises ContractError / Error
Complexity: time O(n),
space Full diagnostic trace retained for teaching; see implementation for observation/window/matrix dimensions.
Worked example#
executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.
Input#
{
"returns": [-0.02, 0],
"parameters": {
"omega": -0.5,
"initial_variance": 0.0001,
"alpha": 0.1,
"beta": 0.9,
"gamma": -0.2
}
}Call#
calculate(data)Returns#
object with 8 fields: topic_id, title, parameters, series, latest, ready, ready_at, diagnostics
{
"topic_id": "D10-F03-A03",
"title": "EGARCH",
"parameters": {
"omega": -0.5,
"initial_variance": 0.0001,
"alpha": 0.1,
"beta": 0.9,
"gamma": -0.2
},
"series": [
{
"index": 0,
"variance": 0.0001,
"initialization": true
},
{
"index": 1,
"variance": 0.00025631720695395993,
"log_variance": -8.26909479085885,
"standardized_shock": -2,
"intercept": -0.5,
"carry": -8.289306334778564,
"magnitude_contribution": 0.12021154391971348,
"sign_contribution": 0.4
}
],
"latest": {
"index": 1,
"variance": 0.00025631720695395993,
"log_variance": -8.26909479085885,
"standardized_shock": -2,
"intercept": -0.5,
"carry": -8.289306334778564,
"magnitude_contribution": 0.12021154391971348,
"sign_contribution": 0.4
},
"ready": true,
"ready_at": 0,
"diagnostics": {
"causal": true,
"input_count": 2,
"fitted_parameters": false,
"model": "egarch"
}
}Diagrams#
Calculation flow#
EGARCH — calculation-flow
flowchart TD
N0["Standardize using previous variance"]
N1["Center the shock magnitude"]
N2["Add signed shock and carried log state"]
N3["Exponentiate or reject numerical overflow"]
N0 --> N1 --> N2 --> N3
EGARCH — decision-boundary
flowchart TD
A["Supplied observations and parameters"] --> B{"Contract valid?"}
B -->|No| E["Reject with explicit error"]
B -->|Yes| C{"Required history available?"}
C -->|No| W["Withhold; never insert zero"]
C -->|Yes| D["EGARCH calculation"]
D --> F["Inspect diagnostics and stated limits"]
How it works#
This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.
References#
- Scope of evidence