scan.test function

Compute the scan test