def npv_converter(sensitivity, specificity, prevalence):
    """Generates the negative predictive value from designated sensitivity, specificity, and prevalence.

    .. math::

        NPV = \\frac{Sp \\times (1-P)}{(1-Se) \\times P + Sp \\times (1-P)}

    Parameters
    -------------
    sensitivity : float
        Sensitivity of the testing criteria
    specificity : float
        Specificity of the testing criteria
    prevalence : float
        Prevalence of the outcome in the population

    Returns
    ------------
    float
        Negative predictive value

    Examples
    --------
    Calculate the positivity predictive value

    >>> from zepid.calc import npv_converter
    >>> npv_converter(0.9, 0.88, 0.15)
    """
    if sensitivity > 1 or specificity > 1 or prevalence > 1:
        raise ValueError(
            'sensitivity/specificity/prevalence cannot be greater than 1')
    if sensitivity < 0 or specificity < 0 or prevalence < 0:
        raise ValueError(
            'sensitivity/specificity/prevalence cannot be less than 0')
    spec_nprev = specificity * (1 - prevalence)
    nsens_prev = (1 - sensitivity) * prevalence
    npv = spec_nprev / (spec_nprev + nsens_prev)
    return npv
