Confidence interval in shell script

An additional function for calculating the confidence interval of a sample for this script.

conf_inter() {
  avg=$(arith_mean); ntimes=$?
  conf=$1
  var1=$(echo "scale=$SC; ($avg - ($conf*1/sqrt($ntimes)))" | bc)
  var2=$(echo "scale=$SC; ($avg + ($conf*1/sqrt($ntimes)))" | bc)
  echo "$var1 <= m <= $var2"
}
conf=$(conf_inter $2)
echo "Confidence interval: $conf"

One thought on “Confidence interval in shell script

  1. Pingback: History of ACF Fiorentina » Mean and predicted response

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s