2024-04-07

Definition of Mean:(average)

  • Mean is average for a set of data.
    It is computed by adding all the numbers in the data together and dividing by the number of elements contained in the data set.
  • Example: -Data set = 5,9,2,3,7,5,4
  • Number of elements in data set = 7
  • \[Mean= (5+9+2+3+7+5+4)/7 \]
  • Mean = 5

Mean Formula

  • we have the sum of all data values \[ Mean (x) = {\sum^{n}_{i} x_{i}}/n \]
  • is the sum of all data values
  • n is the number of data in the set

Definition and Example of Median

  • Median of a data set is the middle number in an ordered set of data.
    It is dependant on whether the number of the elements in the data set is odd or even.

  • Example 1:
    Data set= 1,3,3,5,6,7,9
    -Median=5
    <br Example 2:
    Data set= 1,2,3,4,5,6,7,8 < br>\[ Median = (4+5)/2\] - Median= 4.5

    Median Formula

    • when n is even \[ Median= {(n+1)^{th} }/2 \]
    • when n is odd \[ Median= {(n^{th}/2) + (n/2 +1)^{th}}/2 \]
    • n= number of terms.
    • th= n(th) number.

    Definition of Mode

    • Mode: The value that occurs most often in a set of data.

    • It is not uncommon for a data set to have more than one mode.

    • In addition,we have the function Range() which is define by the difference between the largest and smallest values of a data set.

    Plot with and example of the mean

    …

    Plot with and example of the median

    With the code

    set.seed(1234)      # creat data set 
    x <- round(rnorm(5000,20 ,3)) 
    ggp <- ggplot(data.frame(x), aes(x)) +    # Draw histogram
      geom_histogram(bins = 100)
    ggp+ geom_vline(xintercept = mean(x),        # Add line for mean
                 col = "red", lwd = 3) + theme_bw()