annrisk(): number
Computes the Annualized Risk (Standard Deviation).
Computes the annualized standard deviation of asset or portfolio returns. Standard deviation is scaled based on the frequency of the data.
Formula: Annualized Risk = √t × Standard Deviation (σ)
Annualized risk for a single asset (monthly data)
Annualized risk for a single asset (monthly data)
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(annrisk(x, 12), 0.08047276972160623);
x: array
Asset/portfolio returns
Frequency of data points in a year: 1: yearly, 4: quarterly, 12: monthly, 52: weekly, 252: daily (default)
annrisk(): array | matrix
Computes the Annualized Risk (Standard Deviation).
Computes the annualized standard deviation of asset or portfolio returns. Standard deviation is scaled based on the frequency of the data.
Formula: Annualized Risk = √t × Standard Deviation (σ)
Annualized risk for a single asset (monthly data)
Annualized risk for a single asset (monthly data)
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(annrisk(x, 12), 0.08047276972160623);
x: matrix
Asset/portfolio returns
Frequency of data points in a year: 1: yearly, 4: quarterly, 12: monthly, 52: weekly, 252: daily (default)