BEGIN { IGNORECASE = 1; # Ignore case in string comparisons. FS = ","; # Initialize the field separator. OFS = ","; # Initialize the output field separator. Pred = 30; # Initialize the range for Pred. } { EstimatedEffort = $1; ActualEffort = $2; Re = (EstimatedEffort-ActualEffort)/ActualEffort Mre = Re < 0 ? -1* Re : Re; SumMre += Mre; SumMreSq += Mre^2; if (Mre < (Pred/100)) PredN++ Corr_Se+=((EstimatedEffort-AvgEstimate)*(EstimatedEffort-AvgEstimate)); Corr_Sa+=((ActualEffort-AvgActual)*(ActualEffort-AvgActual)); Corr_Sea+=((EstimatedEffort-AvgEstimate)*(ActualEffort-AvgActual)); } END { Mmre = 100*SumMre/NR; Pred30 = 100*PredN/NR; SdMre = 100*sd(SumMreSq,SumMre,NR); Corr_Se=Corr_Se/(NR-1); Corr_Sa=Corr_Sa/(NR-1); Corr_Sea=Corr_Sea/(NR-1); Corr=(Corr_Sea/sqrt(Corr_Se*Corr_Sa)); print Mmre, SdMre, Pred30, Corr; } function sd(sumSq,sumX,n) { return sqrt((sumSq-((sumX*sumX) / n)) / (n-1)) }