Anscombe's quartet

%matplotlib inline

import random

import numpy as np
import scipy as sp
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

import statsmodels.api as sm
import statsmodels.formula.api as smf

sns.set_context("talk")

anascombe = pd.read_csv('data/anscombe.csv')
anascombe.head()

A0 = (10+8+13+9+11)/5
B0 = ((10-A0)*(10-A0) + (8-A0)*(8-A0) + (13-A0)*(13-A0) + (9-A0)*(9-A0) + (11-A0)*(11-A0))/5

A = (8.04 + 6.95 + 7.58 + 8.81 + 8.33) / 5
B = ((8.04 - A)*(8.04 - A) + (6.95 - A)*(6.95 - A) + (7.58 - A)*(7.58 - A) + (8.81 - A)*(8.81 - A) + (8.33 - A)*(8.33 - A)) / 5

C = (10-A0)*(8.04-A) + (8-A0)*(6.95-A) + (13-A0)*(7.58-A) + (9-A0)*(8.81-A) + (11-A0)*(8.33-A)

D = 5*sqrt(B0)*sqrt(B)





你可能感兴趣的:(Anscombe's quartet)