ADA2 S24

UNM Stat 428/528: Advanced Data Analysis II (ADA2)

Spring 2024 Syllabus is below the tables

Goal

This is Statistics Learn to produce beautiful (R Markdown) and reproducible (quarto) reports with informative plots (ggplot2) and tables (kable) by writing code (R, tidyverse, Rstudio) to answer questions using fundamental statistical methods (multiple regression, analysis of covariance, logistic regression, and multivariate methods), which you’ll be proud to present (poster).


Content

Roadmap

Here’s your roadmap for the semester! Each week, follow the general process outlined below:
  • The class maintains a Tuesday/Thursday schedule.
  • Each Tuesday and Thursday:
    • Enjoy reading the assigned chapter, using Video lectures to supplement the reading.
  • Complete the homework assignments in the form of quizzes and worksheets.
    • Weekly quizzes are due Tuesday by 11:50 PM
    • Tuesday assignments are due Friday by 11:50 PM
    • Thursday assignments are due Monday by 11:50 PM
  • The table below has a row for each Tuesday and Thursday.

Resources

  • UNM Canvas for completing quizzes and for submitting worksheet assignments (evaluated by TA within 1 week).
    • After uploading a pdf assignment, verify with a preview of the file.
  • Book (online and free)
    • ADA: Statistical Acumen: Advanced Data Analysis by Erik Erhardt.
    • Note that the (historical) chapter numbers referred to in the table and assignments below differ from the (new) book chapter numbers.  The chapter names are the same and I hope this won’t cause much confusion.
  • Videos
 

Pre-course to-dos

Did you receive a registration error for Spring 2024? 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 prerequisites)?
If you are waitlisted, as long as there are seats available, I will override you into the course. Don’t worry.

Step 0

Before our first “class” (Mon 1/15/24) please read through the following actions and install the required software on your computer.
  1. Install:
    1. R (windows or mac) or upgrade (Install R video (5 min)),
    2. RStudio, and
    3. Quarto.
  2. Install R packages.
    1. Follow these instructions: R packages.  (Ignore warning about rtools or any packages unavailable.)
    2. In RStudio, open Packages tab, click on “Update”, Select All, Install Updates (“No” to restart, “No” to compile from source).
  3. Install erikmisc package (also at the end of “Install R packages”, above).
    1. Submit these the two lines to the R console:
      1. install.packages("remotes")
      2. remotes::install_github("erikerhardt/erikmisc")
        1. If it asks to update packages (it should not ask this if you updated packages above), press 3 [Enter] for “None”.
        2. If asks about “make” command, click “Cancel”.
        3. If asks about “git” command, click “Cancel”.
    2. Make sure it works by printing the logo:
      1. library(erikmisc)
      2. erikmisc_logo()
  4. Set up your computer
    1. RStudio disable notebook
    2. Operating system to be more friendly to programming.
If you have a Chromebook or no laptop, consider using RStudio Cloud > Individuals,  and when installing packages remove the type="binary" option.
 

Timetable

Date Class Topic Reading, Video, Quiz class Worksheet, Data
01/15 00 Install software
  • See Step 0
  • video: S21 Intro (similar for S24)
01/16 01 01 R statistical software and review
  • read: Ch 01
  • video: 01-1, 01-2
  • quiz: 01 (uses worksheet data)
  • Due M 01/23 (11:50 PM)
01/18 02
  • continued
01/23 03 02 Introduction to Multiple Linear Regression
  • read: Ch 02
  • video: 02-1, 02-2
  • quiz: 03
  • Due T 01/23 (11:50 PM for all remaining)
  • qmd html dat
  • Class 03, Ch 02 Introduction to Multiple Linear Regression
  • video: CL03
  • Due F 01/26
01/25 04
  • qmd html dat
  • Class 04, Ch 02 Introduction to Multiple Linear Regression
  • video: CL04
  • Due M 01/29
01/30 05 03 A Taste of Model Selection for Multiple Linear Regression
  • read: Ch 03, 04
  • video: 03-1, 03-2, 04
  • quiz: 05a, 05b
  • Due T 01/30
  • qmd html dat
  • Class 05, Ch 03 A Taste of Model Selection for Multiple Regression
  • video:  CL05
  • Due F 02/02
02/01 06 04 Experimental Design: One- and Two-Factor Designs
  • Data: none
  • qmd html dat
  • Class 06, Ch 03 A Taste of Model Selection for Multiple Regression
  • video: CL06
  • Due M 02/05
02/06 07 05 Paired Experiments and Randomized Block Designs
  • qmd html
  • Class 07, Ch 05a Paired Experiments and Randomized Block Experiments: Randomized complete block design (RCBD)
  • video: CL07
  • Due F 02/09
02/08 08
  • qmd html dat
  • Class 08, Ch 05a Paired Experiments and Randomized Block Experiments
  • video: CL08
  • Due M 02/12
02/13 09
  • qmd html dat
  • Class 09, Ch 05b Paired Experiments and Randomized Block Experiments: Two-way Factor design
  • video: CL09
  • Due F 02/16
02/15 10
  • qmd html dat
  • Class 10, Ch 05b Paired Experiments and Randomized Block Experiments: Two-way Factor design
  • video: CL10
  • Due M 02/19
02/20 11 06 Discussion of Observational Studies
  • read: Ch 06-07
  • video:  06 07-1 07-2 07-3
  • quiz: 11a, 11b
  • Due T 02/20
  • qmd html dat1 dat2
  • Class 11, Chs 05 and 07, writing and plotting model equations
  • video: CL11
  • Due F 02/23
02/22 12 07 Analysis of Covariance: Comparing Regression Lines
  • qmd html dat
  • Class 12, Ch 07a, Analysis of Covariance: Comparing Regression Lines
  • video: CL12
  • Due M 02/26
02/27 13 08 Polynomial Regression
  • qmd html dat
  • Class 13, Ch 08, polynomial regression
  • video: CL13
  • Due F 03/01
02/29 14 09 Response Models with Factors and Predictors
03/05 15 10 Model Selection for Multiple Regression
03/07 16
03/12 Spring Break
03/14 Spring Break
03/19 17 11 Logistic Regression
  • qmd html dat
  • Class 17, Ch 11, Logistic Regression
  • video: CL17
  • Due F 03/22
03/21 18
  • qmd html dat
  • Class 18, Ch 11, Logistic Regression
  • video: CL18
  • Due M 03/25
03/26 19 12 An Introduction to Multivariate Methods
  • Data: none
13 Principal Components Analysis (PCA)
  • read: Ch 12, Ch 13
  • video: 12 13-1 13-2 13-3
  • quiz: 19a, 19b
  • Due T 03/26
  • qmd html dat
  • Class 19, Ch 13, Principal Components Analysis (PCA)
  • video: CL19
  • Due F 03/29
03/28 20 PCA, continued
  • qmd html dat
  • Class 20, Ch 13, Principal Components Analysis (PCA)
  • video: CL20
  • Due M 04/01
04/02 21 14 Cluster Analysis 15 Multivariate Analysis of Variance (MANOVA)
  • read: Ch 14, Ch 15
  • video:  14-1 14-2 14-3  15
  • quiz: 21a, 21b
  • Due T 04/02
 
04/04 22
  • qmd html dat
  • Class 22, Ch 15, Multivariate Analysis of Variance (MANOVA)
  • video: CL22
  • Due M 04/08
04/09 23 16 Discriminant Analysis 17 Classification
  • qmd html dat
  • Class 23, Chs 16+17, Discrimination for Classification
  • video: CL23
  • Due M 04/15
04/11 24
04/16 25 13+11+17 PCA and logistic regression classification
  • Data: none
  • qmd html dat
  • Class 25, Chs 13+11+17, PCA and Logistic Regression for Classification
  • video: CL25
  • Due M 04/22
04/18 26
04/23 27 10 Model Selection for Multiple Regression, revisited:  ATUS data subset and model selection
  • Data: none
  • qmd html dat
  • Class 27, ATUS data subset and model selection
  • video: CL27
  • Due M 04/29
  • Results
04/25 28 MS Stat Qual exam, you can do it!
  • qmd html dat
  • Class 28, Pulse
  • video: none
  • Due M 05/06
04/30 29
05/02 30
  1. EvalKit course evaluation: print a pdf of your email confirmation that you’ve completed the EvaluationKIt Survey and upload that to UNM Canvas. (Due F 05/03)
  2. PDS Wesleyan U Qualtrics survey (email), no receipt required
05/07 FINALS WEEK (no final) Congratulations on a great semester!
 
(I reserve the right to continue to improve the materials throughout the semester.)

