Skip to content

danhammer/ARE212

Repository files navigation

ARE212

Section notes

This is a repository for the latest version of the ARE212 section notes. Each section has its own directory that contains at least three core files:

  1. An org-mode document .org that compiles to the .pdf, .tex, and .R files. In fact, the org-mode document is the code; and you can dynamically update all downstream documents from within Emacs' org-mode. You do not have to interact with the org-mode document directly if you are not using Emacs, but rather just with the R code or PDF write-up. If you'd like to get set up with Emacs (highly recommended) then please see the next section of this README.

  2. A PDF of the section notes, which effectively documents the code. If you are only interested in following along, rather than running the code yourself, just browse to the .pdf file for the section (e.g. sec-01.pdf) and click "view raw". The PDF will begin downloading immediately.

  3. An R script that compiles all of the code within the PDF. Note that there is no documentation within the code. Instead, the code is documented from the PDF description.

If there are supporting images or TeX fragments for the write-ups, there will be a subdirectory called inserts/ within the section header.

The sections are organized as follows:

section-01 Preliminaries and setup

section-02 Matrix operations in R

section-03 OLS regressions from first principles

section-04 Goodness of fit

section-05 Hypothesis testing

section-06 Returns to education, empirical example

section-07 Efficiency of GLS and ggplot2

section-08 Instrumental Variables

section-09 Testing for heteroskedasticity

section-10 Feasible generalized least squares

section-11 Serial correlation

section-12 Instrumental variables

section-13 Spatial analysis in R

section-14 Web scraping

Help me write this!

This project can and should be treated like any other open source, collaborative coding project. If you are interested in helping me make this project better, fork the repo, edit the screwy files, and send a pull request. I will review and merge the changes -- until someone else takes over!

Org mode notes

If you are running Emacs, then you have access to org-mode, an open source solution for interactive coding and reproducible research. The code, documentation, and results are all bundled into the same file. The #+RESULTS output is automatically generated from the immediately preceding code block.

A few things to note. When you try to compile the .org files to a PDF document, you may have to compile it twice or reload the buffer using C-u M-x org-reload. To tangle the code within the org-mode document to an .R script, you can use the key binding C-c C-v t.

You can highlight code by using the minted package in LaTeX. For this, from the command line, make sure that you invoke pdflatex with the -shell-escape flag. For example,

cd ~/Dropbox/github/danhamer/ARE212/section-04
pdflatex -shell-escape sec-04

Ensure that you have the proper minted.sty file by downloading the zipfile, installing it, and then ensuring that LaTeX knows where everything is:

unzip minted.zip
cd minted/
latex minted.ins
sudo texhash

Finally, you will have to add the following to your .emacs.d/init.el file, and make sure it doesn't conflict with anything else in there:

(require 'org-latex)
(setq org-export-latex-listings 'minted)
(add-to-list 'org-export-latex-packages-alist '("" "minted"))

Spatial analysis in R

This is of personal interest. R is ideal for econometric analysis; but it also has some very convenient facilities for interacting with relational databases that support spatial data analysis. A notable example is the open source project cartodb-r. An example of the type of spatial data analysis that can be done from within R, riding on CartoDB is shown below.

The orange and blue points are households in New Delhi; the orange indicates a relatively healthy household, the blue indicates a household where at least one member has recently experienced diarrhea. The green points are sewage and garbage facilities. This is a sort of modern-day cholera map.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages