substituting ppchi2.f with chi2inv.for and ppnd16.f with invnormcdf.for