Syllabus

  • Description: A continuation of 427/527 that focuses on methods for analyzing multivariate data and categorical data. Topics include MANOVA, principal components, discriminant analysis, classification, factor analysis, analysis of contingency tables including log-linear models for multidimensional tables and logistic regression.
  • Prerequisite: Stat 427/527 (ADA1)
  • Semesters offered: Spring
  • Lecture: Stat 428/528.001 (CRN 33933 or 33935) (TR 0930-1045, CTLB 300 Video)
  • Email: Please include “ADA2” in the subject line of all emails.

Instructors

  • Professor
    • Erik Erhardt <erike@stat.unm.edu>, he/him
  • Teaching Assistants
    • Behzad FallahiFard <bfallahifard@unm.edu>, he/him
    • Azadeh Golduzian <agolduzian96@unm.edu>, she/her

Office hours

See Canvas announcement “ADA2, Stat 428/528, Announcements” from 1/16/24 for Zoom links and instructions.
Time Mon Tue Wed Thu Fri Sat Sun
8 AM
9 AM EE BF EE BF
10 AM EE BF EE BF
11 AM EE BF EE BF
12 PM
1 PM
2 PM EE BF
3 PM EE BF
4 PM AG AG BF
5 PM AG AG
6 PM
7 PM
8 PM
9 PM
  • We are also all available by appointment by email if these many hours do not work for you.

Student learning outcomes

Similar to ADA1, but at a higher level.

Assessment

  • Quizzes. Purpose: to assess reading and video comprehension and assure you’re prepared to actively participate in worksheet activities with minimal lecture. (About 12, 15% of final grade.) Most weeks plan for 1-2 hours reading and video, 1-hour 20-minute quiz. Quizzes are not timed, they can be taken twice, and the higher of the two scores is used as the grade.
    • Quiz solutions can be viewed after the due date in UNM Canvas.
  • Worksheet assignments.  Purpose: to struggle and find success in class with the concepts and skills. (About 21, 83% of final grade.)
  • Course surveys are due at the end of the course (EvalKit).  (1 or 2, 2% of final grade.)
  • No late assignments.  Roughly speaking, the lowest 2-weeks worth of assignments are dropped, so your lowest 1-2 quizzes assignments and 2-3 worksheet assignments are not included in the calculation of your grade (this could include a worksheet assignment that spanned a full week).
Final grade may include a small buffer at the discretion of the instructor. For example, final grade could be the total points earned adjusted none or a little for graduate students and a little more for undergraduate students. That is [Final Grade] = 1 – (1 – [Points Earned])/a, where a = 1.25 for undergraduate students.  This increases your grade is slightly higher than you earned, and does more so for those with lower grades.  Here’s R code to see how grades would adjust for a given value of “adjustment”:
adjustment = 1.25
tibble::tibble(
    original   = seq(0, 1, by = 0.05)
  , adjusted   = 1 - ((1 - original) / adjustment)
  , difference = adjusted - original
  ) |> 
  print(n=Inf)
All assignments in this class are electronic, submitted to UNM Canvas.  For all submissions: (1) In Quarto, render qmd file to HTML, (2) Open HTML file in your internet browser, (3) Print HTML to pdf file, (4) Submit pdf to UNM Canvas.  Always view your submission in Canvas to verify that the grader will also be able to view your assignment! Browser choice: Chrome is the best browser choice.  On a Mac, Safari adds “.txt” to Quarto files when downloaded, and Firefox sometimes fails on upload of a pdf to UNM Canvas. Rubrics guide assessment (and self-assessment) of homework, code, projects, exams, and presentations.  Each assignment will have its own specific rubric. The use of R and Quarto are required for the course.  This will include all of the R code for the assignment with the part of the problem it addresses in a fixed-width font and syntax highlighting. You will weave your code with prose narrations of your work and solutions.

Collaboration and citation

  • For homework, 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 homework, and we will enforce this under the honor code. The small benefit you might get from plagiarism is not worth the severe penalty (of lost trust, being reported to the dean, no points for the assignment, etc.).
  • As in life, please use any resources available to you. Projects and some homework 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 to 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 simply copy the URL into your code as a comment (which is doubly helpful to you for finding the resource again).

Statements

COVID-19 Health and Awareness

