Current course is at ADA1, this is a previous year.

UNM Stat 427/527: Advanced Data Analysis I (ADA1)

This page is a reminder for what the course looked like before “flipping” it.

Fall 2014 schedule; Time: ; Location: ; Stat 427.001, CRN Stat 527.001, CRN

Did you receive a registration error for Fall 20xx? Send me an email with the following answers:
1. What registration error did you get (copy/paste is best)?
2. What is your UNM ID?
3. What is your Math/Stat background (that is, do you have the pre-reqs)?

If you are waitlisted, I will override you into the course. Don’t worry.

Before first day:

Step 0a: Set up R and Rstudio
(1) Download R for windows or mac, (2) install Rstudio, and (3) install a package we’ll use with the following R command:install.packages("ggplot2").
style matters. There is a lot of online help on R, such as at UCLA. Usually try searching for “R [mytopic]” and you’ll get lots of results.

Step 0c: A few more to come …

News: (I reserve the right to continue to improve the notes.)

Tentative Timetable for Fall 2014

Wk-Date Ch Topic Slides Code Data pts HW sol
01-08/19 00 Introduction to R,
Rstudio, and ggplot
Ch 00 R 10 HW00 sol
Step 0
08/21 day
01-08/21 (Find a HW/R buddy) 1.2, 1.3 Minard
02-08/26 Ch 2 pac,pi
02-08/28 01 Summarizing and
Displaying Data
Ch 01 R 60 HW01 sol
d1 d2, FB
09/11 crash
03-09/02 Ch 4 Nobel
03-09/04 Space
04-09/09 02 Estimation in
Ch 02 R 120 HW02 sol
d1 d2 d3FB
09/25 9/11
04-09/11 N: Uncert 5.1 baby
05-09/16 fx23456
05-09/18 03 Two-Sample
Ch 03 R includes Ch 4 5.3 ebola
06-09/23 rad
06-09/25 04 Checking
Ch 04 R 130 HW03 sol
d1 d2 d3FB
10/07 boyfr
07-09/30 sig
07-10/02 05 One-way ANOVA Ch 05 R
CHDS dat desc
80 HW05 sol
7.1 10/21 worst,2
08-10/07 Obudg,2
08-10/09 Fall Break
09-10/14 Cancelled (ACASA) bball
09-10/16 06 Nonparametric
(Midterm Review)
Ch 06 R
175 HW06 sol
d1 d2 d3 d4
5.2, 5.5,
7.2, 7.4
11/04 bball2
10-10/23 feel,2
11-10/28 MidtermChs 1-5 Bring: UNM ID, pen(cil), and
4×6″ handwritten “help” card
11-10/30 07 Categorical
Data Analysis
Ch 07 R 105 HW07 sol
Ch 8 11/20 choc p
12-11/04 cause
12-11/06 work
13-11/11 occupy
13-11/13 08 Correlation and
Ch 08 R 80 HW08 sol
Ch 6 12/04 food
14-11/18 terr
14-11/20 extrap,2
15-11/25 roulette
15-11/27 Thanksgiving break sodapop
16-12/02 09 Bootstrap Ch 09 R text
16-12/04 Cancelled (travel) wordcloud R insur
17-12/09 Finals week (no final) FB income

10 Power and Sample size Ch 10 R

R functions written for these notes appearing in other chapters.

Statistical consulting and collaboration slides

Notes from Fall 2014 using R: ADA1_notes_F14.pdf includes all chapters in one document.
Creative Commons License Lecture notes for Advanced Data Analysis 1 (ADA1) Stat 427/527 University of New Mexico is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at

Notes from Fall 2013 using R: ADA1_notes_F13.pdf includes all chapters in one document.
Creative Commons License Lecture notes for Advanced Data Analysis 1 (ADA1) Stat 427/527 University of New Mexico is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at

Notes from Fall 2012 using R: ADA1_notes_F12.pdf includes all chapters in one document.
Creative Commons License Lecture notes for Advanced Data Analysis 1 (ADA1) Stat 427/527 University of New Mexico is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at

Notes from Fall 2011 using Minitab: ADA1_notes_F11.pdf includes all chapters in one document.
Creative Commons License Lecture notes for Advanced Data Analysis 1 (ADA1) Stat 427/527 University of New Mexico is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at


