Simple Explanation of Statsmodels Summary
Implementation in python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
import statsmodels.formula.api as smf
import pylab as py
df = pd.read_csv("salary.csv")
df
fig = plt.figure(figsize=(15,10))
plt.plot(df['People_managing'], df['Salary'], 'o')
plt.grid()
fig = plt.figure(figsize=(15,10))
plt.plot(df['Projects'], df['Salary'], 'o')
plt.grid()
fig = plt.figure(figsize=(15,10))
plt.plot(df['YearsExperience'], df['Salary'], 'o')
plt.xlabel('YearsExperience')
plt.ylabel('Salary')
plt.grid()
model = smf.ols(formula = 'Salary ~ Projects + People_managing + YearsExperience', data = df)
# model = smf.ols(formula = 'Salary ~ YearsExperience', data = df)
# model = smf.ols(formula = 'Salary ~ Projects', data = df)
model = model.fit()
# model = model.fit(cov_type="hc0")
# model.predict(y)
print(model.summary())