aggregate Loss Lab
aggregate Loss Lab
description to distribution

How to use aggregate from other environments.

Use of this site signifies agreement with the terms.

Jupyter runs the library itself, in Python on your machine. R, Excel and Google Sheets send a DecL program to an aggregate server and read back exhibits, quantiles and whole distributions. Each tab includes the same basic Gross 20-claim example. Click each step's number as you complete it.

Runs
the library, on your machine
Prerequisites
uv; it fetches Python 3.13
Install time
about five minutes
  1. Install uv

    Windows, in PowerShell
    winget install astral-sh.uv
    macOS or Linux
    curl -LsSf https://astral.sh/uv/install.sh | sh

    Then open a new terminal.

  2. Make a project folder

    uv init --python 3.13 agg-notebooks
    cd agg-notebooks
  3. Add aggregate, with JupyterLab

    uv add "aggregate[notebook]"

    Resolves, locks and installs in one go; no uv sync needed.

  4. Start JupyterLab

    uv run jupyter lab

    File ▸ New ▸ Notebook. Next time, this line alone.

  5. Build a distribution

    from aggregate import build, qd
    gross = build('agg Gross 20 claims 2000 xs 0 sev lognorm 250 cv 2 mixed gamma 0.4')
    qd(gross)
    gross.q([0.5, 0.9, 0.99])

    Any program from the Loss Lab editor pastes into build() as it stands. The documentation goes from here.

Runs
aggregateR, over a server
Prerequisites
R 4.1 or later; no Rtools
Install time
about five minutes
  1. Install the four packages it uses

    install.packages(c("httr2", "jsonlite", "nanoparquet", "processx"))
  2. Install aggregateR from GitHub

    install.packages("https://github.com/mynl/aggregate-R/archive/refs/heads/master.tar.gz",
                     repos = NULL, type = "source")

    Pure R, so no Rtools on Windows.

  3. Choose a server

    To try it, nothing to do: it talks to https://agg.mynl.com. For real work, a private server on your machine (needs uv; the first start takes a couple of minutes):

    library(aggregateR)
    agg_start()
  4. Build, and read quantiles

    library(aggregateR)
    gross <- agg_build("agg Gross 20 claims 2000 xs 0 sev lognorm 250 cv 2 mixed gamma 0.4")
    agg_q(gross, c(0.5, 0.9, 0.99))
  5. The whole distribution, as a data.frame

    dg <- agg_frame(gross)
    plot(dg$loss, dg$p_total, type = "l", xlim = c(0, 15000))

    More: agg_exhibit(gross, "summary"), agg_library(), and the first session in the README.

Your programs are your data. The public server keeps an audit record of every build. Made-up numbers there; agg_start() for anything real.

Runs
the AGG functions, over agg.mynl.com
Prerequisites
Excel on the web, or Microsoft 365 on Windows
Install time
two minutes on the web, five on the desktop
  1. Download the manifest

  2. Upload it

    Any workbook at office.com, then Home ▸ Add-ins ▸ More Settings ▸ Upload My Add-in, choose the file, Upload.

    It lives in this browser's storage; clear the site data and upload again.

  3. Build in A2, quantiles in A3

    A1
    agg Gross 20 claims 2000 xs 0 sev lognorm 250 cv 2 mixed gamma 0.4
    A2
    =AGG.BUILD(A1)
    A3
    =AGG.Q(A2, {0.5, 0.9, 0.99})

    =AGG.VERSION() anywhere says which server you are on.

  1. Save the manifest in a folder

    In PowerShell
    New-Item -ItemType Directory -Force C:\OfficeAddins
    Invoke-WebRequest https://agg.mynl.com/excel/manifest.xml -OutFile C:\OfficeAddins\aggregate-manifest.xml
  2. Share the folder, with yourself

    Right-click it, Properties ▸ Sharing ▸ Share, add yourself, Share. Note the path, such as \\YOUR-PC\OfficeAddins.

  3. Trust it in Excel

    File ▸ Options ▸ Trust Center ▸ Trust Center Settings ▸ Trusted Add-in Catalogs: paste the path, Add catalog, tick Show in Menu, OK, OK.

  4. Restart Excel, then add it

    Close every Excel window, reopen, then Home ▸ Add-ins ▸ More Add-ins ▸ SHARED FOLDER ▸ Aggregate ▸ Add.

  5. Build in A2, quantiles in A3

    A1
    agg Gross 20 claims 2000 xs 0 sev lognorm 250 cv 2 mixed gamma 0.4
    A2
    =AGG.BUILD(A1)
    A3
    =AGG.Q(A2, {0.5, 0.9, 0.99})

Trust Center locked by IT? Use Excel on the web, or ask a Microsoft 365 admin to deploy it (admin center ▸ Settings ▸ Integrated apps). On a Mac, use the web.

Your programs are your data. The add-in builds on the public server, which keeps an audit record of every program. Use made-up numbers.

Runs
the AGG functions, over agg.mynl.com
Prerequisites
a Google account; nothing to install
Install time
about a minute
  1. Make your own copy of the template

    It lands in your Drive with a Start here tab, a worked Example tab, and a blank Sheet1 for the next step.

  2. On Sheet1, build in A2, quantiles in A3

    A1
    agg Gross 20 claims 2000 xs 0 sev lognorm 250 cv 2 mixed gamma 0.4
    A2
    =AGG_BUILD(A1)
    A3
    =AGG_Q(A2, {0.5, 0.9, 0.99})

    AGG_ where Excel has AGG.: a Sheets name cannot hold a dot.

  3. Authorize the AGG menu, once

    First use of AGG ▸ Recalculate AGG cells: Google says it hasn't verified the app. Advanced, then the Go to link, then Allow. The cells never ask.

  4. A whole frame, as a live table

    =IMPORTDATA(AGG_FRAMEURL(A2, "density_df") & "?cols=loss,p_total,S")

Your programs are your data. Sheets always builds on the public server, which keeps an audit record of every program. Use made-up numbers.