Description: Statistical tools for scientific research, including parametric and non-parametric methods for ANOVA and group comparisons, simple linear and multiple linear regression and basic ideas of experimental design and analysis. Emphasis placed on the use of statistical packages such as R. Course cannot be counted in the hours needed for graduate degrees in Mathematics and Statistics.
Prerequisite: Stat 145 (or other intro stats course)
Semesters offered: Fall
Lecture: Stat 427/527.001, TR 12:30–13:45, Hibben 105
Office hours: Tue 11:00-12:00, Thu 15:30-16:30, and by appointment in SMLC 312
email: “Erik B. Erhardt” <>, please include “ADA1” in subject line
Textbook: Peter Dalgaard, “Introductory Statistics with R“, Second Edition, 2008, ISBN: 978-0-387-79053-4. The book is not required, but it will provide a backup for what you learn in class.
i>Clickers: Yes, we’re going to use clickers! You don’t need to buy a new one, you can get a used one, or you can share with someone who isn’t also in our class. Please bring the same one to class each day. Sorry, web clickers are not an option, since it won’t meet our needs (also some expense for using the web clicker system rather than the simple iClicker system).
Laptops running R: I encourage you to bring a laptop to class each day so you can try the R programming exercises in class. If you don’t have one, no problem, teamwork is encouraged — sit next to someone friendly who likes to share.

Teaching Assistant and Grader

Stat grad students TAs:
Zhanna Galochkina <>, office hours Wed 11:00-12:00 SMLC 208
Miao (Maggie) Yu <>, office hours Fri 10:30-11:30 SMLC 305

Student learning outcomes

At the end of the course, you will be able to: (student results: R, all years2014, 20132012)
General outcomes:

1. Organize knowledge in graphs, tables, and code to support concise, comprehensible, and scientifically defensible written interpretations to produce knowledge.

2. Distinguish a testable scientific hypothesis or data-supported interpretation from an opinion.

3. Understand from a data story the goals of the study and apply the correct statistical procedure.

4. Explain the scientific aspects of a problem to nonscientists in a fashion that enhances understanding and decision making.

Topical outcomes:

5. Define parameters of interest and hypotheses in words and notation.

6. Summarize data visually, numerically, and descriptively and interpret the observed characteristics. Calculate and interpret numerical summaries such as mean, variance, five-number summary, confidence intervals, and p-values, and create visual summaries such as bar plots, scatter plots, and histograms. (Never pie charts!)

7. Distinguish between statistical significance and scientific relevance.

8. Use statistical software, such as R, to read and manage data, create informative plots, report numerical summaries, apply statistical models, by recommended programming practice including abstraction and documentation.

9. Understand the differences and limitations of controlled experiments and observational studies. Design experiments to infer causal treatment effects. Analyze observational data to infer associations between measured variables.

10. Identify and explain the statistical methods, assumptions, and limitations used in reported studies in scientific literature or popular media.

11. Evaluate and criticize published studies, the work of peers, and your own work and assess what was done well, what could be done better, and examine whether their conclusions are supported using statistical principles.

12. Make evidence-based decisions by constructing and deciding between testable hypotheses using appropriate data and methods.

13. Discover relationships and make predictions through model development and selection.

Meeting the learning outcomes

You will acquire new information in this class, but the emphasis is comprehending, integrating, and applying information. Rote factual memorization is the lowest form of learning. Effective learning takes place by explaining, integrating, applying, and analyzing facts, hypotheses, and theories.

Learning in this class occurs by:

  1. Doing – completion of exercises that require analysis of data to answer questions and test hypotheses, or researching answers to reading assignments.
  2. Discussion – interaction with classmates to assemble and synthesize information you’d utilizing the collective skills and knowledge base of the group.
  3. Listening, acting, and reflecting – activities during class time provide insights into information not available in readings and includes review difficult material to aid comprehension. Note taking permits later reflection on lecture content. Listening to the professor lecture is the least effective learning tool for both students, however, and you should plan on coming to every class prepared to participate in active and reflective learning opportunities.


Rubrics guide assessment (and self-assessment) of homework, code, projects, exams, and presentations.

Homework is due 1 week (or 2 classes, whichever is shorter) after we complete each chapter. Extra points may be given for exceptional work based on the rubrics for homework and code.  For example, if you earn a 5+5+5 on the rubric, then your grade will be increased by 10% of what you earned for doing exceptional work.

Header for homework assignments for each part:

First Last
ADA1 Stat 427 (or 527)
HW ##, Part #

All R code for the assignment should be included with the part of the problem it addresses (for code and output use a fixed-width font, such as Courier).
Do NOT use your R code and output as your answer to the problem, but include them to show me how you arrived at your answer. Your prose solution (in a non-fixed-width font) should be provided in addition to R output.

Grading breakdown

Semi-weekly homework: 75%
Midterm exam: 20% (Given a few pages of output, answer several pages of questions by interpreting the plots, tests, CIs, etc.)
Class participation: 5% (i>Clicker)

Final grade will include a small buffer at the discretion of the instructor. For example, final grade could be the total points earned divided by the total possible points times 0.95 for graduate students and 0.90 for undergraduate students. That is [Final Grade] = [Points Earned]/[Points possible * 0.95], so that your grade is slightly higher than you earned.

Please hand in a physical version of your homework and projects – a TA will write comments on it and give it back to you. An electronic version will be accepted under exception circumstances (almost never).

Late assignments will be penalized 20% if handed in by 5pm the following day, and will not be accepted after that.  Please slide your late assignments under my office door (SMLC 312) after writing the date/time in the upper-left hand corner of when you’re turning it in.

