Public
Edited
Jul 8, 2024
1 fork
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
[...projection1]
Insert cell
Insert cell
Insert cell
Insert cell
{
if (step != mutable v0) {
console.log("RUNNING");
const animation = await gemini.animate(mapped[v0], mapped[step], gem);
await animation.play("#view");
setV0(step);
console.log("done");
}
}
Insert cell
gemini.animate(mapped[0], mapped[1], gem)
Insert cell
//gemini.animate(mapped[0], mapped[1], gem)
Insert cell
spec0.marks.map((d) => d.name)
Insert cell
viewof chart = embed("#view", mapped[0], { renderer: "svg" })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mutable v0 = 0
Insert cell
v1 = step
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
introspection1 = await calculang.introspection("entrypoint.cul.js", fs1)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
projection0_ = helpers.calcudata({
models: [model0],
outputs: ["premiums", "mclaims", "profit", "mΔreserve"],
input_domains: { year_in: _.range(0, 21 + 0.1, 1) },
input_cursors: [cursor, cursor] // for update in enter/exit/update pattern to match
//pivot: true
})
//.filter((d) => d.formula == "profit" || Math.abs(d.value) > 0.001)
Insert cell
projection0 = aq
.from(projection0_)
.groupby(["year_in", "formula"])
.orderby("input_cursor_id")
.derive({ A: (d) => aq.op.lag(d.value, 1, 0), B: (d) => d.value })
.filter((d) => d.input_cursor_id == 1)
.derive({
keep: (
d // =IF(C6<0,MIN(0,MAX(D6,C6)),IF(C6>0,MAX(0,MIN(D6,C6))))
) => {
if (d.A < 0) return Math.min(0, Math.max(d.A, d.B));
return Math.max(0, Math.min(d.A, d.B));
},
add: (d) => Math.max(0, d.B - d.A),
subtract: (d) => Math.max(0, d.A - d.B)
})
.fold(["A", "B", "keep", "add", "subtract"], { as: ["partition", "value"] })
Insert cell
projection1_ = helpers.calcudata({
models: [model0],
outputs: ["premiums", "mclaims", "profit", "mΔreserve"],
input_domains: { year_in: _.range(0, 21 + 0.1, 1) },
input_cursors: [cursor, { ...cursor, limit_in: 0 }] // for update in enter/exit/update pattern to match
//pivot: true
})
//.filter((d) => d.formula == "profit" || Math.abs(d.value) > 0.001)
Insert cell
Insert cell
cursor = ({ premiums_fn_in:() => premiums, claims_fn_in:() => claims, point_id_in: 0, adverse_reserve_factor_in:0, limit_in:10000 })
Insert cell
premiums = [0, ..._.range(0, 19.1).map((year) => 100 - year * 1.5)]
Insert cell
claims = [0, ..._.range(0, 19.1).map((year) => 1.35 ** year)]
Insert cell
mapped[0]
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more