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
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | (depends on the data source) | Title bar text. |
| model | string | "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). |
| params | object | {} | Initial model parameter values by name, e.g. {"rho": 0.7, "sdX": 2}. Slider ranges widen to include them. |
| sliders | string[] | model-specific (rho for bivariate-normal; all parameters for the others) | Names of the model parameters the learner gets a slider for; [] hides them. |
| n | number | 400 (300 for multinomial) | Sample size for a model (2 to 3000). |
| seed | number | string | 1 | Seed of the random sample; "New sample" advances it. |
| xDistribution | string | 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}. |
| yDistribution | string | object | "Uniform[0, 2]" | Law of Y for the independent model. |
| fx | string | "x" | Function model: first coordinate as an expression in x. |
| fy | string | "x^2" | Function model: second coordinate as an expression in x (e.g. "x^3", "exp(x)", "-x"). |
| fyOptions | string[] | [] | Function model: expressions the learner can switch fy between (a dropdown). |
| matrix | number[][] | [[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. |
| points | number[][] | (none) | Fixed data as [x, y] pairs; the learner drags them (up to 40) and clicks to add points. |
| x | number[] | (none) | First of two fixed lists to be re-paired (needs y). |
| y | number[] | (none) | Second fixed list; pairings decide which y goes with which x. |
| pairings | string[] | ["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. |
| draggable | boolean | true | Let the learner drag (and add) points for points/presets data. |
| xLabel | string | "$x$" | x-axis title ($...$ TeX allowed). |
| yLabel | string | "$y$" | y-axis title. |
| showCorrelation | boolean | true | Readout of the sample correlation r. |
| showCovariance | boolean | true | Readout of the sample covariance s_xy (divisor n - 1). |
| showSummaries | boolean | true for x/y lists, else false | Readouts of the means and standard deviations of x and y. |
| showTheoreticalRho | boolean | false | Readouts of the model's rho and Cov(X, Y) (model data only). |
| showRegressionLine | boolean | false | Initial state of the least-squares line toggle; adds slope and intercept readouts. |
| showResidualSd | boolean | false | Band 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). |
| showConditionalMeans | boolean | false | Initial 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. |
| showEllipse | boolean | false | Initial state of the model's 95% ellipse (jointly normal models). |
| showMarginalHistograms | boolean | false | Histograms of x (top) and y (right), with the model's marginal densities. |
| showQuadrantSigns | boolean | false | Initial state of the quadrant toggle: points coloured by the sign of (x - x bar)(y - y bar), with sums of positive and negative products. |
| showDeviationProducts | boolean | false | Quadrant colouring plus a rectangle per point for its deviation product, and a table of products for n <= 15. |
| showConcordantPairs | boolean | false | Concordant and discordant pair counts and Kendall's tau; draws every pair for n <= 15. |
| showSumDifferenceHistograms | boolean | false | Histograms of x + y and x - y with s^2 = s_x^2 + s_y^2 +- 2 s_xy. |
| showDirectionalVariance | boolean | false | Draggable direction u with Var(u^T X) and the curve 2 sqrt(u^T Sigma u); negative directions of an invalid Sigma are red. |
| theta | number | 30 | Initial direction of u in degrees. |
| showConstruction | boolean | false | bivariate-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). |
| showCauchySchwarz | boolean | false | Readouts (mean of xy)^2 <= mean(x^2) mean(y^2) and r^2 <= 1. |
| predictors | string[] | [] | Candidate predictors of y as expressions in x, drawn dashed with their mean squared errors. |
| showTransform | boolean | false | Sliders that shift, rescale and rotate the data (and standardize), with an original-vs-transformed table. |
| transform | object | {} | Initial transform {shiftX, shiftY, scaleX, scaleY, rotateDegrees, standardize}. |
| transformControls | string[] | ["shiftX", "shiftY", "scaleX", "scaleY", "rotateDegrees", "standardize"] | Which transform controls to show. |
| showToggles | boolean | true | Show the learner toggles for the line, conditional means, quadrant signs and ellipse. |
| controls | string[] | all controls shown | Registry 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. |