stats code was confusing x- and y- dimensions of matrix data