STA261: Probability and Statistics II

Undergraduate course, University of Toronto, 2020

STA261 is intended to be a rigorous (but friendly) introduction to mathematical statistics for students in the Theory and Methods Statistics Specialist program at the University of Toronto (UofT). I taught this course four times, from 2020 to 2024. The content here is mainly from the Summer 2024 offering.

Syllabi

Summer 2021
Summer 2022
Summer 2024

Modules (Summer 2024)

Module 1: Statistics

Slides

Module 1 - Statistics
Module 1 - Statistics (Annotated)

Assignment

Assignment 0 (Solutions)
Assignment 1

Optional Readings and Resources

Module 2: Point Estimation

Slides

Module 2 - Statistics
Module 2 - Point Estimation (Annotated)

Assignment

Assignment 2

Optional Readings and Resources

Module 3: Hypothesis Testing

Slides

Module 3 - Hypothesis Testing
Module 3 - Hypothesis Testing (Annotated)

Assignment

Assignment 3

Optional Readings and Resources

Module 4: Intervals and Model Checking

Slides

Module 4 - Intervals and Model Checking
Module 4 - Intervals and Model Checking (Annotated)

Assignment

Assignment 4

Optional Readings and Resources

When Uniform Numbers Aren’t That Uniform…

library(rgl) # for plotting

####

# A linear congruential generator: starting with an initial X_{0}, we recursively update X_{i+1} = c + a*X{i} (mod m) 
# for some fixed c, prime number a, m and then return (X_{0}, ..., X_{n})/m

####

a <- 65539
m <- 2^31
seed <- 1234

lcg <- function(n, seed, a, m) {
  X <- numeric(n)
  X[1] <- seed
  for (i in 2:n) {
    X[i] <- a*X[i-1] %% m
  }
  return(X / m)
}

n <- 10000
X <- lcg(n, seed, a, m)

rgl::plot3d(X[1:(n-2)], X[2:(n-1)], X[3:n], xlab = 'X[i]', ylab = 'X[i+1]', zlab = 'X[i+2]', col = 'blue')

Module 5: Asymptotic Extensions

Slides

Module 5 - Asymptotic Extensions
Module 5 - Asymptotic Extensions (Annotated)

Assignment

Assignment 5

Optional Readings and Resources

Asymptotics in Action

If you know some basic R and you’ve worked through the assignment, try to figure out what this does and then run it. If you aren’t amazed, you should be!

set.seed(123456)
wald <- 0
score <- 0
J <- 1000
N <- 10000

for (j in 1:J) {
    dat <- rnorm(n=N, mean=10, sd=sqrt(4))
    vardat <- (1/N)*sum((dat-10)^2)

    L_w <- (1-sqrt(2/N)*1.96)*vardat
    U_w <- (1+sqrt(2/N)*1.96)*vardat
    if (L_w < 4 && 4 < U_w) {
    wald <- wald + 1
    }

    L_s <- vardat/(1+sqrt(2/N)*1.96)
    U_s <- vardat/(1-sqrt(2/N)*1.96)
    if (L_s < 4 && 4 < U_s) {
    score <- score + 1
    }
}

score_conf <- score/J
wald_conf <- wald/J

Module 6: Bayesian Statistics

Slides

Module 6 - Bayesian Statistics
Module 6 - Bayesian Statistics (Annotated)

Assignment

Assignment 6

Optional Readings and Resources

Assessments

Summer 2021

Summer 2021 - Quiz 1
Summer 2021 - Quiz 2
Summer 2021 - Quiz 3
Summer 2021 - Quiz 4
Summer 2021 - Quiz 5
Summer 2021 - Final Assessment

Summer 2022

Summer 2022 - Midterm 1
Summer 2022 - Midterm 2
Summer 2022 - Final Exam

Summer 2024

Summer 2024 - Midterm 1
Summer 2024 - Midterm 2
Summer 2024 - Final Exam