import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(color_codes =True)
%matplotlib inline
Sales = pd.read_excel("F:/2019 GB Python/Regression.xlsx")
Sales.head()
sns.distplot(Sales.Sales, kde=False)
sns.scatterplot(y=Sales.Sales, x=Sales.Enquires)
sns.pairplot(Sales, vars = ['Sales', 'Enquires'])
sns.pairplot(Sales, vars = ['Sales', 'Enquires', 'LaborDeployed','AvgResponseTime', 'NoofStockOuts'])
cor = Sales.corr(method='pearson')
cor
sns.heatmap(cor)
import statsmodels.api as sm
inputs = ['Enquires', 'LaborDeployed', 'NoofStockOuts']
X= Sales[inputs]
X
y=Sales['Sales']
y
X=sm.add_constant(X)
model = sm.OLS(y,X).fit()
predictions =model.predict(X)
model.summary()
inputs = ['Enquires','NoofStockOuts']
X= Sales[inputs]
X=sm.add_constant(X)
model = sm.OLS(y,X).fit()
predictions =model.predict(X)
model.summary()