Semi-weekly homework

Homework is designed to encourage you to review the material we’ve learned, synthesize new information from the R help pages or the web, and apply (and learn!) your new skills. Expect to spend 4-5 hours a week (outside of class!) to do well, and maybe double that to do outstandingly well.

Model answers

My solutions posted after each HW is due will provide model answers to have a sense of the quality and content I’m looking for.

Collaboration and citation

For homeworks (and obviously team projects) I encourage you to work together. Please discuss the data, code, and problems with one another, but do your own exploration and write up. We expect everyone to hand in substantially different homeworks, and we will enforce this under the honor code. The small benefit you might get from plagiarism is not worth the severe penalty.

As in life, please use any resources available to you. Projects and some homeworks will explicitly encourage you to use resources on the internet, but showing extra initiative will always be appreciated. You may find R programming tough at first, so feel free discuss your problems with other classmates or meet with or email questions to the TAs or me.

I encourage you to use the ideas of others, but make them your own, giving credit. For projects have a formal bibliography, for homework cite casually, and for code copy the URL in a comment (which is doubly helpful for finding the resource again).

Disability statement

If you have a documented disability that will impact your work in this class, please contact me to discuss your needs. You’ll also need to register with the Accessibility Resource Center in 2021 Mesa Vista Hall (building 56) across the courtyard east from the SUB.

Learning without thought is labor lost.
What I hear, I forget.
What I see, I remember.
What I do, I understand.
– Confucius

Random stuff:
UNM has license for free online access to the definitive books for the Lattice and ggplot2 graphing platforms. Note you must be on campus or logged in through the UNM proxy to access these.

R is currently available in these UNM Locations: DSH 141 and 143, Econ 1004, SMLC pods, and SUB IT-LoboLab Pod and IT-LoboLab Classroom.

style matters. There is a lot of online help on R, such as at UCLA, try-r, and Google’s Intro to R video series. Usually try searching for “R [mytopic]” and you’ll get lots of results.  ggplot2 plotting cookbook.

R reference card by Jonathan Baron.

Translate between MATLAB and R.

Figure checklist.  Choosing the right chart.  Nature Methods points of view on visualization.

Raster vs vector graphics.

Statistics pre-req refresher from Khan Academy.

Coursera has a free 4-week course on computing for data analysis with R.

Muddy points in perspective.

R+LaTeX+knitr for reproducible research.  See my SC1 lecture notes (Ch01), and Mohammad Arbabshirani’s notes (pdf, rnw).



Team projects (did only in F12)

Project Teams csv R

Working in teams is how science gets done. Each member of the team is responsible for every part of the project. I know team projects can be frustrating, requiring maturity, mutual consideration, and professionalism throughout, but I hope to teach some skills that should make it less painful. More details will be provided when we start the first project, but expect to produce a 5-10 page report detailing the analysis of a data set or one you collect from a study you design.

Each project will receive a single grade, but individual grades will be weighted by effort as judged by the entire team.

Teams will be assigned by the TAs and myself. Teams can chose to fire team members who are not performing well (after meeting with me as a team), and individuals can choose to quit if they feel they are doing all the work.

Table of selected statistical methods

The data and design determines which method you use: original or UCLA.

Here’s a table of methods with the applicable semester of ADA and Chapter.

Measure Test(s) ADA-Ch
1 0
(1 population)
continuous normal not applicable
mean one-sample
median one-sample
categorical proportions Chi Square
binomial test
(2 independent
normal 2 categories mean 2 independent
sample t-test
non-normal medians Mann Whitney,
rank sum test
categorical proportions Chi square test
Fisher’s Exact test
(1 population
measured twice)
(2 matched
normal not
means paired t-test 1-02
non-normal medians Wilcoxon
signed ranks test
categorical proportions McNemar,
Chi-square test
(3 or more
normal categorical means one-way ANOVA 1-05
non-normal medians Kruskal Wallis 1-06
categorical proportions Chi square test 1-07
2 or more
(e.g., 2-way ANOVA)
normal categorical means Factorial ANOVA 2-05
non-normal medians Friedman test not
categorical proportions log-linear,
logistic regression
(1 population
3 or more
normal not applicable means Repeated measures
1 normal continuous correlation,
simple linear
non-normal non-parametric
categorical categorical
or continuous
logistic regression 2-11
continuous discriminant
2 or more normal continuous multiple linear
categorical logistic regression 2-11
normal mixed categorical
and continuous
Analysis of Covariance,
General Linear Models
categorical logistic regression 2-11
2 2 or more normal categorical MANOVA 2-15
2 or more 2 or more normal continuous multivariate
multiple linear
2 sets of
2 or more
0 normal not applicable canonical correlation not
2 or more 0 normal not applicable factor analysis not
0 or more mixed categorical
and continuous
principal component
(w/multiple regression)
categorical cluster analysis 2-13
discriminant analysis 2-16
classification 2-17

Acumen in Statistics