# Zivot-Andrews Break Test

`D09-F01-A06` · Statistical Time Series → Diagnostics · archetype `record-transform` · difficulty 4/5 · verification **contract**

Full page: https://docs.thefintechbuilder.com/statistical-time-series/diagnostics/zivot-andrews-break-test/
Agent skill: `npx skills add IslamBaraka90/Fintech-Algorithms-Library` — https://docs.thefintechbuilder.com/guides/agent-skill/

## Install and import

```bash
npm install fintech-algorithms
```

```ts
import { zivotAndrews } from "fintech-algorithms/statistical-time-series/diagnostics/zivot-andrews-break-test";
```

## Signature

```ts
zivotAndrews(values, lags, trim, criticalValue)
```

A unit-root test that allows one structural break at an unknown date, found by searching. Standard ADF frequently reports a unit root when the truth is a stationary series with a single level shift.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `values` | `number[]` | yes | Observation series in chronological order, oldest first. |
| `lags` | `number` | yes | Lagged differences included. · min: 0, integer: true |
| `trim` | `number` | yes | Fraction of the sample trimmed at each end of the break search; the test is unreliable near the boundaries. · min: 0 |
| `criticalValue` | `number` | yes | Critical value for the minimum statistic across candidate break dates. |

## Returns

`{ method, trim, candidate_start, candidate_end, scan, break_index, statistic, decision, … }`

The chosen break date with the full scan across candidates, so a marginal choice between two dates is visible.

## Errors

- When trim leaves too few candidate break points — throws

## Complexity

Time `O(n² × lags)`, space `O(n)`.

## Worked example

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

`values`:

```json
[10.34556492, 11.02095, 9.20624589, 10.31211299, 10.28712609, 9.63521836]
```

Showing 6 of 96 elements.

`lags`:

```json
1
```

`trim`:

```json
0.15
```

`criticalValue`:

```json
-4.8
```

### Call

```ts
zivotAndrews(values, lags, trim, criticalValue)
```

### Returns

object with 17 fields: method, variant, nobs, lags, trim, candidate_start, candidate_end, scan, …

```json
{
  "method": "zivot_andrews",
  "variant": "intercept-break-fixed-lag",
  "nobs": 96,
  "lags": 1,
  "trim": 0.15,
  "candidate_start": 15,
  "candidate_end": 80,
  "scan": [
    {
      "break_index": 15,
      "statistic": -2.5968971047294005,
      "gamma": -0.16587948752228582,
      "gamma_standard_error": 0.06387603390992676,
      "level_shift": -0.04138705771243637,
      "residual_sse": 63.10830583976075
    },
    {
      "break_index": 16,
      "statistic": -2.5793149673915057,
      "gamma": -0.16477543600586345,
      "gamma_standard_error": 0.06388341016471631,
      "level_shift": -0.01654423349541098,
      "residual_sse": 63.11836401077814
    },
    {
      "break_index": 17,
      "statistic": -2.570119387857429,
      "gamma": -0.16400056863572565,
      "gamma_standard_error": 0.0638104865519279,
      "level_shift": 0.0005933378039946896,
      "residual_sse": 63.12032010539862
    }
  ],
  "break_index": 47,
  "statistic": -7.029594549659584,
  "gamma": -0.5990847849626595,
  "gamma_standard_error": 0.08522323453088355,
  "level_shift": 3.0605819661853846,
  "critical_value": -4.8
}
```

Showing 14 of 17 fields.

## Other exports

`acf`, `pacf`, `adf`, `kpss`, `ljungBox`, `runDiagnostic`. Every module additionally exports `run` as an alias of its primary
function, and a `meta` object carrying its catalog id, domain, family, shape and article URL.

## Verification and provenance

Tier: **contract**.

The module loads, the entry point is callable and its declared signature matches the compiled code. The example below is real captured output, but no independently published figure asserts the numbers.

Both tiers guarantee the signature. Full explanation: https://docs.thefintechbuilder.com/guides/verification/

Generated from the docs.json payload shipped inside fintech-algorithms@0.13.1.
The signature and parameter list are checked against the compiled implementation at build time,
so a description that contradicts the code fails the build rather than reaching this file.

## Links

- Article (how it works, step by step): https://thefintechbuilder.com/statistical-time-series/diagnostics/zivot-andrews-break-test/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/statistical-time-series/diagnostics/zivot-andrews-break-test/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/statistical-time-series/llms.txt
