AIDS C04 Session 24
AIDS C04 Session 24
AIDS C04 Session 24
Session -24
1
The topics covered
• Representing statistical measures:
• Density diagrams
• Mean, Standard Deviation ,
• Median,
• Quantiles,
• and correlations
Density Plot
• A Density plot is a smoothed, continuous version of a histogram
estimated from the data.
• The most common form of estimation is known as kernel density
estimation.
• In this method, a continuous curve (the kernel) is drawn at every
individual data point and all of these curves are then added together
to make a single smooth density estimation.
Why Density Plot?
• It visualizes the distribution of data over a continuous interval or time
period.
• This chart is a variation of a Histogram that uses kernel smoothing to
plot values, allowing for smoother distributions by smoothing out the
noise.
• The peaks of a Density Plot help display where values are
concentrated over the interval.
• Density Plots have over Histograms is that they're better at
determining the distribution shape because they're not affected by the
number of bins used (each bar used in a typical histogram).
Example of Density Plot
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import gaussian_kde
data = np.random.normal(10,3,100) #
Generate Data
density = gaussian_kde(data)
x_vals = np.linspace(0,20,200) #
Specifying the limits of our data
density.covariance_factor = lambda : .5
#Smoothing parameter
density._compute_covariance()
plt.plot(x_vals,density(x_vals))
plt.show()
5
Statistical measures
• Statistics, in general, is the method of collection of data, tabulation,
and interpretation of numerical data
• With statistics, we can see how data can be used to solve complex
problems.
Descriptive Statistics
# mean()
import statistics
# initializing list
li = [1, 2, 3, 3, 2, 2, 2, 1]
15