Introduction to Econometrics with R Study Guide and Chapter Summaries – Hanck et al. (2026) BS Economics/BS Stats

BS Economics and BS Statistics students can use Introduction to Econometrics with R to learn undergraduate econometrics by running the methods themselves. Christoph Hanck, Martin Arnold, Alexander Gerber and Martin Schmelzer wrote it at the University of Duisburg-Essen as an R companion to Stock and Watson’s Introduction to Econometrics. The free book has 16 chapters, from a probability review to regression, panel data, instrumental variables and time series, and the official site also offers a PDF edition.

Each chapter works through empirical applications from the textbook, such as test scores and class size, traffic deaths, mortgage denials and orange juice prices, with R code you can copy and run. It leaves out most derivations and proofs, so use it as a lab manual beside your lecture notes, not as a stand-alone textbook. It is licensed under CC BY-NC-SA 4.0 and was last updated in April 2026.

Book Overview

CourseEconometrics
Degree ProgramsBS Economics, BS Statistics
LevelUniversity / Undergraduate (introductory)
EditionOnline edition, last updated April 4, 2026 (no edition number); built with R 4.4.3
AuthorsChristoph Hanck, Martin Arnold, Alexander Gerber, Martin Schmelzer
InstitutionChair of Econometrics, University of Duisburg-Essen
Companion ToStock and Watson, Introduction to Econometrics (Third Update, Global Edition)
Total Chapters16
ExercisesInteractive R exercises at the end of Chapters 2 to 13
SoftwareR and RStudio
LanguageEnglish
LicenseCC BY-NC-SA 4.0 International
FormatFree online book (HTML) with an official PDF edition

Chapter List

Chapter 1: Introduction

Difficulty: Easy · Key topics: R and CRAN, reproducible research, Stock and Watson companion, code chunks, interactive exercises, RStudio, vectors, functions

The first chapter explains why the authors wrote an R companion for undergraduate econometrics. R is free, open source and backed by more than 11,000 CRAN add-on packages when the project began, and an R script documents every analysis step so others can re-run and check it. The authors say plainly that the book is neither a full econometrics textbook nor a general R course, and that it leaves out derivations and proofs. They then show how the interactive exercises and code chunks work. Section 1.2 is a short primer on R and RStudio: the four panes, vectors, functions and help pages. Section 1.1 is the colophon with the session information.

Key Points:

  • The book is an empirical companion to Stock and Watson’s Introduction to Econometrics (Third Update, Global Edition), not a replacement for it.
  • Code chunks come with a copy button, and R output is printed behind #> so you can tell it apart from code.
  • Interactive exercises run in a DataCamp Light widget with Run, Hint and Solution buttons plus a real R console.
  • Reproducible reports are built with the knitr, R Markdown and bookdown packages.
  • Section 1.2 is for readers who have never used R; readers who know basic R can start at Chapter 2.

Practice Tip: Install R and RStudio, then run the book’s first example, the line that counts the packages on CRAN with nrow(available.packages()). Afterwards type ?mean to open a help page and run the examples at its bottom.

Common Mistake: Treating this book as a stand-alone econometrics textbook. It skips derivations and proofs on purpose, so the theory has to come from Stock and Watson or your lecture notes.

Important Questions:

  • Why does the book teach econometrics with R? R is free and open source, it documents each step of an analysis, and its results are reproducible, so other people can re-run and check an empirical study.
  • Is this book a replacement for Stock and Watson? No. The authors call it an empirical companion: it shows how to replicate the textbook’s applications in R and leaves most theory to the textbook.

Chapter 2: Probability Theory

Difficulty: Easy · Key topics: random variables, Bernoulli trials, expected value, variance, normal, chi-squared, t and F distributions, random sampling, law of large numbers, central limit theorem

This chapter reviews the probability that regression relies on and shows how to compute it with the stats package in base R. Section 2.1 starts from outcomes and random variables, then covers discrete distributions, Bernoulli trials, expected value, mean and variance, and continuous densities. It introduces the four distributions econometrics uses most: normal, chi-squared, Student t and F. Section 2.2 turns to random sampling and the distribution of the sample average, using a dice-rolling example. It gives the mean and variance of the sample mean and then the large-sample results, the law of large numbers and the central limit theorem, checked by simulation. The chapter ends with exercises on each distribution.

Key Points:

  • The expected value of a discrete random variable is an average of its outcomes weighted by their probabilities; the variance measures the spread around it.
  • In R, density, probability, quantile and random-draw functions follow one naming pattern, such as dnorm, pnorm, qnorm and rnorm.
  • The chi-squared, t and F distributions are all built from standard normal variables and are the source of most test critical values.
  • For i.i.d. draws, the sample mean has mean μ and variance σ²/n, so it becomes more precise as n grows.
  • The law of large numbers says the sample mean converges in probability to the population mean; the central limit theorem says its standardised version is approximately standard normal for large n.

