Skip to content

Instantly share code, notes, and snippets.

@jebyrnes
Created April 30, 2017 18:31
Show Gist options
  • Save jebyrnes/2efeb17570145312f5e0e6f55de07934 to your computer and use it in GitHub Desktop.
Save jebyrnes/2efeb17570145312f5e0e6f55de07934 to your computer and use it in GitHub Desktop.
library(rethinking)
#make a multivariate vector with known correlation
sigma_mat <- matrix(c(1,.3, 0.2,
0.3, 1, 0.4,
0.2, 0.4, 1), nrow=3)
z <- rmvnorm(1, c(0,0, 0), sigma_mat)
z_2 <- z[2]
z[2] <- NA
#model
mod <- alist(
z <- dmvnorm(0, sigma)
)
#fit - doesn't work...
fit <- map2stan(mod,
data=list(z=z, sigma=sigma),
start=list(z=c(z[1], 0, z[2])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment