Wayne's Github Page

A place to learn about statistics

Applied Statistical Methods - Homework 1

Goals

Format

Please return a PDf file with your solutions on GradeScope.

Question 0 - reproducing the S1 results from Trustworthiness paper

Here we are following the steps in the code.

Question 1

In the file stim_descriptives/S1_attractiveness_ratings.csv contains the average attractiveness rating for each single face. How would you model the relationship between attractiveness vs the trustworthiness according to the paper? Be sure to articulate:

Question 2 - simulation

Given the in-class simulation that simulated multiple measurements from the same individual,

uniq_n <- 100
reps <- 5
n <- uniq_n * reps  # Sample Size
p <- 5    # number of features

p <- p + 1 # this allows for the intercept

X <- rnorm(n * p, 0, 2)
X_matrix <- matrix(X, ncol=p, nrow=n)
X_matrix[, 1] <- 1 # this is the intercept

beta <- runif(p, min=1, 2)
noise <- rnorm(n, 0, sd=1)

# This is how we think about Y being modeled by X and noise
Y <- X_matrix %*% beta + noise

# adding in the individual effect
individual_intercepts <- rnorm(uniq_n, 0, sd=5)
Y <- Y + rep(individual_intercepts, each=reps)

df <- as.data.frame(cbind(Y, X_matrix[, -1]))
names(df) <- c("Y", paste0("X", 1:(p - 1)))

df["subj_id"] <- as.character(rep(1:uniq_n, each=reps))

head(df, 4)

Question 3 - Posterior

We want to understand how fast different estimates converge to the truth given additional data points. Please visualize your answer.