UNM is a mask friendly, but not a mask required, community. If you are experiencing COVID-19 symptoms, please do not come to class. If you do need to stay home, please communicate with me at my email; I can work with you to provide alternatives for course participation and completion. Let me, an advisor, or another UNM staff member know that you need support so that we can connect you to the right resources. Please be aware that UNM will publish information on websites and email about any changes to our public health status and community response. Support: Student Health and Counseling (SHAC) at (505) 277-3136. If you are having active respiratory symptoms (e.g., fever, cough, sore throat, etc.) AND need testing for COVID-19; OR If you recently tested positive and may need oral treatment, call SHAC.  LoboRESPECT Advocacy Center (505) 277-2911 can offer help with contacting faculty and managing challenges that impact your UNM experience.

Accessibility and Privacy

UNM is committed to providing courses that are inclusive and accessible for all participants. As your instructor, it is my objective to facilitate an accessible classroom setting, in which students have full access and opportunity. If you are experiencing physical or academic barriers, or concerns related to mental health, physical health, and/or COVID-19, please consult with me after class, via email/phone, or during office hours. You are also encouraged to contact the Accessibility Resource Center at arcsrvs@unm.edu or by phone 277-3506.

Below are accessibility and privacy statements for the tools we will be using in this course. If you have questions or concerns about any of these, please contact me.

Credit-hours

This is a three credit-hour course delivered in an entirely asynchronous online modality over 16 weeks during the Spring 2024 semester. Please plan for a minimum of 9 hours per week to learn course materials and complete assignments. Support: Resources to support study skills and time management are available through Student Learning Support at the Center for Teaching and Learning.

Title IX statement

Our classroom and our university should always be spaces of mutual respect, kindness, and support, without fear of discrimination, harassment, or violence. Should you ever need assistance or have concerns about incidents that violate this principle, please access the resources available to you on campus. Please note that, because UNM faculty, TAs, and GAs are considered “responsible employees” any disclosure of gender discrimination (including sexual harassment, sexual misconduct, and sexual violence) made to a faculty member, TA, or GA must be reported by that faculty member, TA, or GA to the university’s Title IX coordinator. For more information on the campus policy regarding sexual misconduct and reporting, please see: https://policy.unm.edu/university-policies/2000/2740.html. Support: LoboRESPECT Advocacy Center, the Women’s Resource Center, and the LGBTQ Resource Center all offer confidential services.

Citizenship and/or Immigration Status

All students are welcome in this class regardless of citizenship, residency, or immigration status. Your professor will respect your privacy if you choose to disclose your status. As for all students in the class, family emergency-related absences are normally excused with reasonable notice to the professor, as noted in the attendance guidelines above. UNM as an institution has made a core commitment to the success of all our students, including members of our undocumented community. The Administration’s welcome is found on our website: http://undocumented.unm.edu/.

Land Acknowledgement

Founded in 1889, the University of New Mexico sits on the traditional homelands of the Pueblo of Sandia. The original peoples of New Mexico Pueblo, Navajo, and Apache since time immemorial, have deep connections to the land and have made significant contributions to the broader community statewide. We honor the land itself and those who remain stewards of this land throughout the generations and also acknowledge our committed relationship to Indigenous peoples. We gratefully recognize our history. Faculty Resource: Information provided by UNM’s Division for Equity and Inclusion can support building an inclusive classroom, https://diverse.unm.edu/education-and-resources/programs/index.html.

Respectful and Responsible Learning

