Skip to content

Commit

Permalink
Merge pull request #244 from stan-dev/fix-LFO-vignette-typo
Browse files Browse the repository at this point in the history
Fix typo in LFO vignette
  • Loading branch information
jgabry authored Feb 12, 2024
2 parents dab6e58 + 33d5609 commit c29c4f7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vignettes/loo2-lfo.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ preds <- cbind(
)
ggplot(cbind(df, preds), aes(x = year, y = Estimate)) +
geom_smooth(aes(ymin = Q5, ymax = Q95), stat = "identity", size = 0.5) +
geom_smooth(aes(ymin = Q5, ymax = Q95), stat = "identity", linewidth = 0.5) +
geom_point(aes(y = y)) +
labs(
y = "Water Level (ft)",
Expand Down Expand Up @@ -321,7 +321,7 @@ The initial step for the exact computation is to calculate the log-predictive
densities by refitting the model many times:

```{r exact_loglik, results="hide"}
loglik_exact <- matrix(nrow = nsamples(fit), ncol = N)
loglik_exact <- matrix(nrow = ndraws(fit), ncol = N)
for (i in L:(N - 1)) {
past <- 1:i
oos <- i + 1
Expand Down Expand Up @@ -514,7 +514,7 @@ predict.

```{r exact_loglikm, results="hide"}
M <- 4
loglikm <- matrix(nrow = nsamples(fit), ncol = N)
loglikm <- matrix(nrow = ndraws(fit), ncol = N)
for (i in L:(N - M)) {
past <- 1:i
oos <- (i + 1):(i + M)
Expand Down Expand Up @@ -548,7 +548,7 @@ df_oos <- df[c(past, oos), , drop = FALSE]
fit_past <- update(fit, newdata = df_past, recompile = FALSE)
loglik <- log_lik(fit_past, newdata = df_oos, oos = oos)
loglikm <- rowSums(loglik[, oos])
approx_elpds_1sap[L + 1] <- log_mean_exp(loglikm)
approx_elpds_4sap[L + 1] <- log_mean_exp(loglikm)
# iterate over i > L
i_refit <- L
Expand Down

0 comments on commit c29c4f7

Please sign in to comment.