You are on page 1of 1

import pandas as pd

MLR_df = pd.read_csv('MLR.csv')
MLR_df.info()
MLR_df.iloc[0:15, 0:4]

X_features = ['CTRP','Promotion']
MLR_X_df = MLR_df[X_features]
MLR_X_df.iloc[0:15, 0:4]

import numpy as np
import statsmodels.api as sm
X = sm.add_constant(MLR_X_df)
X.iloc[0:15, 0:4]
Y=MLR_df['Revenue']
MLR_lm = sm.OLS( Y, X ).fit()
print( MLR_lm.params )
MLR_lm.summary2()

import pandas as pd
MLRCat_df = pd.read_csv('MLRCat.csv')
MLRCat_df.info()
MLRCat_df.iloc[0:15, 0:7]

X_features = ['HS','UG','PG']
MLRCat_X_df = MLRCat_df[X_features]
MLRCat_X_df.iloc[0:15, 0:7]

import numpy as np
import statsmodels.api as sm
X = sm.add_constant(MLRCat_X_df)
X.iloc[0:15, 0:7]
Y=MLRCat_df['Salary']
MLRCat_lm = sm.OLS( Y, X ).fit()
print( MLRCat_lm.params )
MLRCat_lm.summary2()

import pandas as pd
MLRInt_df = pd.read_csv('MLRInt.csv')
MLRInt_df.info()
MLRInt_df.iloc[0:15, 0:5]

X_features = ['Gender','WE','GenderWE']
MLRInt_X_df = MLRInt_df[X_features]
MLRInt_X_df.iloc[0:15, 0:5]

import numpy as np
import statsmodels.api as sm
X = sm.add_constant(MLRInt_X_df)
X.iloc[0:15, 0:5]
Y=MLRInt_df['Salary']
MLRInt_lm = sm.OLS( Y, X ).fit()
print( MLRInt_lm.params )
MLRInt_lm.summary2()

You might also like