Test Solutions

Medium: Guided Tour Vignette

This test evaluated the ability to communicate complex statistical concepts through practical examples and demonstrations. The task involved writing a comprehensive R Markdown vignette that showcases the skinny projection pursuit index integrated with tourr's guided tour framework and optimization methods such as jellyfish.

Overview

The vignette demonstrates the skinny scagnostic index in action. The skinny measure characterizes how narrow or elongated a point cloud appears in a 2D projection, useful for finding projections that reveal linear structure in data.

Key demonstrations include computing skinny scores, running guided tours, using the jellyfish optimizer, and comparing skinny with other PP indices like holes().

Approach

The vignette uses the flea dataset and demonstrates: (1) standardizing the data, (2) computing skinny index values on specific projections, (3) running guided tours that optimize for skinny, (4) using the jellyfish population-based optimizer, and (5) comparing skinny scores with other indices like holes() to show how different indices capture different geometric properties.

Implementation

The vignette demonstrates the skinny index with real data and runnable examples:

Code snippetFull vignette available in PR #141

library(tourr)

# Standardize the flea dataset
f <- apply(flea[, 1:6], 2, function(x) (x - mean(x)) / sd(x))

# Compute skinny index on a random projection
set.seed(2026)
proj <- basis_random(ncol(f), 2)
skinny()(f %*% proj)

# Guided tour optimizing skinny index
set.seed(2026)
animate_xy(f,
  tour_path = guided_tour(skinny()),
  col = flea$species)

The vignette also demonstrates the jellyfish optimizer and compares skinny with other indices like holes().

Results

✓ Demonstrates skinny index on real flea dataset
✓ Shows guided tour optimization finding elongated point patterns
✓ Illustrates jellyfish optimizer for population-based search
✓ Compares skinny with holes() index showing different geometric interpretations