Skip to main content

lag1_autocorrelation

Function lag1_autocorrelation 

Source
pub fn lag1_autocorrelation(values: &[f64]) -> Option<f64>
Expand description

The lag-1 autocorrelation of values in draw order: the sum of products of each deviation from the mean with the next one, over the sum of squared deviations.

A diagnostic: for independent draws it lies near -1 / n, within about 2 / √n, so ±0.45 for 20 renders. A drift over the sequence takes it towards 1. Returns None for fewer than two values or values that do not vary.