Browse Source

add three point extimates table

arzzen 9 years ago
parent
commit
6730ae4dba
1 changed files with 11 additions and 4 deletions
  1. 11
    4
      pert.sh

+ 11
- 4
pert.sh View File

19
     echo "scale=$scale; $@" | bc -l | sed 's/^\./0./'
19
     echo "scale=$scale; $@" | bc -l | sed 's/^\./0./'
20
 }
20
 }
21
 
21
 
22
+width=88
22
 function _divider
23
 function _divider
23
 {
24
 {
24
     divider=------------------------------
25
     divider=------------------------------
25
     divider=" +"$divider$divider$divider"+"
26
     divider=" +"$divider$divider$divider"+"
26
-    width=88
27
     
27
     
28
     printf "%$width.${width}s+\n" "$divider"
28
     printf "%$width.${width}s+\n" "$divider"
29
 }
29
 }
91
     
91
     
92
     echo -e "\nThree point estimates\n"
92
     echo -e "\nThree point estimates\n"
93
     
93
     
94
-    echo -e " 1 Sigma - 68% confidence:" $(_calc "$total_estimate - $total_variance") "-" $(_calc "$total_estimate + $total_variance")
95
-    echo -e " 2 Sigma - 95% confidence:" $(_calc "$total_estimate - 2 * $total_variance") "-" $(_calc "$total_estimate + 2 * $total_variance")
96
-    echo -e " 2 Sigma - 99.7% confidence:" $(_calc "$total_estimate - 3 * $total_variance") "-" $(_calc "$total_estimate + 2 * $total_variance")
94
+    width=42 
95
+    tpeformat=" | %-13s |%11s |%10s |\n"
97
     
96
     
97
+    _divider
98
+    printf "$tpeformat" "Confidence:"
99
+    _divider
100
+    printf "$tpeformat" "1 Sigma - 68%" $(_calc "$total_estimate - $total_variance") $(_calc "$total_estimate + $total_variance")
101
+    printf "$tpeformat" "1 Sigma - 95%" $(_calc "$total_estimate - 2 * $total_variance") $(_calc "$total_estimate + 2 * $total_variance")
102
+    printf "$tpeformat" "1 Sigma - 99%" $(_calc "$total_estimate - 3 * $total_variance") $(_calc "$total_estimate + 3 * $total_variance")
103
+    _divider
104
+
98
 fi
105
 fi
99
 
106
 
100
 echo -e "\n"
107
 echo -e "\n"

Loading…
Cancel
Save