painindex(): number
Pain Index.
Mean value of the drawdowns, similar to Ulcer Index. It measures the depth, duration, and frequency of losses.
Single array of returns
Single array of returns
import { assertEquals } from "jsr:@std/assert"; var x = [0.003,0.026,0.015,-0.009,0.014,0.024,0.015,0.066,-0.014,0.039]; assertEquals(painindex(x), 0.0023000000000000034);
Multiple arrays
Multiple arrays
import { assertEquals } from "jsr:@std/assert"; var x = [0.003,0.026,0.015,-0.009,0.014,0.024,0.015,0.066,-0.014,0.039]; var y = [-0.005,0.081,0.04,-0.037,-0.061,0.058,-0.049,-0.021,0.062,0.058]; assertEquals(painindex(x), 0.0023000000000000034); assertEquals(painindex(y), 0.042955093457969766);
x: array
asset/portfolio returns
painindex(): array | matrix
Pain Index.
Mean value of the drawdowns, similar to Ulcer Index. It measures the depth, duration, and frequency of losses.
Single array of returns
Single array of returns
import { assertEquals } from "jsr:@std/assert"; var x = [0.003,0.026,0.015,-0.009,0.014,0.024,0.015,0.066,-0.014,0.039]; assertEquals(painindex(x), 0.0023000000000000034);
Multiple arrays
Multiple arrays
import { assertEquals } from "jsr:@std/assert"; var x = [0.003,0.026,0.015,-0.009,0.014,0.024,0.015,0.066,-0.014,0.039]; var y = [-0.005,0.081,0.04,-0.037,-0.061,0.058,-0.049,-0.021,0.062,0.058]; assertEquals(painindex(x), 0.0023000000000000034); assertEquals(painindex(y), 0.042955093457969766);
x: matrix
asset/portfolio returns