# ROIC Calculation

`D18-F01-A02` · Fundamental Analysis and Valuation → Statement Ratios · archetype `record-transform` · difficulty 4/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/fundamental-analysis-and-valuation/statement-ratios/roic-calculation/
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 { roicCalculation } from "fintech-algorithms/fundamental-analysis-and-valuation/statement-ratios/roic-calculation";
```

## Signature

```ts
roicCalculation(input)
```

Computes NOPAT as operating profit less tax at a normalized rate, then divides it by average invested capital, where invested capital at each end of the period is operating assets minus operating liabilities.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `input` | `{ operating_profit: number; normalized_tax_rate: number; beginning_operating_assets: number; beginning_operating_liabilities: number; ending_operating_assets: number; ending_operating_liabilities: number }` | yes | A plain object. `operating_profit` and `normalized_tax_rate` produce NOPAT; `beginning_operating_assets` minus `beginning_operating_liabilities` and `ending_operating_assets` minus `ending_operating_liabilities` give the two capital snapshots that are averaged. Every key must be a finite number. |

## Returns

`{ nopat: number; beginning_invested_capital: number; ending_invested_capital: number; average_invested_capital: number; roic: number | null; state: string; reason: string }`

`nopat` is operating profit times one minus the tax rate. `beginning_invested_capital`, `ending_invested_capital` and `average_invested_capital` expose the capital base, and `roic` is NOPAT over that average. When the average is not positive, `roic` is `null`, `state` is `not-meaningful` and `reason` is `nonpositive-average-invested-capital`; otherwise `state` is `loss` for negative NOPAT or `calculated`, with `reason` `package-operating-capital-definition`.

## Errors

- When any of the six inputs is not a finite number — throws RangeError
- When normalized_tax_rate is below 0 or above 1 — throws RangeError

## Complexity

Time `O(1)`, space `O(1)`.

## Worked example

This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.

### Input

`input`:

```json
{
  "operating_profit": 180,
  "normalized_tax_rate": 0.25,
  "beginning_operating_assets": 900,
  "ending_operating_assets": 1000,
  "beginning_operating_liabilities": 250,
  "ending_operating_liabilities": 270
}
```

### Call

```ts
roicCalculation(input)
```

### Returns

object with 7 fields: nopat, beginning_invested_capital, ending_invested_capital, average_invested_capital, roic, state, reason

```json
{
  "nopat": 135,
  "beginning_invested_capital": 650,
  "ending_invested_capital": 730,
  "average_invested_capital": 690,
  "roic": 0.195652173913,
  "state": "calculated",
  "reason": "package-operating-capital-definition"
}
```

## Other exports

`dupontDecomposition`, `cashConversionCycle`, `interestCoverageRatio`, `netDebtToEbitda`, `commonSizeStatements`, `calculate`. 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: **verified** (via input-expected).

The worked example below is the figure published in this algorithm's article, replayed and asserted by the test suite on every build. The arithmetic cannot drift without the build failing.

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.0.
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/fundamental-analysis-and-valuation/statement-ratios/roic-calculation/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/fundamental-analysis-and-valuation/statement-ratios/roic-calculation/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/fundamental-analysis-and-valuation/llms.txt
