Aps Assignment

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

1|Page

University of Engineering and Technology, Lahore


Faisalabad Campus

Submitted To Dr. SHAZIA KARIM

Submitted By AFSHAN JAVED

Registration No 2022-CS-802

Department Computer Science

Class First Year

ASSIGNMENT
2|Page

DIFFERENCE BETWEEM Mean mode and median

SR.No Mean Median Mode


1 The average taken The middle number in a The most
of given given set of observations is frequently
observations is called Median. occurred number
called Mean.  in a given set of
observations is
called mode.
2 Add up all the Place all the numbers in  the mode is
numbers and divide ascending or descending derived when a
by the total number order  number has
of terms frequency
occurred in a
series
3  Once the above After arranging everything The mode can be
step is finished, from smallest to biggest, one or more than
what we get is the take out the middle one. It is possible
mean. number, which is your to have no mode
median. at all, as well
4 Mean is the When series have even If there is a unique
arithmetic mean or numbers, median is the data set, there is
in a simple way simple average of the no mode at all.
can be a simple middle pair of numbers. 
average or
weighted average. 
5 When data is When data distribution is When there is a
normally skewed, median is the best nominal
distributed, the representative. distribution of
mean is widely data, the mode is
preferred. preferred.
6 Mean= x̄ = ∑x/ N If the total number of The mode is the
observations (n) are odd most frequently
then median is: occurring
observation or
Median = (n +
value
1/2)th observation  
If the total number of
observations (n) are even
number, then the formula
is given below:
Median =
(n/2)th observation +
(n/2+1)th observation /2
3|Page

Difference between arithmetic geometric and harmonic means

Type of Calculation Formula Use


Average

Arithmetic Sum of values divided (x1 + x2 + ... Measures the central tendency of
Mean by the number of values + xn) / n data and is commonly used as a
baseline for other statistical
calculations

Geometric The nth root of the (x1 * x2 * ... * Used to calculate average rates
Mean product of values xn)^(1/n) of change, such as compound
interest or growth rates

Harmonic The reciprocal of the n / [(1/x1) + Used to calculate average rates


Mean arithmetic mean of the (1/x2) + ... + of speed, such as the average
reciprocals of values (1/xn)] speed of a vehicle on a trip

EXAMPLES OF MEAN MODE AND MEDIAN

MEAN:
The mean, also called the arithmetic mean, is the most frequently used
measure of central tendency. This book will use the words mean and average
synonymously. For ungrouped data, the mean is obtained by dividing the sum of all
values by the number of values in the data set.

EXAMPLE:
Mean of Ungrouped Data

Let x1, x2, x3 , . . . , xn be n observations. We can find the arithmetic mean using the
mean formula:
4|Page

Mean, x̄ = (x1 + x2 + ... + xn)/n

Example: If the heights of 5 people are 142 cm, 150 cm, 149 cm, 156 cm, and 153
cm.

Find the mean height.

Mean height, x̄ = (142 + 150 + 149 + 156 + 153)/5

= 750/5

= 150

Mean, x̄ = 150 cm

Thus, the mean height is 150 cm.

Mean of Grouped Data

When the data is present in tabular form, we use the following formula:

Mean, x̄ = (x1f1 + x2f2 + ... + xnfn)/(f1 + f2 + ... + fn)

Consider the following example.

Example 1: Find the mean of the following distribution:


x 4 6 9 10 15
f 5 10 10 7 8

Solution:

Calculation table for arithmetic mean:


x i fi
xi fi
4 5 20
6 10 60
9 10 90
10 7 70
15 8 120
  ∑ fi = 40 ∑ xi fi = 360
Mean, x̄ = (∑xi fi)/(∑fi)

= 360/40

=9

Thus, Mean = 9

MEDIAN
5|Page

The value of the middlemost observation, obtained after arranging the data


in ascending or descending order, is called the median of the data. For example,
consider the data: 4, 4, 6, 3, 2. Let's arrange this data in ascending order: 2, 3, 4, 4,
6. There are 5 observations. Thus, median = middle value i.e. 4 .

