Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views2 pages

Question 4

The document contains a Python script that performs a regression analysis using data from an Excel file. It formulates a linear regression model to predict sales based on factors such as price, advertising, incentives, and salesforce. The script also includes calculations to predict sales under different scenarios and adjusts advertising expenditure to achieve a target predictive price.

Uploaded by

deep.mba24177
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Question 4

The document contains a Python script that performs a regression analysis using data from an Excel file. It formulates a linear regression model to predict sales based on factors such as price, advertising, incentives, and salesforce. The script also includes calculations to predict sales under different scenarios and adjusts advertising expenditure to achieve a target predictive price.

Uploaded by

deep.mba24177
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#Question 4.

import pandas as pd
import statsmodels.api as st

#Reading excel file

df=pd.read_excel("C:\\Users\\abhij\\Downloads\\AFB_END_DATA.xlsx",
sheet_name="Supermarket")

x=df[["Price","Advertising","Incentives","Salesforce"]]

#adding constant to model

x=st.add_constant(x)

print (x)

y=df[["Sales"]]

#Formulating model

results=st.OLS(y,x).fit()

#Printing results

print(results.summary())

#Question 4.b Sol

#b The regresion equation for the above table is Y = 1244.0741 - 133.4065*(Price) +


4.29*(Advertising) + 12.5063*(Incentives) + 17.3282*(Salesforce)

#c
#Price = 30 , advertisement = Rs 100 , Incentives = 100 , total salesforce = 10
p=30
ad=100
inc = 100
ts = 10
Predicted_Price = 1244.0741 - (133.4065*p) + (4.29*ad) + (12.5063*inc) +
(17.3282*ts)
print (Predicted_Price)

#d if p = p+10
p = 40
Predicted_Price = 1244.0741 - (133.4065*p) + (4.29*ad) + (12.5063*inc) +
(17.3282*ts)
print (Predicted_Price)

#e ad = ad+100
ad = 200
Predicted_Price = 1244.0741 - (133.4065*p) + (4.29*ad) + (12.5063*inc) +
(17.3282*ts)
print(Predicted_Price)

#f if ts = 20
ts = 20
Predicted_Price = 1244.0741 - (133.4065*p) + (4.29*ad) + (12.5063*inc) +
(17.3282*ts)
print (Predicted_Price)

#g Predicted_Price = 10000 , ts = 10 , p = 10 , inc= 200


Predictive_Price = 10000
ts = 10
p = 10
inc = 200
ad = ((Predictive_Price-1244.0741) + (133.4065*p) - (12.5063*inc) -
(17.3282*ts))/4.29

print(ad)

You might also like