def compute_p_error(x, intdims, axis=None):
    """Computes the error rate for integer dimension estimates (1-hit rate)

    :param int x: the intrinsic dimension of the manifold
    :param numpy.ndarray of int intdims: id estimates
    :param axis: axis to compute the mean (default None)
    :return: error rate
    :rtype: float or numpy.ndarray of float
    """
    p_err = 1 - (x==intdims).mean(axis=axis)
    return p_err