Descriptive Statistics

vignesh
vignesh
Nov 5 · 2 min read

Descriptive Statistics is that branch of Statistics which analyzes brief descriptive coefficients that summarize a given data set. Those coefficients are called ‘descriptive statistics’.

I’ll be using Python to run build outputs

Photo by Carlos Muza on Unsplash
def median(a, l, r): 
n = r - l + 1
n = (n + 1) // 2 - 1
return n + l

# Function to calculate IQR
def IQR(a, n):

a.sort()

# Index of median of entire data
mid_index = median(a, 0, n)

# Median of first half
Q1 = a[median(a, 0, mid_index)]

# Median of second half
Q3 = a[median(a, mid_index + 1, n)]

# IQR calculation
return (Q3 - Q1)

# Driver Function
if __name__=='__main__':
a = [1, 2, 3, 4, 5 , 6,7,8,9,10]
n = len(a)
print("IQR :%.03f"%IQR(a, n))

Output : IQR :6.000

Variance calculation

#Import statistics module
import statistics
import random
import pandas as pd
#Create a sample of data
sample = []
num = random.randint(0,10)
for j in range(100):
sample.append(random.randint(0,1900))

print("Variance of sample set is % s" %(statistics.variance(sample)))

output :

# Python code to demonstrate the working of 
# variance() function of Statistics Module

# Importing Statistics module
import statistics

# Creating a sample of data
sample = [2.74, 1.23, 2.63, 2.22, 3, 1.98]

# Prints variance of the sample set

# Function will automatically calulate
# it's mean and set it as xbar
print("Variance of sample set is % s"
%(statistics.variance(sample)))

Here’s my git-hub gist :

vignesh

Written by

vignesh

CEO of Arcknet Deep Learning researcher Intrigued by nature and love

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade