Session 7: Before the workshop

Can you reproduce what the papers claim, with only what you have learned?

Thierry Warin, PhD

HEC Montréal

Outline · Before class

  1. What to do, and how long it takes
  2. Re-read the papers
  3. Set up your folder
  4. Arrive with

What session 7 is for

The mathematics

  • Choose which of the course’s models fits a new outcome — a number, a yes/no, ordered or unordered categories
  • Read every result as a sentence, in units, and say what it does not license
  • Compare OLS with ridge, the lasso and the elastic net on data the models did not see

The Python

  • Load a paper’s data into pandas straight from a web address
  • Run the code cells of sessions 3 to 5 on new data, changing only the variable names
  • Run a whole analysis as one script in VS Codium, step by step, in a folder of your own

The international business

  • Use international-business data from published papers
  • Explain a result to someone who will not read the code
  • Read a result the way a referee would, before trusting it

What to do, and how long it takes

Thirty minutes

The workshop is three hours at your own keyboard, in a folder of your own. It goes well if that folder is ready when you arrive, and badly if you spend the first hour installing.

1 Re-read the four abstracts: the question, and what the data are 10 min
2 Set up your session-07 folder: Python, four packages, the scripts 15 min
3 Write two lines per paper, from memory 5 min

Everything on these slides is also on the pre-session page, 07-replication-workshop/00-pre-session/README.md, where the commands can be copied.

Re-read the papers

The four papers, and the models you will fit

# Paper What you will fit
1 Fraiberger, Lee, Puy & Ranciere (2021), Media sentiment and international asset prices OLS, binary, ordinal and multinomial logits
2 Saganowski, Bródka, Koziarski & Kazienko (2019), Analysis of group evolution prediction … binary, ordinal and multinomial logits
3 Blonigen & Piger (2014), Determinants of foreign direct investment OLS, ridge, lasso, elastic net
4 Topalova & Khandelwal (2011), Trade liberalization and firm productivity OLS, binary, ordinal and multinomial logits, ridge, lasso, elastic net

You read these before sessions 2 to 6. Re-read the abstract and the description of the data: what one observation is, and what is measured.

Set up your folder

A folder of your own, not the repository

Make an empty folder — Desktop/session-07 — and open it in VS Codium (File → Open Folder…). In its terminal: plain Python, four packages by name, the scripts, the check.

open /Applications/Python\ 3*/Install\ Certificates.command   # python.org Python only, once
python3 -m venv .venv
source .venv/bin/activate
pip install pandas statsmodels scikit-learn matplotlib
curl -LO https://warint.github.io/quantitative-methods/session-07-scripts.zip
unzip session-07-scripts.zip
python check_setup.py
python3 -m venv .venv
source .venv/bin/activate
pip install pandas statsmodels scikit-learn matplotlib
curl -LO https://warint.github.io/quantitative-methods/session-07-scripts.zip
unzip session-07-scripts.zip
python check_setup.py

No unzip? sudo apt install unzip (Debian, Ubuntu) or sudo dnf install unzip (Fedora).

py -m venv .venv
.venv\Scripts\Activate.ps1
pip install pandas statsmodels scikit-learn matplotlib
$zip = "https://warint.github.io/quantitative-methods/session-07-scripts.zip"
Invoke-WebRequest $zip -OutFile session-07-scripts.zip
Expand-Archive session-07-scripts.zip -DestinationPath .
python check_setup.py

No requirements.txt, nothing to download from Dataverse: each script reads its paper’s data from the course site. Every line of the check should say OK.

Arrive with

The checklist

Nothing to hand in, before or after: the workshop is practice, and revision for the midterm.