Bivariate cloud explorer

A scatter of paired data (from a model with sliders, draggable points, re-paired lists or preset data sets) with correlation and covariance readouts. Learners move rho or the model parameters, drag points, re-pair lists or transform the data, and see the least-squares line, conditional means, quadrant signs, concordant pairs, marginals or directional variance respond.

Used in: Introduction to Probability Theory, Introduction to Statistics

Props

PropTypeDefaultDescription
titlestring(depends on the data source)Title bar text.
modelstring"bivariate-normal"Generative model when no points, x/y lists or presets are given: bivariate-normal (rho, sdX, sdY, muX, muY), covariance (varX, varY, covXY; may be invalid), common-cause (X = Z + E1, Y = Z + E2: sdZ, sdE1, sdE2), linear-map ((X,Y) = A Z + b: a11..a22, b1, b2), independent (xDistribution, yDistribution), function ((fx(X), fy(X) + noiseSd*eps), X ~ xDistribution), random-sign (Y = S X, S = +-1), multinomial (trials, p1, p2).
paramsobject{}Initial model parameter values by name, e.g. {"rho": 0.7, "sdX": 2}. Slider ranges widen to include them.
slidersstring[]model-specific (rho for bivariate-normal; all parameters for the others)Names of the model parameters the learner gets a slider for; [] hides them.
nnumber400 (300 for multinomial)Sample size for a model (2 to 3000).
seednumber | string1Seed of the random sample; "New sample" advances it.
xDistributionstring | object"N(0, 1)" (function), "Exp(1)" (independent)Law of X for the function and independent models; any sampling-core spec such as "Uniform[-1, 1]" or {family, params}.
yDistributionstring | object"Uniform[0, 2]"Law of Y for the independent model.
fxstring"x"Function model: first coordinate as an expression in x.
fystring"x^2"Function model: second coordinate as an expression in x (e.g. "x^3", "exp(x)", "-x").
fyOptionsstring[][]Function model: expressions the learner can switch fy between (a dropdown).
matrixnumber[][][[1, 0.5], [0, 1]] (linear-map), [[1, 0.5], [0.5, 1]] (covariance)2x2 matrix: A for linear-map, the covariance matrix Sigma for covariance.
pointsnumber[][](none)Fixed data as [x, y] pairs; the learner drags them (up to 40) and clicks to add points.
xnumber[](none)First of two fixed lists to be re-paired (needs y).
ynumber[](none)Second fixed list; pairings decide which y goes with which x.
pairingsstring[]["original", "sorted", "reversed", "shuffle"]Pairings offered for x/y lists: original (as given), sorted (both ascending), reversed (opposite order), shuffle (random; reshuffle button). The first is shown first.
presets(string | {label, points})[](none)Data sets to choose from: linear-strong, linear-weak, negative, no-association, curved, uncorrelated-dependent, outlier, clusters, or custom {label, points}. Points are draggable.
draggablebooleantrueLet the learner drag (and add) points for points/presets data.
xLabelstring"$x$"x-axis title ($...$ TeX allowed).
yLabelstring"$y$"y-axis title.
showCorrelationbooleantrueReadout of the sample correlation r.
showCovariancebooleantrueReadout of the sample covariance s_xy (divisor n - 1).
showSummariesbooleantrue for x/y lists, else falseReadouts of the means and standard deviations of x and y.
showTheoreticalRhobooleanfalseReadouts of the model's rho and Cov(X, Y) (model data only).
showRegressionLinebooleanfalseInitial state of the least-squares line toggle; adds slope and intercept readouts.
showResidualSdbooleanfalseBand of +-s_e around the line, with s_e, s_y sqrt(1 - r^2) and the model's sigma_Y sqrt(1 - rho^2).
showConditionalMeansbooleanfalseInitial state of the conditional-means toggle: mean of y in x-bins, the model's E[Y | X = x], and the between/within variance decomposition.
showEllipsebooleanfalseInitial state of the model's 95% ellipse (jointly normal models).
showMarginalHistogramsbooleanfalseHistograms of x (top) and y (right), with the model's marginal densities.
showQuadrantSignsbooleanfalseInitial state of the quadrant toggle: points coloured by the sign of (x - x bar)(y - y bar), with sums of positive and negative products.
showDeviationProductsbooleanfalseQuadrant colouring plus a rectangle per point for its deviation product, and a table of products for n <= 15.
showConcordantPairsbooleanfalseConcordant and discordant pair counts and Kendall's tau; draws every pair for n <= 15.
showSumDifferenceHistogramsbooleanfalseHistograms of x + y and x - y with s^2 = s_x^2 + s_y^2 +- 2 s_xy.
showDirectionalVariancebooleanfalseDraggable direction u with Var(u^T X) and the curve 2 sqrt(u^T Sigma u); negative directions of an invalid Sigma are red.
thetanumber30Initial direction of u in degrees.
showConstructionbooleanfalsebivariate-normal, covariance, linear-map: show the independent (Z1, Z2) cloud beside the result with one draggable pair and its image (and A e1, A e2 for linear-map).
showCauchySchwarzbooleanfalseReadouts (mean of xy)^2 <= mean(x^2) mean(y^2) and r^2 <= 1.
predictorsstring[][]Candidate predictors of y as expressions in x, drawn dashed with their mean squared errors.
showTransformbooleanfalseSliders that shift, rescale and rotate the data (and standardize), with an original-vs-transformed table.
transformobject{}Initial transform {shiftX, shiftY, scaleX, scaleY, rotateDegrees, standardize}.
transformControlsstring[]["shiftX", "shiftY", "scaleX", "scaleY", "rotateDegrees", "standardize"]Which transform controls to show.
showTogglesbooleantrueShow the learner toggles for the line, conditional means, quadrant signs and ellipse.
controlsstring[]all controls shownRegistry ids of the hideable toggles and readouts this lecture shows (see `controls` in this file), e.g. readout.correlation, toggle.regression-line, toggle.quadrant-signs; core ones always show. Absent = everything. Fitted per page by component_scopes.py fit-nodes, not by hand.