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.
-
Install uv
Windows, in PowerShellwinget install astral-sh.uv
macOS or Linuxcurl -LsSf https://astral.sh/uv/install.sh | sh
Then open a new terminal.
-
Make a project folder
uv init --python 3.13 agg-notebooks cd agg-notebooks
-
Add
aggregate, with JupyterLabuv add "aggregate[notebook]"
Resolves, locks and installs in one go; no
uv syncneeded. -
Start JupyterLab
uv run jupyter lab
File ▸ New ▸ Notebook. Next time, this line alone.
-
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.
-
Install the four packages it uses
install.packages(c("httr2", "jsonlite", "nanoparquet", "processx")) -
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.
-
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()
-
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)) -
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.
-
Download the manifest
-
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.
-
Build in A2, quantiles in A3
A1A2agg Gross 20 claims 2000 xs 0 sev lognorm 250 cv 2 mixed gamma 0.4
A3=AGG.BUILD(A1)
=AGG.Q(A2, {0.5, 0.9, 0.99})=AGG.VERSION()anywhere says which server you are on.
-
Save the manifest in a folder
In PowerShellNew-Item -ItemType Directory -Force C:\OfficeAddins Invoke-WebRequest https://agg.mynl.com/excel/manifest.xml -OutFile C:\OfficeAddins\aggregate-manifest.xml
-
Share the folder, with yourself
Right-click it, Properties ▸ Sharing ▸ Share, add yourself, Share. Note the path, such as
\\YOUR-PC\OfficeAddins. -
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.
-
Restart Excel, then add it
Close every Excel window, reopen, then Home ▸ Add-ins ▸ More Add-ins ▸ SHARED FOLDER ▸ Aggregate ▸ Add.
-
Build in A2, quantiles in A3
A1A2agg Gross 20 claims 2000 xs 0 sev lognorm 250 cv 2 mixed gamma 0.4
A3=AGG.BUILD(A1)
=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.
-
Make your own copy of the template
Make a copy of the AGG template
The template's copy link is being published and appears here when it is.
It lands in your Drive with a Start here tab, a worked Example tab, and a blank Sheet1 for the next step.
-
On Sheet1, build in A2, quantiles in A3
A1A2agg Gross 20 claims 2000 xs 0 sev lognorm 250 cv 2 mixed gamma 0.4
A3=AGG_BUILD(A1)
=AGG_Q(A2, {0.5, 0.9, 0.99})AGG_where Excel hasAGG.: a Sheets name cannot hold a dot. -
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.
-
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.