Page 229 - Ai Book - 10
P. 229

Mean, Median, Mode, Standard Deviation, Variance, Correlation etc. are generally used to analyse data. Let us
        learn more about these terms in detail.

         u   Mean: The mean is the average or the most common value in a collection of numbers. It is denoted by X bar.
             You should remember that all data is given equal importance in mean. We can use the following formula to
             calculate the mean of the given values:








             where:
             •  x =  mean
             •  x i =  sum of values

             •  n =  total number of elements
        To calculate mean in Python:
              import statistics
              num = [10,20,30,40,50,60,70,80]
              m = statistics.mean(num)
              print(“The mean value is:”, round(m,2))
              Output:
              The mean value is: 45

         u   Median: The median is the middle of the set of numbers. In order to calculate the median, the data must
             first be ranked (sorted in ascending order). We can use the following formula to calculate the median:




        To calculate median in Python:

              import statistics
              num = [10,20,30,40,50,60,70,80]
              m = statistics.median(num)
              print(“The middle of the set of numbers is:”, m)
              Output:

              The middle of the set of numbers is: 45.0

         u   Mode: The mode is that value of observation which occurs most frequently. We can estimate the Mode
             using the following formula:







             where:
             •  L is the lower class boundary of the modal group
             •  fm-1 is the frequency of the group before the modal group
             •  fm is the frequency of the modal group

             •  fm+1 is the frequency of the group after the modal group
             •  w is the group width.

                                                                                                             103
                                                                                                             103
   224   225   226   227   228   229   230   231   232   233   234