PV115 April 20211 Correlation and matplotlib.animation Katarína Švecová 2 Correlation ̶  Dependence ̶  Statistical relationship between two random variables ̶  Linear correlation (Pearsons correlation coefficient) PV115 April 2021 3 Variance, Covariance ̶  E is expected value (average) ̶  µ too ̶  corr(X,Y)= cov(X,Y)/ √(var(X)*var(Y) https://en.wikipedia.org/wiki/Covariance PV115 April 2021 4 Pearsons correlation coefficient ̶  σ= √var (rozptyl= √štandardnej odchýlky) ̶  Linear correlation of numerical variables PV115 April 2021 https://en.wikipedia.org/wiki/Correlation_and_dependence 5 Pearsons correlation coefficient illustration PV115 April 2021 https://en.wikipedia.org/wiki/Correlation_and_dependence#/media/ File:Correlation_examples2.svg 6 Other correlation measures ̶  Spearman correlation coefficient ̶  Pearson coefficient between rank variables ̶  Asseses monotonic correlation ̶  Kendall rank correlation coefficient ̶  Point biserial for one binary variable PV115 April 2021 https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient 7 scipy.stats ̶  Big library with a lot of statistical functions ̶  For correlation: ̶  scipy.stats.pearsonr(x, y) ̶  scipy.stats.spearmanr(x, y) ̶  scipy.stats.kendalltau(x, y) https://realpython.com/numpy-scipy-pandas-correlation-python PV115 April 2021 8 Matplotlib ̶  A python library for plots ̶  Simple plot, subplots, images, heatmaps, histograms, 3d… ̶  Animations ̶  Examples: https://matplotlib.org/stable/tutorials/introductory/sample_plots.html PV115 April 2021 9 Matplotlib ̶  Simple example https://matplotlib.org/stable/gallery/lines_bars_and_markers/simple_plot.html PV115 April 2021 10 Matplotlib.animation ̶  Live animations ̶  Example from https://matplotlib.org/2.0.2/examples/animation/simple_anim.html PV115 April 2021 Open in pycharm Define footer – presentation title / department11 Bar Chart Race ̶  Built on matplotlib.animation ̶  Works on 3-dimensional data ̶  Example from https://pypi.org/project/bar-chart-race/