Practice Tip: Use set.seed(), replicate() and rnorm() or sample() to draw many samples, then plot a histogram of the sample averages for n = 5, 10 and 100. You will see the bell shape appear as n grows.

Common Mistake: Treating the value returned by dnorm as a probability. It is the height of the density curve; probabilities come from pnorm or from integrating the density.

Important Questions:

  • What does the central limit theorem say? For i.i.d. draws with finite variance, the standardised sample average is approximately standard normal when n is large, whatever the shape of the original distribution.
  • Why is the sample mean a random variable? It is computed from randomly drawn observations, so it changes from sample to sample; its distribution has mean μ and variance σ²/n.

Chapter 3: A Review of Statistics using R

Difficulty: Medium · Key topics: estimators, bias, consistency, efficiency, hypothesis tests, p-value, t-statistic, confidence intervals, two-sample comparison, covariance, correlation

Chapter 3 applies probability to inference about an unknown population mean. It separates estimators, which are random variables, from estimates, which are numbers, and judges estimators by bias, consistency and efficiency. The longest section covers hypothesis tests: null and alternative, the p-value with known and unknown standard deviation, the standard error, the t-statistic, significance levels, type I and type II errors and one-sided alternatives. Then come confidence intervals, a test for the difference between two population means, and a replication of the gender gap in earnings application from Stock and Watson using the readxl and dplyr packages. The last section covers scatterplots, sample covariance and correlation.

Key Points:

  • An estimator is a function of the sample and is random; an estimate is the number it produces for one sample.
  • The sample mean is the least squares estimator of the population mean, and random sampling is what makes it unbiased.
  • The standard error of the sample mean is the sample standard deviation divided by sqrt(n).
  • The t-statistic is (sample mean − hypothesised mean) / standard error; compare it with critical values or turn it into a p-value.
  • A type I error rejects a true null; a type II error fails to reject a false null.
  • A 95% confidence interval is a recipe that covers the true value in 95% of repeated samples.

Practice Tip: Simulate a sample with rnorm(), run t.test() on it, and then rebuild the t-statistic and confidence interval by hand from mean(), sd() and sqrt(). The numbers should match.

Common Mistake: Reading the p-value as the probability that the null hypothesis is true. It is the probability, assuming the null is true, of getting a statistic at least as extreme as the one observed.

Important Questions:

  • What is a p-value? The probability, computed under the null hypothesis, of drawing a test statistic at least as extreme as the one found in the sample.
  • How is a 95% confidence interval interpreted? If you repeated the sampling many times, about 95% of the intervals built this way would contain the true population mean; any single interval either does or does not.

Chapter 4: Linear Regression with One Regressor

Difficulty: Medium · Key topics: simple linear regression, OLS estimator, residuals, R-squared, standard error of the regression, least squares assumptions, sampling distribution of OLS

This chapter introduces simple linear regression with one running example: the relation between the student-teacher ratio and test scores, first on a few made-up districts and then on the California school districts data. It sets out the model and its terminology, then computes the OLS slope and intercept by hand with mean() and sum() before using lm(), and shows predicted values and residuals. Measures of fit follow: the coefficient of determination and the standard error of the regression. The three least squares assumptions come next, and three simulation studies show that the OLS estimators are approximately normal in large samples.

Key Points:

  • The model is Y = β0 + β1 X + u, where the error term u collects every other influence on Y.
  • OLS chooses the intercept and slope that minimise the sum of squared residuals.
  • R-squared is the share of the sample variance of Y explained by X; the standard error of the regression is the typical size of a residual in the units of Y.
  • Assumption 1: the error has conditional mean zero given X. Assumption 2: the observations are i.i.d. Assumption 3: large outliers are unlikely.
  • Under these assumptions OLS is consistent and approximately normal in large samples, which is what the later tests rely on.

Practice Tip: Compute the slope as the sample covariance of X and Y divided by the sample variance of X, then compare it with the coefficient from lm() on the same data. They are identical.

Common Mistake: Reading the slope as a causal effect because the fit looks good. It only has that meaning if the conditional-mean-zero assumption holds, and R-squared says nothing about that.

Important Questions:

  • What are the three least squares assumptions? The error has conditional mean zero given X; the pairs (X, Y) are independent and identically distributed; large outliers are unlikely.
  • What does R-squared measure? The fraction of the sample variance of Y that the regression on X explains, between 0 and 1.

Chapter 5: Hypothesis Tests and Confidence Intervals in the Simple Linear Regression Model

