Demo
A preview of the parts of a lesson: formulas, definition blocks, data tables, charts, code that runs on the page and layout blocks
In short
This page shows the parts you will meet in lessons, with a small example on probability and regression. The study-scores.csv data is simulated data for illustration: self-study hours, hours of sleep and scores for 3 groups of learners.
Video
Click the video to watch it as on YouTube.
Formulas and content blocks
Inline formula: the sample mean . A display formula:
Concept (Random variable)
A quantity whose value depends on the outcome of a random experiment, for example the number of heads in 10 coin tosses.
Definition (Probability)
For a finite sample space of equally likely outcomes, the probability of an event is .
Theorem (Law of large numbers)
As , the sample mean converges to the expected value .
Proof
Apply Chebyshev's inequality to .
Example
Tip
Tables and tabs
| Kind of random variable | Example | Described by |
|---|---|---|
| Discrete | number of heads in 10 coin tosses | probability mass function |
| Continuous | height, waiting time | density function |
The number of successes in independent trials, each succeeding with probability :
Steps
State the hypotheses
: no difference; : a difference.
Choose a significance level
Usually .
Compute the test statistic and p-value
The p-value is the probability of a result at least as extreme as the one observed if is true.
Conclude
If , reject .
Further questions
The standard deviation has the same units as , so it is easier to interpret.
When the data is skewed or has large outliers.
Diagrams
Data and charts
Data tables support sorting, search and pagination:
| 1 | B | 9.5 | 6.7 | 100 |
| 2 | C | 1.8 | 4.9 | 46.5 |
| 3 | A | 1.3 | 6.6 | 57.1 |
| 4 | A | 6 | 8.3 | 84.1 |
| 5 | A | 6.7 | 6.7 | 81.1 |
| 6 | C | 4.6 | 7.3 | 69.8 |
| 7 | A | 3.6 | 7.3 | 70.6 |
| 8 | B | 6 | 6.8 | 80.5 |
| 9 | C | 6.8 | 6 | 84.1 |
| 10 | A | 6.1 | 6.1 | 73.7 |
A simple linear regression model:
where is the average increase in score for one more hour of study, and is the share of the variance in scores explained by the model.
Code that runs on the page
Click Run to execute Python or R right in your browser; the first run may take a moment while the page loads the runtime.
Ctrl/Cmd + Enter to run. Code runs right in your browser.
Simulating a probability in Python:
Ctrl/Cmd + Enter to run. Code runs right in your browser.
Code blocks for reading
import pandas as pd
df = pd.read_csv("study-scores.csv")
print(df.describe()) pip install pandas scikit-learnprint("Hello, data!")Folder structures and parameters
Prop
Type
Related lessons
How satisfied are you with this page?