docs icon indicating copy to clipboard operation
docs copied to clipboard

Error in "32.2 Example decision analysis"

Open avehtari opened this issue 3 years ago • 0 comments

Summary:

@Ullrika pointed out that "32.2 Example decision analysis" https://mc-stan.org/docs/2_29/stan-users-guide/example-decision-analysis.html has an error in the code.

The utility function is defined with arguments c and t

real U(real c, real t) {
    return -(c + 25 * t);
}

The model block has

  t ~ lognormal(mu[d], sigma[d]);
  c ~ lognormal(nu[d], tau[d]);

and the generated quantities block has

util[k] = U(lognormal_rng(mu[k], sigma[k]),
                lognormal_rng(nu[k], tau[k]));

Here mu and ´sigmaare parameters corresponding totand it is provided as the first argument which should bec`.

As the arguments in the generated quantities are in the wrong order, the generated quantities are wrong.

Current Version:

v2.29.0

avehtari avatar Feb 18 '22 18:02 avehtari