Difficulty: Medium · Key topics: t-statistic for the slope, confidence intervals, binary regressor, heteroskedasticity, robust standard errors, Gauss-Markov theorem, small samples

Chapter 5 uses the large-sample normality of OLS to test hypotheses about the slope. It gives the general t-statistic, two-sided tests of the slope with p-values from summary(), confidence intervals with confint() and a simulation showing about 95% coverage. A section on regression with a binary regressor shows that the slope on a dummy variable is a difference in group means. The core of the chapter is heteroskedasticity versus homoskedasticity, with a real-world example, a discussion of whether it matters, and robust standard errors with vcovHC(). It ends with the Gauss-Markov theorem, a BLUE simulation, and the t-statistic in small samples.

Key Points:

  • The slope’s t-statistic is (estimate − hypothesised value) / standard error, and it is compared with the standard normal in large samples.
  • The slope on a 0/1 dummy equals the difference between the two group means.
  • The error is homoskedastic if its variance given X is constant, and heteroskedastic otherwise; the default summary() standard errors assume the first case.
  • Robust standard errors come from vcovHC() in the sandwich package, used with coeftest() from lmtest.
  • Gauss-Markov: under the least squares assumptions plus homoskedasticity, OLS is the best linear unbiased estimator (BLUE).
  • With a small sample, t-based inference is exact only if the errors are normal and homoskedastic.

Practice Tip: Fit one model with lm(), then print summary() and coeftest() with a vcovHC covariance side by side. Compare the standard errors and see how much the conclusion depends on them.

Common Mistake: Reporting the default standard errors when the error variance changes with X. In applied work, robust standard errors are the safer default.

Important Questions:

  • When are the default standard errors invalid? When the error is heteroskedastic, meaning its variance depends on X; use heteroskedasticity-robust standard errors instead.
  • What does the Gauss-Markov theorem say? If the least squares assumptions and homoskedasticity hold, OLS has the smallest variance among all linear unbiased estimators.

Chapter 6: Regression Models with Multiple Regressors

Difficulty: Medium · Key topics: omitted variable bias, multiple regression, adjusted R-squared, perfect multicollinearity, dummy variable trap, imperfect multicollinearity

The chapter begins with a flaw in the earlier test score regressions: ignoring other determinants of the outcome that correlate with class size. Section 6.1 defines omitted variable bias and when it arises. Section 6.2 introduces the multiple regression model, where each coefficient is the effect of one regressor with the others held fixed, and estimates it with lm(). Section 6.3 covers the standard error of the regression, R-squared and adjusted R-squared. Section 6.4 adds a fourth assumption, no perfect multicollinearity, with examples including the dummy variable trap, and a simulation of imperfect multicollinearity. Section 6.5 gives the large-sample distribution of the OLS estimators.

Key Points:

  • Omitted variable bias needs two things: the left-out variable affects Y, and it is correlated with an included regressor.
  • Each coefficient in multiple regression is the effect of a one-unit change in that regressor, holding the other regressors constant.
  • R-squared never falls when you add a regressor; adjusted R-squared penalises extra regressors.
  • Perfect multicollinearity means one regressor is an exact linear function of the others, and R reports NA for the coefficient it cannot estimate.
  • The dummy variable trap appears when you include a dummy for every category together with an intercept.
  • Imperfect multicollinearity does not break OLS, but it inflates the variance of the affected coefficients.

Practice Tip: Add a copy of a regressor, rescaled to different units, to an lm() formula and look at the summary. The NA in the output is perfect multicollinearity in action.

Common Mistake: Adding variables just to raise R-squared. A variable belongs in the model because of the causal question and omitted variable bias, not because it improves the fit.

Important Questions:

  • When does omitted variable bias occur? When an omitted variable is both a determinant of Y and correlated with an included regressor; the included regressor then picks up part of its effect.
  • What is the dummy variable trap? Including a dummy variable for every category along with an intercept, which makes the dummies sum to the constant column and creates perfect multicollinearity.

Chapter 7: Hypothesis Tests and Confidence Intervals in Multiple Regression Models

Difficulty: Medium · Key topics: single-coefficient tests, robust standard errors, joint hypotheses, F-statistic, confidence sets, model specification, control variables

Chapter 7 extends inference to the multiple regression model. Section 7.1 tests and builds confidence intervals for one coefficient. Section 7.2 does this for the test score regression with extra controls, using confint() and heteroskedasticity-robust standard errors. Section 7.3 handles joint hypotheses with the F-statistic and the linearHypothesis() function, and section 7.4 draws confidence sets for two coefficients as an ellipse with confidenceEllipse(). Section 7.5 discusses model specification, omitted variable bias, and what R-squared and adjusted R-squared do and do not tell you. Section 7.6 compares several specifications of the test score regression in one table.

