percentiles of a variable in jags

  • Martyn Plummer
    Martyn Plummer
    2014-01-14

    This should give you the quantile Q of variable x3

       index.Q <- round(nData*Q)
       x3.sorted <- sort(x3)
       x3.Q <- x3.sorted[index.Q]
    

    So, for example Q <- 0.5 gives you the median.