Reference

Contents

Look here over the course of the semester for resources, links, and tips on how to succeed in the course, how to write well, and other things of interest related to econometrics, data analysis, managing your worfklow, and using R.

Tips for Success

1. Take notes. On paper. Yes. Studies show that using pen and paper trump taking notes on a device. The main reason is because you cannot possibly write down everything I am saying by hand. This forces you to selectively filter my lecture to its most essential and important components – an integral part of the learning and retention process. If you are taking notes on a laptop, you become a court stenographer, thoughtlessly transcribing everything I am saying. At the other extreme, do not assume everything is written in my lecture slides. My lecture slides are visuals and cues to organize the content both for me and for you. I try hard to make sure that I have few words on slides, and even fewer answers to problems.
2. At least skim all of the readings. I give out readings for a reason, and that reason is not to bore you or waste your time. The truth is, as a beginner, you can’t rely on heuristics or memory to “fill in the blanks.” You need the readings to provide context to what I am saying in class. I cannot help you if you are not going to try. Any professor also will lose patience at short notice when it’s discovered you haven’t done the reading.
3. Do the homeworks (if there are any). You might be surprised that I need to say this, but I do. Students that do not do the homeworks do poorly on exams, which often are similar to homework questions. Homeworks are the best practice for exams, they give you a sense of the relevant content areas that might come up, the type and style of questions that I ask, and you often get answer keys to help you “get inside my head” and study from. There is no good reason why you should have a low homework grade.
4. Work on assignments together and study together. Recognize that you are not in this alone, and other students are just as anxious or uncertain as you are. More surprisingly, other students probably have some answers you are looking for, and you may have answers for some of their problems! You will learn better when you collaborate with others similar to you. More importantly, you don’t truly understand something unless you can explain it to others.Yes, that means I am doing a ton of learning every time I teach!

As a wise woman once told me “whomever is doing the talking is doing the learning.”
5. Learn how to learn. The most important skill you learn in college is how to learn. Taking a course on a subject will not make you an expert on that subject. It a) helps you recognize that you do not know everything on that subject, and this prevents you from actively saying stupid things; and b) gives you enough context and skills to figure out how to actually fill those gaps. This is the actual skill that’s relevant in the real world.Yes, Google is your best friend. But you do not yet know how to ask the right questions, or understand what constitutes good answers.

Installing R and R Studio

1. Install R from CRANThe Comprehensive R Archive Network

2. Install R Studio (Desktop Version), choose the “Free” option

R Packages

Packages come from multiple sources.

The polished, publicly released versions are found on CRAN. When installing a package available on CRAN, it is sufficient simply to tell R the following:Note the plural s on packages, and the quotes around the “package name”

install.packages("packagename") 

Other packages, which may be in various developmental states (including perfectly functional!) are often hosted on GitHub before they make their way onto CRAN. Simply telling R install.packages("packagename") will fail to find it (as R only looks in CRAN for packages), so you must use another package called devtoolsWhich you will need to install first if you (probably) don’t already have it!

to install packages directly from Github:Note the :: allows you to use the function install_github() from the devtools package without having to first load the devtools package with library(devtools).

devtools::install_github("username/packagename") 

For example, to install Hadley Wickham’s package r4ds from its Github page https://github.com/hadley/r4ds, we would type:

devtools::install_github("hadley/r4ds")

Getting Help for R

For specific functions or commands, you can simply type:

?functionname()

# example
?mean()

This will display a help page specific to that function in the Viewer pane. R functions and packages are extremely well-documented; help pages normally include a short description of the function, arguments and options (as well as their default values), and several examples or vignettes to demonstrate usage of the function.

Additionally, you can turn to the community.

R Markdown

Math and $$\LaTeX{}$$

Math in R Markdown uses the $$\LaTeX{}$$ language to typeset beautiful formulas and equations. To include mathematical symbols or expressions inlineThat means, within the text, and not in a separate line, location, or environment within the document.

, insert it $between two dollar signs$. Within a sentence, $2^2+\frac{\pi}{\pi}=5$ becomes $$2^2+\frac{\pi}{\pi}=5$$.

If you prefer it to be centered in its own line, put it on its own line, $$between two dollar signs$$.

$$$$2^2+\frac{\pi}{\pi}=5$$$$ becomes:

$2^2+\frac{\pi}{\pi}=5$

There is also a shortcut with the R package equatiomatic.

Producing documents

Producing a PDF Output

PDFs are archaic document formats with many flaws, yet the format remains the industry standard in most cases. PDFs are made with $$\LaTeX{}$$, a typography language dating to the 1980s. $$\LaTeX{}$$ has its own problems

One alternative is tinytex

install.packages("tinytex")
tinytex::install_tinytex()  # install TinyTeX

R Packages

The following is a compendium of all R packages used, and their main uses

• tidyverse
• DT
• knitr
• haven
• readxl
• dplyr
• ggplot2
• car
• sandwich
• lmtest
• equatiomatic
• gganimate
• stargazer
• broom
• modelr
• infer
• aer`

Finding Data

• A near-comprehensive list of all existing data sets built-in to R or R packagesNote: You should use these more for playing around with in R to boost your data wrangling skills. These should not be used for your projects in most circumstances.