Key Points:

  • A single coefficient is tested with a t-statistic and an interval built from a robust standard error.
  • A joint hypothesis, such as two coefficients both equal to zero, needs an F-statistic; separate t-tests are not a substitute.
  • linearHypothesis() from the car package tests linear restrictions and can use a robust covariance matrix.
  • A confidence set for two coefficients is an ellipse, not a rectangle formed by two single intervals.
  • Control variables are added to reduce omitted variable bias in the coefficient of interest; their own coefficients need not have a causal reading.
  • R-squared and adjusted R-squared do not show that omitted variable bias is gone or that a coefficient is causal.

Practice Tip: Test whether two coefficients are jointly zero with linearHypothesis(), and compare the answer with the two separate t-tests in coeftest(). They can disagree.

Common Mistake: Concluding from two insignificant t-statistics that both coefficients are zero together. The joint F-test can still reject, especially when the regressors are correlated.

Important Questions:

  • Why use an F-test instead of separate t-tests? Separate tests ignore the correlation between the estimators and cannot control the overall significance level; the F-statistic tests all restrictions at once.
  • What does a confidence ellipse show? The set of coefficient pairs that would not be rejected at the chosen level, so it reflects the correlation between the two estimates.

Chapter 8: Nonlinear Regression Functions

Difficulty: Medium · Key topics: polynomials, logarithms, log-log elasticity, interactions, binary and continuous variables, nonlinear effects on test scores

This chapter drops the assumption that a regressor has the same effect at every level. Section 8.1 gives a general strategy and shows a curved relation between district income and test scores. Section 8.2 covers polynomial terms and the three logarithm cases (log of X, log of Y, and both), and how to read each coefficient. Section 8.3 covers interactions between two binary variables, a binary and a continuous variable, and two continuous variables, with a demand-for-economic-journals example. Section 8.4 returns to test scores and asks whether the class-size effect depends on the share of English learners and on district income.

Key Points:

  • In a nonlinear model the effect of a change in X depends on the level of X, so compute predicted values at two X values and compare them.
  • Polynomial terms are written in R with I(income^2) or poly().
  • In a log-log regression the slope is an elasticity: the percent change in Y for a one percent change in X.
  • Taking the log of only Y or only X changes the interpretation to percent change per unit, or unit change per percent.
  • An interaction between a dummy and a continuous variable lets two groups have different slopes.
  • A joint F-test on the added nonlinear terms checks whether the relationship is linear at all.

Practice Tip: Draw a scatterplot, then add the fitted lines from a linear, a quadratic and a log specification with lines() on sorted X values. Seeing the curves side by side shows which functional form fits.

Common Mistake: Reading the coefficient on a squared term as a slope. The slope of the fitted curve is the sum of the linear coefficient and twice the squared coefficient times X.

Important Questions:

  • How is a log-log coefficient interpreted? As an elasticity: a one percent increase in X is associated with a change of that many percent in Y.
  • What does an interaction between a binary and a continuous variable allow? A different slope, and optionally a different intercept, for each group defined by the binary variable.

Chapter 9: Assessing Studies Based on Multiple Regression

Difficulty: Medium · Key topics: internal validity, external validity, omitted variable bias, functional form misspecification, measurement error, sample selection, simultaneous causality

Chapter 9 is mostly conceptual: how to judge whether a regression study can be trusted. Section 9.1 defines internal validity, meaning the causal conclusions hold for the population studied, and external validity, meaning they carry over to other populations and settings. Section 9.2 goes through five threats to internal validity, each with a short R simulation: omitted variable bias, functional form misspecification, errors-in-variables, missing data and sample selection, and simultaneous causality, plus causes of inconsistent standard errors. Section 9.3 covers forecasting, and section 9.4 applies the checklist to the California and Massachusetts test score studies.

Key Points:

  • Internal validity is about the study population; external validity is about generalising to other populations and settings.
  • Noise in a regressor (errors-in-variables) generally pulls the estimated coefficient toward zero.
  • Sample selection bias arises when the reason an observation is missing is related to the outcome.
  • Simultaneous causality means X affects Y and Y also affects X, as with price and quantity in a market.
  • A forecasting regression does not need a causal reading, but it does need the future to resemble the sample period.
  • More data shrinks the variance of an estimator but does not remove bias.

Practice Tip: Simulate X and Y with a known slope, add random measurement noise to X, and refit with lm(). The estimated slope comes out smaller than the true one.

Common Mistake: Assuming a very large sample fixes a biased regression. The bias from an omitted variable or from simultaneous causality does not shrink as n grows.

