ropensci / jagstargets

Reproducible Bayesian data analysis pipelines with targets and JAGS
https://docs.ropensci.org/jagstargets
Other
10 stars 6 forks source link

`generate_data` in `mcmc_rep.Rmd` doesn't use `alpha`? #17

Closed dill closed 3 years ago

dill commented 3 years ago

Prework

Description

This is part of ropensci/software-review#425.

Running through the vignette Scaling MCMC pipelines, the data is generated by the following function:

generate_data <- function (n = 10L) {
  alpha <- stats::rnorm(n = 1, mean = 0, sd = 1)
  beta <- stats::rnorm(n = n, mean = 0, sd = 1)
  x <- seq(from = -1, to = 1, length.out = n)
  y <- stats::rnorm(n, x * beta, 1)
  # Elements of .join_data get joined on to the .join_data column
  # in the summary output next to the model parameters
  # with the same names.
  .join_data <- list(alpha = alpha, beta = beta)
  list(n = n, x = x, y = y, .join_data = .join_data)
}

Although alpha is generated, it is not actually used in the model. Should the line assigning y be:

y <- stats::rnorm(n, alpha + x * beta, 1)

?

link to line in this repo

Diagnostic information

Issue exists in last commit 18eeb2db40a49e5031868dac8f145095bd6135a4

wlandau commented 3 years ago

Thanks, should be fixed now.