All exercises & code

Twenty worked R walkthroughs and seven downloadable projects

Author

Eduard (Eddie) Bukin

Each application exercise is a rendered R walkthrough: read it in the browser to see the code and its output together. Each one also ships inside a project bundle β€” an RStudio project with the data already in place, so you can open it and run the same code yourself.

TipHow to work through these
  1. Read the rendered walkthrough in the browser to see where you are heading.
  2. Download the matching bundle and open the .Rproj file in RStudio.
  3. Work through the .Rmd yourself β€” the blanks (______) are for you to fill.
  4. Compare against the solutions where they are provided.

2 Β· Data wrangling

Exercise What you practise Bundle
πŸ“‹ AE03-01 Import, clean, summarise, plot Reading messy Excel and CSV files, cleaning names, first summaries and plots πŸ“¦ ae03

3 Β· Describing data

Exercise What you practise Bundle
πŸ“‹ AE03-02 Plastic waste Exploring distributions of plastic waste per capita πŸ“¦ ae03
πŸ“‹ AE03-02 Plastic waste β€” solutions Worked solutions to the exercise above πŸ“¦ ae03
πŸ“‹ AE03-03 Correlation Computing and interpreting correlations πŸ“¦ ae03
πŸ“‹ AE03-04 Categorical data (homework) Visualising categorical variables πŸ“¦ ae03-hw

4 Β· Simple regression

Exercise What you practise Bundle
πŸ“‹ ae04-00-simple-regression-from-slides-HW.R Reproducing the whole simple-regression analysis from the slides in a plain R script πŸ“¦ ae04

This one is a plain .R script rather than an R Markdown document, so there is no rendered page β€” open it from the bundle.

5 Β· Multiple regression

Exercise What you practise Bundle
πŸ“‹ AE04-01 Multiple linear regression Fitting and reading a model with several predictors πŸ“¦ ae04
πŸ“‹ AE04-02 Linearity Residual plots, transformations, marginal effects πŸ“¦ ae04
πŸ“‹ AE04-03 Hedonic land prices (homework) A hedonic price model end to end πŸ“¦ ae04
πŸ“‹ AE04-04 OVB from the slides (homework) Reproducing the omitted-variable-bias examples πŸ“¦ ae04
πŸ“‹ AE05-01 OVB and the wage equation Omitted variable bias in a classic wage regression πŸ“¦ ae05
πŸ“‹ AE05-02 OVB from the slides (homework) More omitted-variable-bias practice πŸ“¦ ae05
πŸ“‹ AE05-03 Hedonic prices & heteroscedasticity A complete regression analysis including robust inference πŸ“¦ ae05
πŸ“‹ AE06-01 Transformations & interactions toolbox The full toolbox for transformed and interacted regressors πŸ“¦ ae06
πŸ“‹ AE06-02 Interactions with continuous variables Interpreting continuous-by-continuous interactions πŸ“¦ ae06
πŸ“‹ AE06-03 Simpson’s paradox Unobserved heterogeneity reversing a relationship πŸ“¦ ae06

6 Β· Panel regression

Exercise What you practise Bundle
πŸ“‹ AE08-01 Production function Estimating a production function on panel data πŸ“¦ ae08
πŸ“‹ AE11-01 Translog production function A translog specification on Ghanaian firm data πŸ“¦ ae11

7 Β· Instrumental variables

Exercise What you practise Bundle
πŸ“‹ AE12 Instrumental variable Two-stage least squares on Angrist & Krueger’s quarter-of-birth data πŸ“¦ ae12
πŸ“„ ae12-iv-solutions.Rmd Worked solutions β€” in the bundle only, no rendered page πŸ“¦ ae12
πŸ“„ ae12-iv-solutions-2.Rmd Further worked solutions β€” in the bundle only πŸ“¦ ae12

Project bundles

Each bundle is an RStudio project: unzip it, open the .Rproj file, and every path in the exercises will resolve. Open a bundle page to see exactly which files and datasets are inside before you download.

Topic 2 & 3

ae03-data-wrangling

Four exercises on importing, cleaning, exploring and correlating data, with five datasets.

Topic 3

ae03-data-wrangling-hw

Homework on visualising categorical data.

Topic 4 & 5

ae04-multiple-regression-part-1

Five exercises: simple regression recap, multiple regression, linearity, hedonic prices and OVB.

Topic 5

ae05-multiple-regression-part-2

Three exercises on omitted variable bias and heteroscedasticity.

Topic 5

ae06-multiple-regression-part-3

Three exercises on transformations, interaction terms and Simpson's paradox.

Topic 6

ae08-panel-regression-part-1

Estimating a production function on panel data.

Topic 6

ae11-panel-regression-part-2

Translog production function on Ghanaian firm data.

Topic 7

ae12-iv

Instrumental variables with the Angrist & Krueger quarter-of-birth data.