Skip to contents

Visualizing distributions and variation

Make counts, spread, and portions of a distribution visible: countable histograms, distribution part functions for shading (with cutoff markers), a standard deviation ruler, and overlays that mark a distribution’s mean and the process that generated it.

gf_sd_ruler() experimental
Add a Standard Deviation Ruler to a Plot
StatSdRuler
Measure one standard deviation of the outcome, anchored at its mean
gf_squareplot() experimental
Countable-Rectangle Histogram
StatSquareplot
Bin observations the way ggplot2::stat_bin() does
GeomSquareplot
Draw one countable rectangle per observation
middle() outer() tails() lower() upper() experimental
Find a percentage of a distribution
show_cutoffs() experimental
Add Cutoff Markers to a Distribution
StatCutoff
Compute a distribution part's empirical quantile cutoffs, per panel
show_mean() experimental
Mark a Distribution's Mean
show_dgp() experimental
Frame a Sampling Distribution With Its Data Generating Process

Visualizing models

Layer models, their coefficients, residuals, reductions, and squares of both onto ggformula plots.

gf_b() gf_coef()
Annotate a model's coefficients on a plot
gf_model()
Add a model to a plot
gf_reduce()
Add Reduction Lines to a Plot
gf_resid()
Add Residual Lines to a Plot
gf_resid_fun() experimental
Add Residual Lines from a Function to a Plot
gf_square_reduce() gf_squareduce() experimental
Add Squared Reduction Visualization to a Plot
gf_square_resid() gf_squaresid() experimental
Add Squared Residual Visualization to a Plot
gf_square_resid_fun() experimental
Add Squared Residual Visualization from a Function to a Plot
StatResid
Carry a prediction alongside the observation it belongs to
GeomResid
Draw a residual as a segment from a prediction to an observation
GeomSquareResid
Draw a residual as the square it would make

Evaluating models

Pull estimates out of fitted models (useful for bootstrapping), and quantify fit — including on separate train and test sets.

b0() b1() b() f() pre() p()
Extract estimates/statistics from a model
fit_stats() fitstats()
Test the fit of a model on a train and test set.
split_data()
Split data into train and test sets.

Plot theme and palettes

The colorblind-friendly ggplot2 theme that is applied when the package is loaded, and tools for customizing or toggling it.

coursekata_load_theme()
Utility function for loading all themes.
coursekata_palette()
The color palettes used in our theme system
coursekata_palette_provider()
Create a function that provides a colorblind palette.
coursekata_unload_theme()
Restore ggplot2 default settings
scale_discrete_coursekata()
A discrete color scale constructor with colorblind-safe palettes.
theme_coursekata()
A simple theme built on top of ggplot2::theme_bw

Package management

Install, update, and load the packages used in CourseKata courses.

coursekata coursekata-package
coursekata: CourseKata Statistics and Data Science
coursekata_attach()
Attach the CourseKata course packages
coursekata_install() coursekata_update()
Install or update all CourseKata packages.
coursekata_packages()
List all CourseKata course packages
coursekata_repos()
Get repositories for the packages.

Data

Data sets used in CourseKata courses and supplementary materials.

Ames
Ames, Iowa housing data
class_data
Generated "class data" for exploring pairwise tests
er
Emergency room canine therapy
fevdata
Forced Expiratory Volume (FEV) Data
Fingers
Data from introductory statistics students at a university.
FingersMessy
Raw data from introductory statistics students at a university.
game_data
Simulated math game data.
penguins
A modified form of the palmerpenguins::penguins data set.
Smallville
Simulated housing data
Survey
Students at a university were asked to enter a random number between 1-20 into a survey.
Tables
Tables data
tip_exp
Simulated data for an experiment about smiley faces and tips
TipExperiment
Data from an experiment about smiley faces and tips
World
Data on countries from the Happy Planet Index project.