🚧 Under construction
Using R for Introductory Econometrics

Using R for Introductory Econometrics

2nd Edition

de Florian Heiss (2020)

Produção Independente


Using Python for Introductory Econometrics

Using Python for Introductory Econometrics

2nd Edition

de Florian Heiss, Daniel Brunner (2020)

Produção Independente



This family of books covers the application of econometric methods using the R and Python languages, such as regressions and statistical tests, along with charts and visualizations. There is also a Julia version, which I did not use. This notebook contains reproductions of the techniques described in the book, as well as in the classes of the Econometrics course at FEA-USP. The files are in HTML format, produced from markdown files.



Notes





Active study

  1. Recall Off the notes externo · general · cap-1 ●○○

    Which textbook do Heiss's books accompany, and what is their aim?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 1 — Introduction

    Reveal answer

    Wooldridge's Introductory Econometrics: they reproduce its examples and concepts in R (and in Python, in the version with Brunner), using the same datasets.

  2. Recall Off the notes externo · detail · cap-1 ●○○

    How do you access the data of Wooldridge's examples in R and in Python?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 1 — Introduction

    Reveal answer

    Through the wooldridge package: in R, data(wage1, package='wooldridge'); in Python, wooldridge.data('wage1').

  3. Recall Off the notes externo · concept · cap-2 ●○○

    What criterion defines the OLS estimators?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 2 — The Simple Regression Model

    Reveal answer

    Choosing the intercept and slope that minimize the sum of squared residuals.

  4. Recall Off the notes externo · concept · cap-2 ●●○

    How is the estimated slope computed in simple regression?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 2 — The Simple Regression Model

    Reveal answer

    β̂₁ = Cov(x, y) / Var(x); and the intercept is β̂₀ = ȳ − β̂₁·x̄.

  5. Recall Off the notes externo · detail · cap-2 ●○○

    How do you estimate wage = β₀ + β₁·educ + u in R and in Python (statsmodels)?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 2 — The Simple Regression Model

    Reveal answer

    R: lm(wage ~ educ, data = wage1). Python: smf.ols('wage ~ educ', data=wage1).fit().

  6. Recall Off the notes externo · concept · cap-2 ●○○

    What does R² measure?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 2 — The Simple Regression Model

    Reveal answer

    The fraction of the sample variation in y explained by the model: SSE/SST, or 1 − SSR/SST.

  7. Recall Off the notes externo · relationship · cap-2 ●●●

    A regression of wage on education has an R² of 0.16. Does this mean the estimate of the effect of education is useless?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 2 — The Simple Regression Model

    Reveal answer

    No: a low R² only says that many other factors affect wages; the coefficient can be unbiased if the assumptions (such as zero conditional mean) hold.

  8. Recall Off the notes externo · concept · cap-2 ●●○

    How do you interpret β₁ in log(wage) = β₀ + β₁·educ?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 2 — The Simple Regression Model

    Reveal answer

    One more year of education changes the wage by approximately 100·β₁ percent (semi-elasticity).

  9. Recall Off the notes externo · concept · cap-2 ●●○

    How do you interpret β₁ in log(salary) = β₀ + β₁·log(sales)?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 2 — The Simple Regression Model

    Reveal answer

    As an elasticity: a 1% increase in sales changes salary by approximately β₁ percent.

  10. Recall Off the notes externo · relationship · cap-2 ●●●

    In a log-level model, β̂₁ = 0.083 for education. What is the interpretation?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 2 — The Simple Regression Model

    Reveal answer

    Each year of education is associated with about 8.3% higher wages, holding everything else constant.

  11. Recall Off the notes externo · concept · cap-2 ●●○

    What are the assumptions (SLR.1–SLR.4) for simple OLS to be unbiased?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 2 — The Simple Regression Model

    Reveal answer

    Linearity in parameters, random sampling, sample variation in x and zero conditional mean of the error: E(u|x) = 0.

  12. Recall Off the notes externo · relationship · cap-2 ●●●

    In the regression of wage on education, why does innate ability threaten the assumption E(u|x) = 0?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 2 — The Simple Regression Model

    Reveal answer

    Because ability is in the error and is probably correlated with education; so E(u|educ) ≠ 0 and β̂₁ is biased.

  13. Recall Off the notes externo · concept · cap-2 ●●○

    What is the homoscedasticity assumption (SLR.5)?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 2 — The Simple Regression Model

    Reveal answer

    The variance of the error does not depend on x: Var(u|x) = σ². It is needed for the usual standard error formulas, not for unbiasedness.

  14. Recall Off the notes externo · concept · cap-3 ●○○

    Why does multiple regression help obtain ceteris paribus effects?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 3 — Multiple Regression Analysis: Estimation

    Reveal answer

    Because each coefficient measures the effect of its variable holding fixed the other variables included in the model, explicitly controlling for them.

  15. Recall Off the notes externo · concept · cap-3 ●●●

    What does the Frisch–Waugh–Lovell theorem ("partialling out") say?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 3 — Multiple Regression Analysis: Estimation

    Reveal answer

    The coefficient on x₁ in the multiple regression equals that of the simple regression of y on the residuals of x₁ regressed on the other variables.

  16. Recall Off the notes externo · concept · cap-3 ●●○

    When does omitting a relevant variable cause bias?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 3 — Multiple Regression Analysis: Estimation

    Reveal answer

    When the omitted variable affects y (β ≠ 0) and is correlated with an included regressor.

  17. Recall Off the notes externo · relationship · cap-3 ●●●

    How do you predict the sign of omitted variable bias?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 3 — Multiple Regression Analysis: Estimation

    Reveal answer

    It is the sign of β₂ (effect of the omitted variable on y) times the sign of the correlation between the omitted variable and the included regressor.

  18. Recall Off the notes externo · relationship · cap-3 ●●●

    Ability increases wages and is positively correlated with education. If omitted, is the estimated return to education biased upward or downward?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 3 — Multiple Regression Analysis: Estimation

    Reveal answer

    Upward: positive effect × positive correlation = positive bias.

  19. Recall Off the notes externo · concept · cap-3 ●●○

    What is multicollinearity, and what is its effect?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 3 — Multiple Regression Analysis: Estimation

    Reveal answer

    High (but not perfect) correlation between regressors; it does not cause bias, but it increases the variance of the estimators, inflating standard errors.

  20. Recall Off the notes externo · concept · cap-3 ●●○

    What does the VIF measure?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 3 — Multiple Regression Analysis: Estimation

    Reveal answer

    The variance inflation factor: 1/(1 − R²ⱼ), where R²ⱼ comes from regressing xⱼ on the other regressors; it shows how much collinearity inflates the variance of β̂ⱼ.

  21. True or false Off the notes externo · relationship · cap-3 ●●○

    High multicollinearity makes the OLS estimators biased.

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 3 — Multiple Regression Analysis: Estimation

  22. Recall Off the notes externo · concept · cap-3 ●●○

    What does the Gauss–Markov theorem guarantee?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 3 — Multiple Regression Analysis: Estimation

    Reveal answer

    Under assumptions MLR.1–MLR.5 (including homoscedasticity), OLS is the best linear unbiased estimator (BLUE): it has the smallest variance among them.

  23. Recall Off the notes externo · relationship · cap-3 ●●○

    What is the consequence of including an irrelevant variable in the model?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 3 — Multiple Regression Analysis: Estimation

    Reveal answer

    It does not cause bias, but it can increase the variance of the other estimators if it is correlated with them.

  24. Recall Off the notes externo · concept · cap-4 ●○○

    How is the t statistic computed for H₀: βⱼ = 0?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 4 — Multiple Regression Analysis: Inference

    Reveal answer

    t = β̂ⱼ / se(β̂ⱼ); it is compared with the t distribution with n − k − 1 degrees of freedom.

  25. Recall Off the notes externo · concept · cap-4 ●●○

    What is the p-value of a test?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 4 — Multiple Regression Analysis: Inference

    Reveal answer

    The probability, under H₀, of observing a statistic as extreme as the one obtained; the smallest significance level at which H₀ would be rejected.

  26. Recall Off the notes externo · relationship · cap-4 ●●○

    The p-value of the education coefficient is 0.03. Is H₀ rejected at 5%? And at 1%?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 4 — Multiple Regression Analysis: Inference

    Reveal answer

    At 5% yes (0.03 < 0.05); at 1% no (0.03 > 0.01).

  27. Recall Off the notes externo · relationship · cap-4 ●●●

    What is the difference between statistical significance and economic significance?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 4 — Multiple Regression Analysis: Inference

    Reveal answer

    Statistical significance depends on the size of t (and of the sample); economic significance, on the magnitude of the coefficient. An effect can be statistically significant and economically irrelevant, or vice versa.

  28. Recall Off the notes externo · concept · cap-4 ●●○

    How is a 95% confidence interval for βⱼ built?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 4 — Multiple Regression Analysis: Inference

    Reveal answer

    β̂ⱼ ± c·se(β̂ⱼ), where c is the critical value of the t with n − k − 1 d.f. (≈ 1.96 in large samples); in R, confint().

  29. Recall Off the notes externo · concept · cap-4 ●●○

    What is the F test for?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 4 — Multiple Regression Analysis: Inference

    Reveal answer

    To test joint restrictions, such as H₀: β₃ = β₄ = β₅ = 0, by comparing the SSR (or R²) of the restricted and unrestricted models.

  30. Recall Off the notes externo · relationship · cap-4 ●●●

    Three performance variables of a player are individually insignificant, but the joint F rejects H₀. How is this possible?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 4 — Multiple Regression Analysis: Inference

    Reveal answer

    Because of multicollinearity: the variables are highly correlated, inflating the individual standard errors, but together they explain y well.

  31. Recall Off the notes externo · detail · cap-4 ●●●

    Which R function tests joint linear restrictions on the coefficients?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 4 — Multiple Regression Analysis: Inference

    Reveal answer

    linearHypothesis(), from the car package; in Python, the f_test method of the statsmodels result.

  32. Recall Off the notes externo · concept · cap-5 ●●○

    What does it mean for an estimator to be consistent?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 5 — Multiple Regression Analysis: OLS Asymptotics

    Reveal answer

    That it converges in probability to the true value as the sample size grows.

  33. Recall Off the notes externo · relationship · cap-5 ●●○

    Why, in large samples, do t and F tests remain valid even without normal errors?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 5 — Multiple Regression Analysis: OLS Asymptotics

    Reveal answer

    Because of the asymptotic normality of OLS (via the central limit theorem): the statistics have an approximately normal/t distribution.

  34. Recall Off the notes externo · concept · cap-5 ●●●

    How does the LM (Lagrange multiplier) test for excluding variables work?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 5 — Multiple Regression Analysis: OLS Asymptotics

    Reveal answer

    Estimate the restricted model, regress its residuals on all the regressors, and LM = n·R² of this auxiliary regression, with a χ² distribution with q d.f.

  35. Recall Off the notes externo · concept · cap-6 ●●○

    How are beta (standardized) coefficients interpreted?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 6 — Multiple Regression Analysis: Further Issues

    Reveal answer

    A one standard deviation increase in x changes y by β standard deviations; it allows comparing magnitudes across variables on different scales.

  36. Recall Off the notes externo · concept · cap-6 ●●○

    In y = β₀ + β₁x + β₂x², what is the marginal effect of x and where is the turning point?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 6 — Multiple Regression Analysis: Further Issues

    Reveal answer

    Marginal effect: β₁ + 2β₂x. Turning point: x* = −β₁/(2β₂).

  37. Recall Off the notes externo · relationship · cap-6 ●●●

    Wage = … + 0.30·exper − 0.006·exper². From how many years of experience does the marginal effect turn negative?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 6 — Multiple Regression Analysis: Further Issues

    Reveal answer

    x* = 0.30/(2·0.006) = 25 years.

  38. Recall Off the notes externo · concept · cap-6 ●●○

    What does an interaction term x₁·x₂ capture?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 6 — Multiple Regression Analysis: Further Issues

    Reveal answer

    That the effect of x₁ on y depends on the level of x₂: ∂y/∂x₁ = β₁ + β₃·x₂.

  39. Recall Off the notes externo · concept · cap-6 ●●○

    Why use the adjusted R²?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 6 — Multiple Regression Analysis: Further Issues

    Reveal answer

    Because R² never falls when adding regressors; the adjusted one penalizes additional variables and allows comparing non-nested models with the same y.

  40. Recall Off the notes externo · relationship · cap-6 ●●●

    Why is the prediction interval for an individual y wider than the confidence interval for E(y|x)?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 6 — Multiple Regression Analysis: Further Issues

    Reveal answer

    Because besides the uncertainty in estimating the parameters it includes the variance of the error u, which does not shrink with the sample.

  41. Recall Off the notes externo · concept · cap-7 ●○○

    How is the coefficient on a female dummy in a wage regression interpreted?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 7 — Multiple Regression Analysis with Qualitative Regressors

    Reveal answer

    It is the average wage difference between women and men (base category), holding the other variables constant.

  42. Recall Off the notes externo · concept · cap-7 ●●○

    What is the dummy variable trap?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 7 — Multiple Regression Analysis with Qualitative Regressors

    Reveal answer

    Including a dummy for each category along with the intercept, producing perfect collinearity; one category (the base) must be omitted.

  43. Recall Off the notes externo · detail · cap-7 ●●○

    How does R handle categorical variables in the lm formula?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 7 — Multiple Regression Analysis with Qualitative Regressors

    Reveal answer

    factor variables are automatically converted into dummies, omitting the reference category; in statsmodels, use C(var) in the formula.

  44. Recall Off the notes externo · relationship · cap-7 ●●●

    In log(wage), the female dummy has a coefficient of −0.30. What is the exact percentage difference?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 7 — Multiple Regression Analysis with Qualitative Regressors

    Reveal answer

    100·(e^(−0.30) − 1) ≈ −25.9%; the −30% approximation gets worse for large coefficients.

  45. Recall Off the notes externo · concept · cap-7 ●●●

    What does the Chow test test?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 7 — Multiple Regression Analysis with Qualitative Regressors

    Reveal answer

    Whether a model's coefficients are equal across two groups (e.g. men and women), by interacting all variables with the group dummy and testing jointly.

  46. Recall Off the notes externo · concept · cap-7 ●●○

    What is the linear probability model (LPM), and what are its limitations?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 7 — Multiple Regression Analysis with Qualitative Regressors

    Reveal answer

    OLS with a binary y: the coefficients are changes in the probability that y = 1. It can predict probabilities outside [0, 1] and is necessarily heteroscedastic.

  47. Recall Off the notes externo · concept · cap-8 ●●○

    What are the consequences of heteroscedasticity for OLS?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 8 — Heteroscedasticity

    Reveal answer

    The estimators remain unbiased and consistent, but the usual standard errors are wrong (t and F tests invalid) and OLS is no longer BLUE.

  48. Recall Off the notes externo · concept · cap-8 ●●○

    How do you get heteroscedasticity-robust standard errors in R and in Python?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 8 — Heteroscedasticity

    Reveal answer

    R: coeftest(model, vcov = hccm) (lmtest/car packages) or vcovHC (sandwich). Python: fit(cov_type='HC3') in statsmodels.

  49. Recall Off the notes externo · concept · cap-8 ●●○

    How does the Breusch–Pagan test work?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 8 — Heteroscedasticity

    Reveal answer

    Regress the squared residuals on the regressors and test (F or LM) whether they jointly explain the variance; in R, bptest().

  50. Recall Off the notes externo · relationship · cap-8 ●●●

    How does the White test differ from the Breusch–Pagan test?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 8 — Heteroscedasticity

    Reveal answer

    It includes squares and interactions of the regressors (or, in the special form, ŷ and ŷ²), detecting more general forms of heteroscedasticity.

  51. Recall Off the notes externo · concept · cap-8 ●●○

    What is WLS, and when should it be used?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 8 — Heteroscedasticity

    Reveal answer

    Weighted least squares: it weights each observation by the inverse of the error variance; more efficient than OLS when the form of heteroscedasticity is known (or estimated, FGLS).

  52. Recall Off the notes externo · relationship · cap-8 ●●●

    The BP test rejects homoscedasticity. Are your coefficients biased? What should you do at a minimum?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 8 — Heteroscedasticity

    Reveal answer

    They are not biased; at a minimum, use robust standard errors for inference (optionally, WLS/FGLS for efficiency).

  53. Recall Off the notes externo · concept · cap-9 ●●○

    What does Ramsey's RESET test?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 9 — More on Specification and Data Issues

    Reveal answer

    Functional form misspecification: it adds powers of ŷ (ŷ², ŷ³) and tests whether they are jointly significant; in R, resettest().

  54. Recall Off the notes externo · concept · cap-9 ●●○

    What is a proxy variable?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 9 — More on Specification and Data Issues

    Reveal answer

    An observable variable correlated with an unobservable omitted one (e.g. IQ as a proxy for ability), used to reduce omitted variable bias.

  55. Recall Off the notes externo · relationship · cap-9 ●●●

    What is the effect of classical measurement error in a regressor?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 9 — More on Specification and Data Issues

    Reveal answer

    Attenuation bias: the estimated coefficient tends toward zero, because the measurement error becomes correlated with the observed regressor.

  56. Recall Off the notes externo · relationship · cap-9 ●●●

    What effect does measurement error in the dependent variable (y) have on the OLS estimators?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 9 — More on Specification and Data Issues

    Reveal answer

    If uncorrelated with the regressors, it causes no bias; it only increases the variance of the error and therefore of the estimators.

  57. Recall Off the notes externo · concept · cap-9 ●●○

    Why are influential observations (outliers) a concern in OLS, and what alternative does the book mention?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 9 — More on Specification and Data Issues

    Reveal answer

    Because OLS minimizes squares and is sensitive to extreme values; LAD regression (least absolute deviations, quantile regression at the median) is more robust.

  58. Recall Off the notes externo · concept · cap-10 ●●○

    What changes in time series compared to cross-sectional data?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 10 — Basic Regression Analysis with Time Series Data

    Reveal answer

    Observations have a temporal order and are not independent random samples; there is dependence over time, trends and seasonality.

  59. Recall Off the notes externo · concept · cap-10 ●●○

    What is a finite distributed lag model, and what is the long-run multiplier?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 10 — Basic Regression Analysis with Time Series Data

    Reveal answer

    It includes current and lagged values of z as regressors; the long-run multiplier is the sum of the lag coefficients.

  60. Recall Off the notes externo · relationship · cap-10 ●●●

    Two series with upward trends appear strongly related in a regression. What is the risk, and how do you deal with it?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 10 — Basic Regression Analysis with Time Series Data

    Reveal answer

    Spurious regression: the common trend produces correlation without a causal relationship. Include a time trend (or work with differences).

  61. Recall Off the notes externo · concept · cap-11 ●●○

    What is a (weakly) stationary series?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 11 — Further Issues in Using OLS with Time Series Data

    Reveal answer

    A series with constant mean and variance and covariance between periods depending only on the distance between them.

  62. Recall Off the notes externo · relationship · cap-11 ●●●

    Why is a random walk (yₜ = yₜ₋₁ + eₜ) problematic, and what is the usual solution?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 11 — Further Issues in Using OLS with Time Series Data

    Reveal answer

    It has a unit root, is highly persistent and non-stationary; the first difference Δyₜ = eₜ is stationary.

  63. Recall Off the notes externo · concept · cap-12 ●●○

    What is the consequence of serial correlation in the errors, with strictly exogenous regressors?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 12 — Serial Correlation and Heteroscedasticity in Time Series Regressions

    Reveal answer

    OLS remains unbiased, but the usual standard errors become invalid (usually underestimated).

  64. Recall Off the notes externo · detail · cap-12 ●●○

    Which tests detect serial correlation, and which standard error correction is used?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 12 — Serial Correlation and Heteroscedasticity in Time Series Regressions

    Reveal answer

    The Durbin–Watson and Breusch–Godfrey tests (bgtest() in R); Newey–West HAC standard errors correct the inference.

  65. Recall Off the notes externo · concept · cap-13 ●●○

    How does the difference-in-differences estimator work?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 13 — Pooling Cross-Sections Across Time: Simple Panel Data Methods

    Reveal answer

    It compares the change over time in the treated group with that of the control group; the effect is the coefficient of the interaction treated × post-treatment.

  66. Recall Off the notes externo · relationship · cap-13 ●●●

    An incinerator is built near some houses. How do you estimate its effect on their prices?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 13 — Pooling Cross-Sections Across Time: Simple Panel Data Methods

    Reveal answer

    With data before and after, compare the price change of the nearby houses (treated) with that of the distant ones (control): the coefficient of near × after.

  67. Recall Off the notes externo · concept · cap-13 ●●○

    Why does differencing panel data help eliminate bias?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 13 — Pooling Cross-Sections Across Time: Simple Panel Data Methods

    Reveal answer

    It removes the time-constant unobserved effect (aᵢ), which could be correlated with the regressors.

  68. Recall Off the notes externo · relationship · cap-14 ●●●

    What is the difference between fixed effects and random effects?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 14 — Advanced Panel Data Methods

    Reveal answer

    Fixed effects allow aᵢ to be correlated with the regressors (removing it via the within transformation); random effects assume no correlation, gaining efficiency and allowing time-constant regressors. The Hausman test compares the two.

  69. Recall Off the notes externo · detail · cap-14 ●●○

    Which packages estimate panel models in R and in Python?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 14 — Advanced Panel Data Methods

    Reveal answer

    R: plm (with model = 'within', 'random', 'fd'). Python: linearmodels (PanelOLS, RandomEffects).

  70. True or false Off the notes externo · relationship · cap-14 ●●○

    With fixed effects, it is possible to estimate the effect of a variable that does not change over time, such as gender.

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 14 — Advanced Panel Data Methods

  71. Recall Off the notes externo · concept · cap-15 ●●○

    What are the two conditions for a valid instrument z for an endogenous regressor x?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 15 — Instrumental Variables Estimation and Two Stage Least Squares

    Reveal answer

    Relevance: z correlated with x. Exogeneity: z uncorrelated with the error u.

  72. Recall Off the notes externo · relationship · cap-15 ●●●

    To estimate the return to education, distance to a college is used as an instrument. Which condition is testable and which is not?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 15 — Instrumental Variables Estimation and Two Stage Least Squares

    Reveal answer

    Relevance is testable (first-stage regression); exogeneity is not directly testable — one has to argue that distance does not affect wages through another channel.

  73. Recall Off the notes externo · relationship · cap-15 ●●●

    Why are weak instruments a problem?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 15 — Instrumental Variables Estimation and Two Stage Least Squares

    Reveal answer

    With little correlation with x, the IV estimator has a huge variance and can be badly biased even with small violations of exogeneity.

  74. Recall Off the notes externo · concept · cap-15 ●●○

    How does 2SLS work?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 15 — Instrumental Variables Estimation and Two Stage Least Squares

    Reveal answer

    1st stage: regress the endogenous x on the instruments and exogenous variables, obtaining x̂. 2nd stage: regress y on x̂ and the exogenous variables. In R, ivreg() (AER/ivreg package).

  75. Recall Off the notes externo · concept · cap-16 ●●●

    Why is OLS biased in simultaneous equations models?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 16 — Simultaneous Equations Models

    Reveal answer

    Because the variables are jointly determined (e.g. price and quantity by supply and demand), so the endogenous regressor is correlated with the error; 2SLS is used with excluded exogenous variables as instruments.

  76. Recall Off the notes externo · concept · cap-17 ●●○

    Why use logit or probit instead of the LPM for a binary y?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 17 — Limited Dependent Variable Models and Sample Selection Corrections

    Reveal answer

    Because they model P(y=1|x) through a function (logistic or normal) that always stays between 0 and 1; they are estimated by maximum likelihood (glm(family = binomial) in R).

  77. Recall Off the notes externo · relationship · cap-17 ●●●

    Why are logit coefficients not the marginal effects, and what is reported?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 17 — Limited Dependent Variable Models and Sample Selection Corrections

    Reveal answer

    Because the effect of x on P(y=1) depends on the point (g(xβ)·β); average partial effects (APE) or partial effects at the average (PEA) are reported.

  78. Recall Off the notes externo · concept · cap-17 ●●●

    What are Tobit and Poisson models for?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 17 — Limited Dependent Variable Models and Sample Selection Corrections

    Reveal answer

    Tobit: a dependent variable with a corner solution (many zeros and continuous positive values). Poisson: a count variable (0, 1, 2…).

  79. Recall Off the notes externo · general · cap-19 ●●○

    What are the steps of an empirical project according to the last chapter?

    Source: Heiss, Using R for Introductory Econometrics (2nd ed.), ch. 19 — Carrying Out an Empirical Project

    Reveal answer

    Formulating the question, reviewing the literature, collecting and organizing data, specifying and estimating econometric models, testing robustness and writing up the results reproducibly.

  80. Recall detail · cap-1 ●●○

    In R, what is the difference between A * B and A %*% B for matrices?

    Reveal answer

    * multiplies element by element; %*% does the matrix product.

    Source: Notes (R), Chapter 1 — vectors, matrices and descriptive statistics

  81. Recall detail · cap-1 ●●○

    Which R functions compute the inverse, determinant, trace and rank of a matrix C?

    Reveal answer

    solve(C), det(C), sum(diag(C)) and qr(C)$rank.

    Source: Notes (R), Chapter 1 — vectors, matrices and descriptive statistics

  82. Recall relationship · cap-1 ●●●

    In the notes, det(A) for A <- matrix(1:9, nrow = 3) came out as 0. What does this imply for solve(A)?

    Reveal answer

    A is singular (linearly dependent columns): it has no inverse, and solve(A) would give an error.

    Source: Notes (R), Chapter 1 — vectors, matrices and descriptive statistics

  83. Recall detail · cap-1 ●○○

    How do you filter the rows of a data frame by a condition in R?

    Reveal answer

    With subset(df, condition), for example subset(df_C, var1 > 5).

    Source: Notes (R), Chapter 1 — vectors, matrices and descriptive statistics

  84. Recall detail · cap-1 ●●○

    In the wage1 dataset, what correlation between wage and education was computed in the notes?

    Reveal answer

    About 0.41 (covariance ≈ 4.15).

    Source: Notes (R), Chapter 1 — vectors, matrices and descriptive statistics

  85. Recall concept · cap-1 ●●○

    How do you test in R whether the mean of wage is greater than 5, and what was the conclusion?

    Reveal answer

    t.test(wages$wage, alternative = 'greater', mu = 5): t ≈ 5.56, p ≈ 2e-8; H₀ is rejected (sample mean ≈ 5.90).

    Source: Notes (R), Chapter 1 — vectors, matrices and descriptive statistics

  86. Recall relationship · cap-1 ●●●

    The test that the mean of educ is less than 10 gave a p-value of 1. Why, if the sample mean is 12.56?

    Reveal answer

    Because the sample points in the opposite direction to the alternative: with a mean well above 10, there is no evidence it is smaller — the one-sided p-value is close to 1.

    Source: Notes (R), Chapter 1 — vectors, matrices and descriptive statistics

  87. Recall detail · cap-2 ●●○

    In the regression wage ~ educ with wage1, what are the coefficient on educ and the R²?

    Reveal answer

    β̂ ≈ 0.541 (se 0.053) and R² ≈ 0.165: each year of education is associated with ~US$0.54/hour more.

    Source: Notes (R), Chapter 2 — simple regression and simulations (Problem sets 7–9)

  88. Recall detail · cap-2 ●○○

    Which functions extract the coefficients, residuals and fitted values of an lm in R?

    Reveal answer

    coef(), resid() and predict() (or fitted()).

    Source: Notes (R), Chapter 2 — simple regression and simulations (Problem sets 7–9)

  89. Recall relationship · cap-2 ●●○

    In the notes, log(wage) ~ educ gave 0.083 and log(wage) ~ log(educ) gave 0.825. Interpret both.

    Reveal answer

    One more year of education ≈ +8.3% in wages; 1% more education ≈ +0.83% in wages (elasticity).

    Source: Notes (R), Chapter 2 — simple regression and simulations (Problem sets 7–9)

  90. Recall relationship · cap-2 ●●●

    Why did the notes filter educ != 0 before estimating log(wage) ~ log(educ)?

    Reveal answer

    Because log(0) is undefined; observations with educ = 0 have to be dropped from the log-log model.

    Source: Notes (R), Chapter 2 — simple regression and simulations (Problem sets 7–9)

  91. Recall relationship · cap-2 ●●●

    The regression through the origin (wage ~ 0 + educ) had an R² of 0.764, much higher than the 0.165 of the full model. Is it better?

    Reveal answer

    No: without an intercept, R² is computed without centering on the mean and is not comparable; the high value is an artifact, not a better fit.

    Source: Notes (R), Chapter 2 — simple regression and simulations (Problem sets 7–9)

  92. Recall relationship · cap-2 ●●○

    What does lm(wage ~ 1) estimate?

    Reveal answer

    Only the intercept, which is the sample mean of wage (≈ 5.896), with R² = 0.

    Source: Notes (R), Chapter 2 — simple regression and simulations (Problem sets 7–9)

  93. Recall concept · cap-2 ●●○

    What did the simulations of sample means from normals and chi-squares show?

    Reveal answer

    By the central limit theorem, the means are approximately normally distributed, even when coming from the chi-square, and the variance falls as n grows.

    Source: Notes (R), Chapter 2 — simple regression and simulations (Problem sets 7–9)

  94. Recall relationship · cap-2 ●●●

    In the notes' Monte Carlo simulation (y = β₀ + β₁x + u, with true β₁ = 0.25), the error u was generated with mean x/4. What happened to β̂₁, and why?

    Reveal answer

    It was biased (mean far from the true β₁ of 0.25), because it violates the zero conditional mean assumption (SLR.4).

    Source: Notes (R), Chapter 2 — simple regression and simulations (Problem sets 7–9)

  95. Recall relationship · cap-2 ●●●

    In the notes' Monte Carlo simulation (y = β₀ + β₁x + u, with true β₁ = 0.25), the error u was generated with zero mean but a variance dependent on x. What happened to β̂₁?

    Reveal answer

    β̂₁ stayed centered on the true value (no bias), just more dispersed: heteroscedasticity (violation of SLR.5) affects the variance, not the bias.

    Source: Notes (R), Chapter 2 — simple regression and simulations (Problem sets 7–9)

  96. Multiple choice relationship · cap-2 ●●○

    In the notes' Monte Carlo simulations, which violated either zero conditional mean (assumption 4) or homoscedasticity (assumption 5), which violation had the more serious effect on the estimates?

  97. Recall relationship · cap-2 ●●○

    In the CI simulation with a true mean of 10, why did testing H₀: μ = 9.5 reject many times and H₀: μ = 10 almost never?

    Reveal answer

    Because almost all 95% CIs contain 10 (H₀ true, rejection ≈ 5%), but many exclude 9.5 (H₀ false, which the test has power to detect).

    Source: Notes (R), Chapter 2 — simple regression and simulations (Problem sets 7–9)

  98. Recall detail · cap-3 ●●○

    In wage ~ educ + exper, what are the coefficients and the R²?

    Reveal answer

    educ ≈ 0.644 and exper ≈ 0.070, both significant; R² ≈ 0.225.

    Source: Notes (R), Chapter 3 — multiple regression, specification and heteroscedasticity

  99. Recall relationship · cap-3 ●●●

    The coefficient on educ rose from 0.541 (simple) to 0.644 when exper was included. How does omitted variable bias explain this?

    Reveal answer

    Experience affects wages positively and is negatively correlated with education (more years studying, fewer working); omitting it produced a negative bias on educ.

    Source: Notes (R), Chapter 3 — multiple regression, specification and heteroscedasticity

  100. Recall relationship · cap-3 ●●●

    How did the notes compute the LM test for including exper?

    Reveal answer

    They estimated the restricted model wage ~ educ, regressed its residuals on educ and exper and computed LM = n·R², comparing with a χ² with 1 d.f.

    Source: Notes (R), Chapter 3 — multiple regression, specification and heteroscedasticity

  101. Recall relationship · cap-3 ●●○

    What happens to t, p-values and R² when the dependent variable is multiplied by a constant (hourly wage → annual)?

    Reveal answer

    Nothing changes: coefficients and standard errors scale by the same factor, so t, p and R² remain the same.

    Source: Notes (R), Chapter 3 — multiple regression, specification and heteroscedasticity

  102. Recall detail · cap-3 ●●○

    How did the notes estimate standardized coefficients in R?

    Reveal answer

    Using scale() on the variables: lm(scale(wage) ~ scale(exper) + scale(educ)).

    Source: Notes (R), Chapter 3 — multiple regression, specification and heteroscedasticity

  103. Recall relationship · cap-3 ●●●

    In the wage regression (wage1 dataset) with educ, educ² and educ³, no education term was individually significant. Does this prove that education does not matter?

    Reveal answer

    No: the polynomial terms are highly collinear, inflating standard errors; they should be tested jointly (F test).

    Source: Notes (R), Chapter 3 — multiple regression, specification and heteroscedasticity

  104. Recall detail · cap-3 ●●○

    How did the notes turn exper into a categorical variable?

    Reveal answer

    With factor(cut(exper, c(0, 15, 30, Inf))), creating three bands; lm creates the dummies automatically.

    Source: Notes (R), Chapter 3 — multiple regression, specification and heteroscedasticity

  105. Recall relationship · cap-3 ●●●

    In the wage regression (wage1 dataset) with exper in bands (0–15, 15–30 and over 30 years) interacted with educ, what was concluded?

    Reveal answer

    Education remained significant; the interactions were not significant; wages seem higher for those with more than 30 years of experience, but not for the 15–30 band.

    Source: Notes (R), Chapter 3 — multiple regression, specification and heteroscedasticity

  106. Recall relationship · cap-3 ●●○

    The resettest of the wage regression (wage1 dataset) with exper in bands interacted with educ had a low p-value. What does this indicate?

    Reveal answer

    Probable functional form misspecification: another arrangement of the variables would better explain wages.

    Source: Notes (R), Chapter 3 — multiple regression, specification and heteroscedasticity

  107. Recall concept · cap-3 ●●●

    What is encomptest in R for?

    Reveal answer

    To compare non-nested models through the encompassing test, estimating a joint model with the regressors of both.

    Source: Notes (R), Chapter 3 — multiple regression, specification and heteroscedasticity

  108. Recall relationship · cap-3 ●●○

    In a wage regression in the notes (wage1 dataset), the robust standard errors (hccm) barely changed from the usual ones, but bptest rejected homoscedasticity. How do you reconcile this?

    Reveal answer

    The BP test detects heteroscedasticity statistically, but its impact on inference in this model is small; using robust errors is the precaution.

    Source: Notes (R), Chapter 3 — multiple regression, specification and heteroscedasticity

  109. Recall concept · cap-3 ●●●

    What are the steps of the FGLS done in the notes?

    Reveal answer

    Regress log(residuals²) on the regressors, get weights 1/exp(fitted values) and re-estimate with lm(..., weights = weight).

    Source: Notes (R), Chapter 3 — multiple regression, specification and heteroscedasticity

See all questions (109)

Transparency note AI was used in this post for: generating the study questions · creating the English version