graph TB
A[Types of data] --> B[Quantitative]; B --> D{Numerical}
A --> C[Qualitative]; C --> E{Categorical}
D --> F(Continuous)
D --> G(Discrete)
E --> H(Ordinal)
E --> I(Nominal)
Published course presentation · repository edition
HEC Montréal
pd.read_parquet and .dropna, and say how many rows went.quantileEverything you need to type is on one sheet — how to start Python in VS Codium on your platform, how to make a file and run it, the DataFrame basics, and every name from sessions 1 to 2, each with a line showing it in use.
Python Cheatsheet · Session 02 (PDF) · in the repository at
02-…/PYTHON-CHEATSHEET.pdf
One sheet per package, functions explained with pictures: pandas · NumPy · SciPy · statsmodels
Print it, or keep it open beside the editor. Nothing on it is examinable; all of it is assumed.
Respect: Respect other participants and speakers.
Participation: Participate actively in discussions and activities.
Commitment: Be committed and involved in the learning process.
Collaboration: Collaborate with your peers and share your knowledge.
Confidentiality: Respect the confidentiality of shared information.
Cell phones are in backpacks, not on the table.
Computers are used for taking notes and following the course, not for personal messages or other activities.
| Session | Day and Time | Building, Room | Instructor | Session Dates |
|---|---|---|---|---|
| Session 1 | Wed 15:30–18:30 | Décelles — Victoriaville | Thierry Warin | August 26, 2026 |
| Session 2 | Wed 15:30–18:30 | Décelles — Victoriaville | September 2, 2026 | |
| Session 3 | Wed 15:30–18:30 | Décelles — Victoriaville | September 9, 2026 | |
| Session 4 | Wed 15:30–18:30 | Décelles — Victoriaville | September 16, 2026 | |
| Session 5 | Wed 15:30–18:30 | Décelles — Victoriaville | September 23, 2026 | |
| Session 6 | Wed 15:30–18:30 | Asynchronous — no room | October 7, 2026 | |
| Session 7 | Wed 15:30–18:30 | Décelles — Victoriaville | October 14, 2026 | |
| Session 8 | Wed 15:30–18:30 | Décelles — Victoriaville | November 4, 2026 | |
| Session 9 | Wed 15:30–18:30 | Décelles — Victoriaville | November 11, 2026 | |
| Session 10 | Wed 15:30–18:30 | Décelles — Victoriaville | November 18, 2026 | |
| Session 11 | Wed 15:30–18:30 | Décelles — Victoriaville | November 25, 2026 | |
| Session 12 | Wed 15:30–18:30 | Décelles — Victoriaville | December 2, 2026 |
It’s tough to make predictions, especially about the future
Statistics is a language, constructed by mathematicians.
The tools (formulas and processes) are constructs. They do not represent the truth, just the tools to get closer to the truth. They are the foundations that we use in our applications as a data analyst.
So, let us spend some time on the foundations first.
The magic in the data
Statistics: decision making under uncertainty.
Statistics is that branch of knowledge which deals with the multiplicity of data, its
collection,
analysis, and
interpretation
Statistical learning is a vast set of tools for understanding data
classified as supervised learning: building a statistical model for predicting, or estimating, and output based on one (single) or more (multiple) inputs.
classified as unsupervised learning: there are inputs, but no supervising output
The goal is to understand the models, intuitions, and strengths and weaknesses of the various approaches
scalar, random variable, vector, matrix
quantitative values versus qualitative values
quantitative: numerical (continuous or discrete)
qualitative: categorical (nominal or ordinal)
graph TB
A[Types of data] --> B[Quantitative]; B --> D{Numerical}
A --> C[Qualitative]; C --> E{Categorical}
D --> F(Continuous)
D --> G(Discrete)
E --> H(Ordinal)
E --> I(Nominal)
| Numerical | Examples | Visualizations |
|---|---|---|
| Discrete: data have a finite number of values | Number of balls in a jar | Bar charts, line graphs |
| Continuous: data have an infinite number of values | Distance, time | Histograms, line graphs |
| Categorical | Examples | Visualizations |
|---|---|---|
| Nominal: identified by particular names or categories and cannot be organized in any order | Gender, colors, locations | Bar charts |
| Ordinal: identified by particular names or categories and can be ordered | Rankings | Bar charts |
\[ X, Y, Z \]
\[ x, y, z \]
Let \(X\) be a r.v. taking values in the sample space \(S=\left\{x_{1},\, x_{2},\,\ldots,x_{k}\right\}\)
\[ p(x_{i})=\Pr(X=x_{i}), \quad i=1,2,\ldots,k \]
\[ \sum_{i=1}^{k}p(x_{i}) = p(x_{1})+p(x_{2})+\cdots+p(x_{k}), = 1 \]
Three Basic Features
Center: middle or general tendency
Spread: small means tightly clustered, large means highly variable
Shape: symmetry versus skewness, kurtosis
Make the difference between a sample and a population!
In what follows, we will look into the following concepts:
Basics:
Extensions:
R.V.’s mean
\[ \mu = \sum_{i=1}^{k} x_{i} p(x_{i}) \\\\ = x_{1} \times p(x_{1}) + \cdots + x_{k} \times p(x_{k}) \]
the mean is a center or average value of \((X)\)
\((\mu)\) can be any number or decimal
\((\mu)\) is the “first moment about the origin”
Sample mean
\[ \overline{x} = \frac{x_{1} + x_{2} + \cdots+x_{n}}{n} \\\\ = \frac{1}{n}\sum_{i = 1}^{n} x_{i} \]
Wait!
Greek letters are for the RV and latin letters are for the sample?
| stack.loss |
|---|
| 42 |
| 37 |
| 37 |
| 28 |
| 18 |
| 18 |
| 19 |
| 20 |
| etc. |
How to find it
sort the data into an increasing sequence of \(n\) numbers
\(\tilde{x}\) lies in position \((n + 1)/2\)
Good: resistant to extreme values, easy to describe
Bad: not as mathematically tractable, need to sort the data to calculate
How to find it
“trim” a proportion of data from both ends of the ordered list
find the sample mean of what’s left
Good: also resistant to extreme values, has good properties, too
Bad: still need to sort data to get rid of outliers
So, \(75%\) of the data (.75*21=16) fall below the value \(19\).
In what follows, we will look into the following concepts:
The sample variance
The sample standard deviation
The sample interquartile range (IQR)
The sample variance \(s^{2}\):
\[ s^{2} = \frac{1}{n - 1}\sum_{i = 1}^{n}(x_{i} - \overline{x})^{2} \]
The sample standard deviation is \((s = \sqrt{s^{2}})\)
Good: tractable, nice mathematical/statistical properties
Bad: sensitive to extreme values
Interpretation of \(s\)
The empirical rule:
For nearly normally distributed data,
about \(68\%\) falls within 1 SD of the mean,
about \(95\%\) falls within 2 SD of the mean,
about \(99.7\%\) falls within 3 SD of the mean.
It is possible for observations to fall 4, 5, or more standard deviations away from the mean, but these occurrences are very rare if the data are nearly normal.
SAT scores are distributed nearly normally with mean 1500 and standard deviation 300.
Following the 68-95-99.7 Rule:
\(\sim 68\%\) of students score between 1200 and 1800 on the SAT.
\(\sim 95\%\) of students score between 900 and 2100 on the SAT.
\(\sim 99.7\%\) of students score between 600 and 2400 on the SAT.
\[ IQR = \tilde{q}_{0.75} - \tilde{q}_{0.25} \]
Good: resistant to outliers (see session 3)
Bad: only considers middle \(50\%\) of the data, equivalent to:
In what follows, we will look into the following concepts:
Skewness: degree of “symmetry”
Kurtosis: degree of “thickness”
Symmetric or skewed
Kurtosis
leptokurtic - steep peak, heavy tails
platykurtic - flatter, thin tails
mesokurtic - right in the middle
All three can share the same mean and the same variance: kurtosis is about shape, not spread
Wait!
Why are we looking at the distribution of the sample?
Is the study of the sample shape/distribution relevant because otherwise the tools designed by the statisticians would not work?
The sample skewness \(g_{1}\):
\[ g_{1} = \frac{1}{n}\frac{\sum_{i = 1}^{n}(x_{i} - \overline{x})^{3}}{s^{3}} \]
Things to notice:
\(-\infty < g_{1} < \infty\)
sign of \(g_{1}\) indicates direction of skewness \(\pm)\)
np.float64(1.1564007167787318)
If \(\vert g_{1} \vert > 2\sqrt{6/n}\), then the data distribution is substantially skewed in the direction of the sign of \(g_{1}\)
The sample excess kurtosis \(g_{2}\):
\[ g_{2} = \frac{1}{n}\frac{\sum_{i = 1}^{n}(x_{i} - \overline{x})^{4}}{s^{4}} - 3 \]
Things to note:
\(-2 \leq g_{2} < \infty\)
\(g_{2} > 0\) indicates leptokurtosis
\(g_{2} < 0\) indicates platykurtosis
np.float64(0.13435238060300536)
If \(\vert g_{2} \vert > 4\sqrt{6/n}\), then the data distribution is substantially kurtic.
Required: the next session’s article, its Dataverse package, and the self-check. That is the pre-session deck.
Optional: the QMIB Lab for this session — a knowledge check on the hour you have just sat through: warin.ca/qmib-labs
Never a prerequisite, never marked for correctness. A completed report counts toward participation because attempting it is the engagement being measured.
MATH60033A · Session 02 · Thierry Warin, PhD · HEC Montréal