<jupyter_start><jupyter_text>Anscombe's Quartet - An analysis of Anscombes Quartet Dataset ![title](Images/1datasaurus.png) In this assignment I will be looking at Anscombes Quartet Dataset. I hope to:1) Explain the background of the dataset, who created it, when it was created and speculate how it might have been created.2) Using python and it's various libraries, plot interesting aspects of the dataset.3) Calculate the descriptive statistics of the variables in the dataset.4) Explain why the dataset is interesting based on my findings.  What is Anscombe's Quartet? Anacombes's Quartet comprises four datasets that have nearly identical simple descriptive statistics, yet appear very different when graphed. Each dataset consists of eleven (x,y) points. They were constructed in 1973 by statistician <NAME> in his paper "Graphs and Statistical Analysis", to demonstrate both the importance of graphing data before analyzing it and the effect of outliers on statistical properties.  The Man Behind the Data <NAME>, was a mathematician born in England in 1918. Educated at Cambridge University on a scolarship, he received a degree in mathematics in 1939 and a master's degree in 1943. He helped to computerize statistical analyses while seeking to avoid flawed interpretations of such data. In addition to publishing 50 research articles, he wrote a classic text "Computing in Statistical Science Through APL". He was emphatic in cautioning against misdiagnosing and misapplying computer models without obtaining the necessary proof. He detailed the need for great care in a paper in 1973 by demonstrating how one equation could neatly fit four different sets of data (Anscombe's Quartet Dataset).   The Python Libraries to be used Numpy is the fundamental package for scientific computing with Python. Besides it's scientific uses it can also be used as an efficient multi-dimensional container of generic data.Pandas is a package providing fast, flexible and expressive data structures designed to make working with data both easy and initutive.Matplotlib is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms.Seaborn is a Python data visualizition library based on Matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics.<jupyter_code># Upload the Python packages I plan on using

import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline<jupyter_output><empty_output><jupyter_text>The Data Set<jupyter_code># Load Anscombe's Dataset Quartet from a url.

df = pd.read_csv("https://vincentarelbundock.github.io/Rdatasets/csv/datasets/anscombe.csv")
df
# Use the loc function to tidy the data to remove the unnamed column
df.loc[:, ["x1", "x2", "x3", "x4", "y1", "y2", "y3", "y4"]]<jupyter_output><empty_output><jupyter_text>A look at the descriptive statistics of the variables in the dataset.<jupyter_code>df.loc[:, ["x1", "y1", "x2", "y2", "x3", "y3", "x4", "y4"]].describe()
# Looking at the mean of x and y on each of the 4 datasets we can see they are exactly the same.
# Dataset 1
df.loc[:,["x1", "y1"]].mean()
# Dataset 2
df.loc[:,["x2", "y2"]].mean()
# Dataset 3
df.loc[:,["x3", "y3"]].mean()
# Dataset 4
df.loc[:,["x4", "y4"]].mean()
# Looking at the standard deviation of x and y on each of the 4 datasets we can see they are almost the same.
# Dataset 1
df.loc[:,["x1", "y1"]].std()
# Dataset 2
df.loc[:,["x2", "y2"]].std()
# Dataset 3
df.loc[:,["x3", "y3"]].std()
# Dataset 4
df.loc[:,["x4", "y4"]].std()
# The correlation between the datasets is also similar.
# Dataset 1
df.loc[:,["x1", "y1"]].corr()
# Dataset 2
df.loc[:,["x2", "y2"]].corr()
# Dataset 3
df.loc[:,["x4", "y4"]].corr()
# Dataset 4
df.loc[:,["x4", "y4"]].corr()
# The coveriance between the datasets is also similar.
# Dataset 1
df.loc[:,["x1", "y1"]].cov()
# Dataset 2
df.loc[:,["x2", "y2"]].cov()
# Dataset 3
df.loc[:,["x3", "y3"]].cov()
# Dataset 4
df.loc[:,["x1", "y1"]].cov()<jupyter_output><empty_output><jupyter_text>Looking at the above data it would be easy to make the assumption that all of the data sets will look the same when graphed. According to Anscombe this is not the case and the below graphs will show why.  Plotting the Datasets<jupyter_code># Anscombes dataset is available in Seaborn.
anscombe = sns.load_dataset("anscombe")
sns.lmplot(x="x", y="y", data=anscombe.query("dataset == 'I'"),
           ci=None, scatter_kws={"s": 80}), plt.title("Dataset 1");
sns.lmplot(x="x", y="y", data=anscombe.query("dataset == 'II'"),
           ci=None, scatter_kws={"s": 80}), plt.title("Dataset 2");
sns.lmplot(x="x", y="y", data=anscombe.query("dataset == 'III'"),
           ci=None, scatter_kws={"s": 80}), plt.title("Dataset 3");
sns.lmplot(x="x", y="y", data=anscombe.query("dataset == 'IV'"),
           robust=True, ci=None, scatter_kws={"s": 80}), plt.title("Dataset 4");<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12163509471585245, 'fraction_numerical': 0.021136590229312063, 'mean_word_length': 5.192592592592592, 'pattern_counts': {'":': 4, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '171926', 'license': 'Apache-2.0', 'n_tokens_mistral': 1621, 'n_tokens_neox': 1521, 'n_words': 638, 'path': 'anacombe-quartet.ipynb', 'repo_name': 'TommyVaughan/anacombe-quartet', 'size': '5040'}