<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Getting distribution values using scipy
The scipy stats package contains a lot of useful distributions. Here, you can compute z and t statistics, etc. Normal distribution is given in scipy.stats.norm, while the t distribution is given as stats.
Step1:  Linear regression
Let us first read the data from the csv file into a Pandas "DataFrame" using Pandas' built in parsers.
Step2:  Quick exploration
The DataFrame contains a lot of useful convenience functions. For example, df.describe() gives you a quick summary of useful information! See more at http
Step3:  You can also do quick plotting of the data. The results are not aesthetically the best, but it is useful for a quick visual of the data
Step4:  Much nicer results can be obtained using a dedicated plotter like seaborn.
Step5:  Performing the regression
We will use scipy's built in regression analysis here. There are quite a number of options out there, e.g., statsmodels, scikit-learn, etc., that you can explore.
Step6:  ANOVA anslysis
We can also perform ANOVA analysis using pandas + scipy. Again, let us now read the polymer.csv data into a DataFrame.
Step7:  Each row in the above data is one group.
<ASSISTANT_TASK:>
Python Code:
# Cumulative probability P(X<120) where X ~ N(100, 10^2)
print("P(X<120) where X ~ N(100, 10^2) = %.3f" % stats.norm.cdf(120, loc=100, scale=10))
# Calculate value
print("x for which P(X < x = 0.97) = %.1f" % stats.norm.ppf(0.97, loc=100, scale=10))
# Cumulative probability P(X<120) where X ~ N(100, 10^2)
print("P(X<120) where X ~ t with df = 10, mean = 100 and sigma = 10) = %.3f" % stats.t.cdf(120, df=10, loc=100, scale=10))
# Calculate value
print("x for which P(X < x = 0.97) = %.1f" % stats.t.ppf(0.97, df=10, loc=100, scale=10))
Explanation: Getting distribution values using scipy
The scipy stats package contains a lot of useful distributions. Here, you can compute z and t statistics, etc. Normal distribution is given in scipy.stats.norm, while the t distribution is given as stats.
End of explanation
df = pd.read_csv("co2_temp_yr.csv", delimiter=",")
print(df)
Explanation: Linear regression
Let us first read the data from the csv file into a Pandas "DataFrame" using Pandas' built in parsers.
End of explanation
df.describe()
Explanation: Quick exploration
The DataFrame contains a lot of useful convenience functions. For example, df.describe() gives you a quick summary of useful information! See more at http://pandas.pydata.org/pandas-docs/stable/10min.html.
End of explanation
ax = df.plot(x="CO2 ppm", y="Global Temp", style='o')
Explanation: You can also do quick plotting of the data. The results are not aesthetically the best, but it is useful for a quick visual of the data
End of explanation
ax = sns.regplot(x="CO2 ppm", y="Global Temp", data=df)
Explanation: Much nicer results can be obtained using a dedicated plotter like seaborn.
End of explanation
res = stats.linregress(df["CO2 ppm"], df["Global Temp"])
print("Slope = %.3f" % res.slope)
print("Intercept = %.3f" % res.intercept)
print("R = %.3f" % res.rvalue)
print("Std error = %.3f" % res.stderr)
Explanation: Performing the regression
We will use scipy's built in regression analysis here. There are quite a number of options out there, e.g., statsmodels, scikit-learn, etc., that you can explore.
End of explanation
df = pd.read_table("polymer.csv", delimiter=",", index_col=0)
print(df)
Explanation: ANOVA anslysis
We can also perform ANOVA analysis using pandas + scipy. Again, let us now read the polymer.csv data into a DataFrame.
End of explanation
print(stats.f_oneway(*df.as_matrix()))
Explanation: Each row in the above data is one group.
End of explanation
<END_TASK>