function martinratio
martinratio(
x: array,
frisk?: number,
t?: number,
mode?: "return" | "geometric",
dim?: 0 | 1,
): number

Martin Ratio.

A risk-adjusted performance measure that uses the Ulcer Index to adjust for risk. Martin Ratio = (Portfolio Return - RiskFree) / Ulcer Index

Examples

Martin ratio for a single asset

import { assertEquals } from "jsr:@std/assert";

const x = [0.003, 0.026, 0.015, -0.009, 0.014, 0.024, 0.015, 0.066, -0.014, 0.039];
assertEquals(martinratio(x, 0, 12), 44.42545597931942);

Martin ratio for multiple assets

import { assertEquals } from "jsr:@std/assert";

const x = [0.003, 0.026, 0.015, -0.009, 0.014, 0.024, 0.015, 0.066, -0.014, 0.039];

const y = [-0.005, 0.081, 0.04, -0.037, -0.061, 0.058, -0.049, -0.021, 0.062, 0.058];
assertEquals(martinratio(x, 0, 12), 44.42545597931942);
assertEquals(martinratio(y, 0, 12), 2.438364078885411);

Martin ratio with geometric mode

import { assertEquals } from "jsr:@std/assert";

const x = [0.003, 0.026, 0.015, -0.009, 0.014, 0.024, 0.015, 0.066, -0.014, 0.039];

assertEquals(martinratio(x, 0.02, 12, "geometric"), 40.3700870722293);

Parameters

Asset/portfolio returns

optional
frisk: number

Annual free-risk rate (defaults to 0)

optional
t: number

Frequency of data. 1: yearly, 4: quarterly, 12: monthly, 52: weekly, 252: daily (defaults to 252)

optional
mode: "return" | "geometric"

Drawdown calculation mode: 'return' or 'geometric' (defaults to 'return')

optional
dim: 0 | 1

Dimension to operate on (0: row-wise, 1: column-wise) (defaults to 0)

Return Type

number

Martin Ratio

Throws

If input is not an array or matrix

martinratio(
x: matrix,
frisk?: number,
t?: number,
mode?: "return" | "geometric",
dim?: 0 | 1,
): array | matrix

Martin Ratio.

A risk-adjusted performance measure that uses the Ulcer Index to adjust for risk. Martin Ratio = (Portfolio Return - RiskFree) / Ulcer Index

Examples

Martin ratio for a single asset

import { assertEquals } from "jsr:@std/assert";

const x = [0.003, 0.026, 0.015, -0.009, 0.014, 0.024, 0.015, 0.066, -0.014, 0.039];
assertEquals(martinratio(x, 0, 12), 44.42545597931942);

Martin ratio for multiple assets

import { assertEquals } from "jsr:@std/assert";

const x = [0.003, 0.026, 0.015, -0.009, 0.014, 0.024, 0.015, 0.066, -0.014, 0.039];

const y = [-0.005, 0.081, 0.04, -0.037, -0.061, 0.058, -0.049, -0.021, 0.062, 0.058];
assertEquals(martinratio(x, 0, 12), 44.42545597931942);
assertEquals(martinratio(y, 0, 12), 2.438364078885411);

Martin ratio with geometric mode

import { assertEquals } from "jsr:@std/assert";

const x = [0.003, 0.026, 0.015, -0.009, 0.014, 0.024, 0.015, 0.066, -0.014, 0.039];

assertEquals(martinratio(x, 0.02, 12, "geometric"), 40.3700870722293);

Parameters

Asset/portfolio returns

optional
frisk: number

Annual free-risk rate (defaults to 0)

optional
t: number

Frequency of data. 1: yearly, 4: quarterly, 12: monthly, 52: weekly, 252: daily (defaults to 252)

optional
mode: "return" | "geometric"

Drawdown calculation mode: 'return' or 'geometric' (defaults to 'return')

optional
dim: 0 | 1

Dimension to operate on (0: row-wise, 1: column-wise) (defaults to 0)

Return Type

Martin Ratio

Throws

If input is not an array or matrix