The Confidence Interval Operator

A summary function applied to a finite population vector produces a parameter.   A summary function applied to a sample vector produces a statistic, or point estimate.

A point estimate may be unbiased, but it is rarely the correct value.  The distribution of the point estimate allows us to create an interval which contains the true value of a parameter with a degree of confidence.    The operator confInt modifies a summary function to produce a 2-item vector consisting of the lower bound and upper bound of a confidence interval. 

The left argument is the confidence level; it is optional--the default is a 95%.  The left operand is a summary function, typically: mean, proportion, variance or sdev.   The right operand can be either a numeric vector, a 2-column matrix representing a frequency distribution, or a namespace containing count, mean and variance.

The syntax of the confInt operator is:

          [ConfLevel|0.95]  summaryFunction confInt SampleVector|frequencyDistribution|SummaryNamespace

Some examples follow:

A sample of 15 heights of college students was taken and is listed below:

   Height←69 69 63 63 66 67 73 67 70 72 71 63 68 63 66

Find a 95% confidence interval for the mean height.

   mean confInt Height
65.465 69.202

Find a 90% confidence interval for the proportion of students taller than 70 inches:

   0.90 proportion confInt Height > 70
0.05685 0.43978

 Find a 99% confidence interval for the standard deviation.

   0.99 sdev confInt Height 
2.2555 6.2533

Find an 80% confidence interval for the median.

   0.8 median confInt Height 
66 69

A sample of  85 home sales from a certain city was taken and the average price was $149,000 with a standard devation of $25,000.  Find a 95% confidence interval for average home price.

   mean confInt stats 85 149000 25000
143608 154392

A sample of 38 students were asked how many siblings each had.   2 were only children, 17 had one sibiling, 11 had two siblings, 7 and three and one had four.  Find a 90% confidence interval for the average number of siblings.      

   FD←0 1 2 3 4,[1.5]2 17 11 7 1
    0.90 mean confInt FD
1.4288 1.9396

What is a 95% confidence interval for the variance?

         0.95 var confInt FD
0.05786 1.4571