Fixed ftest. Now gives same results as matlab