Skip to content

Commit 6b5c674

Browse files
committed
fix plot in Rate_5
1 parent 8ad9a40 commit 6b5c674

File tree

1 file changed

+7
-7
lines changed
  • Bayesian_Cognitive_Modeling/ParameterEstimation/Binomial

1 file changed

+7
-7
lines changed

Bayesian_Cognitive_Modeling/ParameterEstimation/Binomial/Rate_5_Stan.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ library(rstan)
55

66
# to be passed on to Stan
77
data <- read_rdump("Rate_5.data.R")
8-
8+
99
myinits <- list(
1010
list(theta=.5))
1111

1212
# parameters to be monitored:
1313
parameters <- c("theta", "postpredk1", "postpredk2")
14-
14+
1515
# The following command calls Stan with specific options.
1616
# For a detailed description type "?stan".
1717
samples <- stan(file="Rate_5_model.stan",
@@ -29,7 +29,7 @@ print(samples)
2929
theta <- extract(samples)$theta
3030
postpredk1 <- extract(samples)$postpredk1
3131
postpredk2 <- extract(samples)$postpredk2
32-
32+
3333
# Two-panel plot.
3434
layout(matrix(c(1,2),1,2))
3535
layout.show(2)
@@ -44,13 +44,13 @@ plot(c(y$breaks, max(y$breaks)), c(0,y$density,0), type="S", lwd=2, lty=1,
4444
lines(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))
4949
nsamples <- length(theta)
5050
sc <- 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

Comments
 (0)