Published
Edited
Sep 25, 2022
8 stars
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
function rank_bootstrap(i) {
const subset =
i >= 0
? bootstraps.params({ i }).derive({ Total: (d, $) => d.bootstraps[$.i] })
: true_subset;
const transitions = subset
.groupby("InstitutionName")

.derive({ p: (d) => d.Total / op.sum(d.Total) })
.ungroup()
.select(["InstitutionName", "DegreeInstitutionName", "p", "Total"]);

let state = transitions
.groupby("DegreeInstitutionName")

.rollup({ t: (d) => op.sum(d.Total) })
.ungroup()
.derive({ p: (d) => d.t / op.sum(d.t) })
.orderby(aq.desc("p"))
.params({ placement_weight })
.derive({
p: (d, $) =>
d.p * $.placement_weight + (1 - $.placement_weight) / op.count()
})
.rename({ DegreeInstitutionName: "InstitutionName" });

for (let i in d3.range(20)) {
state = state
.join(transitions, ["InstitutionName", "InstitutionName"])
.derive({ p: (d) => d.p_1 * d.p_2 })
.groupby("DegreeInstitutionName")
.rollup({
t: (d) => op.sum(d.Total),
p: op.sum("p")
})
.orderby(aq.desc("p"))
.derive({ p: (d) => d.p / op.sum(d.p) })
.derive({
p: (d, $) =>
d.p * $.placement_weight + (1 - $.placement_weight) / op.count()
})
.rename({ DegreeInstitutionName: "InstitutionName" });
}
return state;
}
Insert cell
Insert cell
bootstraps = {
const total = d3.sum(true_subset.values("Total"));
const vs = [];
for (let v of true_subset.values("Total")) {
const o = [];
for (let i = 0; i < 100; i += 1) {
o.push(d3.randomBinomial(total, v / total)());
}
vs.push(o);
}
const t2 = aq.table({ bootstraps: vs });
const with_vals = true_subset.assign(t2);
return with_vals;
}
Insert cell
//edges.filter((d) => d.Total == 6)
Insert cell
edges = aq.fromCSV(
await fetch(
"https://raw.githubusercontent.com/LarremoreLab/us-faculty-hiring-networks/main/data/edge-lists.csv"
).then((t) => t.text())
)
Insert cell
import { aq, op } from "@uwdata/arquero"
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