Skip to content

Commit 790fe8f

Browse files
committed
Updates for final version of JSS paper
1 parent 462f865 commit 790fe8f

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

r/example3-sv.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ loadSavedWorkspace <- FALSE
2020

2121
# Save plot to file
2222
savePlotToFile <- FALSE
23+
nPlot <- 2500
2324

2425
##############################################################################
2526
# Load data
@@ -65,6 +66,10 @@ if (savePlotToFile) {
6566
}
6667

6768
# Print the estimate of the posterior mean and standard deviation
69+
resTh <- res$theta[noBurnInIterations:noIterations, ]
70+
thhat <- colMeans(resTh)
71+
thhatSD <- apply(resTh, 2, sd)
72+
6873
print(thhat)
6974
print(thhatSD)
7075

r/example4-sv.R

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ set.seed(10)
2020
loadSavedWorkspace <- FALSE
2121

2222
# Save plot to file
23-
savePlotToFile <- FALSE
23+
savePlotToFile <- TRUE
24+
nPlot <- 2500
2425

2526
##############################################################################
2627
# Load data
@@ -83,20 +84,21 @@ if (savePlotToFile) {
8384
##############################################################################
8485

8586
# Print the estimate of the posterior mean and standard deviation
87+
resTh <- res$theta[noBurnInIterations:noIterations, ]
88+
thhat <- colMeans(resTh)
89+
thhatSD <- apply(resTh, 2, sd)
90+
8691
print(thhat)
8792
print(thhatSD)
8893

89-
#[1] -0.1087619 0.9668493 0.1593125
90-
#[1] 0.24976843 0.02232583 0.05356500
94+
#[1] -0.0997589 0.9723418 0.1492119
95+
#[1] 0.27266581 0.01792217 0.04535608
9196

9297
# Compute an estimate of the IACT using the first 100 ACF coefficients
9398
print(iact)
94-
# [1] 13.28575 26.50253 23.31947
95-
96-
# Estimate the covariance of the posterior to tune the proposal
97-
estCov <- var(resTh)
99+
# [1] 31.94972 32.07775 28.36988
98100

99101
# Save the workspace to file
100102
if (!loadSavedWorkspace) {
101103
save.image("savedWorkspaces/example4-sv.RData")
102-
}
104+
}

r/example5-sv.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ loadSavedWorkspace <- FALSE
2121

2222
# Save plot to file
2323
savePlotToFile <- FALSE
24+
nPlot <- 2500
2425

2526
##############################################################################
2627
# Load data
@@ -78,15 +79,16 @@ if (savePlotToFile) {
7879
##############################################################################
7980

8081
# Print the estimate of the posterior mean and standard deviation
81-
print(thhat)
82-
print(thhatSD)
82+
resTh <- res$theta[noBurnInIterations:noIterations, ]
83+
thhat <- colMeans(resTh)
84+
thhatSD <- apply(resTh, 2, sd)
8385

84-
#[1] -0.1466918 0.9577250 0.1813333
85-
#[1] 0.21236553 0.02287443 0.05967315
86+
#[1] -0.1550373 0.9601144 0.1742736
87+
#[1] 0.23637116 0.02239614 0.05701460
8688

8789
# Compute an estimate of the IACT using the first 100 ACF coefficients
8890
print(iact)
89-
# [1] 12.55590 20.63091 16.94274
91+
# [1] 21.93670 28.96783 16.65938
9092

9193
# Estimate the covariance of the posterior to tune the proposal
9294
resThTransformed <- res$thetaTransformed[noBurnInIterations:noIterations,]

0 commit comments

Comments
 (0)