Skip to content

Commit af4649e

Browse files
committed
fix error in non-factorizable vignette
@paul-buerkner FYI fit$autocor$W was returning NULL so I had to change this to spdep::nb2mat(COL.nb) instead of fit$autocor$W. I think that's a break in backwards compatibility in brms so I wanted to give you a heads up (it says deprecated but that should still work with a warning right?).
1 parent 2b19358 commit af4649e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

vignettes/loo2-non-factorized.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,9 @@ follows.
359359

360360
```{r fit, results="hide"}
361361
fit <- brm(
362-
CRIME ~ INC + HOVAL,
362+
CRIME ~ INC + HOVAL + sar(COL.nb, type = "lag"),
363363
data = COL.OLD,
364-
autocor = cor_lagsar(COL.nb),
364+
data2 = list(COL.nb = COL.nb),
365365
chains = 4,
366366
seed = SEED
367367
)
@@ -398,7 +398,7 @@ loglik <- yloo <- sdloo <- matrix(nrow = S, ncol = N)
398398
for (s in 1:S) {
399399
p <- posterior[s, ]
400400
eta <- p$b_Intercept + p$b_INC * fit$data$INC + p$b_HOVAL * fit$data$HOVAL
401-
W_tilde <- diag(N) - p$lagsar * fit$autocor$W
401+
W_tilde <- diag(N) - p$lagsar * spdep::nb2mat(COL.nb)
402402
Cinv <- t(W_tilde) %*% W_tilde / p$sigma^2
403403
g <- Cinv %*% (y - solve(W_tilde, eta))
404404
cbar <- diag(Cinv)

0 commit comments

Comments
 (0)