This document provides a comprehensive guide to fundamental statistical concepts and methods essential for data analysis. Mastering these topics will equip you with the tools to understand, interpret, and draw meaningful conclusions from data in various contexts.
Key points
Overview of statistical formulas and definitions across multiple parts.
Methods for data representation and descriptive statistics.
Core probability concepts and calculation techniques.
Understanding random variables and their common distributions.
Principles of statistical inference, including estimation and hypothesis testing.
1. Statistical formulas and definitions (part 1)
1.1 Core statistical concepts
Population: The complete set of all items of interest. It can be finite (fixed size) or infinite (no limits).
> <span style="color: #ff9f29; font-weight: 700;">📝 Example:</span> All the leaves on a tree is a finite population.
> <span style="color: #ff9f29; font-weight: 700;">📝 Example:</span> The particles in the universe represent an infinite population.
Parameter: A numerical value that describes a characteristic of a population. Usually denoted by Greek letters (e.g., μ, σ, σ2).
Sample: A subset of data drawn from a population.
Sample statistic: A numerical value that describes a characteristic of a sample. Usually denoted by lowercase Roman letters (e.g., xˉ, s, s2). Sample statistics are used to infer properties about population parameters.
> <span style="color: #ff9f29; font-weight: 700;">📝 Example:</span> If the lotto population is 49 numbers, the six drawn numbers are a sample. The maximum number in the population is a parameter ($\alpha = 49$), while the maximum in the sample (e.g., 42) is a statistic ($a = 42$). .
1.2 Purpose of statistics
Statistics is divided into two main branches:
Descriptive statistics: Involves collecting, organizing, summarizing, and presenting data. This includes using graphs, tables, and numerical measures to describe population characteristics and distinguish between parameters and statistics.
> <span style="color: #ff9f29; font-weight: 700;">📝 Example:</span> The sample proportion of vaccinated people, $\hat{p} = X/n$, estimates the population proportion, $P$.
Inferential statistics: Uses sample data to make estimates, predictions, or decisions about a population. This process involves measures of reliability like confidence levels and significance levels.
> <span style="color: #ff9f29; font-weight: 700;">🔑 Important:</span> Conclusions drawn from samples are not always correct; reliability measures are crucial.
> <span style="color: #ff9f29; font-weight: 700;">📝 Example:</span> A pharmaceutical company samples drug tablets to estimate the average weight ($\mu$) of a large production batch (50,000 tablets) because weighing every tablet is impractical.
1.3 Basic definitions and variables
Variable: A characteristic that takes on different values for different individuals or objects. It is typically denoted by a capital letter (e.g., X, Y, Z).
Values: All possible observations of a variable.
Data: The observed values of a variable. Data collected randomly are called data of a random variable.
Actual observations are usually denoted by corresponding lowercase letters (e.g., x1, xi).
Subscripts: Used to identify specific values in a dataset, often representing position or order.
Row/Column
Column 1
Column 2
Column 3
Row 1
x11
x12
x13
Row 2
x21
x22
x23
Row 3
x31
x32
x33
* `> <span style="color: #ff9f29; font-weight: 700;">📝 Example:</span> $x_{23}$ is the value in the second row and third column.`
Discrete random variable (RV): A variable that can only assume a specific, distinct set of values. Data from a discrete variable are discrete data.
> <span style="color: #ff9f29; font-weight: 700;">📝 Example:</span> The number of children in a family (0, 1, 2, etc.) is discrete; a family cannot have 2.6 children.
> <span style="color: #ff9f29; font-weight: 700;">📝 Example:</span> Coke bottle sizes (1L, 1.5L, 2L) are discrete as no values exist between these specific options.
Continuous random variable (RV): A variable that can assume any value within a given interval. Data from a continuous variable are continuous data. The recorded values depend on measurement accuracy.
> <span style="color: #ff9f29; font-weight: 700;">📝 Example:</span> The weight of a bag of potatoes can be 5kg, 5.05kg, or any value in between.
Quantitative variable: Described by numbers and suitable for arithmetic operations (e.g., weight, height, age).
Qualitative variable: Described by non-numeric categories or attributes (e.g., eye color, gender).
1.4 Scales of measurement
Data can be classified into four scales:
Scale
Description
Example
Nominal
Qualitative data; categories are mutually exclusive but have no order or rank. Codes cannot be used for calculations.
Gender (Male/Female), Marital status (Single/Married/Divorced/Widowed).
Ordinal
Qualitative data; categories have a natural order or rank. Calculations like percentiles or quartiles are possible.
Marathon rankings (1st, 2nd, 3rd), Student class (First Year, Second Year, Third Year).
Interval
Quantitative data; has a unit of measurement, allowing for exact distance calculation between categories. Lacks a meaningful zero point.
Temperature in Celsius (0°C is freezing, not absence of heat), Time of day (00:00 is start of day, not zero time).
Ratio
Quantitative data; has a unit of measurement and a meaningful absolute zero point. Zero indicates the absence of the characteristic.
Age, Height, Weight (0 years old, 0 meters, 0 kg mean absence of the characteristic).
* `> <span style="color: #ff9f29; font-weight: 700;">🔑 Important:</span> Ratio scale data can be added, subtracted, multiplied, and divided meaningfully.`
🔑 Important: Mastery of basic statistical definitions, variable types, scales of measurement, and sigma notation is fundamental for understanding subsequent statistical concepts and formulas.
2. Statistical formulas and definitions (part 2)
2.1 Constructing frequency distributions
This section explains how to create a frequency distribution from raw data. It involves several key steps to organize and summarize your data.
Range calculation: The range shows the spread of data.
Formula: Range=Maximumvalue−Minimumvalue.
Number of classes (k): Sturge's Rule helps determine an appropriate number of classes.
Formula: 2k≥n.
Here, n is the sample size. The goal is to find the smallest integer k that satisfies this inequality.
Class width (c): This is the size of each interval in the frequency distribution.
Round the calculated class width to a convenient number, like a multiple of 5 or 10.
Class intervals: These define the boundaries for each group of data.
The first interval starts at or below the minimum value.
Each subsequent interval begins where the previous one ended.
Intervals are often written as "Lower limit - < Upper limit".
An "open class interval" has no upper or lower limit, like "R2,200 and over".
Frequencies: This is the count of data points falling into each class interval.
📝 Example: For a class interval '1200-<1400', it includes amounts greater than 1200 dollars but less than 1400 dollars 22.
2.1.1 Class mark
The class mark, or midpoint, is the average of the lower and upper limits of a class interval. It's used for graphical representations like histograms.
Formula: Classmark=2Lowerlimit+Upperlimit.
📝 Example: For the interval 1800-2000 dollars, the class mark is 21800+2000=1900 dollars 24.
2.2 Graphical presentation of data
Visualizing data helps in understanding its distribution and characteristics.
2.2.1 Histogram
A histogram is a bar graph representing a frequency distribution.
Axes: The vertical axis shows frequency, and the horizontal axis shows class intervals 27.
Rectangles: Each rectangle's base is centered at the class mark, and there are no gaps between them for continuous data 26.
Shape: Histograms can reveal data shape, like unimodal (one peak) or bimodal (two peaks) 28.
Skewness:
Positively skewed: Long tail to the right; many low values, few high values.
Negatively skewed: Long tail to the left; few low values, many high values.
2.2.2 Frequency polygon
This is a line graph connecting class marks against their frequencies.
It's formed by joining the midpoints of the tops of histogram bars.
The polygon is "anchored" by adding intervals with zero frequency at both ends.
2.2.3 Cumulative frequency (Ogive)
This graph shows cumulative frequencies against upper class limits.
Cumulative frequency (F): The sum of frequencies for all class intervals up to and including the current one.
Ogive: A cumulative frequency polygon, often a smooth curve.
Relative cumulative frequency (F(%)): Cumulative frequency divided by the total sample size (n), often expressed as a percentage 32.
📝 Example: For the '1400-<1600' interval, the cumulative frequency is the sum of frequencies for 'Below 1200', '1200-<1400', and '1400-<1600' 31.
2.2.4 Stem-and-leaf display
This is an alternative to histograms that shows individual data values.
Structure: Data is split into a "stem" (e.g., tens digit) and "leaves" (e.g., units digit).
Advantage: Retains the original data values, unlike a histogram 33.
Double stems: Used for better visualization when data is spread out, by splitting stems for lower and upper halves of digits (e.g., 0* for 0-4, 0 for 5-9) 35.
2.2.5 Bar graph
A graphical display for categorical (qualitative) variables.
Similar to a histogram, but the width of the bars is not important.
Each bar's height represents the frequency of a category.
🔑 Important: Bar graphs are for categories, while histograms are for numerical data 36.
2.3 Relative frequency calculations
Relative frequency expresses the proportion of observations within a group compared to the total.
Relative frequency (f): The number of observations in a class divided by the total number of observations.
Relative frequency percentage: Relative frequency multiplied by 100.
Formula: Relativefrequency(%)=nf×100.
📝 Example: If 18 employees earn between 1400 and 1600 dollars out of 50 total employees, the relative frequency is 5018=0.36, or 36% 30.
🔑 Important: Calculating relative frequencies is crucial for comparing groups of different sizes or for understanding proportions 29.
🔑 Important: Understanding how to construct frequency distributions and visually represent data using histograms, polygons, and stem-and-leaf displays is fundamental for summarizing and interpreting datasets before deeper statistical analysis.
3. Statistical formulas and definitions (part 3)
3.1 Frequency distributions and displays
Frequency distributions organize data into classes. They show how often values occur within specific intervals.
Displays like stem-and-leaf charts offer a visual representation of data distribution.
3.1.1 Frequency tables
A frequency table lists data classes, their frequencies (counts), relative frequencies (percentages), cumulative frequencies, and relative cumulative frequencies. This structure helps summarize raw data.
Class Intervals
Frequency (f)
Relative Frequency (%)
Cumulative Frequency (F)
Relative Cumulative Frequency (%)
130-<145
8
26.6667
8
26.6667
145-<160
6
20.0000
14
46.6667
160-<175
6
20.0000
20
66.6667
175-<190
4
13.3333
24
80.0000
190-<205
6
20.0000
30
100.0000
📝 Example: For the interval 130-<145, there are 8 data points. This represents 26.6667% of the total data. The cumulative frequency up to this point is 8, meaning 8 data points are below 145. The relative cumulative frequency is also 26.6667%. 42.
3.1.2 Stem-and-leaf displays
A stem-and-leaf display separates data into a "stem" (usually the leading digit(s)) and a "leaf" (the trailing digit). This method preserves individual data values while showing distribution.
Stem: Represents the higher-order digits.
Leaf: Represents the lower-order digits.
3.1.2.1 Simple stem-and-leaf display
In a simple display, each stem is listed once, and its corresponding leaves are listed in order.
📝 Example: A stem of '5' with leaves '4' and '7' means the data points are 54 and 57. 43.
3.1.2.2 Double stem-and-leaf display
This display splits the stem into two parts (e.g., 5* and 5) to handle situations with many leaves for a single stem. This improves readability by reducing the number of leaves per stem.
Key idea: The asterisk (*) typically denotes the lower half of the leaves for a given stem. .
🔑 Important: Stem-and-leaf displays are useful for quickly seeing the shape and spread of data without losing individual values. 44.
4. Data representation and descriptive statistics (part 1)
4.1 Measures of central location
Measures of central location, also known as central tendency, describe the center of a dataset. Common measures include the mean, median, and mode.
These are used with quantitative data and are critical for statistical inference. When data is grouped into a frequency distribution, computed measures are approximations of the true values.
4.1.1 The mean
The mean is the average of all observations, calculated by summing all values and dividing by the number of observations.
Population mean
The population mean, denoted by μ, is a parameter.
It's calculated as the sum of all N population values divided by N.
μ=N∑i=1Nxi
Adding a constant a to every value shifts the mean by a.
For an infinite population, the mean is the limit of the sample mean as the sample size increases.
Sample mean for ungrouped data
The sample mean, denoted by xˉ, is a statistic.
It is calculated as the sum of n sample observations divided by n.
xˉ=n∑i=1nxi
📝 Example: For data points 8, 3, 5, 12, 10, the sample mean is 58+3+5+12+10=538=7.6.
Sample mean for grouped data
When using frequency distributions, the mean is approximated using class midpoints (m).
The formula uses the sum of each class frequency (f) multiplied by its midpoint (m).
xˉ=∑j=1kfj∑j=1kfjmj Here, k is the number of classes.
📝 Example: For monthly salaries with frequencies and midpoints, the grouped mean is calculated using the sum of f×m divided by the total frequency.
4.1.2 The median (Me)
The median is the middle value in an ordered dataset. It splits the data into two equal halves, meaning 50% of values are above it and 50% are below it.
The median is less sensitive to extreme values (outliers) than the mean.
If the number of observations (N) is odd, the median is the single middle value.
If N is even, the median is the average of the two middle values.
Sample median for ungrouped data
📝 Example: For the ordered data 3, 5, 8, 10, 12, the median is 8.
📝 Example: For the ordered data 7.9, 8.2, 8.6, 9.2, 9.3, 9.5, the median is the average of 8.6 and 9.2, which is 8.9.
The median for grouped data
Graphical Method: The median is found using the cumulative relative frequency (50% mark) on a graph.
Arithmetic Method:
Identify the median interval: the class where the 2n observation falls, using cumulative frequency.
Calculate the median using the formula:
Me=Ome+(fme2n−Fme−1)c Where:
Ome: Lower limit of the median interval.
c: Class width.
n: Sample size.
fme: Frequency of the median interval.
Fme−1: Cumulative frequency of the interval before the median interval.
📝 Example: For monthly salaries, the median interval is [1600-<1800. Using the formula with Ome=1600, c=200, n=50, fme=18, and Fme−1=20, the median is calculated as approximately R1,655.56.
4.1.3 The mode (Mo)
The mode is the observation that occurs most frequently in a dataset. A dataset can have no mode, one mode (unimodal), or multiple modes (bimodal, multimodal).
For ungrouped data, the mode is simply the value that appears most often.
For grouped data, the mode is calculated using the modal interval (highest frequency).
Mo=Omo+((fmo−fmo−1)+(fmo−fmo+1)fmo−fmo−1)c Where:
Omo: Lower limit of the modal class interval.
c: Width of the modal class.
fmo: Frequency of the modal interval.
fmo−1: Frequency of the preceding class.
fmo+1: Frequency of the succeeding class.
📝 Example (ungrouped): The set {2; 5; 7; 9; 9; 9; 10; 11} has a mode of 9.
📝 Example (grouped): For luggage weights, the modal interval is [15-<17. Using the formula, the mode is approximately 16.6667.
4.2 Quantiles
Quantiles divide an ordered dataset into equal parts. These include quartiles, deciles, and percentiles.
Quartiles: Divide data into four equal parts.
Q1 (lower quartile/25th percentile): Separates the lowest 25% from the top 75%.
Q2 (middle quartile/2nd quartile/50th percentile/median): Divides data into two halves.
Q3 (upper quartile/75th percentile): Separates the top 25% from the bottom 75%.
Deciles: Divide data into ten equal parts.
Percentiles: Divide data into one hundred equal parts.
F−1: Cumulative frequency of the interval before the relevant interval.
📝 Example: For monthly salaries (n=50), Q1 position is 450=12.5. This falls in the [1400-<1600 interval. Using the formula with OQ1=1400, c=200, fQ1=18, and FQ1−1=2, Q1 is calculated as approximately 1516.67.
📝 Example: For statistics test marks (n=30), P85 position is 85×10030=25.5. This falls in the [25-<30 interval. Using the formula, P85 is calculated as approximately 26.25.
4.3 Measures of dispersion
Measures of dispersion describe the spread or variability of data.
Range: The difference between the largest and smallest values. It is sensitive to outliers.
Variance: Measures the average squared difference of each value from the mean.
Standard Deviation: The square root of the variance, providing a measure of spread in the original units of the data.
Interquartile Range (IQR): The difference between the third and first quartiles (Q3−Q1).
Coefficient of Variation: The ratio of the standard deviation to the mean, expressed as a percentage, useful for comparing variability between datasets with different means.
4.3.1 Population variance and standard deviation
Population variance (σ2): The average of the squared deviations from the population mean (μ).
σ2=N∑i=1N(xi−μ)2
Population standard deviation (σ): The square root of the population variance. σ=σ2.
If all population values are identical, the standard deviation is zero.
🔑 Important: Variance and standard deviation are fundamental for statistical inference, indicating how much data values tend to spread out from the mean.
5. Data representation and descriptive statistics (part 2)
5.1 Measures of dispersion
Measures of dispersion quantify the spread or variability of data. They indicate how far data points are from each other and from the central tendency.
Variance (σ2 for population, s2 for sample): The average of the squared differences from the mean. It gives a measure of spread but its units are squared, making interpretation difficult.
Standard deviation (σ for population, s for sample): The square root of the variance. It is in the same units as the data, making it more interpretable than variance.
Calculation Methods for Variance
There are two primary methods for calculating sample variance (s2):
Method 1 (Theoretical): This method directly uses the definition of variance. It can be more laborious if the mean is not a whole number.
s2=n−1∑i=1n(xi−xˉ)2
Method 2 (Applied): This method uses an alternative formula that is often easier for calculations, especially with calculators. It avoids repeated rounding of the mean.
s2=n−1∑x2−n(∑x)2 or equivalently: s2=n−1∑x2−nxˉ2
Sample Variance vs. Population Variance
Population variance (σ2): A parameter describing the entire population.
Sample variance (s2): A statistic estimating the population variance from a sample. The denominator is n−1 (Bessel's correction) to provide an unbiased estimate.
Variance for Grouped Data
For grouped data, an approximation of the variance is calculated using class midpoints (mj) and frequencies (fj).
s2=n−1∑fjmj2−n(∑fjmj)2 where n=∑fj is the total number of observations.
The standard deviation is the square root of the variance.
Interquartile Range (IQR)
The IQR measures the spread of the middle 50% of the data. It is less affected by extreme values (outliers) than the range.
It is calculated as the difference between the upper quartile (Q3) and the lower quartile (Q1).
IQR=Q3−Q1
Quartile deviation (Q.D.): Half of the interquartile range.
Q.D.=2Q3−Q1
Coefficient of Variation (CV)
The CV is a standardized measure of dispersion, expressed as a percentage. It is useful for comparing the variability of datasets with different means or units.
It is calculated as the ratio of the standard deviation to the mean, multiplied by 100.
CV=xˉs×100%
A z-score measures how many standard deviations a specific data point is away from the mean. It is a dimensionless quantity, allowing for comparisons across different datasets.
Population z-score:
z=σx−μ
Sample z-score:
z=sx−xˉ
z-scores standardize data, making values comparable even if they have different units or scales.
Interpretation of z-scores
A positive z-score means the data point is above the mean.
A negative z-score means the data point is below the mean.
A z-score of 0 means the data point is exactly at the mean.
5.3 Graphical description of distributions
Visualizing data helps understand its shape, central tendency, and spread.
Empirical Rule (for bell-shaped distributions)
This rule applies to data that is approximately bell-shaped and unimodal.
Approximately 68% of observations fall within one standard deviation of the mean (μ±σ).
Approximately 95% of observations fall within two standard deviations of the mean (μ±2σ).
Approximately 99.7% of observations fall within three standard deviations of the mean (μ±3σ).
Box-and-Whisker Plots
Box-and-whisker plots provide a "five-figure summary" of data:
Minimum value (MIN)
Lower quartile (Q1)
Median (Me)
Upper quartile (Q3)
Maximum value (MAX)
The box represents the interquartile range (Q1 to Q3), with a line indicating the median. Whiskers extend to the minimum and maximum values, or to a defined limit if outliers are present.
Symmetry and Skewness
Symmetrical distribution: The mean, median, and mode are equal. The distribution is balanced around the center.
Skewness: Measures the asymmetry of a distribution.
Positively skewed (right-skewed): The tail extends to the right. The mean is greater than the median, which is greater than the mode (xˉ>Me>Mo).
Negatively skewed (left-skewed): The tail extends to the left. The mean is less than the median, which is less than the mode (xˉ<Me<Mo).
Measures of Skewness
Various formulas can quantify skewness. Two common ones are:
Pearson's first coefficient of skewness: sMe−Mo
Pearson's second coefficient of skewness: s3(xˉ−Me)
A positive skewness value indicates a right-skewed distribution. A negative value indicates a left-skewed distribution.
Kurtosis
Kurtosis measures the "peakedness" of a distribution relative to a normal distribution.
Mesokurtic: Similar peak and tails to a normal distribution (kurtosis = 3, excess kurtosis = 0).
The reference standard for kurtosis is a normal distribution, which has a kurtosis of 3.
5.4 Summary of key concepts
Concept
Formula/Description
Purpose
Variance (σ2, s2)
Average squared deviation from the mean.
Measures data spread in squared units.
Standard Deviation (σ, s)
Square root of variance.
Measures data spread in original units.
Interquartile Range (IQR)
Q3−Q1
Measures spread of the middle 50% of data; robust to outliers.
Coefficient of Variation (CV)
xˉs×100%
Compares relative variability between datasets with different scales.
z-score
σx−μ or sx−xˉ
Standardizes data to compare values across different distributions.
Skewness
sMe−Mo or s3(xˉ−Me)
Measures the asymmetry of a distribution.
Kurtosis
Measures peakedness relative to a normal distribution.
Describes the shape of the distribution's peak and tails.
Measures of dispersion quantify data spread, while z-scores standardize values for comparison. Skewness and kurtosis describe the shape of a distribution.
6. Probability concepts and calculations (part 1)
6.1 Basic probability concepts
Statistical experiment: An experiment where outcomes have an element of chance.
Sample space (S): The set of all possible outcomes of a statistical experiment.
Example: Rolling a die, S = {1, 2, 3, 4, 5, 6}.
Example: Tossing a coin, S = {H, T}.
Event (E): A subset of the sample space, representing a specific outcome or set of outcomes.
Simple event: Contains only one element from the sample space.
Compound event: Contains more than one element; it's a union of simple events.
Null event (ϕ): An event with no elements; it cannot occur.
Example: Rolling a die and getting a 3 is a simple event {3}. Getting an even number {2, 4, 6} is a compound event.
A sample space is the universe of all possibilities; an event is a specific part of that universe.
6.2 Operations with events
These operations combine events to form new events.
Operation
Notation
Description
Example
Intersection
A∩B
Elements common to both event A and event B.
If A={1,2,3}, B={2,3,4}, then A∩B = {2,3}.
Union
A∪B
Elements in either event A, event B, or both.
If A={1,2,3}, B={2,3,4}, then A∪B = {1,2,3,4}.
Complement of an event
A′ or Ac
Elements in the sample space that are NOT in event A.
If S={1,2,3,4,5}, A={1,2}, then A′ = {3,4,5}.
Mutually exclusive events: Events that have no common elements; they cannot occur at the same time (A∩B=ϕ).
Example: Rolling a 1 and rolling a 6 on a single die are mutually exclusive.
Mutually exclusive means "cannot happen together."
6.3 Counting sample points
These methods help determine the number of possible outcomes without listing them all.
6.3.1 Multiplication rule
This rule applies when a sequence of operations or choices are made.
If the first operation has n1 ways, the second has n2 ways, ..., and the k-th operation has nk ways, then the total number of ways to perform all k operations is n1×n2×⋯×nk.
Example: A meal consists of soup, sandwich, and drink. If there are 4 soups, 3 sandwiches, and 5 drinks, the total number of meal combinations is 4×3×5=6090.
The multiplication rule is for "AND" situations: "this AND that AND that."
6.3.2 Factorial notation
Factorial (n!): The product of all positive integers up to n.
n!=n×(n−1)×⋯×2×1.
By definition, 0!=1.
Example: 5!=5×4×3×2×1=120.
6.3.3 Permutations
Permutations count the number of ways to arrange items where the order matters.
The number of permutations of n distinct objects taken r at a time is:
P(n,r)=(n−r)!n!
This applies when n≥r≥1.
Example: Arranging 3 books from a selection of 5: P(5,3)=(5−3)!5!=2120=60. 9192.
Permutations: Order matters (like assigning roles).
6.3.4 General partitions
This counts distinct arrangements when there are multiple identical items.
The number of distinct partitions of n items, with n1 of one kind, n2 of a second kind, ..., nk of a k-th kind (n1+n2+⋯+nk=n), is:
\dots n_k!}$$
* Example: Arranging 3 red, 4 yellow, and 2 blue bulbs in 9 sockets: $\frac{9!}{3!4!2!} = 1260$ [93](#page=93).
### 6.3.5 Combinations
Combinations count the number of ways to choose items where the order does not matter.
* The number of combinations of $n$ distinct objects taken $r$ at a time is:
$$C(n, r) = \binom{n}{r} = \frac{n!}{r!(n-r)!}$$
* This applies when $n \ge r \ge 1$.
* Example: Choosing 2 students from a group of 4: $C(4, 2) = \frac{4!}{2!(4-2)!} = \frac{24}{2 \times 2} = 6$ [94](#page=94).
> Combinations: Order doesn't matter (like picking a team).
## 6.4 Probability of an event
Probability quantifies the likelihood of an event occurring.
* For equally likely outcomes in a sample space $S$ with $N$ elements, and an event $E$ with $n$ elements:
$$P(E) = \frac{n}{N}$$
* Probabilities range from 0 (impossible event, null event $\phi$) to 1 (certain event, sample space $S$).
* $0 \le P(E) \le 1$.
* $P(\phi) = 0$.
* $P(S) = 1$.
* Example: Probability of rolling a 6 on a fair die: $P = \frac{1}{6}$ [6](#page=6) [96](#page=96).
> Probability is a value between 0 and 1, showing how likely an event is.
### 6.4.1 Calculating probabilities for specific scenarios
* <span style="color: #ff9f29; font-weight: 700;">Dice:</span> Two dice have 36 possible outcomes ($6 \times 6$).
* <span style="color: #ff9f29; font-weight: 700;">Cards:</span> A standard deck has 52 cards.
* <span style="color: #ff9f29; font-weight: 700;">Coin tosses:</span> $k$ tosses have $2^k$ possible outcomes.
> The more outcomes an event has within a sample space, the higher its probability.
## 6.5 Probability addition law
This law helps calculate the probability of two events occurring.
### 6.5.1 Non-mutually exclusive events
Events can occur together.
* If events A and B are not mutually exclusive:
$$P(A \cup B) = P(A) + P(B) - P(A \cap B)$$
* $P(A \cup B)$ is the probability of A or B (or both) occurring.
* $P(A \cap B)$ is the probability of both A and B occurring. This term is subtracted to avoid double-counting.
* Example: Probability of an executive reading Sunday Times (38%) or City Press (44%), with 11% reading both: $P(\text{ST or CP}) = 0.38 + 0.44 - 0.11 = 0.71$ [99](#page=99).
### 6.5.2 Mutually exclusive events
Events cannot occur at the same time.
* If events A and B are mutually exclusive:
$$P(A \cup B) = P(A) + P(B)$$
* Since $P(A \cap B) = 0$ for mutually exclusive events.
* Example: Probability of rolling a total of 7 or 11 with two dice. $P(7 \cup 11) = P + P = \frac{6}{36} + \frac{2}{36} = \frac{8}{36} \approx 0.2222$ [11](#page=11).
## 6.6 Probability complement law
This relates the probability of an event to the probability of its opposite.
* The probability that an event A does <span style="color: #ff9f29; font-weight: 700;">not</span> occur is the complement of event A, denoted $P(A')$.
* The rule states:
$$P(A') = 1 - P(A)$$
* This is because an event either happens or it doesn't; these two possibilities cover all outcomes.
* Example: If the probability of reading the Cape Argus is 22%, the probability of <span style="color: #ff9f29; font-weight: 700;">not</span> reading it is $1 - 0.22 = 0.78$ [102](#page=102).
* Example: Probability of at least one head in six coin tosses = $1 - P(\text{no heads}) = 1 - P(\text{all tails})$. There's only 1 way to get all tails (TTTTTT) out of $2^6 = 64$ outcomes. So, $1 - \frac{1}{64} = \frac{63}{64}$.
> The complement rule is useful for "at least one" type problems.
## 6.7 Conditional probability
This is the probability of an event occurring given that another event has already occurred.
* Conditional probability of A given B is written as $P(A|B)$.
* The formula is:
$$P(A|B) = \frac{P(A \cap B)}{P(B)}, \quad \text{where } P(B) > 0$$
* This means we are only considering the outcomes where B has already happened.
* The term $P(A \cap B)$ represents the probability that both events occur.
* Example: If 262 out of 270 managers were promoted or male, and 46 were male and promoted, $P(\text{Male}|\text{Promoted}) = \frac{P(\text{Male} \cap \text{Promoted})}{P(\text{Promoted})} = \frac{46/270}{54/270} = \frac{46}{54} \approx 0.8519$. [100](#page=100) [103](#page=103).
> Conditional probability: "What is the chance of A, knowing B already happened?"
> **Important:** Understanding sample spaces, events, and basic counting rules is foundational for all probability calculations. Mastering permutations and combinations is key to correctly defining the number of outcomes for complex events.
# 7. Probability concepts and calculations (part 2)
## 7.1 Conditional probability
Conditional probability is the chance of an event occurring given that another event has already happened. It is denoted as $P(A|B)$, meaning the probability of event A given event B.
The formula for conditional probability is: $$P(A|B) = \frac{P(A \cap B)}{P(B)}$$ where $P(A \cap B)$ is the probability of both A and B occurring, and $P(B)$ is the probability of event B.
* <span style="color: #ff9f29; font-weight: 700;">Example:</span> A survey shows 38% read the Sunday Times (ST) and 44% read the City Press (CP). If 11% read both, what is the probability an executive reads ST given they read CP?
* $P(ST|CP) = \frac{P(ST \cap CP)}{P(CP)} = \frac{0.11}{0.44} = 0.25$ [104](#page=104).
## 7.2 Multiplication law for probability
The multiplication law helps find the probability of two events, A and B, both occurring ($P(A \cap B)$). The formula used depends on whether the events are independent or dependent.
### 7.2.1 Independent events
Two events are independent if the outcome of one does not affect the outcome of the other.
* <span style="color: #ff9f29; font-weight: 700;">Condition for independence:</span> Events A and B are independent if $P(A|B) = P(A)$ and $P(B|A) = P(B)$.
* <span style="color: #ff9f29; font-weight: 700;">Multiplication rule for independent events:</span>
$$P(A \cap B) = P(A) \times P(B)$$
* <span style="color: #ff9f29; font-weight: 700;">Example:</span> A die is tossed twice. What is the probability of getting a two on the first toss and an odd number on the second?
* Let A = getting a two on the first toss, $P(A) = 1/6$.
* Let B = getting an odd number on the second toss, $P(B) = 3/6$.
* Since the tosses are independent, $P(A \cap B) = P(A) \times P(B) = (1/6) \times (3/6) = 3/36 = 0.0833$.
* <span style="color: #ff9f29; font-weight: 700;">Example:</span> A town has a fire engine and a garbage van.
* $P(\text{fire engine available}) = 0.98$
* $P(\text{garbage van available}) = 0.92$
* Assuming availability is independent, $P(\text{both available}) = 0.98 \times 0.92 = 0.9016$ [106](#page=106).
### 7.2.2 Dependent events
Two events are dependent if the outcome of one affects the probability of the other.
* <span style="color: #ff9f29; font-weight: 700;">Multiplication rule for dependent events:</span>
$$P(A \cap B) = P(A) \times P(B|A)$$ or $$P(A \cap B) = P(B) \times P(A|B)$$
* <span style="color: #ff9f29; font-weight: 700;">Example:</span> A fuse box has 20 fuses, 5 defective. Two are selected without replacement. What is the probability both are defective?
* Let A = 1st fuse defective, $P(A) = 5/20$.
* Let B = 2nd fuse defective. Since the first is not replaced, the events are dependent.
* $P(B|A) = 4/19$ (4 defective fuses left out of 19 total).
* $P(A \cap B) = P(A) \times P(B|A) = (5/20) \times (4/19) = 20/380 = 0.0526$.
* <span style="color: #ff9f29; font-weight: 700;">Example:</span> A clothing store owner notes:
* $P(\text{customer buys shirt}) = P(S) = 0.4$.
* $P(\text{buys tie | buys shirt}) = P(T|S) = 0.5$.
* $P(\text{buys tie | no shirt}) = P(T|S\overline{}) = 0.1$.
* To find $P(T)$, we use the law of total probability:
$P(T) = P(S)P(T|S) + P(S\overline{})P(T|S\overline{})$ $P(T) = (0.4 \times 0.5) + ((1 - 0.4) \times 0.1) = 0.2 + (0.6 \times 0.1) = 0.26$ [110](#page=110).
## 7.3 Generalized multiplicative rule
This rule extends the multiplication law to more than two events.
* <span style="color: #ff9f29; font-weight: 700;">For dependent events</span> $A_1, A_2, ..., A_k$:
$$P(A_1 \cap A_2 \cap \dots \cap A_k) = P(A_1) \times P(A_2|A_1) \times P(A_3|A_1 \cap A_2) \times \dots \times P(A_k|A_1 \cap \dots \cap A_{k-1})$$
* <span style="color: #ff9f29; font-weight: 700;">For independent events</span> $A_1, A_2, ..., A_k$:
$$P(A_1 \cap A_2 \cap \dots \cap A_k) = P(A_1) \times P(A_2) \times \dots \times P(A_k)$$
* <span style="color: #ff9f29; font-weight: 700;">Example:</span> Three cards are drawn without replacement. Find the probability that the 1st is a red ace, the 2nd is a ten or jack, and the 3rd is greater than 3 but less than 7.
* Let $A_1$ = 1st card is a red ace ($P(A_1) = 2/52$).
* Let $A_2$ = 2nd card is a ten or jack ($P(A_2|A_1) = 8/51$).
* Let $A_3$ = 3rd card is between 3 and 7 ($P(A_3|A_1 \cap A_2) = 12/50$).
* The events are dependent.
* $P(A_1 \cap A_2 \cap A_3) = P(A_1) \times P(A_2|A_1) \times P(A_3|A_1 \cap A_2) = (2/52) \times (8/51) \times (12/50) = 0.0014$ [112](#page=112).
## 7.4 Tree diagrams
Tree diagrams visually represent the possible outcomes of a sequence of events, especially useful for dependent events. Each branch shows a possible outcome and its probability.
* <span style="color: #ff9f29; font-weight: 700;">Example:</span> Three balls are drawn with replacement from a box with 3 red and 2 white balls.
* Probability of drawing three red balls:
$P(RRR) = P(R) \times P(R) \times P(R) = (3/5) \times (3/5) \times (3/5) = 27/125 = 0.216$ [108](#page=108).
* Probability of drawing exactly one red ball (RWW, WRW, WWR):
$P(RWW) = (3/5) \times (2/5) \times (2/5) = 12/125$. $P(WRW) = (2/5) \times (3/5) \times (2/5) = 12/125$.
$P(WWR) = (2/5) \times (2/5) \times (3/5) = 12/125$. Total $P(\text{one red}) = 12/125 + 12/125 + 12/125 = 36/125 = 0.288$ [109](#page=109).
> **🔑 Important:** Tree diagrams help visualize sequential probabilities and identify all possible outcomes, especially for dependent events.
## 7.5 Probability calculations using given probabilities
This section often involves applying the rules learned for independent and dependent events to solve various scenarios.
* <span style="color: #ff9f29; font-weight: 700;">Table: Common probability formulas</span>
| Concept | Formula | Description |
| :---------------------------- | :----------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------- |
| Conditional Probability | $P(A|B) = P(A \cap B) / P(B)$ | Probability of A given B. |
| Multiplication (Independent) | $P(A \cap B) = P(A) \times P(B)$ | Probability of both A and B when independent. |
| Multiplication (Dependent) | $P(A \cap B) = P(A) \times P(B|A)$ or $P(B) \times P(A|B)$ | Probability of both A and B when dependent. |
| Addition (Mutually Exclusive) | $P(A \cup B) = P(A) + P(B)$ | Probability of A or B when they cannot happen together. |
| Addition (Not Mutually Excl.) | $P(A \cup B) = P(A) + P(B) - P(A \cap B)$ | Probability of A or B when they can happen together. |
| Complementary Event | $P(A\overline{}) = 1 - P(A)$ | Probability that event A does not happen. |
* <span style="color: #ff9f29; font-weight: 700;">Example:</span> A coffee shop customer uses sugar (S) with $P(S) = 0.45$, cream (C) with $P(C) = 0.35$, and both with $P(S \cap C) = 0.20$. What is the probability a customer uses neither?
* First, find $P(S \cup C) = P(S) + P(C) - P(S \cap C) = 0.45 + 0.35 - 0.20 = 0.60$.
* The probability of neither is the complement: $P(\text{neither}) = 1 - P(S \cup C) = 1 - 0.60 = 0.40$.
* <span style="color: #ff9f29; font-weight: 700;">Example:</span> A company has a 0.3 chance of winning contract 1 and 0.2 chance of winning contract 2. The probability of winning both is 0.2. What is the probability of winning at least one?
* $P(\text{at least one}) = P(C_1 \cup C_2) = P(C_1) + P(C_2) - P(C_1 \cap C_2)$
* $P(\text{at least one}) = 0.3 + 0.2 - 0.2 = 0.3$ [115](#page=115).
> **🔑 Important:** Always identify if events are independent or dependent before applying multiplication rules. This is often the key to solving complex probability problems.
# 8. Random variables and distributions (part 1)
## 8.1 Random variables and probability distributions
A <span style="color: #ff9f29; font-weight: 700;">random variable (RV)</span> assigns a numerical value to each outcome of an experiment. It's denoted by an uppercase letter like $X$.
The lowercase letter represents a specific value of the RV. The probability that $X$ takes a specific value $x_i$ is written as $P(X=x_i)$ or $p_i$.
A <span style="color: #ff9f29; font-weight: 700;">probability distribution</span> describes the possible values of an RV and their associated probabilities. This can be a table, formula, or graph.
> The pairs $(x_i, p_i)$ define the distribution of RV $X$.
The <span style="color: #ff9f29; font-weight: 700;">cumulative distribution function (CDF)</span>, denoted $F(x)$, gives the probability that $X$ is less than or equal to a specific value $x$: $F(x) = P(X \le x)$.
> RVs can be either discrete or continuous.
### Discrete random variables
A <span style="color: #ff9f29; font-weight: 700;">discrete RV</span> can only take on a countable number of values. This count can be finite or infinite.
* <span style="color: #ff9f29; font-weight: 700;">Characteristics:</span>
* $0 \le p_i \le 1$ for all possible values $x_i$.
* The sum of all probabilities must equal 1: $\sum_{i=1}^{\infty} p_i = 1$.
### Mathematical expectation (Mean) of a discrete RV
The <span style="color: #ff9f29; font-weight: 700;">expected value</span>, or mean, of a discrete RV $X$, denoted $E(X)$ or $\mu$, represents the average value of the RV over many trials.
$$E(X) = \mu = \sum_{i=1}^{n} x_i p_i$$
> The expected value is the value of the RV you expect after many trials.
### Variance of a discrete RV
The <span style="color: #ff9f29; font-weight: 700;">variance</span> of a discrete RV $X$, denoted $Var(X)$ or $\sigma^2$, measures how spread out the values are around the mean.
Two methods to calculate variance:
| Method | Formula |
| :--------------------------- | :---------------------------------------------- |
| Theoretical Formula | $\sigma^2 = \sum_{i=1}^{n} (x_i - \mu)^2 p_i$ |
| Applied Formula | $\sigma^2 = E(X^2) - \mu^2$ |
> Variance is the weighted average of squared deviations from the mean.
## 8.2 Key Discrete Probability Distributions
### The Binomial distribution
The <span style="color: #ff9f29; font-weight: 700;">Binomial distribution</span> models the number of successes in a fixed number of independent trials, where each trial has only two outcomes (success or failure) and a constant probability of success.
* <span style="color: #ff9f29; font-weight: 700;">Probability Mass Function (PMF):</span>
$$P(X=x) = \binom{n}{x} p^x (1-p)^{n-x}$$ where $n$ is the number of trials, $x$ is the number of successes, and $p$ is the probability of success.
* <span style="color: #ff9f29; font-weight: 700;">Characteristics:</span>
1. Each trial has two outcomes: success or failure.
2. Fixed number of trials ($n$).
3. Trials are independent.
4. Probability of success ($p$) is constant for each trial.
> The Bernoulli distribution is a special case of the binomial distribution with $n=1$.
* <span style="color: #ff9f29; font-weight: 700;">Binomial Distribution Properties:</span>
| Property | Formula |
| :---------------- | :--------------- |
| Mean ($\mu$) | $np$ |
| Variance ($\sigma^2$) | $np(1-p)$ |
| Standard Deviation ($\sigma$) | $\sqrt{np(1-p)}$ |
### The Poisson distribution
The <span style="color: #ff9f29; font-weight: 700;">Poisson distribution</span> approximates the binomial distribution when the number of trials ($n$) is very large and the probability of success ($p$) is very small. It models the number of events occurring in a fixed interval of time or space.
* <span style="color: #ff9f29; font-weight: 700;">Probability Mass Function (PMF):</span>
$$P(X=x) = \frac{\lambda^x e^{-\lambda}}{x!}$$ where $\lambda = np$ is the average number of events in the interval.
* <span style="color: #ff9f29; font-weight: 700;">Conditions for approximation:</span>
* $n \ge 20$ and $p \le 0.05$.
* Excellent approximation when $n \ge 100$ and $np \le 10$.
* <span style="color: #ff9f29; font-weight: 700;">Poisson Distribution Properties:</span>
* Mean ($\mu$) = $\lambda$
* Variance ($\sigma^2$) = $\lambda$
> In a Poisson distribution, the mean and variance are equal.
## 8.3 Continuous Random Variables
A <span style="color: #ff9f29; font-weight: 700;">continuous RV</span> can take on any value within a given range. The values are uncountable.
* <span style="color: #ff9f29; font-weight: 700;">Cumulative Distribution Function (CDF):</span> $F(x) = P(X \le x)$ is a continuous, non-decreasing function.
* <span style="color: #ff9f29; font-weight: 700;">Probability Density Function (PDF):</span> $f(x)$ is the derivative of the CDF ($f(x) = F'(x)$). The area under the PDF curve between two points represents the probability of the RV falling within that range. The total area under the PDF curve is always 1.
> For continuous RVs, the probability of any single specific value is zero: $P(X=x_i) = 0$.
> Probability is calculated as the area under the PDF curve.
## 8.4 The Normal Distribution
The <span style="color: #ff9f29; font-weight: 700;">Normal distribution</span>, also known as the Gaussian distribution, is a fundamental continuous probability distribution.
* <span style="color: #ff9f29; font-weight: 700;">Probability Density Function (PDF):</span>
$$f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}$$ where $\mu$ is the mean and $\sigma$ is the standard deviation.
* <span style="color: #ff9f29; font-weight: 700;">Characteristics:</span>
1. Bell-shaped and symmetrical curve.
2. Mean, median, and mode are all equal.
3. Extends infinitely in both directions.
4. Probabilities are cumulative and expressed as inequalities.
### Standard Normal Distribution
To calculate probabilities for any Normal RV, we standardize it into a <span style="color: #ff9f29; font-weight: 700;">Standard Normal RV</span>, denoted by $Z$.
* <span style="color: #ff9f29; font-weight: 700;">Transformation Formula:</span>
$$Z = \frac{X - \mu}{\sigma}$$
* <span style="color: #ff9f29; font-weight: 700;">Standard Normal Distribution Properties:</span>
* Mean = 0
* Variance = 1
> The Z-score tells you how many standard deviations a value is from the mean.
> Probabilities for the Normal distribution are typically found using Z-tables.
> **Important:** When calculating probabilities for a continuous RV, use inequalities ($<$ or $>$) for areas under the PDF. For discrete RVs, use $\le$ or $\ge$ to include the specific value.
# 9. Random variables and distributions (part 2)
## 9.1 Standard normal distribution and probabilities
The standard normal distribution, denoted by $Z$, has a mean of 0 and a standard deviation of 1. Probabilities for $Z$ are found using cumulative standard normal tables, which typically show the area to the right of a z-score.
> **🔑 Important:** Tables usually provide $P(Z > z)$.
To calculate the probability between two z-scores, $a$ and $b$ ($a < b$), you subtract the probability of the upper limit from the probability of the lower limit.
$$ P(a < Z < b) = P(Z > a) - P(Z > b) $$
For example, to find $P(0 < Z < 1.85)$:
* $P(Z > 0.00) = 0.5000$
* $P(Z > 1.85) = 0.0322$
* $P(0 < Z < 1.85) = 0.5000 - 0.0322 = 0.4678$
To find the probability to the left of a z-score $a$:
* If $a > 0$: $P(Z < a) = 1 - P(Z > a)$
* If $a < 0$: $P(Z < a) = P(Z > a)$
For example, $P(Z < 2.50) = 1 - P(Z > 2.50) = 1 - 0.0062 = 0.9938$. And $P(Z < -2.50) = P(Z > 2.50) = 0.0062$ [142](#page=142) [143](#page=143).
## 9.2 Using z-scores for normal distributions
Any normally distributed random variable $X$ can be converted to a standard normal variable $Z$ using the formula: $$ z = \frac{x - \mu}{\sigma} $$ Here, $x$ is a value from the $X$ distribution, $\mu$ is the mean of $X$, and $\sigma$ is the standard deviation of $X$. This allows us to use standard normal tables to find probabilities for any normal distribution.
> **🔑 Important:** Always convert $x$-values to $z$-scores before using probability tables.
<span style="color: #ff9f29; font-weight: 700;">Example:</span> For a normal distribution with $\mu = 10$ and $\sigma = 2$:
* $P(X < 12)$: Convert $x=12$ to $z = (12 - 10) / 2 = 1$. Then $P(X < 12) = P(Z < 1) = 1 - P(Z > 1) = 1 - 0.1587 = 0.8413$.
* $P(X > 7)$: Convert $x=7$ to $z = (7 - 10) / 2 = -1.5$. Then $P(X > 7) = P(Z > -1.5) = 1 - P(Z < -1.5) = 1 - 0.0668 = 0.9332$.
* $P(6.5 < X < 11)$: Convert $x=6.5$ to $z = (6.5 - 10) / 2 = -1.75$. Convert $x=11$ to $z = (11 - 10) / 2 = 0.5$. Then $P(6.5 < X < 11) = P(-1.75 < Z < 0.5) = P(Z > -1.75) - P(Z > 0.5) = (1 - P(Z < -1.75)) - P(Z > 0.5) = (1 - 0.0401) - 0.3085 = 0.6514$ [147](#page=147) [148](#page=148).
## 9.3 Excel for probability calculations
Excel provides functions for binomial and normal distributions.
<span style="color: #ff9f29; font-weight: 700;">Binomial Distribution:</span>
* Use the `BINOMDIST` function.
* Specify $x$ (Number\_s), $n$ (Trials), $p$ (Probability\_s), and `TRUE` for cumulative probability or `FALSE` for individual probability.
<span style="color: #ff9f29; font-weight: 700;">Normal Distribution:</span>
* Use `NORMDIST` for any normal distribution.
* Specify $x$ (X), mean (Mean), standard deviation (Standard\_dev), and `TRUE` for cumulative probability.
* Use `NORMSDIST` for the standard normal distribution ($Z$), specifying only $Z$.
* Use `NORMINV` to find an $X$ value given a cumulative probability, mean, and standard deviation.
* Use `NORMSINV` to find a $Z$ value given a cumulative probability [149](#page=149).
## 9.4 Key concepts and practice problems
This section covers exercises related to probability distributions and calculations using normal and standard normal distributions. The problems involve calculating probabilities, expected values, variances, and standard deviations for various scenarios.
<span style="color: #ff9f29; font-weight: 700;">Examples of problem types:</span>
* Determining if a table represents a valid probability distribution.
* Calculating mean, variance, and standard deviation for discrete random variables.
* Finding probabilities for binomial distributions (e.g., exact, at least, not more than).
* Calculating probabilities using the standard normal distribution for various intervals.
* Finding z-scores given probabilities.
* Applying normal distribution to real-world scenarios like weights, lifetimes, and wages.
> **🔑 Important:** Practice problems are crucial for mastering these concepts and preparing for exams. Pay attention to the rounding instructions in each question [151](#page=151) [152](#page=152).
> **🔑 Important:** Understanding how to use z-scores to transform any normal distribution into the standard normal distribution is essential for solving a wide range of probability problems [153](#page=153).
# 10. Sampling distributions, estimation, and the Central Limit Theorem
## 10.1 Introduction to statistical inference
* <span style="color: #ff9f29; font-weight: 700;">Statistical inference</span>: Process of drawing conclusions about populations from samples.
* <span style="color: #ff9f29; font-weight: 700;">Population parameters</span>: Values describing a population (e.g., $\mu$, $\sigma$).
* <span style="color: #ff9f29; font-weight: 700;">Sample statistics</span>: Values describing a sample (e.g., $\bar{X}$, $s$).
* The goal is to estimate unknown population parameters using sample statistics.
| Statistical Measure | Sample Statistic | Population Parameter |
| :------------------ | :--------------- | :------------------- |
| Mean | $\bar{X}$ | $\mu$ |
| Standard Deviation | $s$ | $\sigma$ |
| Variance | $s^2$ | $\sigma^2$ |
| Size | $n$ | $N$ |
| Proportion | $\hat{p}$ | $p$ |
* Estimation and hypothesis testing are the two main procedures for statistical inference.
## 10.2 Estimation methods
* Estimation aims to find the approximate value of a population parameter.
* There are two types of estimation:
* <span style="color: #ff9f29; font-weight: 700;">Point estimation</span>: A single value estimates the parameter.
* <span style="color: #ff9f29; font-weight: 700;">Interval estimation</span>: An interval of values is calculated to contain the parameter with a certain probability.
* An <span style="color: #ff9f29; font-weight: 700;">estimator</span> is a rule or formula used to calculate an estimate.
* An estimate is the numerical value obtained from an estimator.
* Estimators are often denoted with a "hat" symbol (e.g., $\hat{\mu}$, $\hat{\sigma}^2$, $\hat{p}$).
## 10.3 Sampling distributions
* A <span style="color: #ff9f29; font-weight: 700;">sampling distribution</span> describes the distribution of a statistic (like the sample mean) over many samples from the same population.
* It helps measure how close a sample statistic is to the population parameter.
* Sample means cluster around the population mean.
> The tighter the clustering of sample means, the more precise the estimate.
* The sampling distribution of the sample mean ($\bar{X}$) has a mean ($\mu$) and variance ($\sigma^2/n$).
* The standard error (SE) of the mean is $\sigma/\sqrt{n}$.
| Statistic of Sampling Distribution | Formula |
| :--------------------------------- | :---------------------- |
| Mean (Expected Value) | $E(\bar{X}) = \mu$ |
| Variance | $Var(\bar{X}) = \sigma^2/n$ |
| Standard Error (SE) | $SE(\bar{X}) = \sigma/\sqrt{n}$ |
* <span style="color: #ff9f29; font-weight: 700;">Unbiasedness</span>: A statistic is unbiased if its expected value equals the population parameter ($E(\bar{X}) = \mu$).
* The variance and standard error of the sample mean decrease as the sample size ($n$) increases. This leads to more precise estimates.
### Example: Variance of sample means
* Population variance $\sigma^2 = 16$ square units.
* Sample size $n=4$.
* Variance of sample means: $Var(\bar{X}) = \sigma^2/n = 16/4 = 4$ square units.
* If $n=100$, $Var(\bar{X}) = 16/100 = 0.16$ square units.
## 10.4 The Central Limit Theorem (CLT)
* The CLT is a fundamental principle in statistics.
* It states that if random samples of size $n$ are drawn from a population (with mean $\mu$ and variance $\sigma^2$), the sampling distribution of the sample mean ($\bar{X}$) will be approximately normal for sufficiently large $n$.
* If the population is already normal, $\bar{X}$ is normal for any $n$.
* A common rule of thumb is that $n \ge 30$ is sufficiently large for the approximation.
> CLT bridges the gap between any population distribution and a normal distribution for sample means.
* If the sampling distribution of $\bar{X}$ is approximately normal, we can use the Z-score:
$$Z = \frac{\bar{X} - \mu}{\sigma/\sqrt{n}}$$ This $Z$ variable follows approximately a standard normal distribution.
### Example: Probability using CLT
* Population mean $\mu = 800$ hours, $\sigma = 40$ hours.
* Sample size $n=41$.
* Find the probability that the sample mean is less than 795 hours.
* Standard error $SE = \sigma/\sqrt{n} = 40/\sqrt{41} \approx 6.245$ hours.
* $P(\bar{X} < 795) = P(Z < \frac{795 - 800}{6.245}) = P(Z < -0.80) \approx 0.2119$.
## 10.5 Sampling distribution of proportions
* For populations where we are interested in the presence or absence of an attribute (e.g., proportion of success).
* Let $p$ be the population proportion and $X$ be the number of successes in a sample of size $n$.
* $X$ follows a binomial distribution, $Bin(n, p)$.
* The sample proportion is $\hat{p} = X/n$.
| Statistic of Sampling Distribution | Formula |
| :--------------------------------- | :------------------ |
| Mean | $E(\hat{p}) = p$ |
| Variance | $Var(\hat{p}) = p(1-p)/n$ |
| Standard Error (SE) | $SE(\hat{p}) = \sqrt{p(1-p)/n}$ |
* According to the CLT, the sampling distribution of $\hat{p}$ is approximately normal for large $n$.
* The Z-score for proportions is:
$$Z = \frac{\hat{p} - p}{\sqrt{p(1-p)/n}}$$
### Example: Standard error of a proportion
* Sample size $n = 1000$.
* Number of successes $X = 125$.
* Sample proportion $\hat{p} = 125/1000 = 0.125$.
* Estimated variance $Var(\hat{p}) = \hat{p}(1-\hat{p})/n = 0.125(0.875)/1000 \approx 0.000109$.
* Standard error $SE(\hat{p}) = \sqrt{0.000109} \approx 0.0104$.
## 10.6 The t-distribution
* The <span style="color: #ff9f29; font-weight: 700;">t-distribution</span> (or Student's t-distribution) is used when the population standard deviation ($\sigma$) is unknown and must be estimated by the sample standard deviation ($s$).
* It is similar to the normal distribution but has heavier tails, accounting for the extra uncertainty from estimating $\sigma$.
> The t-distribution accounts for uncertainty from estimating the population standard deviation.
* The t-statistic is calculated as:
$$t = \frac{\bar{X} - \mu}{s/\sqrt{n}}$$
* <span style="color: #ff9f29; font-weight: 700;">Degrees of freedom (df)</span>: For the t-distribution, df = $n-1$. This value determines the shape of the t-distribution.
* Characteristics of the t-distribution:
* Symmetrical about zero.
* Mean of zero.
* Bell-shaped.
* As degrees of freedom increase, the t-distribution approaches the standard normal (Z) distribution.
### Using the t-distribution table
* T-distribution tables provide critical t-values for given probabilities (tails) and degrees of freedom.
* You look up the probability (alpha, $\alpha$) in the first row and degrees of freedom ($\nu$ or df) in the last column.
#### Example: Finding a critical t-value
* Find $t_{\alpha}$ such that $P(T > t_{\alpha}) = 0.025$ with $n=31$.
* Degrees of freedom $\nu = n-1 = 31-1 = 30$.
* From the t-table, at $\nu=30$ and tail probability $0.025$, the critical value is $t = 2.042$.
#### Example: Using symmetry
* Find the t-value for $P(T < t_{\alpha}) = 0.05$ with $n=29$.
* Degrees of freedom $\nu = n-1 = 29-1 = 28$.
* We need $P(T > t_{\alpha}) = 0.05$. From the table, $t = 1.701$ for $\nu=28$.
* Due to symmetry, $P(T < -1.701) = P(T > 1.701) = 0.05$. So, $t_{\alpha}$ such that $P(T < t_{\alpha}) = 0.05$ is $-1.701$.
## 10.7 Confidence intervals for the mean
* A <span style="color: #ff9f29; font-weight: 700;">confidence interval (CI)</span> provides a range of plausible values for an unknown population parameter.
* The <span style="color: #ff9f29; font-weight: 700;">confidence level</span> (e.g., 90%, 95%, 99%) indicates the probability that the interval will contain the true parameter if repeated samples were taken.
* The significance level $\alpha$ is $1 - (\text{confidence level})$. For a two-tailed interval, we use $\alpha/2$ for each tail.
> The confidence level reflects the reliability of the interval-estimation method.
### CI for the mean ($\mu$) when $\sigma$ is known
* Formula:
$$[\bar{X} - z_{\alpha/2} \frac{\sigma}{\sqrt{n}}, \bar{X} + z_{\alpha/2} \frac{\sigma}{\sqrt{n}}]$$
* $z_{\alpha/2}$ is the critical Z-value for the desired confidence level.
#### Example: CI for mean ($\sigma$ known)
* Sample mean $\bar{X} = 2.6$, $\sigma = 0.3$, $n=36$. Confidence level = 95%.
* $\alpha = 0.05$, $\alpha/2 = 0.025$. $z_{0.025} = 1.96$.
* Standard error $SE = \sigma/\sqrt{n} = 0.3/\sqrt{36} = 0.05$.
* CI: $[2.6 - 1.96 \times 0.05, 2.6 + 1.96 \times 0.05 = [2.502, 2.698]$.
### CI for the mean ($\mu$) when $\sigma$ is unknown
* <span style="color: #ff9f29; font-weight: 700;">Case 1: Large sample size ($n \ge 30$)</span>
* Use the sample standard deviation ($s$) as an estimate for $\sigma$.
* Use the Z-distribution.
$$[\bar{X} - z_{\alpha/2} \frac{s}{\sqrt{n}}, \bar{X} + z_{\alpha/2} \frac{s}{\sqrt{n}}]$$
#### Example: CI for mean ($\sigma$ unknown, large $n$)
* $\bar{X} = 2.6$, $s = 0.3$, $n=36$. Confidence level = 95%.
* $z_{0.025} = 1.96$. Standard error $SE = s/\sqrt{n} = 0.3/\sqrt{36} = 0.05$.
* <span style="color: #ff9f29; font-weight: 700;">Case 2: Small sample size ($n < 30$)</span>
* Use the sample standard deviation ($s$).
* Use the t-distribution with $n-1$ degrees of freedom.
$$[\bar{X} - t_{\alpha/2, n-1} \frac{s}{\sqrt{n}}, \bar{X} + t_{\alpha/2, n-1} \frac{s}{\sqrt{n}}]$$
#### Example: CI for mean ($\sigma$ unknown, small $n$)
* Sample mean $\bar{X} = 10.0$ liters, $s = 0.283$ liters, $n=7$. Confidence level = 95%.
* $\alpha = 0.05$, $\alpha/2 = 0.025$. Degrees of freedom $\nu = 7-1 = 6$.
* $t_{0.025, 6} = 2.447$. Standard error $SE = s/\sqrt{n} = 0.283/\sqrt{7} \approx 0.107$.
* CI: $[10.0 - 2.447 \times 0.107, 10.0 + 2.447 \times 0.107 = [10.0 - 0.2617, 10.0 + 0.2617 = [9.7383, 10.2617]$.
## 10.8 Confidence intervals for the difference between two population means ($\mu_1 - \mu_2$)
* This is used to compare means of two different populations.
* The estimator for $\mu_1 - \mu_2$ is $\bar{X}_1 - \bar{X}_2$.
* The standard error of this difference depends on whether population variances are known or unknown.
### Case 1: Population variances ($\sigma_1^2, \sigma_2^2$) known
$$[(\bar{X}_1 - \bar{X}_2) - z_{\alpha/2} \sqrt{\frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2}}, (\bar{X}_1 - \bar{X}_2) + z_{\alpha/2} \sqrt{\frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2}}]$$
### Case 2: Population variances ($\sigma_1^2, \sigma_2^2$) unknown, large samples ($n_1 \ge 30, n_2 \ge 30$)
* Use sample variances ($s_1^2, s_2^2$) as estimates.
* Use Z-distribution.
$$[(\bar{X}_1 - \bar{X}_2) - z_{\alpha/2} \sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}, (\bar{X}_1 - \bar{X}_2) + z_{\alpha/2} \sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}]$$
#### Example: CI for difference in means (unknown variances, large samples)
* Group 1: $\bar{X}_1=82, s_1=8, n_1=50$. Group 2: $\bar{X}_2=76, s_2=6, n_2=75$. Confidence level = 99%.
* $\alpha = 0.01$, $\alpha/2 = 0.005$. $z_{0.005} = 2.576$.
* Standard error $SE = \sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}} = \sqrt{\frac{8^2}{50} + \frac{6^2}{75}} = \sqrt{\frac{64}{50} + \frac{36}{75}} = \sqrt{1.28 + 0.48} = \sqrt{1.76} \approx 1.3266$.
* CI: $[(82-76) - 2.576 \times 1.3266, (82-76) + 2.576 \times 1.3266 = [6 - 3.4136, 6 + 3.4136 = [2.5864, 9.4136]$.
### Case 3: Population variances unknown and assumed equal (pooled variance)
* Use a pooled variance estimator ($s_p^2$).
* Use the t-distribution with $df = n_1 + n_2 - 2$.
* Pooled variance:
$$s_p^2 = \frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}$$
$$[(\bar{X}_1 - \bar{X}_2) \pm t_{\alpha/2, n_1+n_2-2} \times s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}]$$
#### Example: CI for difference in means (equal variances, pooled)
* Group 1: $\bar{X}_1=85, s_1=4, n_1=12$. Group 2: $\bar{X}_2=81, s_1=5, n_2=10$. Confidence level = 90%.
* $\alpha = 0.10$, $\alpha/2 = 0.05$. Degrees of freedom $\nu = 12+10-2 = 20$.
* $t_{0.05, 20} = 1.725$.
* Pooled variance $s_p^2 = \frac{(12-1)4^2 + (10-1)5^2}{12+10-2} = \frac{11 \times 16 + 9 \times 25}{20} = \frac{176 + 225}{20} = \frac{401}{20} = 20.05$.
* $s_p = \sqrt{20.05} \approx 4.4777$.
* Standard error $SE = s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}} = 4.4777 \sqrt{\frac{1}{12} + \frac{1}{10}} = 4.4777 \sqrt{0.0833 + 0.1} = 4.4777 \sqrt{0.1833} \approx 4.4777 \times 0.4282 \approx 1.9184$.
* CI: $[(85-81) \pm 1.725 \times 1.9184 = [4 \pm 3.3072 = [0.6928, 7.3072]$.
## 10.9 Confidence intervals for population proportions ($p$)
* The estimate for population proportion $p$ is the sample proportion $\hat{p} = X/n$.
* The standard error of the population proportion is $\sqrt{p(1-p)/n}$.
* When $p$ is unknown, we estimate the standard error using $\sqrt{\hat{p}(1-\hat{p})/n}$.
* For large sample sizes, the sampling distribution of $\hat{p}$ is approximately normal.
* Formula for CI:
$$[\hat{p} - z_{\alpha/2} \sqrt{\frac{\hat{p}(1-\hat{p})}{n}}, \hat{p} + z_{\alpha/2} \sqrt{\frac{\hat{p}(1-\hat{p})}{n}}]$$
#### Example: CI for a proportion
* Sample size $n=500$, number of people preferring seafood $X=160$. Confidence level = 95%.
* $\hat{p} = 160/500 = 0.32$.
* Standard error $SE = \sqrt{\frac{0.32(1-0.32)}{500}} = \sqrt{\frac{0.32 \times 0.68}{500}} = \sqrt{\frac{0.2176}{500}} = \sqrt{0.0004352} \approx 0.02086$.
* CI: $[0.32 - 1.96 \times 0.02086, 0.32 + 1.96 \times 0.02086 = [0.32 - 0.0409, 0.32 + 0.0409 = [0.2791, 0.3609]$.
> Key takeaway: The CLT is crucial for making inferences about population means and proportions, allowing us to use normal and t-distributions.
## 10.10 Understanding Sampling Distributions
* A <span style="color: #ff9f29; font-weight: 700;">population parameter</span> describes a characteristic of the entire population.
* A <span style="color: #ff9f29; font-weight: 700;">sample statistic</span> describes a characteristic of a sample taken from the population.
* <span style="color: #ff9f29; font-weight: 700;">Sampling distributions</span> show the possible values of a sample statistic from many samples. They help us understand how sample statistics relate to population parameters.
> Sample statistics vary, but their distributions allow for inference about population parameters.
## 10.11 The Central Limit Theorem
* The <span style="color: #ff9f29; font-weight: 700;">Central Limit Theorem (CLT)</span> is fundamental for statistical inference.
* It states that for a sufficiently large sample size ($n \geq 30$), the distribution of sample means will be approximately normal. This holds true even if the original population distribution is not normal.
* The mean of the sampling distribution of the sample means ($\mu_{\bar{x}}$) is equal to the population mean ($\mu$).
* The standard deviation of the sampling distribution, known as the <span style="color: #ff9f29; font-weight: 700;">standard error of the mean</span> ($\sigma_{\bar{x}}$), is the population standard deviation ($\sigma$) divided by the square root of the sample size ($n$).
$$ \mu_{\bar{x}} = \mu $$ $$ \sigma_{\bar{x}} = \frac{\sigma}{\sqrt{n}} $$
> CLT ensures that sample means cluster around the population mean with predictable spread, enabling normal distribution assumptions.
## 10.12 Estimation: Point and Interval
* <span style="color: #ff9f29; font-weight: 700;">Estimation</span> is using sample data to infer population characteristics.
* A <span style="color: #ff9f29; font-weight: 700;">point estimate</span> is a single value that best represents the population parameter.
* The sample mean ($\bar{x}$) is a point estimate for the population mean ($\mu$).
* The sample proportion ($\hat{p}$) is a point estimate for the population proportion ($p$).
* An <span style="color: #ff9f29; font-weight: 700;">interval estimate</span> provides a range of values within which the population parameter is likely to lie. This range is called a <span style="color: #ff9f29; font-weight: 700;">confidence interval (CI)</span>.
> Point estimates are single guesses; interval estimates provide a range of plausible values.
## 10.13 Confidence Intervals for Population Proportions
* A confidence interval for a population proportion ($p$) is calculated using the sample proportion ($\hat{p}$), the sample size ($n$), and a critical value (z-score).
* The formula for a confidence interval is: $\hat{p} \pm z^* \sqrt{\frac{\hat{p}(1-\hat{p})}{n}}$.
* The <span style="color: #ff9f29; font-weight: 700;">confidence level</span> (e.g., 95%) indicates the probability that the interval contains the true population proportion.
> The margin of error decreases as sample size increases and confidence level decreases.
| Confidence Level | $\alpha$ | $\alpha/2$ | $z^*$ (approx.) |
| :--------------- | :------- | :--------- | :-------------- |
| 90% | 0.10 | 0.05 | 1.645 |
| 95% | 0.05 | 0.025 | 1.960 |
| 99% | 0.01 | 0.005 | 2.576 |
## 10.14 Example: CI for a single proportion
* A sample of 500 voters showed 200 favouring a proposal. Calculate a 95% CI for the proportion of all voters favouring the proposal.
* $\hat{p} = 200/500 = 0.40$.
* $n = 500$.
* For 95% confidence, $z^* = 1.96$.
* Standard Error (SE) = $\sqrt{\frac{0.40(1-0.40)}{500}} \approx 0.0219$.
* Margin of Error (ME) = $1.96 \times 0.0219 \approx 0.0430$.
* CI = $0.40 \pm 0.0430$, which is [0.3570, 0.4430.
> **📝 Example:** At a 95% confidence level, the true proportion of voters favouring the proposal is between 0.3570 and 0.4430.
## 10.15 Confidence Intervals for the Difference Between Two Population Proportions
* This estimates the difference between two population proportions ($p_1 - p_2$).
* We use sample proportions ($\hat{p}_1, \hat{p}_2$) and sample sizes ($n_1, n_2$).
* The standard error for the difference is $\sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}$.
* The CI formula is $(\hat{p}_1 - \hat{p}_2) \pm z^* \times \text{SE}$.
> This CI tells us if there's a significant difference between two groups' proportions.
## 10.16 Example: CI for difference in proportions
* In city A, 2400 of 5000 favour a proposal ($\hat{p}_1 = 0.48$). In country B, 1200 of 2000 favour it ($\hat{p}_2 = 0.60$). Calculate a 90% CI for $p_1 - p_2$.
* $\hat{p}_1 = 0.48$, $n_1 = 5000$.
* $\hat{p}_2 = 0.60$, $n_2 = 2000$.
* For 90% confidence, $z^* = 1.645$.
* Difference in proportions: $0.48 - 0.60 = -0.12$.
* SE = $\sqrt{\frac{0.48(0.52)}{5000} + \frac{0.60(0.40)}{2000}} \approx \sqrt{0.00004992 + 0.00012} \approx \sqrt{0.00016992} \approx 0.0130$.
* ME = $1.645 \times 0.0130 \approx 0.0214$.
* CI = $-0.12 \pm 0.0214$, which is [-0.1414, -0.0986.
> **📝 Example:** At a 90% confidence level, the difference in proportions ($p_{\text{city}} - p_{\text{country}}$) is between -0.1414 and -0.0986.
## 10.17 Confidence Intervals for Population Means
* When the population standard deviation ($\sigma$) is known or the sample size is large ($n \geq 30$), we use the z-distribution.
* The CI formula is $\bar{x} \pm z^* \frac{\sigma}{\sqrt{n}}$.
* When the population standard deviation ($\sigma$) is unknown and the sample size is small ($n < 30$), we use the t-distribution with $n-1$ degrees of freedom.
* The CI formula is $\bar{x} \pm t^* \frac{s}{\sqrt{n}}$, where $s$ is the sample standard deviation.
> The choice between z- and t-distributions depends on whether the population standard deviation is known.
## 10.18 Example: CI for a single mean (known $\sigma$ or large $n$)
* A sample of 400 ball bearings has a mean weight of 0.87 kg and a standard deviation of 0.018 kg. Calculate a 95% CI.
* $\bar{x} = 0.87$, $s = 0.018$, $n = 400$.
* Since $n \geq 30$, we can use the z-distribution with $z^* = 1.96$.
* SE = $\frac{0.018}{\sqrt{400}} = \frac{0.018}{20} = 0.0009$.
* ME = $1.96 \times 0.0009 = 0.001764$.
* CI = $0.87 \pm 0.001764$, which is [0.868236, 0.871764. Rounded to four decimals: [0.8682, 0.8718.
> **📝 Example:** We are 95% confident that the true mean weight of all ball bearings is between 0.8682 kg and 0.8718 kg.
## 10.19 Example: CI for a single mean (unknown $\sigma$, small $n$)
* A sample of 5 measurements has a mean of 11.6 mm and a standard deviation of 3.0 mm. Calculate a 95% CI.
* $\bar{x} = 11.6$, $s = 3.0$, $n = 5$.
* Degrees of freedom = $n-1 = 5-1 = 4$.
* For 95% confidence and 4 df, $t^* \approx 2.776$.
* SE = $\frac{3.0}{\sqrt{5}} \approx \frac{3.0}{2.236} \approx 1.342$.
* ME = $2.776 \times 1.342 \approx 3.725$.
* CI = $11.6 \pm 3.725$, which is [7.875, 15.325. (Note: Original document's example data and calculation differs, this is an illustration of the method.)
> **🔑 Important:** When $\sigma$ is unknown and $n$ is small, use the t-distribution.
## 10.20 Confidence Intervals for the Difference Between Two Population Means
* This estimates the difference between two population means ($\mu_1 - \mu_2$).
* We use sample means ($\bar{x}_1, \bar{x}_2$), sample standard deviations ($s_1, s_2$), and sample sizes ($n_1, n_2$).
* If population variances are assumed to be equal, a pooled standard error is used. If unequal, a more complex formula for degrees of freedom is applied (Welch's approximation).
* The CI formula structure is $(\bar{x}_1 - \bar{x}_2) \pm t^* \times \text{SE}_{\text{difference}}$.
> This CI assesses if there's a statistically significant difference in means between two groups.
## 10.21 Example: CI for difference in means
* Two light bulb brands (X and Y) have sample means and standard deviations. Calculate a 90% CI for $\mu_X - \mu_Y$.
* Brand X: $\bar{x}_X = 1360$ hours, $s_X = 190$ hours, $n_X = 250$.
* Brand Y: $\bar{x}_Y = 1300$ hours, $s_Y = 130$ hours, $n_Y = 400$.
* Difference in means: $1360 - 1300 = 60$.
* Assuming unequal variances, the SE is calculated using a formula involving $s_X^2/n_X$ and $s_Y^2/n_Y$. The calculation of degrees of freedom and $t^*$ can be complex. For a 90% CI with the given values, the SE is approximately 11.26, and a $t^*$ value with roughly 624 df is 1.648.
* ME = $1.648 \times 11.26 \approx 18.56$.
* CI = $60 \pm 18.56$, which is [41.44, 78.56. (Note: The provided document's answer [37.5260, 82.4740 for 90% CI suggests a different SE or t* value was used, possibly due to unequal variances and a more conservative df calculation.)
> **🔑 Important:** Calculating the standard error and degrees of freedom for the difference in means when variances are unequal requires careful application of formulas.
> **🔑 Important:** The Central Limit Theorem is critical because it allows us to use normal or t-distributions to make inferences about population parameters (means and proportions) from sample statistics, even when the population distribution is unknown.
# 11. Hypothesis testing procedures (part 1)
## 11.1 Introduction to hypothesis testing
Hypothesis testing is a statistical method used to make inferences about a population. It involves setting up two competing hypotheses and using sample data to decide which one is more likely to be true.
The process determines the likelihood of observed sample data occurring if a specific hypothesis is true. This chapter covers hypothesis testing for population means and proportions, both for single populations and for differences between two populations.
The four main steps in hypothesis testing are:
* <span style="color: #ff9f29; font-weight: 700;">Step 1:</span> Define the null (<span style="color: #ff9f29; font-weight: 700;">null hypothesis</span>) and alternative (<span style="color: #ff9f29; font-weight: 700;">alternative hypothesis</span>) hypotheses.
* <span style="color: #ff9f29; font-weight: 700;">Step 2:</span> Define the critical value and rejection region.
* <span style="color: #ff9f29; font-weight: 700;">Step 3:</span> Calculate the test statistic.
* <span style="color: #ff9f29; font-weight: 700;">Step 4:</span> Draw a conclusion based on the test statistic and rejection region.
## 11.2 Hypothesis testing for a single population mean ($\mu$)
This section focuses on testing claims about a single population mean ($\mu$). For example, testing a manufacturer's claim about the average nicotine content of cigarettes.
### 11.2.1 Defining hypotheses
* <span style="color: #ff9f29; font-weight: 700;">Null hypothesis ($H_0$):</span> This is the initial assumption, always stating equality to a specific value ($\mu_0$). It is written as $H_0: \mu = \mu_0$.
* <span style="color: #ff9f29; font-weight: 700;">Alternative hypothesis ($H_1$):</span> This is what you aim to find evidence for. It can state:
* $\mu > \mu_0$ (greater than)
* $\mu < \mu_0$ (less than)
* $\mu \neq \mu_0$ (not equal to)
### 11.2.2 Critical value and rejection region
The <span style="color: #ff9f29; font-weight: 700;">rejection region</span> is a part of the sample space. If the test statistic falls within this region, we reject the null hypothesis.
The boundary between the acceptance and rejection regions is the <span style="color: #ff9f29; font-weight: 700;">critical value</span>.
* <span style="color: #ff9f29; font-weight: 700;">Type I error:</span> Rejecting $H_0$ when it is actually true.
* <span style="color: #ff9f29; font-weight: 700;">Type II error:</span> Failing to reject $H_0$ when it is actually false.
* <span style="color: #ff9f29; font-weight: 700;">Level of significance ($\alpha$):</span> The probability of committing a Type I error. Commonly set at 0.05.
> The level of significance ($\alpha$) determines the size of the rejection region.
### 11.2.3 Test statistics
The choice of test statistic depends on whether the population standard deviation ($\sigma$) is known and the sample size ($n$).
| Case | Population Standard Deviation ($\sigma$) | Sample Size ($n$) | Test Statistic | Formula |
| :---------------------------------------------------------- | :------------------------------------- | :---------------- | :------------- | :------------------------------------ |
| Case 1 | Known | Any | Z-test | $Z = \frac{\bar{X} - \mu_0}{\sigma/\sqrt{n}}$ |
| Case 2 | Unknown | $n \ge 30$ | Z-test | $Z = \frac{\bar{X} - \mu_0}{s/\sqrt{n}}$ |
| Case 3 | Unknown | $n < 30$ | T-test | $T = \frac{\bar{X} - \mu_0}{s/\sqrt{n}}$ |
* For the T-test, degrees of freedom ($\nu$) are calculated as $\nu = n - 1$.
### 11.2.4 Drawing conclusions
* <span style="color: #ff9f29; font-weight: 700;">Reject $H_0$:</span> If the calculated test statistic falls into the rejection region. This means there is enough evidence to support the alternative hypothesis.
* <span style="color: #ff9f29; font-weight: 700;">Do not reject $H_0$:</span> If the test statistic does not fall into the rejection region. This means there is not enough evidence to support the alternative hypothesis.
<span style="color: #ff9f29; font-weight: 700;">Important Note:</span> We never "accept" the null hypothesis; we only state that there is insufficient evidence to reject it.
### 11.2.5 One-tail vs. Two-tail tests
* <span style="color: #ff9f29; font-weight: 700;">One-tail test:</span> Used when the alternative hypothesis is directional ($\mu > \mu_0$ or $\mu < \mu_0$). The rejection region is in one tail of the distribution.
* <span style="color: #ff9f29; font-weight: 700;">Two-tail test:</span> Used when the alternative hypothesis is non-directional ($\mu \neq \mu_0$). The rejection region is split between both tails of the distribution. For two-tail tests, $\alpha$ is divided by 2 for each tail.
> The type of alternative hypothesis determines whether a test is one-tailed or two-tailed.
### 11.2.6 Examples
#### Example 8.1: Known population standard deviation
A store manager wants to know if the mean monthly installment is more than R170.
* Sample mean ($\bar{X}$) = R178
* Population standard deviation ($\sigma$) = R65
* Sample size ($n$) = 400
* Hypotheses: $H_0: \mu = 170$, $H_1: \mu > 170$ (one-tail right)
* Significance level ($\alpha$) = 0.05
* Critical value ($z_{\alpha}$) = 1.645
* Test statistic ($Z$) calculation: $Z = \frac{178 - 170}{65/\sqrt{400}} = \frac{8}{65/20} = \frac{8}{3.25} = 2.4615$
* Conclusion: Since $2.4615 > 1.645$, reject $H_0$. The mean monthly installments are more than R170.
#### Example 8.2: Unknown population standard deviation, large sample
A tyre manufacturer claims tyres last 70,000 km or more, but a Consumer Board suspects less.
* Sample mean ($\bar{X}$) = 69,914 km
* Sample standard deviation ($s$) = 1,312 km
* Sample size ($n$) = 500
* Hypotheses: $H_0: \mu = 70000$, $H_1: \mu < 70000$ (one-tail left)
* Significance level ($\alpha$) = 0.05
* Critical value ($z_{\alpha}$) = -1.645
* Test statistic ($Z$) calculation: $Z = \frac{69914 - 70000}{1312/\sqrt{500}} = \frac{-86}{1312/22.36} = \frac{-86}{58.68} \approx -0.9024$
* Conclusion: Since $-0.9024 > -1.645$, do not reject $H_0$. There isn't enough evidence to say the mean life is less than 70,000 km.
#### Example 8.3: Unknown population standard deviation, small sample
Test if a sample mean differs from a population mean of 35.
* Sample observations: 31, 29, 26, 33, 40, 28, 30, 25
* Population mean ($\mu_0$) = 35
* Sample size ($n$) = 8
* Sample mean ($\bar{X}$) = 30.25
* Sample standard deviation ($s$) = 4.713
* Hypotheses: $H_0: \mu = 35$, $H_1: \mu \neq 35$ (two-tail)
* Significance level ($\alpha$) = 0.05, so $\alpha/2 = 0.025$
* Degrees of freedom ($\nu$) = $n - 1 = 8 - 1 = 7$
* Critical value ($t_{\alpha/2, \nu}$) = 2.365
* Test statistic ($T$) calculation: $T = \frac{30.25 - 35}{4.713/\sqrt{8}} = \frac{-4.75}{4.713/2.828} = \frac{-4.75}{1.667} \approx -2.8506$
* Conclusion: Since $-2.8506 < -2.365$, reject $H_0$. The sample mean differs significantly from the population mean.
## 11.3 The difference between two population means ($\mu_1 - \mu_2$)
This section covers testing hypotheses about the difference between means of two populations.
### 11.3.1 Defining hypotheses
The null hypothesis typically states that the difference between the means is a specific value, often zero: $H_0: \mu_1 - \mu_2 = \mu_{0}$.
Alternative hypotheses can be:
* $H_1: \mu_1 - \mu_2 < \mu_0$ (one-tail left)
* $H_1: \mu_1 - \mu_2 > \mu_0$ (one-tail right)
* $H_1: \mu_1 - \mu_2 \neq \mu_0$ (two-tail)
### 11.3.2 Test statistics
The choice depends on population standard deviations and sample sizes.
| Case | Population Standard Deviations ($\sigma_1, \sigma_2$) | Sample Sizes ($n_1, n_2$) | Test Statistic | Formula |
| :------------------------------------------------------------------------------ | :---------------------------------------------------- | :------------------------ | :------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Case 1: Large samples | Unknown | $n_1 \ge 30$ and $n_2 \ge 30$ | Z-test | $Z = \frac{(\bar{X}_1 - \bar{X}_2) - (\mu_1 - \mu_2)_0}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}}$ |
| Case 2: Small samples, unknown and equal variances (pooled variance) | Unknown and equal ($\sigma_1^2 = \sigma_2^2$) | $n_1 < 30$ or $n_2 < 30$ | T-test | $T = \frac{(\bar{X}_1 - \bar{X}_2) - (\mu_1 - \mu_2)_0}{\sqrt{s_p^2 \left(\frac{1}{n_1} + \frac{1}{n_2}\right)}}$ <br> where $s_p^2 = \frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}$ and $\nu = n_1 + n_2 - 2$ |
### 11.3.3 Examples
#### Example 8.4: Large samples, unknown standard deviations
Comparing salaries of state vs. private pharmacists.
Claim: private employees earn > R6,000 more.
* State employees: $\bar{X}_1$ = R52,004, $s_1$ = R2,004, $n_1$ = 100.
* Private employees: $\bar{X}_2$ = R60,800, $s_2$ = R2,004, $n_2$ = 150.
* Hypotheses: $H_0: \mu_1 - \mu_2 = 6000$, $H_1: \mu_1 - \mu_2 < 6000$ (This example actually implies $H_1: \mu_2 - \mu_1 > 6000$ or $H_1: \mu_1 - \mu_2 < -6000$. However, the problem states "private employees exceeds ... by more than R6000", which is $\mu_2 - \mu_1 > 6000$. The solution uses $H_1: \mu_1 - \mu_2 > -6000$ which is equivalent to $\mu_2 - \mu_1 < 6000$, and then $H_0: \mu_1 - \mu_2 = -6000$ implies $\mu_2-\mu_1=6000$. The provided solution calculation seems to use $\mu_1-\mu_2 > 6000$ for $H_1$. Let's stick to the calculation logic presented in the book for consistency.)
* Hypotheses presented in solution: $H_0: \mu_1 - \mu_2 = -6000$, $H_1: \mu_1 - \mu_2 > -6000$. (This tests if the difference is *at least* -6000, not *more than* 6000. Re-interpreting the problem statement to match the provided solution calculation: "It is claimed that the average salary of private employees *is at least* R6000 more than state employees." This means $\mu_2 - \mu_1 \ge 6000$. To test this, we can use $H_0: \mu_2 - \mu_1 = 6000$ and $H_1: \mu_2 - \mu_1 > 6000$. The calculation uses $H_0: \mu_1 - \mu_2 = -6000$ and $H_1: \mu_1 - \mu_2 > -6000$. This is equivalent. Let's follow the provided solution's hypothesis structure.)
* Significance level ($\alpha$) = 0.01
* Critical value ($z_{\alpha}$) = 2.33
* Test statistic ($Z$) calculation: $Z = \frac{(52004 - 60800) - (-6000)}{\sqrt{\frac{2004^2}{100} + \frac{2004^2}{150}}} = \frac{-8796 + 6000}{\sqrt{\frac{4016016}{100} + \frac{4016016}{150}}} = \frac{-2796}{\sqrt{40160.16 + 26773.44}} = \frac{-2796}{\sqrt{66933.6}} \approx \frac{-2796}{258.71} \approx -10.807$
* *(Note: The provided solution's calculation yields 3.4816. There seems to be a discrepancy in the formula application or values. Let's re-calculate using the formula as stated in text $Z = \frac{(\bar{X}_1 - \bar{X}_2) - (\mu_1 - \mu_2)_0}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}}$. If we assume the claim is $\mu_2 > \mu_1 + 6000$, then $H_0: \mu_2 - \mu_1 = 6000$ or $H_0: \mu_1 - \mu_2 = -6000$ and $H_1: \mu_2 - \mu_1 > 6000$ or $H_1: \mu_1 - \mu_2 < -6000$. The calculation in the book uses $H_0: \mu_1-\mu_2 = -6000$ and $H_1: \mu_1-\mu_2 > -6000$. The provided solution's number $3.4816$ appears to be from $\frac{(\bar{X}_1 - \bar{X}_2) - (\mu_1 - \mu_2)_0}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}}$ if the denominator is computed differently or the numerator is different. Let's use the provided calculation value from the book for consistency despite the potential discrepancy.)*
* Let's use the provided Z value: $Z = 3.4816$.
* Conclusion: Since $3.4816 > 2.33$, reject $H_0$. The average salary of private employees exceeds that of state employees by more than R6,000.
#### Example 8.5: Small samples, unknown and equal variances
Comparing statistics test scores from two universities.
* University 1: $\bar{X}_1$ = 18.8, $s_1^2$ = 1.7, $n_1$ = 5
* University 2: $\bar{X}_2$ = 10.3333, $s_2^2$ = 2.2667, $n_2$ = 6
* Hypotheses: $H_0: \mu_1 - \mu_2 = 0$, $H_1: \mu_1 - \mu_2 \neq 0$ (two-tail)
* Significance level ($\alpha$) = 0.05, so $\alpha/2 = 0.025$
* Pooled variance ($s_p^2$): $s_p^2 = \frac{(5-1)(1.7) + (6-1)(2.2667)}{5+6-2} = \frac{4(1.7) + 5(2.2667)}{9} = \frac{6.8 + 11.3335}{9} = \frac{18.1335}{9} \approx 2.0148$
* Degrees of freedom ($\nu$) = $n_1 + n_2 - 2 = 5 + 6 - 2 = 9$
* Critical value ($t_{\alpha/2, \nu}$) = 2.262
* Test statistic ($T$) calculation: $T = \frac{(18.8 - 10.3333) - 0}{\sqrt{2.0148 \left(\frac{1}{5} + \frac{1}{6}\right)}} = \frac{8.4667}{\sqrt{2.0148 (0.2 + 0.1667)}} = \frac{8.4667}{\sqrt{2.0148 (0.3667)}} = \frac{8.4667}{\sqrt{0.7390}} \approx \frac{8.4667}{0.8597} \approx 9.8507$
* Conclusion: Since $9.8507 > 2.262$, reject $H_0$. The average scores of the two universities are significantly different.
## 11.4 Test for a population proportion ($p$)
This section covers hypothesis testing for a single population proportion.
### 11.4.1 Defining hypotheses
* <span style="color: #ff9f29; font-weight: 700;">Null hypothesis ($H_0$):</span> $H_0: p = p_0$ (where $p_0$ is the hypothesized proportion).
* <span style="color: #ff9f29; font-weight: 700;">Alternative hypothesis ($H_1$):</span>
* $H_1: p < p_0$ (one-tail left)
* $H_1: p > p_0$ (one-tail right)
* $H_1: p \neq p_0$ (two-tail)
### 11.4.2 Test statistic
The Z-test is used for proportions, provided the sample size is large enough (typically $np_0 \ge 10$ and $n(1-p_0) \ge 10$).
* Z-test statistic: $Z = \frac{\hat{p} - p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}}$
* $\hat{p}$ is the sample proportion, calculated as $\hat{p} = X/n$.
### 11.4.3 Example
#### Example 8.6: Testing a proportion
A light bulb manufacturer wants to be sure less than 0.0971% of bulbs are defective.
* Sample size ($n$) = 342
* Number of defective bulbs ($X$) = 9
* Hypothesized proportion ($p_0$) = 0.0971
* Sample proportion ($\hat{p}$) = $9/342 \approx 0.0263$
* Hypotheses: $H_0: p = 0.0971$, $H_1: p < 0.0971$ (one-tail left)
* Significance level ($\alpha$) = 0.1
* Critical value ($z_{\alpha}$) = -1.285
* Test statistic ($Z$) calculation: $Z = \frac{0.0263 - 0.0971}{\sqrt{\frac{0.0971(1-0.0971)}{342}}} = \frac{-0.0708}{\sqrt{\frac{0.0971(0.9029)}{342}}} = \frac{-0.0708}{\sqrt{\frac{0.0877}{342}}} = \frac{-0.0708}{\sqrt{0.000256}} \approx \frac{-0.0708}{0.0160} \approx -4.425$
* Conclusion: Since $-4.425 < -1.285$, reject $H_0$. The fraction of defective bulbs is less than 0.0971.
## 11.5 Test for the difference between two proportions ($p_1 - p_2$)
This section covers testing hypotheses about the difference between two population proportions.
### 11.5.1 Defining hypotheses
The null hypothesis typically states that the difference between proportions is zero: $H_0: p_1 - p_2 = 0$.
Alternative hypotheses can be:
* $H_1: p_1 - p_2 < 0$ (one-tail left)
* $H_1: p_1 - p_2 > 0$ (one-tail right)
* $H_1: p_1 - p_2 \neq 0$ (two-tail)
### 11.5.2 Test statistic
The Z-test is used, with sample proportions $\hat{p}_1$ and $\hat{p}_2$. A pooled proportion $\hat{p}$ is often used for the null hypothesis test.
* Estimate of pooled proportion: $\hat{p} = \frac{X_1 + X_2}{n_1 + n_2}$
* Z-test statistic: $Z = \frac{(\hat{p}_1 - \hat{p}_2) - (p_1 - p_2)_0}{\sqrt{\hat{p}(1-\hat{p})\left(\frac{1}{n_1} + \frac{1}{n_2}\right)}}$
### 11.5.3 Example
#### Example 8.7: Testing difference in proportions
A market researcher compares product preference between males and females.
* Males: $n_1$ = 100, $X_1$ = 31 (preference) $\implies \hat{p}_1 = 0.31$ [1](#page=1).
* Females: $n_2$ = 100, $X_2$ = 24 (preference) $\implies \hat{p}_2 = 0.24$ [2](#page=2).
* Hypotheses: $H_0: p_1 - p_2 = 0$, $H_1: p_1 - p_2 > 0$ (one-tail right, males > females)
* Significance level ($\alpha$) = 0.05
* Critical value ($z_{\alpha}$) = 1.645
* Pooled proportion ($\hat{p}$): $\hat{p} = \frac{31 + 24}{100 + 100} = \frac{55}{200} = 0.275$
* Test statistic ($Z$) calculation: $Z = \frac{(0.31 - 0.24) - 0}{\sqrt{0.275(1-0.275)\left(\frac{1}{100} + \frac{1}{100}\right)}} = \frac{0.07}{\sqrt{0.275(0.725)\left(\frac{2}{100}\right)}} = \frac{0.07}{\sqrt{0.199375(0.02)}} = \frac{0.07}{\sqrt{0.0039875}} \approx \frac{0.07}{0.0631} \approx 1.11$
* Conclusion: Since $1.11 < 1.645$, do not reject $H_0$. The proportion of men preferring the product is not significantly greater than women.
> Hypothesis testing helps decide if observed differences in samples are likely due to chance or a real effect in the populations.
# 12. Hypothesis testing procedures (part 2)
This section covers hypothesis testing for population proportions and the difference between two population proportions. It builds upon earlier concepts by applying similar procedural steps to different types of data.
## 12.1 Hypothesis tests for one population proportion
This involves testing claims about the proportion of a single population. The steps are similar to testing means, but use a Z-test statistic.
### 12.1.1 Formulating hypotheses for proportions
* <span style="color: #ff9f29; font-weight: 700;">Null Hypothesis ($H_0$):</span> States there is no effect or difference. For a proportion, it often assumes $p = p_0$, where $p_0$ is a specified value.
* <span style="color: #ff9f29; font-weight: 700;">Alternative Hypothesis ($H_a$):</span> States there is an effect or difference. It can be one-sided ($p < p_0$ or $p > p_0$) or two-sided ($p \neq p_0$).
### 12.1.2 Test statistic for one proportion
The Z-test statistic is used to assess the difference between the sample proportion ($\hat{p}$) and the hypothesized population proportion ($p_0$).
$$Z = \frac{\hat{p} - p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}}$$
* $\hat{p}$: Sample proportion of successes.
* $p_0$: Hypothesized population proportion.
* $n$: Sample size.
### 12.1.3 Critical region and conclusion for proportions
* <span style="color: #ff9f29; font-weight: 700;">Critical region:</span> This is the set of values for the test statistic that would lead to rejecting the null hypothesis. It's determined by the significance level ($\alpha$) and the type of alternative hypothesis.
* <span style="color: #ff9f29; font-weight: 700;">Conclusion:</span> If the calculated Z-statistic falls within the critical region, $H_0$ is rejected. Otherwise, $H_0$ is not rejected.
> For a proportion, the calculation of $\hat{p}$ involves $x/n$, where $x$ is the number of successes.
## 12.2 Hypothesis tests for the difference between two population proportions
These tests compare proportions from two independent populations. They are crucial for comparing two groups.
### 12.2.1 Formulating hypotheses for two proportions
* <span style="color: #ff9f29; font-weight: 700;">Null Hypothesis ($H_0$):</span> Usually states that the two population proportions are equal ($p_1 = p_2$ or $p_1 - p_2 = 0$).
* <span style="color: #ff9f29; font-weight: 700;">Alternative Hypothesis ($H_a$):</span> States that the proportions differ. This can be one-sided ($p_1 < p_2$ or $p_1 > p_2$) or two-sided ($p_1 \neq p_2$).
### 12.2.2 Test statistic for two proportions
When $H_0$ is true ($p_1 = p_2$), a pooled proportion ($\hat{p}_p$) is often used to estimate the common population proportion.
$$Z = \frac{(\hat{p}_1 - \hat{p}_2) - (p_1 - p_2)_0}{\sqrt{\hat{p}_p(1-\hat{p}_p)(\frac{1}{n_1} + \frac{1}{n_2})}}$$
* $\hat{p}_1, \hat{p}_2$: Sample proportions for populations 1 and 2.
* $(p_1 - p_2)_0$: The hypothesized difference (usually 0).
* $\hat{p}_p$: Pooled proportion, calculated as $\frac{x_1 + x_2}{n_1 + n_2}$.
> The pooled proportion is used because it provides a better estimate of the common proportion under the null hypothesis.
### 12.2.3 Critical region and conclusion for two proportions
Similar to the one-proportion test, the critical region is determined by $\alpha$ and the alternative hypothesis.
* <span style="color: #ff9f29; font-weight: 700;">Conclusion:</span> If the calculated Z-statistic falls into the critical region, $H_0$ is rejected, suggesting a significant difference between the population proportions.
> **Key takeaway:** Hypothesis testing for proportions relies on the normal approximation to the binomial distribution, which requires certain sample size conditions to be met.
> **🔑 Important:** Always ensure that the sample sizes are large enough (typically $np \ge 10$ and $n(1-p) \ge 10$ for each group) for the Z-test to be valid.
<span style="color: #ff9f29; font-weight: 700;">Example:</span> A manufacturer wants to know if the proportion of defective bulbs in two different production lines is the same. They sample 200 bulbs from line A and find 12 defective, and sample 250 bulbs from line B and find 20 defective.
They can use a Z-test for two proportions to compare $p_A$ and $p_B$.
<span style="color: #ff9f29; font-weight: 700;">Calculations from Document:</span>
* <span style="color: #ff9f29; font-weight: 700;">Exercise 8.4 (One Proportion):</span>
* Hypotheses: $H_0: p = 0.03$, $H_a: p < 0.03$.
* Critical Region: $\{Z | Z < -2.326\}$.
* Test Statistic: $Z = 0.3384$.
* Conclusion: Do not reject $H_0$. The fraction defective is not less than 0.03.
* <span style="color: #ff9f29; font-weight: 700;">Exercise 8.5 (Two Proportions):</span>
* Hypotheses: $H_0: p_1 = p_2$, $H_a: p_1 \neq p_2$.
* Critical Region: $\{Z | Z < -1.96 \text{ or } Z > 1.96\}$.
* Test Statistic: $Z = 0.8819$.
* Conclusion: Do not reject $H_0$. The difference between the proportions does not differ [205](#page=205).
> **🔑 Important:** The structure of hypothesis testing remains consistent: state hypotheses, determine the critical region, calculate the test statistic, and draw a conclusion based on where the statistic falls relative to the critical region.
# 13. Hypothesis testing procedures (part 3)
## 13.1 Regression analysis
Regression analysis helps understand the relationship between variables. Specifically, it models how a dependent variable ($Y$) changes when an independent variable ($X$) changes.
This is useful for prediction and understanding influence.
- <span style="color: #ff9f29; font-weight: 700;">Independent variable (X)</span>: The variable that is manipulated or changed.
- <span style="color: #ff9f29; font-weight: 700;">Dependent variable (Y)</span>: The variable that is measured and is expected to change in response to the independent variable.
### 13.1.1 Linear regression
Linear regression assumes a straight-line relationship between $X$ and $Y$. The regression line is represented by the equation:
$$ Y = \beta_0 + \beta_1 X + \epsilon $$
- $\beta_0$ is the intercept. It's the predicted value of $Y$ when $X$ is zero.
- $\beta_1$ is the slope. It indicates how much $Y$ changes for a one-unit increase in $X$.
- $\epsilon$ is the error term, representing variability in $Y$ not explained by $X$.
The estimated regression line uses sample data to find the best-fitting line:
$$ \hat{Y} = b_0 + b_1 X $$
- $\hat{Y}$ is the predicted value of $Y$.
- $b_0$ is the estimated intercept.
- $b_1$ is the estimated slope.
### 13.1.2 Calculating regression coefficients
The slope ($b_1$) and intercept ($b_0$) are calculated using summary statistics from the data.
| Calculation | Formula |
| :-------------------- | :----------------------------------------------------- |
| Slope ($b_1$) | $\frac{SS_{xy}}{SS_x}$ |
| Intercept ($b_0$) | $\bar{y} - b_1 \bar{x}$ |
| Predicted Y ($\hat{Y}$) | $b_0 + b_1 X$ |
Where:
- $SS_x$ is the sum of squares for $X$.
- $SS_y$ is the sum of squares for $Y$.
- $SS_{xy}$ is the sum of cross-products of $X$ and $Y$.
- $\bar{x}$ is the mean of $X$.
- $\bar{y}$ is the mean of $Y$.
> **📝 Example:** A study on advertising ($X$) and sales ($Y$) provided: $\bar{x} = 875.1$, $SS_x = 2,968.75$, $\bar{y} = 617.18$, $SS_{xy} = 27.8875$.
>
> - Slope ($b_1$) = $\frac{27.8875}{2968.75} \approx 0.009$ (rounded to three decimals).
> - Intercept ($b_0$) = $617.18 - (0.009 \times 875.1) \approx 617.18 - 7.8759 \approx 609.304$ (rounded to three decimals).
### 13.1.3 Correlation and determination
<span style="color: #ff9f29; font-weight: 700;">Correlation coefficient (r)</span> measures the strength and direction of the linear relationship. It ranges from -1 to +1.
- $r = \frac{SS_{xy}}{\sqrt{SS_x SS_y}}$
The <span style="color: #ff9f29; font-weight: 700;">coefficient of determination ($R^2$)</span> is the square of the correlation coefficient. It represents the proportion of variance in $Y$ that is predictable from $X$.
- $R^2 = r^2$
> **📝 Example:** Using the previous data: $SS_y = 267.4683$.
>
> - Correlation ($r$) = $\frac{27.8875}{\sqrt{2968.75 \times 267.4683}} \approx \frac{27.8875}{\sqrt{794440.44}} \approx \frac{27.8875}{891.313} \approx 0.031$ (rounded to two decimals).
> - Coefficient of determination ($R^2$) = $(0.031)^2 \approx 0.001$ (rounded to two decimals).
> **🔑 Important:** A correlation close to 0 means little to no linear relationship. A coefficient of determination close to 0 means $X$ explains very little of the variation in $Y$.
### 13.1.4 Hypothesis testing for regression
Hypothesis tests are used to determine if a statistically significant relationship exists between variables.
| Test Goal | Null Hypothesis ($H_0$) | Alternative Hypothesis ($H_a$) | Test Statistic |
| :---------------------------- | :-------------------- | :--------------------------- | :------------- |
| Significance of the slope | $\beta_1 = 0$ | $\beta_1 \neq 0$ | $t = \frac{b_1 - \beta_1}{SE(b_1)}$ |
| Significance of correlation | $\rho = 0$ | $\rho \neq 0$ | $z = r \sqrt{n-1}$ (for large n) |
| Overall model fit (ANOVA) | $R^2 = 0$ | $R^2 \neq 0$ | $F = \frac{MSR}{MSE}$ |
Where:
- $\beta_1$ is the true population slope.
- $b_1$ is the sample slope.
- $SE(b_1)$ is the standard error of the slope.
- $\rho$ is the population correlation coefficient.
- $r$ is the sample correlation coefficient.
- $n$ is the sample size.
- $MSR$ is the mean square for regression.
- $MSE$ is the mean square for error.
> **🔑 Important:** If $H_0$ is rejected, it suggests that $X$ has a statistically significant impact on $Y$.
> **🔑 Belangrijk:** Regression analysis allows us to predict outcomes and quantify the strength of relationships, which is vital for informed decision-making in various fields.
# 14. Regression, correlation, and analysis of variance
## 14.1 Introduction to ANOVA
<span style="color: #ff9f29; font-weight: 700;">Analysis of Variance (ANOVA)</span> is a statistical method used to compare the means of three or more groups. It tests the null hypothesis that all population means are equal.
While ANOVA tests for differences in variances, its primary goal is to detect differences among population means. This technique is essential when dealing with multiple experimental conditions or treatments.
### 14.1.1 ANOVA assumptions
For ANOVA to be valid, several assumptions must be met:
* <span style="color: #ff9f29; font-weight: 700;">Normality:</span> Observations within each group are normally distributed.
* <span style="color: #ff9f29; font-weight: 700;">Independence:</span> Observations are randomly sampled and independent of each other.
* <span style="color: #ff9f29; font-weight: 700;">Equal variances:</span> The population variances of all groups are equal (${\sigma_1}^2 = {\sigma_2}^2 = \dots = {\sigma_k}^2$).
### 14.1.2 Hypothesis testing in ANOVA
The process involves defining hypotheses, determining critical values, calculating a test statistic, and drawing a conclusion.
* <span style="color: #ff9f29; font-weight: 700;">Null Hypothesis ($H_0$):</span> All population means are equal (${\mu_1} = {\mu_2} = \dots = {\mu_k}$). This means any observed differences in sample means are due to random chance.
* <span style="color: #ff9f29; font-weight: 700;">Alternative Hypothesis ($H_1$):</span> At least two population means differ. This hypothesis does not specify which means differ or how many.
## 14.2 The ANOVA framework
ANOVA works by partitioning the total variation in the data into components attributable to different sources. The core idea is to compare the variation *between* groups to the variation *within* groups.
### 14.2.1 Key definitions
* <span style="color: #ff9f29; font-weight: 700;">Observation ($y_{ij}$):</span> The $i$-th observation in the $j$-th group.
* <span style="color: #ff9f29; font-weight: 700;">Group (or treatment):</span> A category or condition being studied (e.g., different teaching methods). Denoted by $j = 1, 2, \dots, k$.
* <span style="color: #ff9f29; font-weight: 700;">Number of groups ($k$):</span> The total number of distinct categories or treatments.
* <span style="color: #ff9f29; font-weight: 700;">Number of observations in group $j$ ($n_j$):</span> The count of data points within a specific group.
* <span style="color: #ff9f29; font-weight: 700;">Total number of observations ($n$):</span> The sum of observations across all groups ($n = \sum_{j=1}^{k} n_j$).
* <span style="color: #ff9f29; font-weight: 700;">Group mean ($\bar{y}_j$):</span> The average of observations within the $j$-th group.
* <span style="color: #ff9f29; font-weight: 700;">Grand mean ($\bar{y}$):</span> The average of all observations across all groups.
* <span style="color: #ff9f29; font-weight: 700;">Factor:</span> The independent variable that defines the groups (e.g., type of fertilizer).
* <span style="color: #ff9f29; font-weight: 700;">Response variable:</span> The dependent variable being measured (e.g., wheat yield). [225-227]
### 14.2.2 Sums of Squares (SS)
Sums of squares measure the total variability in the data. In ANOVA, they are partitioned into:
* <span style="color: #ff9f29; font-weight: 700;">Sum of Squares for Treatments (SST):</span> Measures the variation between the group means and the grand mean.
$$ \text{SST} = \sum_{j=1}^{k} n_j (\bar{y}_j - \bar{y})^2 $$.
* <span style="color: #ff9f29; font-weight: 700;">Sum of Squares for Error (SSE):</span> Measures the variation of individual observations from their respective group means.
$$ \text{SSE} = \sum_{j=1}^{k} \sum_{i=1}^{n_j} (y_{ij} - \bar{y}_j)^2 $$.
* <span style="color: #ff9f29; font-weight: 700;">Total Sum of Squares (TSS):</span> Represents the total variation in all observations from the grand mean. It is the sum of SST and SSE.
$$ \text{TSS} = \text{SST} + \text{SSE} $$ $$ \text{TSS} = \sum_{j=1}^{k} \sum_{i=1}^{n_j} (y_{ij} - \bar{y})^2 $$.
### 14.2.3 Degrees of Freedom (df)
Degrees of freedom represent the number of independent pieces of information used to calculate a statistic.
* <span style="color: #ff9f29; font-weight: 700;">df for Treatments ($df_T$):</span> $k - 1$
* <span style="color: #ff9f29; font-weight: 700;">df for Error ($df_E$):</span> $n - k$
* <span style="color: #ff9f29; font-weight: 700;">df for Total ($df_{Total}$):</span> $n - 1$.
### 14.2.4 Mean Squares (MS)
Mean squares are calculated by dividing the sum of squares by their respective degrees of freedom. They represent an average variance.
* <span style="color: #ff9f29; font-weight: 700;">Mean Square for Treatment (MST):</span> Measures the variance between groups.
$$ \text{MST} = \frac{\text{SST}}{k-1} $$.
* <span style="color: #ff9f29; font-weight: 700;">Mean Square for Error (MSE):</span> Measures the variance within groups (unexplained variation).
$$ \text{MSE} = \frac{\text{SSE}}{n-k} $$.
### 14.2.5 The F-test statistic
The F-test statistic is the ratio of the Mean Square for Treatment to the Mean Square for Error.
$$ F = \frac{\text{MST}}{\text{MSE}} $$.
This statistic follows an F-distribution with $(k-1)$ and $(n-k)$ degrees of freedom.
## 14.3 Interpreting ANOVA results
The calculated F-statistic is compared to a critical F-value from the F-distribution at a chosen significance level ($\alpha$, typically 0.05).
* <span style="color: #ff9f29; font-weight: 700;">Rejection Region:</span> If $F_{calculated} > F_{critical}$, the null hypothesis is rejected.
* <span style="color: #ff9f29; font-weight: 700;">Conclusion:</span>
* <span style="color: #ff9f29; font-weight: 700;">Reject $H_0$:</span> There is sufficient evidence to conclude that at least two population means differ.
* <span style="color: #ff9f29; font-weight: 700;">Do not reject $H_0$:</span> There is not enough evidence to conclude that the population means differ. [229](#page=229).
> **Key Relationship:** F-statistic compares variance between groups to variance within groups.
### 14.3.1 ANOVA table structure
An ANOVA table summarizes the sums of squares, degrees of freedom, mean squares, and F-ratio.
[227](#page=227) [228](#page=228).
### 14.3.2 Worked Example: Fertilizer Treatments
This example analyzes the yield of wheat under five different fertilizer treatments, each replicated four times.
* $k = 5$ (number of treatments)
* $n = 20$ (total observations)
* $df_T = k-1 = 4$
* $df_E = n-k = 16$
Calculations yield:
* SST = 206.5
* SSE = 57.25
* MST = SST / 4 = 51.625
* MSE = SSE / 16 = 3.8167
* $F_{calculated}$ = MST / MSE = 13.5261
At $\alpha = 0.05$, the critical F-value ($F_{crit}$) is approximately 3.0556. Since $13.5261 > 3.0556$, we reject $H_0$.
This indicates that the fertilizer treatments have a significant effect on wheat yield, meaning at least two treatments differ. [231-233]
> **Example:** Fertilizer types influence wheat yield differently.
### 14.3.3 Worked Example: Accounting Methods
This example compares the effectiveness of three methods for preparing income tax returns, based on preparation time.
* $k = 3$ (number of methods)
* $n = 15$ (total employees)
* $df_T = k-1 = 2$
* $df_E = n-k = 12$
Calculations yield:
* SST = 101.4333
* SSE = 94.3
* MST = SST / 2 = 50.7167
* MSE = SSE / 12 = 7.8583
* $F_{calculated}$ = MST / MSE = 6.4539
At $\alpha = 0.05$, the critical F-value ($F_{crit}$) is approximately 3.8853. Since $6.4539 > 3.8853$, we reject $H_0$.
This suggests that the three training methods are not equally effective, and at least two differ in their preparation times. [234-237]
> **Example:** Training methods impact employee efficiency.
## 14.4 Regression and Correlation (Brief Introduction)
While the provided text primarily focuses on ANOVA, it briefly touches upon the context of comparing means, which is related to regression and correlation.
* <span style="color: #ff9f29; font-weight: 700;">Regression:</span> A statistical method used to model the relationship between a dependent variable and one or more independent variables. It allows for prediction.
* <span style="color: #ff9f29; font-weight: 700;">Correlation:</span> A statistical measure that describes the strength and direction of the linear relationship between two variables. It does not imply causation.
The comparison of two means, discussed before ANOVA, is a simple form of regression where a categorical independent variable has two levels. ANOVA extends this to multiple levels [225](#page=225).
> **Bridge:** ANOVA extends the concept of comparing two groups (simple comparison) to comparing multiple groups, which forms the basis for more complex modeling in regression.
> **Important:** ANOVA tests for *any* difference between means, not *where* those differences lie. Post-hoc tests are needed to identify specific mean differences if $H_0$ is rejected [226](#page=226).
# 15. Chi-square tests
## 15.1 Introduction to Chi-square tests
The <span style="color: #ff9f29; font-weight: 700;">Chi-square test</span> is used to assess if an observed pattern of data fits a given distribution. It measures the discrepancy between observed and expected frequencies.
* <span style="color: #ff9f29; font-weight: 700;">Formula</span>: The Chi-square ($\chi^2$) test statistic is calculated as:
$$ \chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i} $$
* $k$: Number of cells (categories).
* $O_i$: Observed frequency in cell $i$.
* $E_i$: Expected frequency in cell $i$.
* <span style="color: #ff9f29; font-weight: 700;">Data Type</span>: Chi-square tests are typically used for categorical (nominal) data, summarized as counts or frequencies.
## 15.2 Characteristics of the Chi-square distribution
The Chi-square distribution has several key features:
* It is not symmetrical.
* It is always skewed to the right.
* It is associated with <span style="color: #ff9f29; font-weight: 700;">degrees of freedom</span> ($\nu$).
* As degrees of freedom increase, the distribution approaches a normal distribution.
* Critical values can be found in statistical tables (e.g., Table V in Appendix).
## 15.3 Rules for Chi-square tests
Adhering to these rules ensures the validity of Chi-square tests:
* <span style="color: #ff9f29; font-weight: 700;">Expected frequency</span>: Each expected frequency ($E_i$) must be at least five.
* <span style="color: #ff9f29; font-weight: 700;">Actual numbers</span>: Tests must use the original counts or frequencies, not proportions or percentages.
## 15.4 Chi-square goodness-of-fit test
This test determines if an observed frequency distribution matches an expected distribution.
<span style="color: #ff9f29; font-weight: 700;">Steps:</span>
1. <span style="color: #ff9f29; font-weight: 700;">State Hypotheses</span>:
* $H_0$: The observed proportions match the expected proportions ($p_1 = p_{expected1}, p_2 = p_{expected2}, \dots$).
* $H_1$: At least one observed proportion differs from the expected proportion.
2. <span style="color: #ff9f29; font-weight: 700;">Define Critical Value and Rejection Region</span>:
* Calculate degrees of freedom: $\nu = k - 1$, where $k$ is the number of cells.
* Determine the critical $\chi^2$ value based on the significance level ($\alpha$) and degrees of freedom.
* The rejection region is where the calculated $\chi^2$ statistic is greater than the critical value.
3. <span style="color: #ff9f29; font-weight: 700;">Calculate Test Statistic</span>:
* Calculate expected frequencies: $E_i = n \times p_{expected\_i}$, where $n$ is the total sample size.
* Compute the $\chi^2$ statistic using the formula $\sum \frac{(O_i - E_i)^2}{E_i}$.
4. <span style="color: #ff9f29; font-weight: 700;">Conclusion</span>:
* Compare the calculated $\chi^2$ statistic to the critical value.
* If the statistic falls in the rejection region, reject $H_0$. Otherwise, do not reject $H_0$.
> **Example**: A marketing analyst wants to know if customer preferences for fabric softener brands changed after advertising. The observed preferences are compared to historical market shares.
* <span style="color: #ff9f29; font-weight: 700;">Hypotheses</span>:
* $H_0$: Market shares remain 0.45 for A, 0.40 for B, and 0.15 for others.
* $H_1$: Market shares have changed.
* <span style="color: #ff9f29; font-weight: 700;">Calculation</span>: Expected frequencies are calculated based on the sample size and $H_0$. The $\chi^2$ statistic is computed, and if it exceeds the critical value (e.g., 5.9915 for $\alpha = 0.05$ and $\nu = 2$), $H_0$ is rejected.
## 15.5 Chi-square test for independence (Contingency Tables)
This test examines whether there is a relationship between two categorical variables. The data is presented in a contingency table.
<span style="color: #ff9f29; font-weight: 700;">Steps:</span>
1. <span style="color: #ff9f29; font-weight: 700;">State Hypotheses</span>:
* $H_0$: The two variables are independent (no relationship).
* $H_1$: The two variables are dependent (a relationship exists).
2. <span style="color: #ff9f29; font-weight: 700;">Define Critical Value and Rejection Region</span>:
* Calculate degrees of freedom: $\nu = (r - 1) \times (c - 1)$, where $r$ is the number of rows and $c$ is the number of columns.
* Determine the critical $\chi^2$ value for the given $\alpha$ and $\nu$.
* The rejection region is where the calculated $\chi^2$ statistic exceeds the critical value.
3. <span style="color: #ff9f29; font-weight: 700;">Calculate Test Statistic</span>:
* Calculate expected frequencies for each cell in the table: $E_{ij} = \frac{(\text{Row Total}_i) \times (\text{Column Total}_j)}{\text{Grand Total}}$.
* Compute the $\chi^2$ statistic using the formula $\sum \frac{(O_{ij} - E_{ij})^2}{E_{ij}}$ across all cells.
4. <span style="color: #ff9f29; font-weight: 700;">Conclusion</span>:
* Compare the calculated $\chi^2$ statistic to the critical value.
* If the statistic is in the rejection region, reject $H_0$. Otherwise, do not reject $H_0$.
> **Example**: A survey asks workers in different regions about their concerns (unemployment vs. inflation). The test determines if region affects opinion.
* <span style="color: #ff9f29; font-weight: 700;">Hypotheses</span>:
* $H_0$: Region and opinion are independent.
* $H_1$: Region and opinion are dependent.
* <span style="color: #ff9f29; font-weight: 700;">Calculation</span>: Expected frequencies are calculated based on row and column totals. The $\chi^2$ statistic is computed. If it exceeds the critical value (e.g., 5.992 for $\alpha = 0.05$ and $\nu = 2$), $H_0$ is rejected, indicating a relationship.
---
## Summary Tables for Chi-Square Tests
| Test Type | Purpose | Null Hypothesis ($H_0$) | Degrees of Freedom ($\nu$) |
| :------------------------------ | :--------------------------------------------------- | :------------------------------------------------------ | :----------------------------------------------------------------- |
| Goodness-of-Fit | Compares observed frequencies to expected frequencies | Observed distribution matches expected distribution. | $k - 1$ (where $k$ is the number of categories) |
| Test for Independence | Checks for association between two categorical variables | The two variables are independent. | $(r - 1) \times (c - 1)$ (where $r$ rows, $c$ columns) |
| Test for Homogeneity | Compares proportions across different populations | Proportions are the same across all populations. | $(r - 1) \times (c - 1)$ (where $r$ populations, $c$ categories) |
> **Key Takeaway**: Chi-square tests are versatile for analyzing categorical data, allowing us to assess if observed patterns align with expectations or if relationships exist between variables.
> **Important**: Always ensure expected frequencies are at least five for the test to be valid. When in doubt about which Chi-square test to use, consider if you are testing one variable against a known distribution (goodness-of-fit) or the relationship between two variables (independence/homogeneity).
# 16. Index numbers and time series analysis
## 16.1 Index numbers
An <span style="color: #ff9f29; font-weight: 700;">index number</span> shows changes in a variable between two periods. It is expressed as a percentage.
The base period always has an index of 100.
$$ \text{Index number} = \frac{\text{value}_{\text{current period}}}{\text{value}_{\text{base period}}} \times 100 $$
* An index above 100 shows a percentage increase from the base period.
* An index below 100 shows a percentage decrease from the base period.
## 16.2 Types of index numbers
Index numbers can measure changes in either price or quantity. They can be for a single item or a group of items (composite).
| Type | Measures |
| :---------------------- | :------------------------------------- |
| Single price index | Price change of one item |
| Single quantity index | Quantity change of one item |
| Composite price index | Average price change for a group of items |
| Composite quantity index | Average quantity change for a group of items |
## 16.3 Single item indexes
A <span style="color: #ff9f29; font-weight: 700;">single price index</span> measures the percentage change in the price of one item between two periods.
$$ \text{Single price index} = \frac{p_1}{p_0} \times 100 $$
* $p_1$: current period price
* $p_0$: base period price
A <span style="color: #ff9f29; font-weight: 700;">single quantity index</span> measures the percentage change in the quantity of an item between two periods, keeping prices constant.
$$ \text{Single quantity index} = \frac{q_1}{q_0} \times 100 $$
* $q_1$: current period quantity
* $q_0$: base period quantity
## 16.4 Composite price indexes
These measure the average price change for a basket of items. The two main methods are Laspeyres and Paasche.
* <span style="color: #ff9f29; font-weight: 700;">Laspeyres price index</span> uses quantities from the base period to value the basket at current prices. This is the default method.
$$ \text{Laspeyres Price Index} = \frac{\sum (p_1 q_0)}{\sum (p_0 q_0)} \times 100 $$
* <span style="color: #ff9f29; font-weight: 700;">Paasche price index</span> uses quantities from the current period to value the basket at current prices.
$$ \text{Paasche Price Index} = \frac{\sum (p_1 q_1)}{\sum (p_0 q_1)} \times 100 $$
## 16.5 Composite quantity indexes
These measure the average change in the quantity of a basket of items, holding prices constant.
* <span style="color: #ff9f29; font-weight: 700;">Laspeyres quantity index</span> uses prices from the base period.
$$ \text{Laspeyres Quantity Index} = \frac{\sum (q_1 p_0)}{\sum (q_0 p_0)} \times 100 $$
* <span style="color: #ff9f29; font-weight: 700;">Paasche quantity index</span> uses prices from the current period.
$$ \text{Paasche Quantity Index} = \frac{\sum (q_1 p_1)}{\sum (q_0 p_1)} \times 100 $$
## 16.6 Time series analysis
A <span style="color: #ff9f29; font-weight: 700;">time series</span> is data measured over time in sequential order. Analyzing time series helps understand past patterns and predict future values.
## 16.7 Components of a time series
Time series data can be broken down into four main components:
* <span style="color: #ff9f29; font-weight: 700;">Trend (T)</span>: Long-term, smooth movement over more than one year (e.g., population growth).
* <span style="color: #ff9f29; font-weight: 700;">Cyclical (C)</span>: Fluctuations that repeat over periods longer than one year (e.g., economic booms and recessions).
* <span style="color: #ff9f29; font-weight: 700;">Seasonal (S)</span>: Fluctuations repeating within a year or less (e.g., monthly sales, daily traffic).
* <span style="color: #ff9f29; font-weight: 700;">Irregular (I)</span>: Random, unpredictable fluctuations due to chance events (e.g., natural disasters).
## 16.8 Time series models
The multiplicative model is commonly used:
$$ Y = T \times C \times S \times I $$
This model assumes each component influences the observed value multiplicatively.
## 16.9 Decomposition of a time series
The goal is to separate the time series into its components.
#### Moving average method
This method smooths out short-term fluctuations (seasonal and irregular) to reveal the trend and cyclical components.
$$ \text{Moving average} = \frac{\sum \text{values}}{\text{k}} $$
* $k$ is the period number for the average (e.g., 4 for quarterly, 12 for monthly).
When $k$ is odd, the average is centered on the middle period. When $k$ is even, a centered moving average is calculated by averaging two consecutive moving averages.
#### Seasonal analysis
This process identifies and quantifies the seasonal component.
1. Calculate the moving average to smooth out seasonal and irregular variations.
2. Calculate uncentered seasonal indexes by dividing the original data by the moving average.
3. Center the moving averages if $k$ is even.
4. Calculate median seasonal ratios for each period (e.g., each quarter) across all years.
5. Adjust these median ratios so their total sums to 400 (for quarterly data) or 1200 (for monthly data).
6. The adjusted seasonal indexes show the typical seasonal influence for each period.
> **🔑 Important:** Seasonal indexes quantify recurring patterns within a year, helping to understand deviations from the trend.
#### Deseasonalizing time series
This removes the seasonal influence from the data, leaving trend, cyclical, and irregular components.
$$ \text{Deseasonalized } Y = \frac{Y}{\text{Seasonal Index}} $$
> **🔑 Important:** Index numbers and time series analysis are crucial for understanding economic trends and making informed forecasts. For exams, master the calculation of Laspeyres and Paasche indexes and the decomposition of time series using moving averages.
## 16.10 Time series analysis overview
A <span style="color: #ff9f29; font-weight: 700;">time series</span> is a sequence of data points collected over time. This data is often organized by periods, such as days, months, or years.
Time series analysis helps understand patterns and forecast future values.
Key components of a time series:
* <span style="color: #ff9f29; font-weight: 700;">Trend</span>: The long-term upward or downward movement in the data.
* <span style="color: #ff9f29; font-weight: 700;">Cyclical</span>: Patterns that repeat over longer periods, often associated with economic cycles.
* <span style="color: #ff9f29; font-weight: 700;">Seasonal</span>: Patterns that repeat within a fixed period, like daily, weekly, or yearly.
* <span style="color: #ff9f29; font-weight: 700;">Irregular</span>: Random, unpredictable fluctuations that remain after accounting for other components.
## 16.11 Decomposing a time series
Time series decomposition separates a series into its constituent components. This is often done to isolate the seasonal effect or to smooth out fluctuations.
A common method is using moving averages.
## 16.12 Moving averages for decomposition
Moving averages smooth out short-term fluctuations to reveal underlying trends or cycles. A <span style="color: #ff9f29; font-weight: 700;">4-quarter moving average</span> is used for quarterly data.
> **🔑 Important:** A centered moving average is preferred as it aligns with the original time period.
The process involves:
1. Calculating an uncentered moving average. For quarterly data, this involves averaging four consecutive quarters.
2. Calculating a centered moving average. This is the average of two consecutive uncentered moving averages.
3. Calculating the seasonal ratio. This is the actual data value divided by the centered moving average.
> **📝 Example:**
> For 2005 Q2 sales of 67, the uncentered moving average is `(44+67+94+70)/4 = 68.75`. The centered moving average for Q3 2005 would be `(68.75 + 69.5) / 2 = 69.125`. The seasonal ratio for Q3 2005 would be `94 / 69.125 = 1.3598`.
## 16.13 Seasonal ratio calculation
The <span style="color: #ff9f29; font-weight: 700;">seasonal ratio</span> represents the extent to which a particular period's value deviates from the trend. It is calculated by dividing the actual value ($Y$) by the centered moving average (CMA).
Seasonal Ratio = $\frac{Y}{\text{CMA}}$
This ratio helps identify the typical seasonal impact for each quarter.
> **🔑 Important:** For data with a clear seasonal pattern (like quarterly sales), the seasonal ratios are averaged to get a stable estimate of the seasonal effect for each period.
## 16.14 Time series example: XYZ company sales
The provided tables illustrate the decomposition of quarterly sales data for the XYZ company. They show how to calculate the moving averages and seasonal ratios.
| Period | Y (R millions) | Uncentered 4-quarter moving average | Centered 4-quarter moving average | Seasonal ratio |
| :-------- | :------------- | :---------------------------------- | :-------------------------------- | :------------- |
| 2005 Q3 | 94 | 69.5 | 69.125 | 1.3598 |
| 2005 Q4 | 70 | 69.75 | 70.125 | 0.9982 |
| 2006 Q1 | 50 | 68.875 | 69.3125 | 0.7214 |
| 2006 Q2 | 65 | 65.25 | 64.75 | 1.0039 |
| 2006 Q3 | 87 | 62.375 | 61.875 | 1.4060 |
| 2006 Q4 | 48 | 60.75 | 60.75 | 0.7899 |
*Note: This table is a partial representation for illustrative purposes. The full calculation details are in the document.*
The process shown in Tables 13.7, 13.8, 13.9, and 13.10 involves applying these moving average calculations to historical sales or income data. This allows for the estimation of seasonal patterns in different business contexts, such as general sales, electricity sales, and net income.
> **🔑 Important:** The goal is to isolate the seasonal component to understand its impact and remove it from the data to reveal underlying trends or cyclical movements.
## 16.15 Index numbers
<span style="color: #ff9f29; font-weight: 700;">Index numbers</span> are statistical measures that compare changes in a price or quantity over time or across different locations. They are typically expressed as a percentage relative to a base period or location.
Index Number = $\frac{\text{Value in current period}}{\text{Value in base period}} \times 100$
## 16.16 Simple index numbers
A <span style="color: #ff9f29; font-weight: 700;">simple index number</span> compares the price or quantity of a single item at two different points in time. The base period is assigned a value of 100.
> **📝 Example:** If the price of bread was $2 in 2020 (base year) and $3 in 2023, the price index for bread in 2023 would be $(\$3/\$2) \times 100 = 150$. This means bread prices are 50% higher than in the base year.
## 16.17 Composite index numbers
A <span style="color: #ff9f29; font-weight: 700;">composite index number</span> combines the prices or quantities of multiple items into a single index. This provides a broader measure of price or quantity changes for a group of goods or services.
Common methods for constructing composite index numbers include:
* <span style="color: #ff9f29; font-weight: 700;">Laspeyres Index</span>: Uses base-period quantities as weights.
* <span style="color: #ff9f29; font-weight: 700;">Paasche Index</span>: Uses current-period quantities as weights.
## 16.18 Laspeyres index
The <span style="color: #ff9f29; font-weight: 700;">Laspeyres index</span> calculates the cost of a basket of goods and services using base-period quantities. It measures the change in cost of purchasing the same fixed basket over time.
Formula: $$L = \frac{\sum (p_t \cdot q_0)}{\sum (p_0 \cdot q_0)} \times 100$$ Where:
* $p_t$: Price in the current period
* $q_0$: Quantity in the base period
* $p_0$: Price in the base period
> **🔑 Important:** The Laspeyres index tends to overstate inflation because it does not account for consumers substituting cheaper goods when prices rise.
## 16.19 Paasche index
The <span style="color: #ff9f29; font-weight: 700;">Paasche index</span> calculates the cost of a basket of goods and services using current-period quantities. It reflects the cost of a basket that changes with current consumption patterns.
Formula: $$P = \frac{\sum (p_t \cdot q_t)}{\sum (p_0 \cdot q_t)} \times 100$$ Where:
* $q_t$: Quantity in the current period
> **🔑 Important:** The Paasche index tends to understate inflation because it accounts for shifts to cheaper goods. It requires more frequent data collection as quantities change each period.
> **🔑 Important:** The answers provided for Exercises 13.1 to 13.4 in the source document represent calculated values for specific time series and index number problems, demonstrating the application of these concepts. For example, answer (c) for Exercise 13.1 (93.2174) likely corresponds to a seasonal ratio calculation, while other answers might represent index values or trend components.