def pooled_autocorr_lag2(df):
    """Compute the pooled autocorrelation with lag 2."""
    ds = df.query("period > 2")["e2"]
    ds.reset_index(drop=True, inplace=True)
    ds_lag = df.query("period < 9")["e2"]
    ds_lag.reset_index(drop=True, inplace=True)
    return ds.corr(ds_lag)