Important Questions:

  • What is the difference between internal and external validity? Internal validity asks whether the causal inference is correct for the population studied; external validity asks whether it generalises beyond it.
  • Name three threats to internal validity. Omitted variable bias, measurement error in the regressors, and simultaneous causality (others are functional form misspecification and sample selection).

Chapter 10: Regression with Panel Data

Difficulty: Hard · Key topics: panel data, before-and-after comparison, entity fixed effects, time fixed effects, clustered standard errors, traffic deaths and beer taxes

Chapter 10 shows how panel data, the same entities observed over several periods, can reduce omitted variable bias. Section 10.1 sets out the notation and the running example of traffic deaths and alcohol taxes across US states. Section 10.2 compares two years, 1982 and 1988, to remove state traits that do not change. Section 10.3 introduces entity fixed effects, estimated with dummies or the entity-demeaned algorithm in the plm package. Section 10.4 adds time fixed effects, and section 10.5 gives the fixed effects assumptions and clustered standard errors. Section 10.6 adds drinking-age, punishment and economic variables to the traffic study.

Key Points:

  • Panel data observe n entities over T periods, written (X_it, Y_it), with T of at least 2.
  • Entity fixed effects control for unobserved factors that differ across entities but stay constant over time.
  • Time fixed effects control for factors that change over time but are the same for every entity.
  • Software uses entity-demeaned OLS instead of estimating n extra dummy coefficients.
  • Clustered standard errors allow errors to be correlated within an entity over time, but not across entities.

Practice Tip: Estimate the traffic fatality model once with state dummies in lm() and once with plm(), and check that the beer tax coefficient is the same in both.

Common Mistake: Using ordinary standard errors on panel data. Observations from the same entity are correlated over time, so the standard errors come out too small.

Important Questions:

  • What do entity fixed effects control for? Any omitted variable that differs across entities but does not change over time, such as a state’s culture or road layout.
  • Why cluster the standard errors? Because errors for the same entity in different periods are usually correlated, which breaks the usual formulas.

Chapter 11: Regression with a Binary Dependent Variable

Difficulty: Hard · Key topics: linear probability model, probit, logit, maximum likelihood, predicted probabilities, pseudo R-squared, mortgage denial

The dependent variable in this chapter is 0 or 1, so the regression function becomes a conditional probability. Section 11.1 introduces the linear probability model on Boston mortgage application (HMDA) data and shows its flaw: it can predict probabilities below 0 or above 1. Section 11.2 presents probit and logit regression, which use an S-shaped function to keep predictions between 0 and 1, and compares the three models. Section 11.3 explains estimation by nonlinear least squares and maximum likelihood, and measures of fit. Section 11.4 asks whether race affects mortgage denial, adding applicant and loan characteristics. Estimated effects are about 4 to 5 percentage points.

Key Points:

  • In the linear probability model the coefficient is the change in the probability that Y = 1 for a one-unit change in X.
  • Probit uses the standard normal cumulative distribution function; logit uses the logistic function.
  • Probit and logit coefficients are not marginal effects; compute predicted probabilities at chosen X values and take the difference.
  • These models are nonlinear in the parameters, so they are estimated by maximum likelihood with glm() and a binomial family.
  • Measures of fit built from the log-likelihood, such as pseudo R-squared, replace the usual R-squared.

Practice Tip: Fit the same model as a linear probability model with lm() and as probit and logit with glm(), then use predict() at a low and a high value of the payment-to-income ratio and compare the three answers.

Common Mistake: Reading a probit or logit coefficient as a change in probability. It is a change in the index inside the S-shaped function, and the effect on probability depends on where you start.

Important Questions:

  • Why prefer probit or logit to the linear probability model? They keep predicted probabilities between 0 and 1 and allow the effect of X to depend on its level.
  • How are probit and logit estimated? By maximum likelihood, which chooses the coefficients that make the observed 0/1 outcomes most probable; OLS cannot be used because the models are nonlinear in the parameters.

Chapter 12: Instrumental Variables Regression

Difficulty: Hard · Key topics: endogeneity, instruments, two-stage least squares, relevance, exogeneity, weak instruments, J-test, demand for cigarettes

Chapter 12 deals with a regressor that is correlated with the error term, for example through omitted variables, measurement error or simultaneous causality, so OLS is inconsistent. Section 12.1 introduces an instrument and two-stage least squares with one regressor and one instrument, applied to cigarette demand. Section 12.2 extends this to the general IV model with included exogenous variables, several endogenous regressors and several instruments, and states the two conditions for valid instruments. Section 12.3 shows how to check them: a first-stage F rule of thumb for weak instruments, and the J-test of overidentifying restrictions. Section 12.4 estimates the demand elasticity with ivreg(), and section 12.5 discusses where instruments come from.

