# Code-through

Due by 11:59 PM on Wednesday, April 22, 2020

The objectives of this class include “Become curious and confident in consuming and producing evaluations,” “Run statistical models,” and “Share your analyses and data with the public.” To help you with this, you will write a code-through tutorial of some statistical, causal, program evaluation-focused, or data-based principle or example.

One of the reasons R is so popular is because the R community is exceptionally generous and open and sharing.1 The internet is full of tutorials and code-throughs where people explain how to do something interesting with R.

Additionally, teaching someone how to do something is one of the best ways to ensure that you know how to do it too. Some R developers have even started to adopt tutorial-focused approaches to development, where their code isn’t complete until they can easily teach it to others.

The code examples I include on each week’s class page and in the weekly RStudio.cloud projects are a good example of didactic tutorials. In addition, the R-Weekly e-mail newsletter includes dozens of these kinds of tutorials every week, and Mara Averick (chief tidyverse advocate at RStudio) regularly tweets out links to different posts as well. Here are some others examples to give you a jist of what you can do:2

You will complete this assignment on your own, but you can get help from others (but you can’t all write about the same topic).

## Instructions

Here’s what you need to do:

1. Decide what statistical or causal or program evaluation concept you want to demonstrate. Perhaps you want to show how DAGs are important and what you can do to control for back doors, or demonstrate how to run a regression discontinuity model, or how to make a plot that shows a program effect from a diff-in-diff model. This is entirely up to you!

2. Write a tutorial that walks a reader through a demonstration of this concept. Your problem sets have been focused on a final product. In this assignment, here the focus is didactic. Show intermediate steps, explain why you do what you do, etc. The reader should learn something new from this tutorial.

There’s no word count here, but there should be several steps and examples of the concept you’re demonstrating.

You should write this in R Markdown, since that allows you to mix prose and code.

Your demonstration must be reproducible. Use built-in datasets from the wooldridge package (like injury or jtrain2 or jtrain3 and so on), or use the wakefield package to simulate data, or point the reader to a CSV file from the internet and incorporate read_csv() into your code-through.

3. Knit the final version of your tutorial as a PDF, Word file, or HTML file.

4. Upload the knitted document to iCollege.

If you’re feeling especially brave, post the HTML version of your document to some public website (Medium, a personal blog, etc.), tell me, and I’ll promote it in the #rstats community on Twitter. You’ll probably get super rich and famous if you do this.

I will grade this using a check system.

1. So are Python and other modern open source languages too.↩︎

2. Yours won’t be nearly as complicated as these, by the way. Nor do they need to be.↩︎