<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Anscombe's quartet
Step1:  Load the Anscombe's quartet dataset
Step2:  And df is... a pandas dataframe
Step3:  that we can print, plot, ...
Step4:  Print just first dataset
Step5:  Basic statistical parameters
Let's compare the basic statistical parameters of each dataset
Step6:  Let's compare the correlation coefficient for each dataset
Step7:  Plot
Plot datasets
Step8:  Linear regression
Show the results of a linear regression within each dataset
Step9:  It's the same line for all datasets
Let's plot with its 95% confidence interval region.
Step10:  Key message
Visualize your data beforehand
Nonlinear regression? outliers?
One can fit a polynomial regression model to explore simple kinds of nonlinear trends in the dataset
Step11:  In the presence of outliers, it can be useful to fit a robust regression, which uses a different loss function to downweight relatively large residuals
<ASSISTANT_TASK:>
Python Code:
#!conda install -y numpy pandas matplotlib seaborn statsmodels
%matplotlib inline
import seaborn as sns
import pandas as pd
sns.set(style="ticks")
Explanation: Anscombe's quartet
End of explanation
df = sns.load_dataset("anscombe")
Explanation: Load the Anscombe's quartet dataset
End of explanation
type(df)
Explanation: And df is... a pandas dataframe
End of explanation
df.head()
Explanation: that we can print, plot, ...
End of explanation
df[df.dataset == 'I']
Explanation: Print just first dataset
End of explanation
groups = ['I', 'II', 'III', 'IV']
for group in groups:
    print(group)
    print(df[df.dataset == group].describe())
    print()
Explanation: Basic statistical parameters
Let's compare the basic statistical parameters of each dataset
End of explanation
for g in groups:
    print(df[df.dataset == g]['x'].corr(df[df.dataset == g]['y']))
Explanation: Let's compare the correlation coefficient for each dataset
End of explanation
sns.lmplot(x="x", y="y", col="dataset", hue="dataset", data=df,
           col_wrap=2, ci=None, palette="muted", size=4,
           scatter_kws={"s": 50, "alpha": 1}, fit_reg=False)
Explanation: Plot
Plot datasets
End of explanation
sns.lmplot(x="x", y="y", col="dataset", hue="dataset", data=df,
           col_wrap=2, ci=None, palette="muted", size=4)
Explanation: Linear regression
Show the results of a linear regression within each dataset
End of explanation
sns.lmplot(x="x", y="y", col="dataset", hue="dataset", data=df,
           col_wrap=2, ci=95, palette="muted", size=4)
Explanation: It's the same line for all datasets
Let's plot with its 95% confidence interval region.
End of explanation
sns.lmplot(x="x", y="y", data=df[df.dataset == 'II'],
           order=2, ci=95, scatter_kws={"s": 80});
Explanation: Key message
Visualize your data beforehand
Nonlinear regression? outliers?
One can fit a polynomial regression model to explore simple kinds of nonlinear trends in the dataset
End of explanation
sns.lmplot(x="x", y="y", data=df[df.dataset == 'III'],
           robust=True, ci=None, scatter_kws={"s": 80});
Explanation: In the presence of outliers, it can be useful to fit a robust regression, which uses a different loss function to downweight relatively large residuals:
End of explanation
<END_TASK>