We all have shared responsibility for ensuring that learning occurs safely, honestly, and equitably. Submitting material as your own work that has been generated on a website, in a publication, by an artificial intelligence algorithm, by another person, or by breaking the rules of an assignment constitutes academic dishonesty. It is a student code of conduct violation that can lead to a disciplinary procedure. Please ask me for help in finding the resources you need to be successful in this course. I can help you use study resources responsibly and effectively. Off-campus paper writing services, problem-checkers and services, websites, and AIs can produce incorrect or misleading results. Learning the course material depends on completing and submitting your own work. UNM preserves and protects the integrity of the academic community through multiple policies including policies on student grievances (Faculty Handbook D175 and D176), academic dishonesty (FH D100), and respectful campus (FH CO9). These are in the Student Pathfinder (https://pathfinder.unm.edu) and the Faculty Handbook (https://handbook.unm.edu). Support: Many students have found that time management workshops or work with peer tutors can help them meet their goals. These and are other resources are available through Student Learning Support at the Center for Teaching and Learning.

Connecting to Campus and Finding Support

UNM has many resources and centers to help you thrive, including opportunities to get involved, mental health resources, academic support such as tutoring, resource centers for people like you, free food at Lobo Food Pantry, and jobs on campus. Your advisor, staff at the resource centers and Dean of Students, and I can help you find the right opportunities for you.

Support in Receiving Help

Students who ask for help are successful students. I encourage students to be familiar with services and policies that can help them navigate UNM successfully. Many services exist to help you succeed academically, such as peer tutoring at CAPS and http://mentalhealth.unm.edu. There are plenty of ways to find your place and your pack at UNM: see the “student guide” tab on my.unm, students.unm.edu, or ask me for information about the right resource center or person to contact.

Doing the Right Thing

UNM has policies to preserve and protect you and the academic community available in the Student Pathfinder as well as in the Faculty Handbook. These include policies on student grievances D175 (undergraduates) and D176 (graduate and professional students), academic dishonesty (D100), and respectful campus (CO9). Please ask for help in understanding and avoiding plagiarism (passing the work or words of others off as your own work or words) or other forms of academic dishonesty. Doing something dishonest in a class or on an assignment can lead to serious academic consequences. Come talk with me about your concerns or needs for academic flexibility or talk with support staff at one of our student resource centers before you do something that may endanger your career.

Our Classroom

We’re doing this because:
  • We want you to be empowered with statistics.
  • We believe everyone should get out of this course with awesome skills
  • Real-time feedback promotes efficient learning
“It encourages me to engage actively with the course material and take responsibility for my learning.”

GAISE Connections

Our six recommendations include the following:
  1. Emphasize statistical literacy and develop statistical thinking
  2. Use real data
  3. Stress conceptual understanding, rather than mere knowledge of procedures
  4. Foster active learning in the classroom
  5. Use technology for developing conceptual understanding and analyzing data
  6. Use assessments to improve and evaluate student learning

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

Archive

Passion Driven Statistics (PDS) data

Old news

Asking smart questions

  • Smart Questions” guide (note “hackers build things, crackers break them”)
  • Follow this Rubric when emailing a question:
    • Send a new email for each new question.  Use “Reply” to continue a conversation on a question (do not start a new email, again).
    • Include “ADA2” as the first word of the subject line in new emails (if replying, use reply), with the rest of the subject indicating the assignment and type of problem.
    • Begin the email with a short question summary (that is, don’t bury your question in the middle of the third paragraph).  Then, begin the detail of your question in the second paragraph.
    • When possible, include commented code in the email body — Comments (starting with # symbol) should indicate where the problem is, what the expected behavior is, and what steps are necessary to reproduce the problem.
    • Attach your qmd file so that the instructor can reproduce the problem.   If attaching code, please include all the files necessary to run your code (data, etc.)
    • [Attaching code supersedes this: Code should include a “Minimum representative test case” (http://www.catb.org/esr/faqs/smart-questions.html#code)]
    • Assume the best. Your instructors want to help and we will do our best. Do not abuse your helpers even if you feel frustrated.

RMarkdown and knitr issues

  • R errors, unresolved, and out of time If you’re saying: “An error while knitting keeps me from turning in the assignment…”, then use code chunk option
```{r, error = TRUE}
to ignore the error and continue. This will allow you to turn in partial assignments with errors.
  • Unicode compile problems:  If you knit to pdf you may get this error: “! Package inputenc Error: Unicode char”.  ASCII is a small character set what we use to program in, Unicode is an extended character set that looks pretty (for example “straight quotes” become “curly quotes”) but causes code to break.  You get unwanted Unicode when you copy/paste from a pdf or some other source into your code.  To fix this, you have to find the Unicode and replace it with it’s ASCII equivalent.  To do this: Ctrl-F to find, search for “[^\x00-\x7F]” (without quotes), select “Regex” for regular expressions, and find the “Next” one.  As it finds instances, replace the characters manually until there are no more.  These characters will typically be curly quotes or fancy dashes.
 
3/1/17 – Data resources for poster:

Citing and using notes, including previous editions

Citing lecture notes: Erhardt EB, Bedrick EJ, and Schrader RM. (2020) Lecture notes for Advanced Data Analysis 2. Retrieved Mar 1, 2020, from statacumen.com/teach/ADA2/notes/ADA2_notes_S20.pdf, 136–144.

Acumen in Statistics