Calculates posterior predictive p-values on data simulated from the posterior
     predictive distribution, returning the quantile of the observed data relative to
     simulated.

     The posterior predictive p-value is computed by:

       .. math:: Pr(T(y^{\text{sim}} > T(y) | y)

     where T is a test statistic of interest and :math:`y^{\text{sim}}` is the simulated
     data.

    :Arguments:
        simdata: array or PyMC object
            Trace of simulated data or the PyMC stochastic object containing trace.

        trueval: numeric
            True (observed) value of the data

        round: int
            Rounding of returned quantile (defaults to 3)

def ppp_value(simdata, trueval, round=3):
    """
    Calculates posterior predictive p-values on data simulated from the posterior
     predictive distribution, returning the quantile of the observed data relative to
     simulated.

     The posterior predictive p-value is computed by:

       .. math:: Pr(T(y^{\text{sim}} > T(y) | y)

     where T is a test statistic of interest and :math:`y^{\text{sim}}` is the simulated
     data.

    :Arguments:
        simdata: array or PyMC object
            Trace of simulated data or the PyMC stochastic object containing trace.

        trueval: numeric
            True (observed) value of the data

        round: int
            Rounding of returned quantile (defaults to 3)

    """

    if ndim(trueval) == 1 and ndim(simdata == 2):
        # Iterate over more than one set of data
        return [post_pred_checks(simdata[:, i], trueval[i])
                for i in range(len(trueval))]

    return (simdata > trueval).mean()