Skip to content

Repository files navigation

StatLab: learn statistics by doing it in R, right in your browser. 18 modules, 64 lessons, 89 exercises, 0 installs.

Open StatLab Watch the tour Play the 20 second video

Deploy status webR version React 18 and TypeScript No install, no account

Statistics you learn by running it, not by reading about it.

StatLab is a complete R and statistics course that runs entirely in the browser.
Students read, predict, write real R, and get instant feedback, from their first read.csv to mixed models and Bayes.
No installation. No account. No server. No data ever leaves the student's computer.

Built for psychology and business students at the University of Twente.
Made by dr. P.J.H. Slijkhuis and dr. V.d.C. Resendez Gomez, based on materials provided by dr. S.J. Watson. Theory, terminology and topic order follow Analysing Data Using Linear Models by S.M. van den Berg (5th ed., University of Twente, 2021; Creative Commons BY-NC-SA licence); the lessons are written independently.

See it in action

Poster of StatLab's 20-second launch video. Click to play it.
▶️ Play the 20-second launch video (with sound), or watch the longer tour below.

A one-minute tour of StatLab: the home page with a 14-day streak and 1300 points; a lesson where R runs in the page and draws a scree plot; an exercise where a wrong answer gets an explanation from the student's avatar and the right answer earns points and confetti; the least-squares simulation with a line being dragged; the model chooser recommending multiple regression in five clicks; and the avatar shop where a crown is bought with points.

Why students love it

⚡ Real R, zero setup

The full R language, compiled to WebAssembly with webR, runs in the page. Open a link on any laptop or Chromebook and start coding in seconds.

✅ Answers checked by R

89 exercises are marked by R itself. A wrong answer gets feedback on the specific mistake, not just a red cross.

🧑‍🔬 An avatar that coaches

Students design their own avatar, which explains their mistakes and R's error messages in plain language.

🎮 Points, streaks, rewards

Every solved exercise and finished lesson earns points to spend in the avatar shop. Daily streaks keep students coming back.

📈 Six live simulations

Drag a regression line, draw a thousand samples, watch p-values move. The hardest ideas in the course become something you can play with.

🧭 "Which model should I use?"

A guide that walks from a research question to the right model among 45, with ready-to-run R code and a link to the lesson.

🖥️ A workspace like RStudio

Script tabs, console, environment and files panes, Tab completion, and most of CRAN one install.packages() away.

📂 Your own data

Upload a CSV or Excel file and analyse it right next to the lesson. It stays in the browser and is never uploaded anywhere.

📱 Works on a phone

The layout folds down for small screens, and progress can be exported and picked up on another device.

🎯 "How many participants?"

A step-by-step sample size planner for two groups, repeated measures, 2 × 2 designs, regression and proportions, with the course model to fit, a power curve and R code that reproduces it.

🧑‍🏫 "Where to?"

Type what you are looking for, "compare two groups" or "how many people do I need", and the avatar points to the right lesson or tool.

♿ Built for everyone

Keyboard navigation, a skip link and screen reader labels, with every page scanned against WCAG 2.1 AA on each change.

A look inside

The StatLab home page: a blue banner with a 63% progress ring and a Continue button, tiles for the day streak, points, lessons and exercises completed, and the module list in the sidebar. A lesson on factor analysis: an R block computes eigenvalues and draws a scree plot, and the output shows the numbers and the plot right below the code.
Your progress, streak and points at a glance. Every code block is real R: edit it, run it, see the plot.
An exercise asking for a two-factor analysis. The student asked for one factor, and their avatar says in a speech bubble: the correlation table shows two blocks of three items, ask for factors = 2. The avatar shop: outfits from a hoodie to a graduation gown with prices in points, and 730 points to spend.
A mistake? The avatar explains what went wrong. Points buy outfits, accessories and backgrounds.
The R Workspace laid out like RStudio: a Source pane with a script that reads an uploaded my_survey.csv and fits lm(score ~ condition), the Console showing the coefficient table, the Environment listing my_survey and model, and the Files pane listing the uploaded file next to the course datasets. The 'Which model should I use?' guide after three choices, recommending multiple linear regression with the lm() code, what to check first, and a link to the lesson.
The R Workspace: RStudio's panes, with your own data. From research question to model in a few clicks.
The sample size planner's result for a 2 × 2 pre-post design: recruit 144 participants to end with 128 complete cases, a table showing how many are needed if the true effect is smaller, and a power curve crossing 80% at 128 people. The Where to? helper opened on a lesson page. The student typed how many people do I need, and it suggests the How many participants? planner and Lesson 8-4 on effect sizes and planning a study.
Plan a study: how many people, and what if the effect is smaller. Lost? Ask the avatar where to go.
The least-squares simulation: a scatter of points, a line the student drags with intercept and slope sliders, and orange squares showing each squared residual. The Central Limit Theorem simulation: a strongly skewed population above, and below it 2000 sample means with n = 30 forming a near-normal histogram.
Drag the line and watch the squared residuals shrink. Skewed data, and means that still come out normal.
The confidence interval simulation: a hundred intervals drawn from repeated samples, with the ones that miss the true mean shown in red. The p-value and power simulation: 4000 simulated differences under the null with the tails beyond the observed difference shaded red, giving p = 0.553.
What "95% confidence" means across a hundred samples. A p-value, drawn from four thousand studies.

