@@ -5,13 +5,13 @@ library(rstan)
55
66# to be passed on to Stan
77data <- read_rdump(" Rate_5.data.R" )
8-
8+
99myinits <- list (
1010 list (theta = .5 ))
1111
1212# parameters to be monitored:
1313parameters <- c(" theta" , " postpredk1" , " postpredk2" )
14-
14+
1515# The following command calls Stan with specific options.
1616# For a detailed description type "?stan".
1717samples <- stan(file = " Rate_5_model.stan" ,
@@ -29,7 +29,7 @@ print(samples)
2929theta <- extract(samples )$ theta
3030postpredk1 <- extract(samples )$ postpredk1
3131postpredk2 <- extract(samples )$ postpredk2
32-
32+
3333# Two-panel plot.
3434layout(matrix (c(1 ,2 ),1 ,2 ))
3535layout.show(2 )
@@ -44,13 +44,13 @@ plot(c(y$breaks, max(y$breaks)), c(0,y$density,0), type="S", lwd=2, lty=1,
4444lines(density(theta ), col = " red" , lwd = 2 )
4545
4646# Second plot, the data space (predictives)
47- plot(k1 ,k2 ,type = " p" , pch = 4 , cex = 2 , lwd = 2 , xlab = " Success Count 1" ,
48- ylab = " Success Count 2" , xlim = c(- 1 , n1 + 1 ), ylim = c(- 1 ,n2 + 1 ))
47+ plot(data $ k1 , data $ k2 , type = " p" , pch = 4 , cex = 2 , lwd = 2 , xlab = " Success Count 1" ,
48+ ylab = " Success Count 2" , xlim = c(- 1 , data $ n1 + 1 ), ylim = c(- 1 , data $ n2 + 1 ))
4949nsamples <- length(theta )
5050sc <- 10
51- for (i in 0 : n1 )
51+ for (i in 0 : data $ n1 )
5252{
53- for (j in 0 : n2 )
53+ for (j in 0 : data $ n2 )
5454 {
5555 match.preds <- sum(postpredk1 == i & postpredk2 == j )/ nsamples
5656 if (match.preds > 0 )
0 commit comments