File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1134,14 +1134,6 @@ c0 <- C0 <- 0.01
11341134cthetas <- c(.01, .1, 1)
11351135
11361136# Allocate space for the draws
1137- # Compute the epsilons recursively
1138- eps <- filter(dat, -theta, "recursive", init = eps0)
1139-
1140- # Sample sigma^2
1141- cN <- c0 + (length(dat) + 1) / 2
1142- CN <- C0 + 0.5 * (eps0^2 + sum(eps^2))
1143- sigma2 <- rinvgamma(1, cN, CN)
1144-
11451137 # Sample theta via RW-MH
11461138 epsprop <- filter(dat, -thetaprop, "recursive", init = eps0)
11471139
@@ -1165,6 +1157,11 @@ for (i in seq_along(cthetas)) {
11651157 tmp <- 1 + sum(bs^2)
11661158 eps0 <- rnorm(1, -sum(as * bs) / tmp, sqrt(sigma2 / tmp))
11671159
1160+ # Sample sigma^2
1161+ eps <- filter(dat, -theta, "recursive", init = eps0)
1162+ cN <- c0 + (length(dat) + 1) / 2
1163+ CN <- C0 + 0.5 * (eps0^2 + sum(eps^2))
1164+ sigma2 <- rinvgamma(1, cN, CN)
11681165
11691166 if (log(runif(1)) < logR) {
11701167 theta <- thetaprop
You can’t perform that action at this time.
0 commit comments