# This program repeats our Lesson 13 but from a file
import scipy
import scipy.stats as stats
print ("Welcome to my Lesson 13 Python program!")
print ("(I never thought college would be this cool)")
# define x and y
x = [4,6,7,11,14,17,21]
y = [18,12,13,8,7,7,4]
print ("x: ")
print x
print ("Mean of x: ")
print scipy.mean(x)
print ("y: ")
print y
print ("Mean of y: ")
print scipy.mean(y)
# Pearson Correlation Coefficient for x, y
print ("Here comes the Pearson Correlation Coefficient (and corresponding p-value)")
print stats.pearsonr(x,y)
# run linear regression for x and y
lr = stats.linregress
slope, intercept, rvalue, pvalue, stderr = lr(x,y)
print ("Slope is ")
print slope
print ("Intercept is ")
print intercept
# calc and print r-squared
rsq = rvalue**2
print ("R-Squared is ")
print rsq
# cool, you made it through the program with no errors
print ("May the force be with you")