5 Replies Latest reply: Jan 5, 2013 4:43 PM by Zach Alexy RSS

    Stdev

      Hi,

      Can anybody help me with the Stdev function. I can't get it to work.

       

      Simple case with question asked how many travels (0, 1, 2 or 3) a year a family undertakes. 200 families answered:

       

      Travels, Families

      0, 50

      1, 80

      2, 60

      3, 10

       

      Stdev(Aggr(Sum(Travels), Families)) gives me 1.29. It should be approx. 0.85.

      Any help?, Zach

        • Re: Stdev
          Henric Cronström

          But why do you use the Aggr function? This creates a nested aggregation and you need only a single aggregation. The expression "stdev(Travels)" will give 0.85 as answer.

           

          HIC

            • Re: Stdev

              Hi, thanks for your reply. If I use stdev(Travels) i still get the 1.29?

                • Re: Stdev
                  Henric Cronström

                  If you have the raw data, i.e all 200 records, then stdev will work the way you expect it. But if you calculate it from a table of just four records (the ones in your initial post), then 1.29 is correct.

                   

                  You can most likely calculate it indirectly from you four records using a formula with weighted values (you need to weight the "travels" number by number of families).

                   

                  HIC

                  • Re: Stdev
                    Henric Cronström

                    If you load the data using the following script, you will recreate the raw data and the stdev (and average and all other statistical entities) will be calculated correctly:

                     

                    Data:

                    Load * while iterno()<= Families;

                    Load * inline

                    [Travels, Families

                    0, 50

                    1, 80

                    2, 60

                    3, 10];

                     

                    HIC

                      • Re: Stdev

                        Hi Henric,

                        Very helpfull. I thought that the Stdev function would 'automatically' expand over the two elements. Good to know that I need all the individual records for Stdev to work the way I want it to. I now understand that the 1.29 simply is the standard deviation of 0, 1, 2 and 3 occuring 1 time each.

                        Thank you.