Published
Edited
Jun 23, 2022
3 forks
Importers
205 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
_cov = (X, Y) => (1 / (X.length - 1)) * Σ(
X.map((_, i) =>
(X[i] - μ(X)) * (Y[i] - μ(Y))
)
)
Insert cell
Insert cell
Insert cell
_corr = (X, Y) => cov(X, Y) / (σ(X) * σ(Y))
Insert cell
Insert cell
Insert cell
lag = (X, t) => X.map((_, i) => X[i - t])
Insert cell
Insert cell
Insert cell
autocorr = (X, t) => corr(X, lag(X, t))
Insert cell
Insert cell
decide = series => autocorr(series, 1) > threshold ? line(series) : bar(series)
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
cov = (X, Y) => _cov(...trim([X, Y]))
Insert cell
corr = (X, Y) => _corr(...trim([X, Y]))
Insert cell
trim = arr => {
const trimmed = d3.transpose(
d3.transpose(arr)
.filter(i => i.every(d => d !== undefined))
)
return trimmed.length ? trimmed : arr.map(() => [])
}
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
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

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