def CvMstat(data, model):
    """
	Cramér–von Mises statistic: Takes all deviances into account
	"""
    modelc = model.cumsum()
    datac = data.cumsum()
    maxmodelc = modelc.max()
    cvm = ((modelc / maxmodelc - datac / datac.max()) ** 2 * model / maxmodelc
        ).mean()
    return cvm
