Modélisation stat
📚 Modélisation_stat.pdf
Brief overview
This document provides a comprehensive guide to statistical modeling and hypothesis testing. It covers fundamental concepts, parametric and non-parametric tests, and both simple and multiple linear regression techniques, offering essential tools for data analysis and interpretation.
Key points
- Introduction to the principles and errors of hypothesis testing.
- Parametric tests for simple and composite hypotheses.
- Comparing independent and dependent samples with parametric tests.
- Application of non-parametric tests and chi-squared analysis.
- Simple linear regression models and parameter estimation.
- Multiple linear regression analysis and model validation.
1. Introduction to hypothesis testing
1.1 Hypothesis testing fundamentals
- Statistical hypothesis: An assertion about population characteristics, such as parameter values or distribution shape.
- Hypothesis test: A procedure to make a decision between two competing hypotheses.
📝 Example: A researcher hypothesizes about the average height of a specific plant species.
1.2 Null and alternative hypotheses
- Null hypothesis (H0): A statement of no effect or no difference, postulating a specific parameter value. It is formulated with the intent of being rejected.
- Represents the belief that observed differences are due to sampling variability.
- Alternative hypothesis (H1): A statement that contradicts the null hypothesis. It can represent any compatible hypothesis different from H0.
🔑 Important: H1 is the logical negation of H0.
📝 Example:
- H0: The average temperature in August in Paris is 20 degrees Celsius (m = 20).
- H1: The average temperature in August in Paris is not 20 degrees Celsius (m ≠ 20).
1.3 Types of hypothesis tests
A test's nature depends on the alternative hypothesis:
| Test Type | Alternative Hypothesis (H1) | Description |
|---|---|---|
| Unilateral | θ > θ0 or θ < θ0 | One-sided test |
| Bilateral | θ ≠ θ0 | Two-sided test |
🔑 Important: A unilateral test can be specified as a "right-tailed" test (θ > θ0) or a "left-tailed" test (θ < θ0).
1.4 Asymmetry in hypothesis testing conclusions
- The decision to "accept" H0 does not definitively prove H0 is true.
- It signifies a lack of sufficient evidence to reject H0.
🔑 Important: Statistical decision-making asymmetry means we reject H0 with a certain confidence, but "fail to reject" H0 implies lack of evidence rather than proof of its truth.
1.5 Risks of error in hypothesis testing
Any statistical decision involves potential errors, categorized into two types:
| Reality | Decision | Outcome | Probability |
|---|---|---|---|
| H0 is True | Reject H0 | Type I Error | α (Significance level) |
| H0 is True | Do Not Reject H0 | Correct Decision | 1 - α |
| H0 is False (H1 is True) | Reject H0 | Correct Decision | 1 - β (Power) |
| H0 is False (H1 is True) | Do Not Reject H0 | Type II Error | β |
1.5.1 Type I error (α)
- Type I Error: Rejecting the null hypothesis (H0) when it is actually true.
- Probability of Type I error is denoted by α, also known as the significance level of the test.
- This probability defines the critical region (or rejection region) W.
- The complement region (W) is the region of acceptance for H0.
- Commonly chosen values for α are 0.05 (5%) and 0.01 (1%).
1.5.2 Type II error (β)
- Type II Error: Failing to reject the null hypothesis (H0) when it is actually false.
- Probability of Type II error is denoted by β.
- Power of the test is defined as 1 - β, representing the probability of correctly rejecting H0 when H1 is true.
- Calculating β requires specifying the parameter value(s) under H1.
> Key relationship: Power (1 - β) is the probability of accepting H1 when H1 is true.
1.5.3 Properties of α and β
- Distance between hypotheses: As the true parameter value under H1 moves further from the value under H0, the test's power (1 - β) increases, and β decreases.
- Trade-off between α and β: Decreasing α (reducing Type I error) increases the region of non-rejection, thus increasing β (increasing Type II error risk).
- Sample size effect: Increasing the sample size n, while keeping α fixed, shrinks the non-rejection region, decreases β, and thus increases the test's power.
> Dynamic Relationship: α decreases → β increases; n increases → β decreases (for fixed α).
1.6 Procedure for developing a hypothesis test
- Formulate hypotheses: Precisely state the null (H0) and alternative (H1) hypotheses.
- Set significance level: Choose the probability α for Type I error before data collection.
- Specify test conditions: Define assumptions about the population distribution, sample size, known/unknown variance, etc.
- Select estimator and distribution: Choose an appropriate estimator and determine its probability distribution under both H0 and H1. These distributions must be distinguishable.
- Determine critical region: Define the critical region W such that Pr(W|H0) = α.
- Establish decision rule: Based on W, formulate the rule for rejecting or not rejecting H0. Calculate β = Pr(W|H1).
- Calculate test statistic: Compute the numerical value of the test statistic using the sample data.
- Make decision: Compare the calculated test statistic to the critical region to decide whether to reject H0.
> Decision Flow: Formulate H0/H1 → Set α → Define Conditions → Choose Estimator → Determine Critical Region → Calculate Statistic → Decide.
🔑 Important: The entire process of hypothesis testing aims to minimize the risks of making incorrect decisions about population parameters based on sample data.
2. Parametric tests for simple and composite hypotheses
2.1 Introduction to hypothesis testing
- A hypothesis test involves defining a null hypothesis (H0) and an alternative hypothesis (H1).
- The goal is to decide whether to reject H0 in favor of H1 based on sample data.
- Decisions are made using a test statistic (t) and a critical region (W).
> 🔑 Important: Rejecting H0 implies the data strongly suggests H1 is true, not that H0 is definitively false.
2.2 Testing simple vs. simple hypotheses
- This scenario involves precisely defined null and alternative hypotheses:
- H0:θ=θ0
- H1:θ=θ1
- Where θ is a parameter of a probability distribution f(x;θ).
2.2.1 Neyman-Pearson lemma
- The Neyman-Pearson lemma provides the most powerful test for simple vs. simple hypotheses.
- It states that for a given significance level α, the most powerful test's critical region (W) is defined by:
- W={x∈Rn∣L(x;θ1)>kαL(x;θ0)}
- L(x;θ) is the likelihood function for the sample x=(x1,…,xn).
- kα is a constant determined by α such that P(W∣H0)=α.
> 📝 Example: For testing the mean (m) of a normal distribution with known variance σ2, H0:m=m0 vs. H1:m=m1, the critical region often simplifies to conditions on the sample mean Xˉ. If m1>m0, we reject H0 if Xˉ is sufficiently large.
- A test derived from the Neyman-Pearson lemma is unbiased, meaning its power (1−β) is always greater than the significance level α.
2.2.2 Applying Neyman-Pearson: Example
- Consider testing the proportion p of male births.
- H0:p=0.5 vs. H1:p=0.48.
- With a sample of 900 births, 470 are boys.
- The test statistic and critical region would be determined based on the likelihood ratio or, in this case, often a normal approximation to the binomial distribution.
2.3 Testing a simple hypothesis against a composite alternative
- This occurs when the alternative hypothesis involves a range of parameter values.
- Example: H0:θ=θ0 vs. H1:θ>θ1 (where θ1 could be equal to θ0).
- The power function β(θ) varies for each θ in the alternative hypothesis.
- The efficiency curve is β(θ), and the power curve is 1−β(θ).
2.3.1 Uniformly Most Powerful (UPP) tests
- A UPP test for H0:θ=θ0 against H1:θ>θ1 exists if the Neyman-Pearson critical region for testing H0:θ=θ0 against H1:θ=θ1 (with θ1>θ0) does not depend on the specific value of θ1.
- Such a test remains the most powerful for the composite alternative H1:θ>θ1 across all its values.
> 🔑 Important: A UPP test does not generally exist for two-sided alternatives (H1:θ=θ0). This is because a test optimal for θ>θ0 might not be optimal for θ<θ0.
2.3.2 Example: Testing for an increase in mean salary
- H0:m=2100 DH vs. H1:m>2100 DH.
- Sample of 25 graduates, Xˉ=2180 DH, ∑(xi−xˉ)2=24000.
- Variance is unknown, so a t-distribution is used.
- The critical region is determined by Xˉ>kα.
- For α=0.05, kα is calculated using the t-distribution with 24 degrees of freedom.
- If the observed Xˉ falls in the critical region, H0 is rejected, concluding the average salary has significantly increased.
2.4 Testing between two composite hypotheses
- This involves situations where both H0 and H1 specify ranges of parameter values.
- Example: H0:θ≤θ0 vs. H1:θ>θ0.
2.4.1 Lehmann's theorem
- Lehmann's theorem addresses the existence of UPP tests for certain composite hypotheses.
- If the likelihood ratio L(x;θ0)L(x;θ) is a monotone function of a statistic Tn for all θ>θ0:
- For testing H0:θ≤θ0 vs. H1:θ>θ0, a UPP test of level α has the critical region Tn>kα.
- For testing H0:θ≥θ0 vs. H1:θ<θ0, a UPP test of level α has the critical region Tn<kα.
2.4.2 Example: Proportion of defective parts
- Testing if the percentage P of defective parts exceeds 3%.
- H0:P≤0.03 vs. H1:P>0.03.
- The likelihood ratio for P and P0=0.03 is a function of the sample proportion Fn.
- Since this ratio is increasing for P>P0, Lehmann's theorem applies.
- A UPP test rejects H0 if the sample proportion Fn is greater than a critical value kα.
- Using a normal approximation for Fn under H0, kα is determined to yield P(Fn>kα∣P0=0.03)=α.
2.5 The Likelihood Ratio Test (LRT)
- The LRT is a general method for constructing tests, particularly useful for composite hypotheses and bilateral tests.
- It considers the ratio of the supremum of the likelihood function over the parameter space of H0 to the supremum over the parameter space of H0∪H1.
- The test statistic is λn(x)=supθ∈Θ0∪Θ1L(x;θ)supθ∈Θ0L(x;θ).
- H0 is rejected if λn(x)≤kα.
2.5.1 LRT for bilateral tests
- The LRT is effective for testing simple hypotheses against two-sided composite alternatives.
- Example: Testing the mean of a normal distribution: H0:m=m0 vs. H1:m=m0.
- The LRT statistic λn(x) leads to a critical region of the form ∣Xˉ−m0∣>kα′, which is a standard bilateral test structure.
2.5.2 Example: Bolt diameter verification
- Verifying if a machine producing bolts is well-regulated.
- H0:m=14.00 mm vs. H1:m=14.00 mm.
- The diameter follows a normal distribution.
- Sample of 6 bolts, Xˉ=14.13 mm.
- Case 1: Known standard deviation σ=0.15 mm.
- The test statistic is σn(Xˉ−m0).
- The critical region is ∣Xˉ−m0∣>kα′.
- kα′ is determined using the standard normal distribution for α=0.01.
- The calculated critical value is 0.158. Since ∣14.13−14∣=0.13≤0.158, H0 is not rejected; the machine is considered well-regulated.
- Case 2: Unknown standard deviation.
- The test statistic uses the sample standard deviation S: Sn−1(Xˉ−m0).
- The critical region is ∣Xˉ−m0∣>kα′′.
- kα′′ is determined using the t-distribution with n−1=5 degrees of freedom for α=0.01.
- The calculated critical value is 0.32. Since ∣14.13−14∣=0.13≤0.32, H0 is not rejected; the machine is considered well-regulated.
> 🔑 Important: For bilateral tests (H1:θ=θ0), if a UPP test exists for H0:θ=θ0 vs. H1:θ>θ0 and for H0:θ=θ0 vs. H1:θ<θ0, these cannot simultaneously be the most powerful test for H1:θ=θ0, necessitating alternative approaches like the LRT.
3. Comparison of independent and dependent samples using parametric tests
3.1 Independent samples: Gaussian data
Parametric tests for independent samples are used to determine if two distinct groups originate from the same population concerning a specific variable. When assuming Gaussian distributions for both samples, X1∼N(m1,σ12) and X2∼N(m2,σ22), the null hypothesis H0:F1(x)=F2(x) is typically decomposed into testing equality of means and variances.
🔑 Important: The general problem is testing H0:F1(x)=F2(x) vs H1:F1(x)=F2(x). For Gaussian data, this simplifies to testing means and variances.
3.1.1 Testing variances (Fisher-Snedecor F-test)
This test specifically addresses the equality of variances between two independent Gaussian populations.
-
Hypotheses:
- H0:σ12=σ22
- H1:σ12=σ22
-
Test Statistic: The test statistic is the ratio of sample variances, adjusted for sample size: F=n1−1n1S12/n2−1n2S22 Under H0, this statistic follows an F-distribution with (n1−1,n2−1) degrees of freedom.
-
Decision Rule: Reject H0 if F falls outside the interval [Fα/2(n1−1,n2−1),F1−α/2(n1−1,n2−1)].
3.1.2 Testing means (Student's t-test)
Provided that the variances are not significantly different (or if sample sizes are large), Student's t-test is employed to compare the means of two independent Gaussian samples.
-
Hypotheses:
- H0:m1=m2
- H1:m1=m2
-
Test Statistic: The t-statistic for independent samples with pooled variance (assuming σ12=σ22) is: T=n1+n2−2(n1−1)S12+(n2−1)S22n11+n21Xˉ1−Xˉ2 Under H0, this statistic follows a t-distribution with (n1+n2−2) degrees of freedom.
-
Decision Rule: Reject H0 if ∣T∣>t1−α/2(n1+n2−2).
📝 Example: Comparing the lifespan of two brands of light bulbs. After testing variances and finding them non-significant, a t-test is used to compare their average lifespans.
3.2 Independent samples: Non-Gaussian data and large sample sizes
When sample sizes are sufficiently large (n1,n2≥30), the Central Limit Theorem allows for the application of parametric tests for comparing means, even if the underlying distributions are not strictly Gaussian. The variance test based on the F-distribution is generally not valid in this scenario without Gaussian assumptions.
- Mean comparison for large samples: Student's t-test formula can be applied to compare means, assuming n1,n2≥30. This approach is robust to deviations from normality.
3.3 Independent samples: Comparing percentages
This section addresses the comparison of proportions from two independent, large samples.
-
Hypotheses:
- H0:p1=p2
- H1:p1=p2
-
Test Statistic: An estimator for the common proportion p is calculated as f=n1+n2n1f1+n2f2. The test statistic is then: Z=f(1−f)(n11+n21)f1−f2 For large samples, this statistic approximates a standard normal distribution (N(0,1)).
-
Decision Rule: Reject H0 if ∣Z∣>z1−α/2.
📝 Example: Evaluating the effectiveness of an advertising campaign by comparing brand awareness percentages before and after the campaign across two distinct large samples.
3.4 Dependent (paired) samples
When observations are paired, meaning each observation in one sample is related to a specific observation in the other (e.g., repeated measures on the same subjects), the analysis focuses on the differences between paired measurements.
-
Hypotheses:
- H0:μ1=μ2 (or equivalently, μd=0, where μd is the mean difference)
- H1:μ1=μ2 (or equivalently, μd=0)
-
Test Statistic: Let Di=X1i−X2i be the difference for the i-th pair. The test statistic is based on the mean difference dˉ and its standard deviation sd: T=sd/ndˉ This statistic follows a t-distribution with (n−1) degrees of freedom, where n is the number of pairs.
-
Decision Rule: Reject H0 if ∣T∣>t1−α/2(n−1).
📝 Example: Assessing if two products are perceived similarly by the same group of consumers, where each consumer rates both products. The test focuses on the average difference in ratings.
3.5 Test on the Pearson correlation coefficient
This test determines if there is a statistically significant linear relationship between two continuous variables.
-
Hypotheses:
- H0:ρ=0 (no linear correlation)
- H1:ρ=0 (there is a linear correlation)
-
Test Statistic: The sample correlation coefficient is denoted by r. The test statistic is: T=1−r2rn−2 Under H0, this statistic follows a t-distribution with (n−2) degrees of freedom.
-
Decision Rule: Reject H0 if ∣T∣>t1−α/2(n−2).
📝 Example: Investigating the relationship between marketing pressure (variable X) and perfume bottle sales (variable Y) by calculating the Pearson correlation coefficient and testing its significance.
🔑 Important: The choice between independent and dependent samples tests hinges critically on the study design and the nature of the data collection. For Gaussian data, variances are typically tested before means. For large samples, normality assumptions become less critical for mean tests.
4. Non-parametric tests and chi-squared applications
4.1 Introduction to non-parametric tests
- Non-parametric tests: Hypothesis tests that do not require specification of the population's distribution form.
- Advantages:
- Applicable when distributional assumptions (e.g., normality) are unmet.
- Suitable for small sample sizes where normality is hard to verify.
- Key non-parametric tests:
- Chi-squared (χ2) goodness-of-fit tests.
- Chi-squared (χ2) independence tests.
4.2 Chi-squared goodness-of-fit tests
Goodness-of-fit tests assess the agreement between observed data and a theoretical model. They address two main scenarios:
-
Adjusting a sample to a given probability distribution:
- The theoretical distribution (its CDF or PDF) is fully specified.
- The goal is to verify if the observed sample conforms to this known distribution.
-
Adjusting a probability distribution to a sample:
- The theoretical distribution is unknown.
- The form and parameters of the distribution are estimated from the sample characteristics.
🔑 Important: Goodness-of-fit tests evaluate an a priori hypothesis about a distribution; they do not discover the true distribution of a random variable 62.
4.2.1 Choosing a distribution
The selection of a theoretical distribution is guided by:
- Nature of the phenomenon: Discrete vs. continuous.
- Distribution shape: Inferred from histograms.
- Key statistical characteristics: Mean, median, variance.
- Number of parameters: More parameters allow for better adaptation.
4.2.2 Procedure for goodness-of-fit tests
The general procedure involves:
-
Hypothesis definition:
- H0: The observations follow a specified theoretical distribution (F=F0).
- H1: The observations do not follow the specified theoretical distribution (F=F0).
-
Significance level (α): Pre-defined risk of Type I error (rejecting H0 when true).
-
Calculate test statistic (d): Based on observed sample data.
-
Decision rule:
- If d>qα (critical value) or p-value≤α, reject H0.
- If d≤qα or p-value>α, do not reject H0.
> Comparison of decision rules for goodness-of-fit tests:
Method Rejection Condition Non-rejection Condition Critical Value d>qα d≤qα P-value p-value≤α p-value>α
4.2.3 The Chi-squared statistic for goodness-of-fit
Let X be the random variable of interest, with a sample of size n providing observations categorized into k modalities or classes. Observed frequencies are N1,…,Nk, such that ∑i=1kNi=n.
-
Hypotheses:
- H0: "X∼L" (Observations follow theoretical distribution L).
- H1: "X≁L" (Observations do not follow distribution L).
-
Under H0, distribution L assigns probabilities p1,…,pk to the k categories.
-
The test statistic is: D2=∑i=1knpi(Ni−npi)2
4.2.4 Asymptotic distribution and degrees of freedom
-
Theorem: As n→∞, D2 asymptotically follows a chi-squared distribution: D2n→∞χν2.
-
Degrees of freedom (ν):
- (k−1): If the theoretical distribution is fully specified (no parameters estimated).
- (k−m−1): If m parameters were estimated from the observations to define the distribution.
-
Decision rule: Reject H0 if d2>χν,1−α2; otherwise, do not reject H0.
> Chi-squared distribution critical values:
Degrees of Freedom (ν) α=0.05 (1-α=0.95) 1 3.84 2 5.99 3 7.81 6 12.59
4.2.5 Important considerations for χ2 goodness-of-fit
-
Type II error: Cannot be determined as the distribution of X is unspecified under H1.
-
Sample size requirement: For the χ2 approximation to hold, the expected frequency (npi) in each class should ideally be greater than 5. If not, classes should be merged until this condition is met 67.
> Example of class merging: If classes with expected frequencies below 5 exist, combine them with adjacent classes to satisfy the npi>5 rule.
4.2.5.1 Example: Poisson distribution fitting
- Scenario: Analyzing car arrivals at a toll booth over 200 minutes. Observed frequencies for 0 to 11 cars per minute.
- Objective: Determine a suitable theoretical distribution and test its fit.
- Procedure:
- Calculate sample mean (xˉ≈4) and variance (σ2≈4.02).
- Calculate expected frequencies (npi) assuming a Poisson distribution with λ=xˉ.
- Apply the χ2 statistic formula.
- For Poisson, ν=k−m−1=12−1−1=10 (1 parameter λ estimated, 12 classes).
- If d2>χ10,0.952, reject Poisson.
- Crucial step: Merge classes with low expected frequencies (e.g., 9, 10, 11 cars) to satisfy npi>5. The example shows merging for classes ≥9 and calculating expected probabilities for these merged classes.
- The calculation demonstrated merging the last 4 classes and resulted in ν=6 for the χ2 distribution. 68-69
> Example of Poisson fitting result: After merging classes, the calculated χ2 statistic was 2.89. With ν=6 and α=0.05, the critical value χ6,0.952=12.59. Since 2.89≤12.59, the Poisson distribution is not rejected 69.
4.2.5.2 Example: Uniform distribution testing
- Scenario: 1000 random numbers generated between 0 and 1.
- Objective: Test if the sequence is uniformly distributed.
- Hypotheses:
- H0: Distribution is uniform on. pi=0.1 for each of the 10 classes 1.
- H1: Distribution is not uniform.
- Calculation: χ2 statistic calculated as 23.48.
- Degrees of freedom: k−1=10−1=9 (uniform distribution is fully specified).
- Conclusion: With α=0.05, the critical value χ9,0.952≈16.92. Since 23.48>16.92, H0 is rejected. The sequence is not uniformly distributed. 70-71
4.2.5.3 Example: Normal distribution testing
- Scenario: Market research data on potential customers' willingness to pay for a new product, grouped into price classes.
- Objective: Test if the data comes from a normal distribution.
- Procedure:
- Estimate mean (xˉ≈59.4) and standard deviation (σ≈14.34) from the grouped data.
- Calculate expected frequencies (npi) for each class assuming a normal distribution N(xˉ,σ2). This involves calculating Z-scores for class boundaries and using standard normal CDFs.
- Apply the χ2 statistic formula.
- Degrees of freedom: k−m−1=7−2−1=4. Here, m=2 for estimating mean and standard deviation. Correction: The provided calculation uses ν=6−2−1=3. This implies 6 classes, 2 estimated parameters (mean, variance), and 1 for the distribution type. It's common to use k−m−1. The document's calculation result suggests ν=3 leading to χ3,0.952=7.81.
- Conclusion: The calculated statistic (6.98) is less than the critical value (7.81). H0 (normal distribution) is not rejected. 72-73
> Important distinction in degrees of freedom: ν=k−1 when the distribution is fully specified, and ν=k−m−1 when m parameters are estimated from data 66.
4.3 Chi-squared test for independence
This test assesses whether two categorical variables are independent or associated.
-
Data structure: Observations are presented in a contingency table with k rows (categories of variable X) and p columns (categories of variable Y).
- Nij: Observed frequency in cell (i, j).
- ni.: Row marginal total for row i.
- n.j: Column marginal total for column j.
- N: Total number of observations.
Y / X y1 y2 ... yj ... yp Total x1 n11 n12 ... n1j ... n1p n1. ... ... ... ... ... ... ... ... xi ni1 ni2 ... nij ... nip ni. ... ... ... ... ... ... ... ... xk nk1 nk2 ... nkj ... nkp nk. Total n.1 n.2 ... n.j ... n.p N
4.3.1 The Chi-squared statistic for independence
-
Hypotheses:
- H0: Variables X and Y are independent.
- H1: Variables X and Y are not independent (associated).
-
Under H0, the expected frequency for cell (i, j) is calculated as: nij=Nni.×n.j
-
The test statistic is: D2=∑i=1k∑j=1pnij(Nij−nij)2
4.3.2 Asymptotic distribution and degrees of freedom
-
Theorem: As n→∞, D2 asymptotically follows a chi-squared distribution: D2n→∞χ(k−1)(p−1)2.
-
Degrees of freedom (ν): ν=(k−1)(p−1), where k is the number of rows and p is the number of columns in the contingency table.
-
Decision rule: Reject H0 if d2>χν,1−α2; otherwise, do not reject H0.
> Key takeaway for independence test: The degrees of freedom for independence tests are calculated as (number of rows - 1) * (number of columns - 1).
4.3.2.1 Example: Independence of socio-professional category and number of children
- Scenario: Survey of 1205 households classified by socio-professional category (A, B, C, D) and number of children (0 or 1, 2 or 3, >3).
- Objective: Test for independence between these two classification criteria.
- Contingency Table: Provided with observed frequencies Nij.
- Procedure:
- Calculate expected frequencies nij for each cell using the formula Nni.×n.j.
- Calculate the χ2 statistic D2.
- Degrees of freedom: ν=(4 categories−1)×(3 categories−1)=3×2=6.
- Conclusion: The calculated statistic is 13.5. With α=0.05, the critical value χ6,0.952=12.59. Since 13.5>12.59, H0 (independence) is rejected. There is an association between socio-professional category and the number of children. 76-77
🔑 Important: Chi-squared tests for independence are powerful tools for examining associations between categorical variables, but they require sufficient expected cell counts (generally >5) for the χ2 approximation to be valid.
🔑 Important: Non-parametric tests, particularly chi-squared applications, are vital for situations where parametric assumptions are violated, offering robust methods for goodness-of-fit and independence assessments.
5. Simple linear regression model and parameter estimation
5.1 The simple linear regression model
- Model definition: A simple linear regression model describes the relationship between a dependent variable (Yi) and an independent variable (Xi) as:
Yi=β0+β1Xi+εi 1.
- Yi: Dependent variable (endogenous).
- Xi: Independent variable (exogenous).
- β0: Intercept (constant at the origin).
- β1: Slope of the regression line.
- εi: Error term (noise).
- Matrix representation: The model can be expressed in matrix form: Y=Xβ+ε where Y is the vector of dependent variables, X is the design matrix, β is the vector of parameters, and ε is the vector of errors.
- Assumptions on error terms (ε): These are crucial for estimator properties and statistical inference.
- H1: E(εi)=0 for all i.
- H2: Var(εi)=σ2 (homoscedasticity).
- H3: cov(εi,εj)=0 for i=j (uncorrelated errors).
- H4: εi∼N(0,σ2) (normality).
5.2 Parameter estimation using Ordinary Least Squares (OLS)
- Objective: To find parameter estimates (β^0,β^1) that best fit the data by minimizing the sum of squared errors.
- Minimization criterion: The OLS method minimizes the sum of squared residuals (S(β0,β1)): S(β0,β1)=∑i=1n(yi−β0−β1xi)2=∑i=1nεi2
- OLS Estimators:
- Properties of OLS estimators:
- The OLS line passes through the centroid of the data (xˉ,yˉ).
- β^0 and β^1 are linear functions of the dependent variable Y.
- Under the model's assumptions, β^0, β^1, and σ^2 are unbiased, consistent, and minimum variance estimators (BLUE - Best Linear Unbiased Estimators).
Key relationship: The OLS estimators are derived by minimizing the sum of squared differences between observed and predicted values.
5.3 Properties of estimated parameters and variance
- Relationship for β^1: β^1=β1+∑i=1n(xi−xˉ)2∑i=1n(xi−xˉ)εi 4.
- Estimator for error variance (σ^2):
- Calculated from the sum of squared residuals: σ^2=n−2∑i=1nε^i2.
Key relationship: The variance of the estimated parameters depends on the variance of the errors and the spread of the independent variable.
5.4 Distributions of estimated parameters
- Distribution of σ^2/σ2: σ2σ^2∼χ2(n−2) where χ2 is the chi-squared distribution with n−2 degrees of freedom.
- Distribution of β^1: σ^β^1β^1−β1∼t(n−2) where σ^β^1=σ^/∑i=1n(xi−xˉ)2 is the estimated standard error of β^1. This follows a Student's t-distribution with n−2 degrees of freedom.
- Distribution of β^0: σ^β^0β^0−β0∼t(n−2) where σ^β^0=σ^n1+∑i=1n(xi−xˉ)2xˉ2 is the estimated standard error of β^0. This also follows a Student's t-distribution with n−2 degrees of freedom.
Key relationship: Under normality assumptions, estimated parameters follow t-distributions, enabling inference.
5.5 Confidence intervals for parameters
- Confidence interval for β0: IC(β0)=[β^0−t(n−2),(1−α/2)σ^β^0,β^0+t(n−2),(1−α/2)σ^β^0]
- Confidence interval for β1: IC(β1)=[β^1−t(n−2),(1−α/2)σ^β^1,β^1+t(n−2),(1−α/2)σ^β^1] where t(n−2),(1−α/2) is the (1−α/2) quantile of the Student's t-distribution with n−2 degrees of freedom.
Key relationship: Confidence intervals quantify the uncertainty around the estimated regression coefficients.
5.6 Prediction using the model
- Point prediction: For a new value xn+1, the predicted value is: y^n+1=β^0+β^1xn+1
- Prediction error variance: The variance of the prediction error (ε^n+1=yn+1−y^n+1) is: V(ε^n+1)=σ2(1+n1+∑i=1n(xi−xˉ)2(xn+1−xˉ)2) 5. When σ2 is unknown, its estimate σ^2 is used: V(ε^n+1)=σ^2(1+n1+∑i=1n(xi−xˉ)2(xn+1−xˉ)2) 6.
- Prediction interval: A (1−α) prediction interval for yn+1 is: y^n+1±t(1−α/2),(n−2)σ^1+n1+∑i=1n(xi−xˉ)2(xn+1−xˉ)2
Key relationship: Prediction intervals are wider than confidence intervals due to the additional uncertainty in predicting a new observation.
5.7 Model validity tests
- Normality of residuals: Assessed visually using histograms and Q-Q plots.
- Homoscedasticity of residuals: Evaluated by plotting residuals against predicted values or the independent variable; a constant variance (no pattern) indicates homoscedasticity.
- Uncorrelation of residuals:
- Tested using the Durbin-Watson test, which checks for autocorrelation.
- The statistic D=∑i=1nεi2∑i=2n(εi−εi−1)2 should be close to 2 for non-correlated residuals.
- Significance of the slope:
- Hypotheses: H0:β1=0 vs. H1:β1=0.
- Test statistic: T=σ^β^1β^1∼t(n−2). Reject H0 if p-value ≤α.
5.8 Analysis of variance (ANOVA)
- Variance decomposition: The total variation in Y (SCT) is decomposed into variation explained by the regression (SCE) and residual variation (SCR): SCT=SCR+SCE where SCT=∑i=1n(yi−yˉ)2, SCR=∑i=1n(yi−y^i)2, and SCE=∑i=1n(y^i−yˉ)2.
- Coefficient of Determination (R2):
R2=SCTSCE=1−SCTSCR
- R2 ranges from 0 to 1. A value closer to 1 indicates a better model fit.
- R2 is the square of the empirical correlation coefficient between xi and yi: R2=ρ2(X,Y).
- Global significance test:
- Hypotheses: H0:R2=0 vs. H1:R2=0.
- Test statistic: F=SCR/(n−2)SCE/1∼F(1,n−2). Reject H0 if p-value ≤α.
- This test is equivalent to the test of significance of the slope (β1).
Key relationship: R2 quantifies the proportion of variance in the dependent variable explained by the independent variable.
🔑 Important: The simple linear regression model provides a foundational framework for understanding linear relationships, with OLS offering statistically sound parameter estimates under specific assumptions, which are critical for valid inference and prediction.
6. Multiple linear regression and model validation
6.1 Model formulation
- Objective: To explain a response variable Y using multiple predictor variables X1,…,Xp.
- Equation form: For n independent and identically distributed observations (xi1,…,xip,yi), the model is: yi=β0+β1xi1+⋯+βpxip+εi where εi represents the unexplained error.
- Matrix form: The model can be expressed as: Y=Xβ+ε where Y is the n×1 vector of observations, X is the n×(p+1) design matrix (with a column of ones for β0), β is the (p+1)×1 vector of coefficients, and ε is the n×1 vector of errors.
6.2 Assumptions on error terms
The core assumptions for valid inference in multiple linear regression concern the error term ε:
- H1: Zero mean: E(ε)=0. The expected error is zero.
- H2: Homoscedasticity: Var(ε)=σ2In. The errors have constant variance σ2, and they are uncorrelated. In is the identity matrix of order n.
- H3: Uncorrelated errors: cov(εi,εj)=0 for i=j.
- H4: Normality: ε∼N(0,σ2In). Errors are normally distributed. This assumption is crucial for statistical inference.
🔑 Important: The design matrix X must have full column rank, meaning XTX is invertible. This prevents perfect multicollinearity, where a predictor is a linear combination of others, rendering it redundant.
6.3 Ordinary Least Squares (OLS) estimation
- Definition: The OLS estimator β^ is the vector of coefficients that minimizes the sum of squared residuals: β^=argmin∣∣Y−Xβ∣∣2
- Proposition: Under the full column rank assumption for X, the unique OLS estimator is: β^=(XTX)−1XTY
- Properties of β^:
- Unbiasedness: E(β^)=β. OLS provides an unbiased estimate of the true coefficients.
- Minimum Variance (Gauss-Markov Theorem): Among all linear unbiased estimators (BLUE), OLS has the smallest variance.
- Variance: V(β^)=σ2(XTX)−1.
- Error variance estimation: The unbiased estimator for σ2 is: σ^2=n−p−1∣∣ε^∣∣2 where ε^=Y−Xβ^ is the vector of estimated residuals.
6.4 Distributions of estimators
Under assumption H4 (normality of errors) and full column rank of X:
- Distribution of β^: β^∼N(β,σ2(XTX)−1)
- Distribution of σ^2: σ2(n−p−1)σ^2∼χn−p−12
- Independence: β^ and σ^2 are independent.
6.5 Confidence intervals for βi
- T-statistic: For individual coefficients βi (i=0,…,p), the statistic is: Ti=σ^[(XTX)−1]iiβ^i−βi∼tn−p−1 where [(XTX)−1]ii is the i-th diagonal element of (XTX)−1.
- Bilateral Confidence Interval: A (1−α) level confidence interval for βi is: [β^i−tn−p−1,(1−α/2)[(XTX)−1]iiσ^,β^i+tn−p−1,(1−α/2)[(XTX)−1]iiσ^]
6.6 Model validation
Model validation assesses the goodness-of-fit and predictive capability of the regression model.
| Metric | Formula | Interpretation |
|---|---|---|
| Coefficient of Determination (R2) | R2=1−SCTSCR | Proportion of variance in Y explained by X1,…,Xp. Ranges from 0 to 1. |
| Adjusted R2 (Ra2) | Ra2=1−n−p−1n−1(1−R2) | Penalizes the addition of irrelevant predictors. Useful for comparing models with different numbers of predictors. Can be negative. |
| Prediction Interval | y^n+1±tn−p−1,(1−α/2)σ^xn+1T(XTX)−1xn+1+1 | Interval for a new individual observation yn+1, accounting for both estimation error and inherent variability of yn+1. |
🔑 Important: While R2 always increases or stays the same when adding variables, Ra2 can decrease if the added variable does not improve the fit sufficiently. Ra2 is primarily useful for comparing nested models.
6.7 Significance tests
Tests are employed to determine the statistical significance of the overall model and individual predictors.
| Test | Null Hypothesis (H0) | Alternative Hypothesis (H1) | Test Statistic |
|---|---|---|---|
| Global Model Significance | β1=β2=⋯=βp=0 | ∃j s.t. βj=0 | F=SCR/(n−p−1)SCE/p=(1−R2)/(n−p−1)R2/p |
| Individual Coefficient (βj) | βj=0 | βj=0 | Tj=σ^β^jβ^j∼tn−p−1 |
| Block of Coefficients | β1=⋯=βq=0 | ∃j∈{1,…,q} s.t. βj=0 | F=(1−Rfull2)/(n−p−1)(Rfull2−Rreduced2)/q (using R2 from nested models) |
📝 Example: The global model test (F-test) is equivalent to testing the significance of R2. If H0 is rejected, the model as a whole is statistically significant. For individual coefficients, rejecting H0 suggests that the predictor Xj is significantly associated with Y, controlling for other variables in the model.
6.8 Model selection criteria
When faced with multiple potential predictor variables, various criteria aid in selecting the most parsimonious and effective model:
| Criterion | Objective | Formula | Notes |
|---|---|---|---|
| R2 | Maximize explained variance. | R2=1−SCTSCR | Favors models with more variables; not suitable for comparing models with differing numbers of predictors. |
| Adjusted R2 | Maximize explained variance, penalizing complexity. | Ra2=1−n−p−1n−1(1−R2) | Better for comparing models with different numbers of predictors. |
| AIC | Minimize information loss. | AIC=nln(nSCR)+2(p+1) | Balances model fit with the number of parameters. |
| BIC | Minimize information loss, stronger penalty for complexity. | BIC=nln(nSCR)+ln(n)(p+1) | Tends to select more parsimonious models than AIC. |
6.9 Model selection techniques
Systematic procedures are used to select predictor variables:
| Technique | Description |
|---|---|
| Forward Selection | Starts with no predictors. Iteratively adds the predictor that most improves the model fit (e.g., lowest p-value) until no further significant improvement is found. |
| Backward Elimination | Starts with all predictors. Iteratively removes the predictor that least contributes to the model (e.g., highest p-value) until all remaining predictors are significant. |
| Stepwise Selection | A hybrid approach. At each step, it considers adding or removing a predictor to optimize a chosen criterion (e.g., lowest p-value for entry, highest p-value for removal). It can both add and remove variables in a single step. |
| Partial F-test | Used within forward and backward selection to assess the marginal contribution of a variable. It tests the null hypothesis that a block of coefficients is zero. |
🔑 Important: Model selection methods like forward, backward, and stepwise selection help navigate the trade-off between model complexity and explanatory power, aiming for models that are both statistically sound and interpretable.
© 2026 Maeve. All rights reserved. This content is protected by copyright.