Median of Ungrouped Data

 Step 1: Arrange the data in ascending or descending order.


 Step 2: Let the total number of observations be n.
To find the median, we need to consider if n is even or odd. If n is odd, then use the
formula:
Median = [(n + 1)/2]th observation

Example 1: Let's consider the data: 56, 67, 54, 34, 78, 43, 23. What is the median?

Solution:

Arranging in ascending order, we get: 23, 34, 43, 54, 56, 67, 78. Here, n (number of
observations) = 7

So, (7 + 1)/2 = 4

∴ Median = 4th observation

Median = 54

If n is even, then use the formula:

Median = [(n/2)th obs.+ ((n/2) + 1)th obs.]/2

Median of Grouped Data

When the data is continuous and in the form of a frequency distribution, the median
is found as shown below:

Step 1: Find the median class.

Let n = total number of observations i.e. ∑ fi

Note: Median class is the class where (n/2) lies.

Step 2: Use the following formula to find the median.


6|Page

Median = l+[n2−cf]×h�+[�2−��]×ℎ

where,

 l = lower limit of median class


 c = cumulative frequency of the class preceding the median class
 n = total number of observations
 f = frequency of the median class
 h = class size

Let's consider the following example to understand this better.

Example: Find the median marks for the following distribution:


Classes 0-10 10-20 20-30 30-40 40-50
Frequency 2 12 22 8 6

Solution:

We need to calculate the cumulative frequencies to find the median.

Calculation table:
Classes Number of students Cumulative frequency
0-10 2 2
10-20 12 2 + 12 = 14
20-30 22 14 + 22 = 36
30-40 8 36 + 8 = 44
40-50 6 44 + 6 = 50

N = 50

N/2 = 50/2 = 25

Median Class = (20 - 30)

l = 20, f = 22, c = 14, h = 10

Using Median formula:


7|Page

= 20 + (25 - 14)/22 × 10

= 20 + (11/22) × 10

= 20 + 5 = 25

∴ Median = 25

MODE
The value which appears most often in the given data i.e. the observation
with the highest frequency is called a mode of data.
Case 1: Ungrouped Data

For ungrouped data, we just need to identify the observation which occurs
maximum times.
Mode = Observation with maximum frequency
For example in the data: 6, 8, 9, 3, 4, 6, 7, 6, 3, the value 6 appears the
most number of times. Thus, mode = 6. An easy way to remember mode
is: Most Often Data Entered. Note: A data may have no mode, 1 mode, or
more than 1 mode. Depending upon the number of modes the data has, it
can be called unimodal, bimodal, trimodal, or multimodal.
The example discussed above has only 1 mode, so it is unimodal.
Case 2: Grouped Data

When the data is continuous, the mode can be found using the following
steps:
 Step 1: Find modal class i.e. the class with maximum frequency.
 Step 2: Find mode using the following formula:
Mode = L+[fm−f12fm−f1−f2]×h�+[��−�12��−�1−�2]×ℎ
where,
 L = lower limit of modal class,
 fm = frequency of modal class,
 f1 = frequency of class preceding modal class,
 f2 = frequency of class succeeding modal class,
8|Page

 h = class width

Mode formula equivalently is written as follows as well:

Consider the following example to understand the formula.


Example: Find the mode of the given data:
Marks Obtained 0-20 20-40 40-60 60-80 80-100
Number of students 5 10 12 6 3
Solution:
The highest frequency = 12, so the modal class is 40-60.
L = lower limit of modal class = 40
fm = frequency of modal class = 12
f1 = frequency of class preceding modal class = 10
f2 = frequency of class succeeding modal class = 6
h = class width = 20
Using the mode formula,
Mode = L+[fm−f12fm−f1−f2]×h�+[��−�12��−�1−�2]×ℎ
= 40 + [12−102×12−10−6]×20[12−102×12−10−6]×20
= 40 + (2/8) × 20
= 45
∴ Mode = 45
____________________________________________________________

You might also like