Chapter Hands-on Code

Ready-to-run R scripts for each chapter, built on the companion recode package.

Setup

Install the companion R package once:

library(devtools)
devtools::install_github("adallak/recode")

Then run any of the chapter scripts below.

Browse on GitHub
Ch 2

Regularized Regression and Thresholding

Regularized regression with the Lasso penalty, the role of thresholding, and the coordinate-descent algorithm — motivated through simple models and real-data examples.

Lasso Thresholding Coordinate Descent
View on GitHub
Ch 3

Covariances and Dependencies

Matrix factorizations of covariance matrices — spectral, Cholesky, and variance–correlation separation — alongside copulas as counterparts of correlation for nonlinear dependence.

Cholesky Spectral Copulas
View on GitHub
Ch 4

Hidden Regressions

Hidden regressions surfaced from multivariate normal conditional distributions, the gradient of the likelihood, and the Cholesky decomposition — connecting sparsity in regression coefficients to columns of the precision matrix.

Hidden Reg. Precision Matrix CLIME

Discussion only — no companion code.

Ch 5

Multivariate Regressions and Graphs

General linear models with unstructured covariance, with shrinkage of the least-squares estimator and regression-based methods such as CAPME for sparse high-dimensional estimation.

GLM Shrinkage CAPME
View on GitHub
Ch 6

Covariance Regressions

Progress in covariance regression from linear covariance models toward GLMs for covariance matrices, with parsimony-driven parameterizations and generalized estimating equations (GEE).

LCM GEE AR(1)
View on GitHub
Ch 7

PCA and Factor Models

Classical PCA and factor analysis alongside modern approximate factor models for econometric panels, with the POET estimator handling sparse idiosyncratic covariance in high dimensions.

PCA Factor Models POET
View on GitHub
Ch 8

Shrinkage and Thresholding

Ledoit–Wolf shrinkage that pulls the sample covariance toward a simple target, and thresholding that zeros out small entries — affecting only eigenvalues versus both eigenvalues and eigenvectors.

Ledoit–Wolf Thresholding Banding
View on GitHub
Ch 9

Undirected Graphical Models

Sparse Gaussian graphical models via penalized likelihood and the GLasso algorithm, with extensions including thresholded GLasso, latent variable GLasso, and covariance graphical models.

GLasso Gaussian Graphs Sparsity
View on GitHub
Ch 10

Directed Graphs

Bayesian networks and DAGs where structural equation models determine sparse Cholesky factors of covariance matrices, with constraint-based, score-based, and functional structure-learning approaches.

DAG SEM Bayesian Networks
View on GitHub
Ch 11

The World of Time Series Data

Stationary multivariate time series with cross-sectional and temporal dependence — ARMA via Cholesky orthogonalization, time-series GLasso, sparse high-dimensional VAR, and Granger causality.

Time Series VAR Granger
View on GitHub
Ch 12

Spatial Data and Vecchia Approximations

Spatial data and random fields partially ordered by location, where Vecchia’s approximation reduces computational burden by conditioning on a subset of past values — fueling interest in sparse inverse Cholesky factors.

Spatial Vecchia Random Fields

Discussion only — no companion code.