Public
Edited
Jul 6, 2023
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
ss = require("simple-statistics")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
rp2012.geocoded.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

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
corr = ss.sampleCorrelation(
rp2012.map((d) => d.dipl_sup),
rp2012.map((d) => d.cadres)
)
Insert cell
Insert cell
lm = ss.linearRegression(rp2012.map((d) => [d.dipl_sup, d.cadres])) // => { m: 1, b: 0 }
Insert cell
Insert cell
Insert cell
linearRegressionLine = ss.linearRegressionLine(lm)
Insert cell
linearRegressionLine(10)
Insert cell
Insert cell
Insert cell
Insert cell
+(corr * corr).toFixed(4)
Insert cell
Insert cell
sample = rp2012.map((d) => [d.dipl_sup, d.cadres])
Insert cell
+ss.rSquared(sample, linearRegressionLine).toFixed(4)
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.dot(rp2012, {
x: "dipl_sup",
y: "cadres",
fill: "#5d5aa1",
fillOpacity: 0.3
}),
Plot.linearRegressionY(rp2012, {
x: "dipl_sup",
y: "cadres",
stroke: "#400b30"
})
]
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
bertin.draw({
params: { projection: "epsg:2154" },
layers: [
{
geojson: fitted.filter(
(d) =>
!["Guyane", "Martinique", "Guadeloupe", "La Réunion"].includes(
d.region
)
),
fill: {
type: "choro",
values: "normres",
leg_x: 100,
leg_y: 500,
breaks,
colors: "RdYlGn"
},
tooltip: ["$commune", (d) => "Résidu : " + d.properties.res.toFixed(2)]
}
]
})
Insert cell
Insert cell
hdv2003.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

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