Key Points:

  • A valid instrument must be relevant (correlated with the endogenous regressor) and exogenous (uncorrelated with the error term).
  • Two-stage least squares first regresses the endogenous regressor on the instruments, then uses its fitted values in the second stage.
  • Weak instruments give unreliable estimates; a first-stage F-statistic below 10 is the common warning sign.
  • The J-test checks the extra instruments, and it needs more instruments than endogenous regressors.
  • Use ivreg() from the AER package, because standard errors from a hand-run second stage are wrong.

Practice Tip: Run the two stages by hand with lm() and compare the coefficient with ivreg(). The estimates agree but the standard errors do not, which shows why the packaged function matters.

Common Mistake: Choosing an instrument only because it is strongly correlated with X. Relevance is testable, but exogeneity needs an economic argument, and with exactly as many instruments as regressors it cannot be tested at all.

Important Questions:

  • What are the two conditions for a valid instrument? Relevance, meaning it is correlated with the endogenous regressor, and exogeneity, meaning it is uncorrelated with the error term.
  • What does the J-test check? Whether the additional instruments are exogenous, when there are more instruments than endogenous regressors.

Chapter 13: Experiments and Quasi-Experiments

Difficulty: Medium · Key topics: potential outcomes, randomised experiments, differences estimator, threats to validity, STAR experiment, differences-in-differences, regression discontinuity

Chapter 13 covers program evaluation, where the goal is to measure the causal effect of a policy. Section 13.1 defines potential outcomes, the average causal effect and the differences estimator in an ideal randomised experiment. Section 13.2 lists threats to the validity of experiments, such as failure to randomise and failure to follow the treatment protocol. Section 13.3 analyses the Tennessee STAR class size experiment: about 6,400 students in 80 schools, randomly assigned to small, regular and regular-with-aide classes. Section 13.4 turns to quasi-experiments, with the differences-in-differences estimator and sharp and fuzzy regression discontinuity designs estimated with the rddtools package.

Key Points:

  • The average causal effect is the expected difference between the treated and untreated potential outcomes.
  • With random assignment, the differences estimator (a regression on a treatment dummy) is unbiased for that effect.
  • An F-test of treatment on pre-treatment characteristics can check whether randomisation worked.
  • Differences-in-differences compares the change over time in a treated group with the change in a control group.
  • Regression discontinuity exploits a cutoff in a running variable that determines treatment; the design can be sharp or fuzzy.

Practice Tip: On the STAR data, regress a test score on the small-class and aide dummies with lm(), then add school or student controls and see whether the treatment estimates move. In a clean experiment they should not move much.

Common Mistake: Calling any treated-versus-untreated comparison an experiment. Without random assignment the difference mixes the treatment effect with pre-existing differences between the groups.

Important Questions:

  • What does the differences-in-differences estimator compare? The before-to-after change in the outcome for the treatment group against the same change for the control group, which removes fixed group differences and common time effects.
  • Why can randomisation identify a causal effect? Random assignment makes treatment independent of every other determinant of the outcome, so the simple difference in means is unbiased.

Chapter 14: Introduction to Time Series Regression and Forecasting

Difficulty: Hard · Key topics: lags and differences, autocorrelation, autoregressions, ADL model, Granger causality, BIC, unit roots, structural breaks, forecasting

This chapter moves from cross-section to time series data and to forecasting. It starts with the difference between estimating causal effects and forecasting, then covers lags, differences, logarithms, growth rates and autocorrelation using quarterly US GDP. Autoregressions and the forecast of GDP growth follow, then a first test of whether stock returns can be predicted. Later sections add predictors in the ADL model with Granger causality tests and forecast intervals, choose the number of lags by information criteria, and treat nonstationarity: trends and the ADF unit root test, then breaks and the QLR test. The closing market-forecasting section tests dividend yield as a predictor.

Key Points:

  • Time series data follow one entity over time, and values are usually correlated from one period to the next (serial correlation).
  • An AR(p) model regresses a series on its own p lags; an ADL model also includes lags of other variables.
  • A Granger causality test is an F-test that the lags of X add no predictive power for Y.
  • BIC and AIC choose the lag length; too many lags raise the variance of the forecast.
  • A stochastic trend (unit root) can be tested with the ADF test, and a break in coefficients with the QLR test.
  • The stock return models in the market-efficiency section find no significant predictors, consistent with efficient markets.

Practice Tip: Build a quarterly series with ts(), estimate an AR(2) model with dynlm(), and compare the BIC for lag lengths 1 to 4. The book writes a short function for the BIC, which is good practice in itself.

Common Mistake: Regressing one trending series on another and trusting the t-statistics. If a series has a stochastic trend, the usual tests and confidence intervals can be badly misleading.

