Statistics 101, 201, and 202: Three Shiny Apps for Teaching Probability Distributions, Inferential Statistics, and Simple Linear Regression
Statistics 101, 201, and 202 are three open-source interactive web applications built with R \citep{R} and Shiny \citep{shiny} to support the teaching of introductory statistics and probability. The apps help students carry out common statistical com…
Authors: Antoine Soetewey
Statistics 101, 201, and 202: Three Shin y Apps for T eac hing Probabilit y Distributions, Inferen tial Statistics, and Simple Linear Regression An toine So etew ey HEC Liège, ULiège, Rue Louvrex 14, 4000 Liège, Belgium OR CID: 0000-0001-8159-0804 an toine.so etew ey@uliege.b e 30 Marc h 2026 Abstract Statistics 101, 201, and 202 are three open-source interactiv e web applications built with R [ 9 ] and Shiny [ 4 ] to supp ort the teaching of introductory statistics and probabilit y . The apps help studen ts carry out common statistical computations— computing probabilities from standard probability distributions, constructing con- fidence in terv als, conducting h yp othesis tests, and fitting simple linear regression mo dels—without requiring prior knowledge of R or an y other programming lan- guage. Eac h app pro vides numerical results, plots rendered with ggplot2 [ 12 ], and inline mathematical deriv ations t yp eset with MathJax [ 3 ], so that computation and statistical reasoning appear side by side in a single interface. The suite is organ- ised around a broad p edagogical progression: Statistics 101 in tro duces probabilit y distributions and their properties; Statistics 201 addresses confidence in terv als and h yp othesis tests; and Statistics 202 cov ers the simple linear mo del. All three apps are freely accessible online and their source co de is released under a CC-BY-4.0 license. 1 Summary Statistics 101, 201, and 202 are three op en-source in teractive w eb applications built with R [ 9 ] and Shin y [ 4 ] to supp ort the teac hing of in tro ductory statistics and probabilit y . The apps are in tended to help studen ts carry out common statistical computations (computing probabilities from standard probability distributions, constructing confidence interv als, conducting h yp othesis tests, and fitting simple linear regression mo dels) without requiring prior kno wledge of R or an y other programming language. Eac h app provides n umerical results, plots rendered with ggplot2 [ 12 ], and inline mathematical deriv ations typeset with MathJax [ 3 ], so that computation and statistical reasoning app ear side by side in a single in terface. The suite was developed during the author’s do ctoral researc h and teaching assistantship 1 at UCLouv ain and con tin ues to b e used as an invited lecturer at UCLouv ain and UNam ur in courses on probability , inferential statistics, and linear regression. The three apps are organised around a broad p edagogical progression: Statistics 101 in tro duces probability distributions and their prop erties; Statistics 201 addresses confidence in terv als and hy- p othesis tests; and Statistics 202 cov ers the simple linear mo del. All three apps are freely accessible online and their source co de is released under a CC-BY-4.0 license. 2 Statemen t of Need In tro ductory statistics courses in economics, biostatistics, so cial sciences, and related dis- ciplines commonly ask students to ev aluate probabilities, construct confidence interv als, p erform hypothesis tests, and fit linear regression mo dels. W orking through these compu- tations b y hand can b e time-consuming and error-prone, while doing so in R presupp oses a level of programming familiarit y that b eginners ma y not y et hav e. Prin ted or online sta- tistical tables can help with probability computations, but typically cov er only a limited n um b er of distributions and offer no graphical feedback. Sev eral existing to ols partially address this gap. Calculators bundled with commercial textb o oks are often proprietary . General-purp ose environmen ts such as R, Python, or SPSS require studen ts to write or adapt co de. W eb-based probabilit y calculators (for instance those offered by W olfram Alpha or individual course websites) tend to co v er only a limited num b er of distributions, and man y do not include h yp othesis testing or regression mo dules, nor do they display the underlying mathematical expressions alongside their results. Shin y-based to ols for teaching statistics hav e b een explored in the literature [ 8 , 11 ], though these tend to fo cus on sp ecific topics or workflo ws rather than co vering the full introductory sequence in single in terfaces. The Statistics 101/201/202 suite is an attempt to complemen t these resources in a few w a ys. It brings together topics from a typical t w o-semester introductory statistics se- quence (probability distributions, inference, and regression) within a single, consisten t in terface. Each n umerical result is sho wn alongside a dynamically up dated plot and the corresp onding mathematical expression, with the aim of supp orting statistical in tuition alongside computation. The apps are fully op en source, so other instructors are w elcome to adopt, fork, or extend them. Their con tin ued use across introductory and intermediate statistics courses at UCLouv ain and UNamur suggests they ma y b e useful b eyond the con text in which they w ere originally dev elop ed. 3 Description of the Apps 3.1 Statistics 101: Probabilit y Distributions Statistics 101 ( https://github.com/AntoineSoetewey/statistics- 101 ) is designed to help students compute probabilities from 18 probability distributions: Beta, Binomial, Cauc h y , Chi-square, Exp onential, Fisher, Gamma, Geometric (t w o parameterisations), Hyp ergeometric, Logistic, Log-Normal, Negativ e Binomial (t wo parameterisations), Nor- mal, Poisson, Student’s t , and W eibull. The app uses a single-page sidebar lay out. Stu- den ts select a distribution from a drop-do wn men u, and the sidebar dynamically renders the appropriate parameter inputs using conditional panels. 2 F or eac h distribution, the studen t specifies the t yp e of p robabilit y to compute: • Lo wer tail: P ( X ≤ x ) • Upper tail: P ( X > x ) • In terv al: P ( a ≤ X ≤ b ) The main panel displa ys three outputs: 1. Solution: the probability statement in full mathematical notation rendered via MathJax, for example X ∼ N ( µ = 0 , σ 2 = 1) and P ( X ≤ 1) = 0 . 8413 , computed to four decimal places using R’s built-in distribution functions ( pbeta , pbinom , pnorm , etc.). 2. Plot: a density or mass function plot with the relev an t region shaded, rendered using ggplot2 graphics and display ed with a loading spinner via shinycssloaders [ 2 ]. 3. Details: the probability densit y function (PDF) or probabilit y mass function (PMF) in display-st yle mathematical notation, follo w ed by the exp ectation E ( X ) , standard deviation S D ( X ) , and v ariance V ar( X ) , all ev aluated n umerically at the curren t pa- rameter v alues. 3.2 Statistics 201: Confidence In terv als and Hyp othesis T ests Statistics 201 ( https://github.com/AntoineSoetewey/statistics- 201 ) is intended to supp ort the teaching of confidence interv als and h yp othesis tests across sev en inference settings, selectable from a drop-do wn men u: • One mean: z -test (p opulation v ariance σ 2 kno wn) or one-sample t -test ( σ 2 unkno wn) • T wo means, indep endent samples: z -test or tw o-sample t -test with either equal ( σ 2 1 = σ 2 2 ) or unequal ( σ 2 1 = σ 2 2 ) v ariances (W elch’s correction) • T wo means, paired samples: paired t -test or z -test on the differences D i = X 1 i − X 2 i • One prop ortion: one-sample z -test • T wo prop ortions: tw o-sample z -test with an option to use a p ooled standard error • One v ariance: χ 2 test, using EnvStats::varTest() [ 7 ] for raw data and a custom help er function for summary statistics ( n and s 2 ) • T wo v ariances: F -test, using var.test() from base R F or all mean and v ariance settings, studen ts may provide either ra w data (comma- separated v alues pasted into a text field) or summary statistics ( n , ¯ x , s 2 , etc.) directly . The significance lev el α is con trolled via a slider (range 0.01 to 0.20, default 0.05). The null h yp othesis v alue H 0 and the direction of the alternative h yp othesis (tw o-sided, greater, or less) are set in the sidebar. F or eac h procedure, the main panel displa ys a structured four-step output: 1. Data: the en tered observ ations (if ra w data w ere provided) together with the rele- v an t summary statistics ( n , ¯ x , s , etc.), typeset in MathJax. 2. Confidence in terv al: the in terv al form ula with all quan tities substituted n umeri- cally , for example ¯ x ± t α/ 2 , n − 1 × s/ √ n = [ ℓ ; u ] , in the appropriate one- or t w o-sided form. 3. Hyp othesis test: a n umbered four-step pro cedure consisting of (1) the statemen t of H 0 and H 1 , (2) the test statistic formula ev aluated n umerically , (3) the critical v alue(s), and (4) the reject or do-not-reject conclusion. 3 4. In terpretation: a plain-language conclusion at the chosen significance level, in- cluding the p -v alue. Belo w the text output, a ggplot2 plot shows the relev ant sampling distribution ( t , N (0 , 1) , χ 2 , or F ) with the rejection region shaded and the observ ed test statistic marked by a v ertical line. 3.3 Statistics 202: Simple Linear Regression Statistics 202 ( https://github.com/AntoineSoetewey/statistics- 202 ) is designed to help studen ts fit a simple linear regression mo del y = β 0 + β 1 x + ε to data en tered directly in the browser. The app accepts comma-separated numeric v alues for the predictor x and the response y , c hecks that the t wo vectors are of equal length and that x contains more than one distinct v alue. The fitted mo del is computed via lm() in R. The main panel presen ts the following sequence of outputs: 1. Data table: an interactiv e DT [ 15 ] table of the en tered observ ations, with exp ort buttons (cop y , CSV, Excel, PDF, prin t). 2. Summary statistics: sample means ¯ x , ¯ y , and sample size n . 3. Step-b y-step deriv ation: the OLS estimator ˆ β 1 computed via the form ula ˆ β 1 = P n i =1 x i y i − n ¯ x ¯ y P n i =1 ( x i − ¯ x ) 2 follo w ed b y ˆ β 0 = ¯ y − ˆ β 1 ¯ x , b oth rendered in MathJax and ev aluated n umerically on the studen t’s o wn data [ 5 ]. 4. R output: the full summary(lm(... )) output, including coefficient estimates, standard errors, t -statistics, p -v alues, and adjusted R 2 . 5. In teractive regression plot: a scatter plot with the fitted line and an optional confidence band, rendered with ggplot2 and made in teractive via plotly [ 10 ]. 6. In terpretation: a plain-language reading of ˆ β 0 and ˆ β 1 , adapted to the user-supplied axis lab els and conditioned on whether each co efficient is significan tly differen t from zero at the 5% lev el. 7. Assumption diagnostics: a collapsible panel containing the six mo del-c hec king plots pro duced b y performance::check_model() [ 6 ], cov ering linearit y , homoscedas- ticit y , influen tial observ ations and normality of residuals. 8. Do wnloadable rep ort: an HTML rep ort of the analysis, generated from an R Markdo wn [ 1 , 13 , 14 ] template, with an option to include or hide the underlying R code. 4 P edagogical Design The three apps share a common design orien tation. The in terface is k ept relatively min- imal so that attention can remain on the statistical conten t rather than on navigating the soft ware. No registration, installation, or command-line interaction is required; stu- den ts op en a URL and b egin working straight a w a y . Results are display ed at a level of mathematical abstraction close to what is used in lectures, with notation, formulas, and n umerical output app earing together, so that the apps can serve as a complemen t to, rather than a replacemen t for, the conceptual material cov ered in class. 4 The step-b y-step deriv ation in Statistics 202 w as motiv ated by a difficult y that often arises in introductory regression courses: studen ts ma y b e able to write do wn a formula from a slide y et find it hard to connect it to the numerical output pro duced by R. Sho wing b oth the symbolic form ula and its numerical ev aluation side b y side, on the student’s o wn data, is one wa y of trying to make that connection more concrete. A related idea underpins the Details panel in Statistics 101, whic h displays the PDF or PMF alongside the computed probabilit y , so that students can see ho w the shaded area in the plot corresp onds to the analytical expression. A comparable motiv ation applies to Statistics 201. Introductory statistics courses typi- cally co ver a large num b er of inference pro cedures, each with its own test statistic form ula, degrees of freedom, and critical v alue. Studen ts often find it difficult to lo cate the relev an t form ula quickly when w orking through an exercise, particularly when the course material is spread across a length y syllabus or a large set of slides. By displa ying the appropriate form ula for each pro cedure alongside its n umerical ev aluation, Statistics 201 is intended to serve as a single reference p oin t where students can find, read, and apply the correct expression without having to searc h through their course materials. The apps were originally developed in resp onse to a practical difficult y observed during teac hing-assistan t sessions at UCLouv ain, where students w ere sp ending a considerable share of class time on the mechanics of lo oking up or computing probabilities and test statistics, leaving relatively little time for in terpretation and discussion. The hop e w as that shifting some of that computational w ork to a transparen t, easy-to-use to ol migh t free up more time for conceptual engagemen t. 5 A v ailabilit y and Repro ducibilit y All three apps are hosted on shiny apps.io and their source co de is publicly a v ailable on GitHub under a CC-BY-4.0 license: • Statistics 101: https://github.com/AntoineSoetewey/statistics- 101 • Statistics 201: https://github.com/AntoineSoetewey/statistics- 201 • Statistics 202: https://github.com/AntoineSoetewey/statistics- 202 Eac h app’s GitHub rep ository includes a README file with instructions on ho w to use the app, the dep endencies, instructions for lo cal deploymen t, and a link to the live version. A c kno wledgemen ts The author thanks Prof. Dominique Deprins and Prof. Eugen Pircalab elu for their com- men ts on previous versions of the apps. The author is grateful to his PhD sup ervisors, Prof. Catherine Legrand and Prof. Mic hel Den uit, for their supp ort and for allowing him to work on these apps during his do ctoral studies at UCLouv ain. Finally , the author thanks the students at UCLouv ain, without whom these apps w ould not exist. References [1] JJ Allaire, Yih ui Xie, Christophe Dervieux, Jonathan McPherson, Javier Luraschi, Kevin Ushey , Aron A tkins, Hadley Wickham, Joe Cheng, Winston Chang, and 5 Ric hard Iannone. rmarkdown: Dynamic Do cuments for R , 2025. URL https: //github.com/rstudio/rmarkdown . R pac k age v ersion 2.30. [2] Dean Attali and Andras Sali. shinycsslo aders: A dd L o ading Animations to a ’shiny’ Output While It’s R e c alculating , 2024. URL https://CRAN.R- project.org/ package=shinycssloaders . R pac k age version 1.1.0. [3] Da vide Cervone. Mathjax: a platform for mathematics on the w eb. Notic es of the AMS , 59(2):312–316, 2012. [4] Winston Chang, Jo e Cheng, JJ Allaire, Carson Sievert, Barret Sc hlo erk e, Gar- ric k A den-Buie, Yihui Xie, Jeff Allen, Jonathan McPherson, Alan Dipert, and Barbara Borges. shiny: W eb Applic ation F r amework for R , 2025. URL https: //CRAN.R- project.org/package=shiny . R pack age v ersion 1.12.1. [5] John F o x. Applie d r e gr ession analysis and gener alize d line ar mo dels . Sage publica- tions, 2015. [6] Daniel Lüdec ke, Mattan S. Ben-Shac har, Indra jeet P atil, Philip W aggoner, and Do- minique Mak owski. performance: An R pac k age for assessment, comparison and testing of statistical mo dels. Journal of Op en Sour c e Softwar e , 6(60):3139, 2021. doi: 10.21105/joss.03139. [7] Stev en P . Millard. EnvStats: An R Package for Envir onmental Statistics . Springer, New Y ork, 2013. ISBN 978-1-4614-8455-4. URL https://www.springer.com . [8] Gail Potter, Jimmy W ong, Irvin Alcaraz, Peter Chi, et al. W eb application teac hing to ols for statistics using r and shiny . T e chnolo gy Innovations in Statistics Educ ation , 9(1), 2016. [9] R Core T eam. R: A L anguage and Envir onment for Statistic al Computing . R F oundation for Statistical Computing, Vienna, Austria, 2025. URL https://www. R- project.org/ . [10] Carson Sievert. Inter active W eb-Base d Data Visualization with R, plotly, and shiny . Chapman and Hall/CR C, 2020. ISBN 9781138331457. URL https://plotly- r.com . [11] An toine So etew ey , Cédric Heuc henne, Arnaud Claes, and An tonin Descampe. As- so ciationexplorer: A user-friendly shiny application for exploring asso ciations and visual patterns. Softwar eX , 33:102483, 2026. doi: 10.1016/j.softx.2025.102483. [12] Hadley Wickham. ggplot2: Ele gant Gr aphics for Data Analysis . Springer-V erlag New Y ork, 2016. ISBN 978-3-319-24277-4. URL https://ggplot2.tidyverse.org . [13] Yih ui Xie, J.J. Allaire, and Garrett Grolem und. R Markdown: The Definitive Guide . Chapman and Hall/CRC, Bo ca Raton, Florida, 2018. ISBN 9781138359338. URL https://bookdown.org/yihui/rmarkdown . [14] Yih ui Xie, Christophe Dervieux, and Emily Riederer. R Markdown Co okb o ok . Chap- man and Hall/CR C, Bo ca Raton, Florida, 2020. ISBN 9780367563837. URL https://bookdown.org/yihui/rmarkdown- cookbook . [15] Yih ui Xie, Jo e Cheng, Xianying T an, and Garric k A den-Buie. DT: A W r app er of the JavaScript Libr ary ’DataT ables’ , 2025. URL https://CRAN.R- project.org/ package=DT . R pac k age version 0.34.0. 6
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment