Generalized Linear Models in R

Instructor:  John Ahlquist
Lab Instructor:  Carlisle Rainey
Lab Time:  Friday, 1:25-3:00
Lab Place:  HCB 302

Schedule

Note: I've changed my website since teaching this class, so some of the urls referenced in the code won't work.

Lab Title Topics Lab Materials Data Files Other Potentially Useful Files
1 Introduction to R Programming Libraries, some programming
technicalities, loading data, summarizing data, linear regression, some
LaTeX tips
Lab 1,
Presentation
anes1992.dta, anes1992.csv Code
for histograms,some humor,detailed intro
2 Graphics in R Indexing and loops, the plot()
function in detail, other graphics functions.
Lab 2,
Exercise, Presentation
None margins,
colors,
complete plot
Maximum Likelihood Estimation in
R
Introduction to Zelig,functions, optimization Lab 3,
Zelig example,
Presentation
None Normal regression
in
Zelig,
simulation paper
4 Logit and Probit in R Zelig for logit and probit,plotting functions,plotting inferences Misc,
Analysis
CSES
subset
Logit
and probit
regression in Zelig
5 Evaluted Models of Binary
Variables
Gradients for optim(),cross-validation in R,ROC and BIC for logit models gradient, cross-validation,
ROC curves
None
6 Ordered Logit and Probit in R Ordered logit and probit,categorical explanatory variables,contrasts Lab 6 None
7 Unordered Logit and Probit in R Zelig for unordered categorical
models, Q&A
None None
8 Poisson Regression in R Zelig for Poisson regresson,Q&A None None
9 Multi-Equation Models in R Zelig for multi-equation models,Q&A John Ahlquist's sample code, simulating
distributions
10 Multiple Imputation in R Amelia, other software,Q&A for class projects Amelia

Resources for R

Link Description
Wikipedia
on
R
If you are like me, you turn to Wikipedia as an introduction to people, ideas, math, and software.
Wikibooks on R
programming
Excellent source on programming in R with lots of examples. Organized by topic as well.
Simon
Jackman's Take on R
Pages 20-22 of The Political Methodologist, vol, 11, no 2. Also see the two articles on computing with R that follow Jackman's piece.
Installing
R
and
Text
Editors
This .pdf gives an excellent set of instructions for downloading and installing R and choosing a text editor. It has equally good discussions of R for Windows and Mac.
Quick-R Quick-R is a website designed to help users of other statistical packages such as Stata, SAS, and SPSS, transition smoothly into R. This site does assumes little, but some knowledge of statistics.
R manuals These are the official manuals for the R packages. These are probably too technical for new R users, but after becoming more familiar with the software, these are very useful.
A
Course on R
An online course maintained by John Fox designed to introduce students to R.
Google's
R
Style
Guide
A set of stylistic rules for writing R scripts. These rules are designed by the R user community atGoogle. Using a consistent style makes your code easier to read andcorrect.
Text
editor
instructions
Andrew Gelman's instruction for setting up text editors for R in Windows
Zelig Gary King's software that allows estimating and working with inferences from many common models in political science. See Imai, King, and Law (2008).

Resources for LaTeX

Link Description
sample2.pdf,
sample2.tex
The .pdf gives lots of useful tips as well as code to create LaTeX documents. The .tex files gives the LaTeX code used to produce the .pdf. Courtesy of Matt GolderHere is a .zip file containing the .bib file and images necessary to
compile. Here Matt provides the LaTeX code for a paper recently published in AJPS as well as some information on posters.
LaTeX code for first lab This is just the LaTeX code for the Beamer presentation slides for the first lab.