Skip to content
Multivariate Lab

About this project

How the lab was rebuilt

MAST90138 Multivariate Statistics for Data Science at The University of Melbourne, 2023 Semester 2. Two individual assignments by Sunchuangyu (Rin) Huang, originally written in R Markdown, revived in 2026 as a static, client-side web app.

Timeline

When the work was done

  1. 11 September 2023

    Assignment 1 submitted: covariance, eigen-decomposition and PCA of the wheat data

  2. Between A1 and A3

    Assignment 2 (not preserved, so not part of this lab)

  3. 22 October 2023

    Assignment 3 submitted: high-dimensional classification of rainfall stations

  4. 2026

    Revived as Multivariate Lab: original R re-run, algorithms ported, bugs documented

Method

Ported, tested, and only then made pretty

Each module below is a TypeScript port of the R function the assignment used, with a Vitest parity test against numbers produced by R from the original code. Your browser recomputes the wheat PCA, the logistic fits, the LOOCV curve, the test-set classification and the PLS tree. The rainfall PCA and PLS scores, the correlation curves and the random forests (22 forests of 5,000 trees, original seed) are computed in R and shipped as small JSON files; the kernel PLS port is checked against them in the test suite.

ModulePort ofChecked against R
lib/linalg.tsCyclic Jacobi eigen-decomposition, covariance, standardisationeigen(cov(X)) for the wheat data to 1e-10; prcomp eigenvalues of the 365 × 365 rainfall correlation matrix to 1e-8
lib/eigen2.tsClosed-form 2 × 2 eigen-decomposition, covariance validity, ellipse geometryR's eigen() for the Problem 1(b) matrix
lib/pca.ts · lib/seeds.tsPCA (covariance / correlation), ψ, scores, correlation circle, the as-submitted projectionprcomp(X, scale = TRUE) loadings and the 2023 report's printed values (signs included)
lib/glm.tsglm.fit IRLS for binomial(logit) with LINPACK dqrdc2/dqrsl pivoting QR and R's link clampingglm(G ~ PC1 + PC2 + PC3) coefficients, deviance and iteration count
lib/loocv.tsHand-written LOOCV for q = 1..30, corrected and bug-for-bug as submitted; test classificationall 30 LOOCV counts for both versions and the test errors for every q
lib/pls.tspls::kernelpls.fit for one response; projection of new stations (test suite only: the site uses the PLS scores exported by R)plsr scores and projection matrix (relative error below 1e-6), including head(pls_data) from the 2023 PDF
lib/rpart.tsrpart classification trees: Gini splits, minsplit/minbucket, cp complexity bookkeepingthe identical tree (C1 < 1.563, C2 < −9.094) and test predictions

Errata

What was wrong in the 2023 submissions

The originals are left untouched; each lab shows the submitted and the corrected behaviour side by side.

Data and integrity

Provenance and academic integrity

Data

The wheat measurements are the public UCI “seeds” dataset (Charytanowicz et al., 2010, CC BY 4.0) and are bundled with the app. The rainfall curves were supplied with the course; the site only serves class-level daily summaries, principal component and PLS projections, importances and error counts derived from them by scripts/a3_artefacts.R.

Academic integrity

This is my own submitted work, published after the subject finished. The original R Markdown, knitted reports and figures are preserved unchanged in the repository's coursework/ folder. The assignment specifications are not reproduced; the tasks are paraphrased. Please do not submit any of it as your own.

The repository (github.com/rNLKJA/Unimelb-Master-2023-MAST90138-Assignments) is private for now. It holds the original submissions in coursework/ and the R scripts that generate this site's data in scripts/.