Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed May 31, 2024
1 parent 688bffe commit 9e042a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vignettes/sbc/R/response.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ simulate_ar1 <- function(data, formula, prior) {
diag(correlation) <- 1
for (patient in seq_len(n_patient)) {
rows <- seq_len(n_time) + n_time * (patient - 1L)
covariance <- diag(sigma[rows]) %*% correlation %*% diag(sigma[rows])
covariance <- (1 / (1 - ar ^ 2)) *
diag(sigma[rows]) %*% correlation %*% diag(sigma[rows])
response <- MASS::mvrnorm(mu = x_beta[rows], Sigma = covariance)
data[[attr(data, "brm_outcome")]][rows] <- response
}
Expand Down

0 comments on commit 9e042a6

Please sign in to comment.