Important Questions:

  • What is an autoregressive (AR) model? A regression of a time series variable on its own past values, used heavily for forecasting.
  • What does the ADF test check? Whether a series has a unit root, meaning a stochastic trend, as the null hypothesis against a stationary alternative.

Chapter 15: Estimation of Dynamic Causal Effects

Difficulty: Hard · Key topics: distributed lag model, dynamic multipliers, cumulative multipliers, exogeneity, HAC standard errors, strict exogeneity, GLS, orange juice prices

Chapter 15 asks how a change in X affects Y now and in later periods, and answers it with one data set: the price of frozen orange juice concentrate and freezing degree days in Orlando. Section 15.1 introduces the data and plots. Section 15.2 defines the dynamic causal effect and the distributed lag model, and what exogeneity means for time series. Section 15.3 defines dynamic and cumulative dynamic multipliers. Section 15.4 explains HAC standard errors, which allow for heteroskedasticity and serial correlation, computed with the sandwich package. Section 15.5 treats strictly exogenous regressors, quasi-differencing and GLS. Section 15.6 estimates how persistent a freeze effect is and whether it is stable.

Key Points:

  • A dynamic causal effect is the effect on Y of a change in X over the following periods, not only today.
  • The h-period dynamic multiplier is a coefficient in the distributed lag model; the cumulative multiplier adds them up.
  • Errors in distributed lag models are often serially correlated, so inference needs HAC (Newey-West) standard errors.
  • Under strict exogeneity, GLS or an OLS regression of the ADL form can give more precise estimates.
  • Distributed lag models are estimated with dynlm(), and NeweyWest() supplies the covariance matrix.

Practice Tip: Fit a distributed lag model with dynlm() using L() for lags and plot the estimated multipliers against the lag. The shape of the curve shows how quickly the effect fades.

Common Mistake: Using ordinary OLS standard errors in a distributed lag model. With serially correlated errors they are too small, so use HAC standard errors.

Important Questions:

  • What is a dynamic multiplier? The effect on Y, h periods later, of a one-unit change in X today; the cumulative multiplier is the running sum of these effects.
  • Why use HAC standard errors? They stay valid when the regression error is both heteroskedastic and serially correlated.

Chapter 16: Additional Topics in Time Series Regression

Difficulty: Hard · Key topics: vector autoregressions, iterated and direct forecasts, order of integration, DF-GLS test, cointegration, ARCH, GARCH, volatility clustering

The last chapter covers four advanced topics. Section 16.1 introduces vector autoregressions with the vars package, forecasting GDP growth and the term spread together, with iterated and direct multiperiod forecasts. Section 16.2 explains orders of integration and the DF-GLS unit root test from the urca package. Section 16.3 defines cointegration, a common stochastic trend between series, tests for it, and applies it to short and long-term interest rates. Section 16.4 covers volatility clustering in financial data and the ARCH and GARCH models, fitted with garchFit() on stock price volatility. Structural VARs are left out as beyond the book’s scope.

Key Points:

  • A VAR models several time series together, each as a function of the lags of all of them.
  • An iterated multiperiod forecast repeats the one-step forecast; a direct forecast regresses on lags chosen for the horizon.
  • A series is integrated of order 1, I(1), if its first difference is stationary.
  • Two I(1) series are cointegrated if some combination of them is stationary, so they share a common stochastic trend.
  • ARCH and GARCH models let the conditional variance of the error change over time, which fits volatility clustering.

Practice Tip: Fit a two-variable VAR with VAR(), call predict() on it and plot the forecasts. Then check the lag order against the BIC from Chapter 14.

Common Mistake: Differencing every trending series automatically. If the series are cointegrated, differencing throws away the long-run relationship that a vector error correction model would keep.

Important Questions:

  • What does cointegration mean? Two or more I(1) series move together because a linear combination of them is stationary, which means they share a common stochastic trend.
  • What problem do ARCH and GARCH models address? Volatility clustering: periods of high volatility tend to be followed by high volatility, so the error variance is not constant over time.

How to Study This Book

Do not read this book on its own if you are new to econometrics. It is built to run next to Stock and Watson’s Introduction to Econometrics and follows that textbook’s chapter order, so read the matching textbook chapter first for the theory, then work through the chapter here with R open. The authors say they leave out derivations and proofs wherever they can, which is why this pairing matters.

Start with Chapter 1 even if you plan to skip ahead, because Section 1.2 is a short R and RStudio primer. If you have never used R, spend an evening on it and on the exercises in Chapter 2. If you already write R, begin at Chapter 2, which is a quick review of probability with R code.

Chapters 2 and 3 are the foundation. Everything in the regression chapters rests on the sampling distribution of the sample mean, the t-statistic and the confidence interval. Do not rush them.

