I'm posting this partially to get a question answered and partially so someone else might find it later and save them the headache.
I am trying to create a beta-pert distribution in NetLogo by following the formula here from Epix Analytics
I've created an Beta(Alpha1, alpha2) distribution using the transformation from a gamma distbutiotn here on the Beta distribution wiki page:
The code that I've created is:
to pert
let mu ((a + 4 * b + c) / 6)
let alpha1 ((mu - a ) * (2 * b - a - c)) / ((b - mu) * (c - a))
let alpha2 (alpha1 * (c - mu)) / (mu - a)
let x (random-gamma alpha1 1)
let y (random-gamma alpha2 1)
let beta-output (x / (x + y))
let output beta-output * (c - a) + a
show output
end
My question is about the Wikipedia page's transformation from a Gamma distribution to a Beta distribution. It has a theta as the second part of the gamma distrbution but doesnt ever define what that is. I took it as a placeholder and as long as theta is the same for both X and Y, would not affect the outcome. I've played with different theta values with no visible change in the distribution. Is this a correct assumption?
to-report random-pert [#minval #likeval #maxval]
;use pert params to draw from a beta distribution
if not (#minval <= #likeval and #likeval <= #maxval) [error "wrong argument ranking"]
if (#minval = #likeval and #likeval = #maxval) [report #minval] ;;handle trivial inputs
let pert-var 1. / 36
let pert-mean (#maxval + 4 * #likeval - 5 * #minval) / (6 * (#maxval - #minval))
let temp pert-mean * (1 - pert-mean) / pert-var
let alpha1 pert-mean * (temp - 1)
let alpha2 (1 - pert-mean) * (temp - 1)
let x1 random-gamma alpha1 1
let x2 random-gamma alpha2 1
report (x1 / (x1 + x2)) * (#maxval - #minval) + #minval
end