added function to compute pvalues