Predictive Check

Donny

Introduction

We have learned about posterior predictive checks and KL-divergence.

How might we use those in our research ?

  • Reframing the idea of model checking

    • Condition on a model that we actually want to reject

Comparing Gaussian Graphical Models

plot of chunk unnamed-chunk-1

Suppose we wanted to compare these “networks”

Comparing Gaussian Graphical Models

Comparing Gaussian Graphical Models

# stack data
Y <- rbind(Y_m, Y_f)
# scatter matrix
S <- t(Y) %*% Y
# posterior assuming equality
post_samp <- rWishart(1000, nrow(Y) - 1,  solve(S)) 

# for s samples
sapply(1:1000, function(s){
  # Precision matrix
  Theta_s <- post_samp[,,s]
  # Covariance matrix
  Sigma_s <- solve(Theta_s)
  # Correlation matrix
  R_s <- diag(1/sqrt(diag(Sigma_s))) %*% Sigma_s %*% diag(1/sqrt(diag(Sigma_s)))
  # Yrep males
  Yrep_m <- MASS::mvrnorm(nrow(Y_m), diag(0, 25), R_s)
  # Yrep females
  Yrep_f <- MASS::mvrnorm(nrow(Y_f), diag(0, 25), R_s)
  # KL
  0.5 * (KL(Yrep_m, Yrep_f) +  KL(Yrep_f, Yrep_m))

})


Comparing Gaussian Graphical Models

Comparing Gaussian Graphical Models