Tutorial: Post-lasso and Post-double-selection inference

There are two ways of running this tutorial:

  1. On your own computer (preferred).

  2. Experimentally, on the cloud at https://madinak.shinyapps.io/tutorial_postselection/ , available for a limited time: from March 20 until Friday evening, March 26.

I strongly recommend the first option, meaning that you download the tutorial from https://github.com/madina-k/DSE2021_tutorials/tree/main/tutorial_postselection and run a local version of the tutorial on your own computer.

Code walk-through (Video)

After you are done with the tutorial, you can see my explanations of the tutorial’s code sections in these video. Please note that I tried to make the explanations as detailed as possible, hence, the videos are lengthy.

Part 1 (Making graphs, simple OLS)

Part 2 (Naive Post-Lasso Estimator)

Part 3 (Simulation of 100 random samples, function for running an OLS)

Part 4 (Running a correct OLS and naive Post-Lasso 100 times)

Part 5 (Partialling-out estimator, Double Selection using cross-validation)

Part 6 (Double Selection using cross-validation and using rigorous Lasso on 100 samples)

Part 7 (Comparing the distributions of the estimators)

Part 8 (Double Machine Learning estimator)

How to run an interactive tutorial locally from your computer

Step 1. Open this folder by downloading the whole repository with all the tutorial https://github.com/madina-k/DSE2021_tutorials

Step 2. Open R Studio and install the following packages for this week’s tutorial:

install.packages(c("tidyverse", "learnr", "glmnet", "hdm", "broom"))

Step 3. Open the tutorial’s Rmd file tutorial_postselection.Rmd in R Studio and click the green button “Run Document” at the top

Rundoc

Or if you do not see the button, run the following command within the console of R Studio:

rmarkdown::run("thefolderwhereyousavedthetutorial/tutorial_postselection.Rmd")

Step 4. Work with the compiled tutorial. The new subsections are slowly revealed to you once you hit continue button. You get the correct answers for each quiz after you submit an answer first. You can get the correct answer to any coding question, by clicking “hint” button at the top panel of the coding chunk.