Introducing the Happy Apps collection, a baker’s dozen of R Shiny apps for introductory statistics at the undergraduate (or AP Stats) level. Each is a dynamic visual aid addressing a specific concept or topic in intro stats. They make nice visual aids to add to a lecture, or teachers can develop in-class activities or homework problems in which teachers provide students with guided exploration of a concept through the app. Most of the apps contain a “Click for more info” checkbox under the title, which will expand upon clicking to describe the different parts of the app in detail.

I will organize the apps here by variable type, as that has been our approach to intro stats at Grand Valley State University for a number of years. I will list all the apps first and the write a description of each below. The links named “app” will go to the apps themselves, and the links named “description” will go to the description of the app below. The screenshots of the apps below are links as well.

One categorical variable

One quantative variable

Two categorical variables

Two quantitative variables

Quantitative \(y\), Categorical \(x\)


Sampling distribution of sample proportion

This app shows a dynamic graph of the sampling distribution of \(\hat{p}\) that reacts to user supplied values of the population proportion \(p\) and the sample size \(n\). It shows the result of checking the conditions for approximate normality of the sampling distribution of \(\hat{p}\) and the value of the mean and standard deviation. Upon request, the app also plots a normal desntiy curve with the same mean and standard deviation as the sampling distribution of \(\hat{p}\) and compares probabilities based on the true sampling distribution of \(\hat{p}\) (from the binomial distribution) and based on the normal approximation.

Confidence interval for the population proportion

This app demonstrates the different parts of the calculation of the confidence interval. The user specifies the values of the sample proportion \(\hat{p}\), the sample size \(n\), and the confidence level \(C\). The app first checks the large-sample conditions associated with the normal approximation and displays a warning (and no confidence interval) if they are not met. Provided the conditions are met, the app displays the confidence interval multiplier \(z^{\ast}\) with a normal curve showing the confidence level as the area between \(-z^{\ast}\) and \(+z^{\ast}\). It is also displays the value of the standard error and the margin of error and a plot of the confidence interval. The app is ideal for answering questions about how the sample size and confidence level affect the width of the interval and how this follows from the formula.

Hypothesis test for a single proportion

This app contains three tabs, one which focuses on the test statistic, one which focuses on the p-value, and one which combines the two. The test statistic tab focuses on how the different parts of the formula affect the result. The p-value tab focuses on the changing graph of the p-value as an area under the normal curve depending on the test statistic value and the alternative hypothesis. The combined tab is then ideal for answering questions about how the difference \((\hat{p}-p_0)\) or the sample size \(n\) affect the p-value.

Descriptive statistics for a single quantitative variable

In this app, the user enters their own data and the app interactively updates numerical and graphical summaries. A histogram is shown with the option of choosing the number of bins and a boxplot wiht the option of showing the “fences” used in determining whether data points are outliers. The app is well-suited to demonstrate concepts such as how the mean and standard deviation are sensitive to outliers while the median and interquartile range are resistant to them.

The Central Limit Theorem

The app first directs users to select one of nine population distributions varying in direction and degree of skewness. Next, the user can change the sample size and note how the sampling distribution of the sample mean \(\bar{x}\) changes relative to the population distribution. The app also compares the distribution of \(\bar{x}\) to that of a normal distribution with the same mean and standard deviation. The app will demonstrate to students that the distribution of \(\bar{x}\) approaches a normal distribution as \(n\) increases and that larger values of \(n\) are needed for the sampling distribution of \(\bar{x}\) to be approximately normal when the population is more skewed.

Using the standard normal distribution

The app performs calculations from the standard normal distribution and shows the corresponding graphs. This includes “forward problems” where users find a probability from a specified range in normal quantiles (\(z\) values) and “backward problems” where users find a range of \(z\)s from a specified probability.

Comparing the \(t\) distribution to the standard normal distribution

This app displays a plot of both the \(t\) and standard normal (\(z\)) densities on the same axes for a user-specified value of the degrees of freedom. It also allows for shaded areas representing a specified confidence level to be added to the plot, along with values of \(t^{\ast}\) and \(z^{\ast}\). The app demonstrates that the \(t\) distribution approaches the \(z\) distribution as the degrees of freedom increases.

Confidence interval for the population mean

This app is quite similar to the app for the confidence interval for the population proportion, demonstrating the different parts of the calculation of the interval.

Hypothesis test for a single mean

This app is very similar to the app for the hypothesis test for the population proportion, showing what goes into the calculation of the test statistic and p-value, first separately and then together. This app provides a concrete means to discuss how data results can be statistically significant but not practically significant.

Chi-squared test of independence

In this app, the user enters the counts on the two-table which can have 2 to 5 rows and columns. The app calculates the expected counts in each cell, checks the large-sample conditions for the chi-squared test, demonstrates the calculation of the test statistic, and draws a picture of the p-value as an area beneath the chi-squared density curve. The app also uses overplotted mosaic plots to visualize the difference between the expected and observed counts.

Slope-intercept form a line

This app shows the plot of the line for a user-specified slope and y-intercept. It could be useful for students needing remedial study before learning simple linear regression.

Least squares regression line

Using a set of ten \((x,y)\) points, the user changes the \(y\)-intercept and slope of the line to try to minimize the sum of squared residuals. The line dynamically updates on the scatterplot as the user changes the equation of the line. The points on the plot are color-coded to correspond to rows of a table that shows the \(x\), \(y\), \(\hat{y}\), residual, and squared residual values. A bar with colored segments shows the contribution of each observation’s squared residual to the sum.

Inference for two-sample data

The app demonstrates the two-sample \(t\) test and confidence interval in much the same way as the corresponding apps for the confidence interval/hypothesis test apps for a single proportion/mean.

Type 1 and 2 error and power

This app illustrates the concepts of Type 1 and 2 error and power in the context of the two-sample \(t\) test. The user is allowed to choose whether \(H_0:\mu_1=\mu_2\) or whether \(H_a:\mu_1\neq\mu_2\) is true, to specify the values of \(\mu_1\) and \(\mu_2\), and also specify the significance level \(\alpha\). The user can then click on buttons to simulate 1 sample or 50 samples. After each click, the user sees a plot of the last sample, the summary statistics, and the test statistic, p-value, and decision about \(H_0\). After repeated clicks, the app will keep track of how many samples led to rejecting or failing to reject \(H_0\).