Chapters 4 to 8 are the core of a first econometrics course: simple regression, inference, multiple regression, joint tests and nonlinear functions. Read them in order. Chapter 6 (omitted variable bias) is the idea that Chapters 9, 10, 12 and 13 all try to fix in different ways.

Chapters 9 to 13 can be read in a different order depending on your syllabus. Chapter 9 is mostly conceptual and is the right place to pause and review. Chapter 10 (panel data) and Chapter 11 (binary outcomes) are independent of each other. Chapter 12 (instrumental variables) and Chapter 13 (experiments and quasi-experiments) both assume you are comfortable with omitted variable bias and endogeneity.

Chapters 14 to 16 are a separate time series block. Read Chapter 14 before 15 and 16. Many one-semester courses stop after Chapter 14 or skip Chapter 16, so check your syllabus before assuming you need every section.

Chapters 2 to 13 end with an exercises section; Chapters 14 to 16 do not. For those later chapters, practise by rerunning the code chunks with your own data. The interactive exercises depend on a third-party widget, so keep a local R installation as a backup.

What the book does not cover: formal proofs, matrix-algebra treatment of OLS, structural VARs, and any software other than R. Plan other sources if your course needs those.


Used In These Programs

This book is used for the Econometrics course in: BS Economics · BS Statistics. Browse all Econometrics books, Regression Analysis books, R Programming books or the full Statistics category on Freebooks.pk.

Who Should Read This

This book is written for undergraduate students of BS Economics and BS Statistics who take a first econometrics course and want to see every method run in R. It suits students with little background in statistics or programming, because it starts with an R primer and reviews probability and statistics in Chapters 2 and 3. It is a companion, not a stand-alone textbook, so pair it with Stock and Watson or your lecture notes. If you are still learning the statistics, start with OpenIntro Statistics first. It is also not the right book if you need a proof-based treatment of OLS or software other than R.


Applicable Universities

This book is useful for students at Pakistani universities offering BS Economics, BS Statistics and related BS Data Science or business degrees, including Punjab University, Virtual University, COMSATS, FAST, UET, NUST, and other HEC-recognized institutions.

Official Copy of Introduction to Econometrics with R

This book is free from its official site, which offers the online chapters and a PDF edition. Click the button below to open the official site and use its PDF download option. This page links to the official source and does not host any file.

→ Visit Official Page

FAQs

Is Introduction to Econometrics with R free?

Yes. The preface states that the book is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. You can read, share and adapt it for non-commercial use with credit, and adaptations must use the same licence. The official site offers the online chapters and a PDF edition. This page links to the official site and does not host any file.

Which edition is this, and is it up to date?

The book has no edition number. The preface and the colophon show that the online version was last updated on April 4, 2026 and built with R 4.4.3. It follows Stock and Watson, Introduction to Econometrics, Third Update, Global Edition (2015), as its textbook.

Do I need the Stock and Watson textbook as well?

It is strongly recommended. The authors call this book an empirical companion to Stock and Watson and say they leave out derivations and proofs wherever they can. You can run the code without the textbook, but the theory behind each method comes from the textbook or your lectures.

Is it good for complete beginners?

It is written for beginners in both R and econometrics. Section 1.2 is a short R and RStudio primer, and Chapters 2 and 3 review probability and statistics. It is not a gentle statistics course, though, so take a basic statistics course alongside it if the ideas in Chapters 2 and 3 are new to you.

How many chapters and exercises does it have?

There are 16 chapters and no appendices. Chapters 2 to 13 each end with an exercises section of interactive R tasks. Chapters 14 to 16 on time series have no exercise section. The exercises run in a DataCamp Light widget backed by an R session on DataCamp’s servers, and the authors also provide datasets and R code through their GitHub repository.

Does it cover panel data, instrumental variables and time series?

Yes. Chapter 10 covers panel data and fixed effects, Chapter 12 instrumental variables, Chapter 13 experiments and quasi-experiments, and Chapters 14 to 16 time series regression, forecasting, VARs, cointegration and GARCH models. It does not cover matrix-algebra proofs for OLS, structural VARs or software other than R.

Related Books

Introduction to Econometrics with R turns a standard undergraduate econometrics course into code you can run, from the sampling distribution of the mean to GARCH models. Keep a textbook open for the theory, and browse more Statistics books for the rest of your semester.

Introduction to Econometrics with R by Christoph Hanck, Martin Arnold, Alexander Gerber and Martin Schmelzer, Chair of Econometrics, University of Duisburg-Essen. Licensed under CC BY-NC-SA 4.0 International. Official source: https://www.econometrics-with-r.org/. This page links to the official site and does not host or copy the book.

Leave a Comment