StatLab on a phone: the banner, progress tiles in a two-by-two grid, and a Lessons button that opens the module list.

In your pocket too

On a phone the sidebar folds into a Lessons button and the streak, points and progress tiles stack into a grid. Progress, streaks, points and the avatar all live in the browser, and export to a file that imports on any other computer.


The course

18 modules · 64 lessons · 89 checked exercises · 6 interactive simulations. From "what is a file path?" to mixed models, logistic regression, mediation and Bayes. Statistics is taught the way the course team's own R workshops teach it: in tidyverse style and through the linear model. lm, lmer and glm do the work, and the t-test, ANOVA and chi-square appear as those same models under their traditional names.

Module What it covers Simulation
Foundations
0 Before you start RStudio Projects, files, folders and paths, and what R's symbols mean, with a cheat sheet
1 First steps in R Objects, functions, help, packages and library()
2 Working with data read.csv, factors, the pipe, select, filter, mutate, wide and long data
3 Describing data group_by and summarise, mean versus median, surprises in a summary, scale scores and Cronbach's alpha
4 Visualising data ggplot2 as layers, facets, and an APA-ready figure
Inference
5 The normal distribution Density, z-scores and probabilities Distribution
6 Sampling Sampling error, sampling distributions, the Central Limit Theorem Central Limit Theorem
7 Estimation Standard errors, confidence intervals, SD, SE and CI error bars Confidence intervals
8 Hypothesis testing Null distributions, p-values, Type I and II errors, power, effect sizes and sample-size planning p-values and power
9 Counts and proportions One proportion, contingency tables, the chi-square test, Cramér's V, Fisher's exact test
The linear model
10 Correlation and simple regression lm(y ~ x), reading model output with tidy() and glance(), Spearman and Kendall rank correlations Correlation, least squares
11 Multiple regression Several predictors, each slope holding the others constant, reporting R² and F, checking residuals and influential cases, Simpson's paradox
12 Categorical predictors The t-test as lm, dummy coding, emmeans pairwise comparisons, the Kruskal-Wallis test
13 Interactions and factorial designs a * b, sum-to-zero contrasts, Type III tests with car, interaction plots
14 Repeated measures and nested data lmer with (1 | id), fixed and random effects, the paired t-test, group by time designs, pre, mid and post, Wilcoxon and Friedman tests
15 Binary and count outcomes glm(..., family = binomial), log odds, odds ratios and reporting, Poisson regression for counts
Advanced
16 Bayesian statistics Prior, likelihood and posterior, credible intervals, Bayes factors, Bayesian regression
17 Mediation, factors and reports Indirect effects with bootstrap intervals, exploratory factor analysis, reproducible reports with Quarto

How a lesson works

Every lesson is built from the same few blocks, so learning is active from the first line:

  • 🤔 Predict: commit to an answer before the code or simulation settles it.
  • ▶️ CodeBlock: an editable R editor with console output, warnings, errors and plots.
  • 🎯 Exercise: a task whose answer R checks, with hints and a solution.
  • ❓ Quiz: a conceptual question with an explanation for every choice.
  • 📝 Interpret: pick the right reading of the output and the right APA-style sentence.
  • 🎛️ Simulation: one of the six interactive simulations.

Two fictional, generated datasets carry the course: a population of 5000 students (wellbeing-population.csv) for the sampling modules, and a workplace study of 480 employees (workplace.csv) built so that the models in the linear-model part have real effects to find, and one deliberate null (mentoring on wellbeing).

Built to be trusted

  • Every exercise is tested against real R. On every change, CI runs each solution, alternate solution and known wrong answer through R and checks that the right ones pass and the wrong ones fail for the right reason.
  • A real browser clicks through the site before anything is published.
  • Accessible by default. Every page is scanned with axe against WCAG 2.1 AA on each change, and a failing scan blocks the release.
  • It keeps itself up to date. A weekly workflow checks for new versions of webR and the site's dependencies and only takes them after the full R check passes.
  • Private by design. A static site with no backend, no accounts and no tracking. Uploaded data and progress never leave the student's browser. The only outside requests are the browser downloading webR and R packages from r-wasm.org.

Credits

StatLab was made by dr. P.J.H. Slijkhuis and dr. V.d.C. Resendez Gomez, based on materials provided by dr. S.J. Watson. Theory, terminology and topic order follow Analysing Data Using Linear Models by Prof. dr. Stéphanie M. van den Berg (5th edition, University of Twente, 2021), which is licensed under a Creative Commons BY-NC-SA licence. StatLab's lessons follow its theory, terminology and topic order but are written independently.

RStudio is a trademark of Posit Software, PBC. StatLab is not affiliated with or endorsed by Posit.

Licence

StatLab (lessons, exercises, datasets and code) is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0, the same licence as the textbook it follows. You may share and adapt it for non-commercial use if you credit the authors and share your version under the same licence. The University of Twente and BMS Lab logos belong to their owners and are not covered by this licence. Third-party packages keep their own licences.

University of Twente     The BMS Lab

It is a project of the University of Twente and The BMS Lab. The same credit shows at the foot of the sidebar on every page of the site and at the bottom of the home page. The partner logos are in src/assets/logos/, picked up by file name; see the README there to replace one.

Open StatLab

About

Interactive statistics and R course for students, running R in the browser via webR

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages