3 Replies Latest reply on May 13, 2013 11:35 AM by . Jawon

    Easy confidence interval question... I think

    . Jawon

      I have just one dimension and then I'm averaging a revenue measure as the first screenshot shows.


      I tried adding a reference distribution and selecting "confidence interval" but I just get the second screenshot.


      Why am I getting just a line right at the average and not an interval around it? Thank you!

        • 1. Re: Easy confidence interval question... I think
          Shawn Wallwork

          Probably because the confidence is high that the reference line is accurate. This is because you've created a reference for each cell. If you were average values across a whole table then if would look more like this:





          • 2. Re: Easy confidence interval question... I think
            Jim Wahl

            Hi Jawon,


            In the JPGs you attached, your measure is an aggregate --- AVG(REV) --- and, therefore, the view only has one value per row / cell. Since reference lines are calculated based on data in the view, the confidence band is just for one value, which is, of course, the value +/- 0, since CI = mean(values) +/- 1.96*sd(values)/sqrt(count(values)).


            You can experiment with this a bit by clicking on the revenue pill in columns and selecting Dimension. Now you'll see a line for each data point. To better show overlapping marks, I usually change the Marks from Automatic to Shape, which creates an open circle and click on color to reduce the transparency.


            Now you can add a reference line showing the AVG and another band with the CI. NOTE: Tableau's default of "Aggregate Measures" can cause problems here. From the menu bar, select Analysis and uncheck Aggregate Measures. When this is checked, only one mark is drawn for each value. Since reference lines are calculated on the data in thew view, the average will be incorrect. For example the values 3, 5, 7, 7, 7, 7 will result in three marks (3, 5, 7) and an average of 5. By disabling Aggregate Measures, you'll get six marks and the correct average of 6.


            If you want to stick with your original view, you can use calculated fields:

            Rev CI lower = AVG([Rev]) - 1.96*STDEV([Rev])/SQRT(COUNT([Rev]))

            Rev CI upper = AVG([Rev]) + 1.96*STDEV([Rev])/SQRT(COUNT([Rev]))

            Now you can add a reference band using these calculated fields as the lower and upper bounds.


            I'm not entirely convinced that you really want to use a statistical CI in this case (and that your data is normally distributed, ...), but that's another topic.



            • 3. Re: Easy confidence interval question... I think
              . Jawon

              Thank you, Jim! That did it. Makes sense. I just unaggregated my measure, made it into a dimension, and cleaned it up. So now here is the result, showing the CI and the avg. Life can now go on!