top of page

Advertising Budget Spend Portfolio

gracecamc168

Updated: Jan 7, 2021

When I was doing marketing promotion plans, one thing was always in my mind is budget. In a word, maximizing advertising and promotion effectiveness to grow sales was my priority. To be honest, that was also my headache. Therefore, knowing some regression models would have helped me a bit for the work. But anyways, now it is not too late.


The dataset I have includes 200 observations and 4 columns. There are three social media platforms to advertise, the numbers under each social media are the budget that the company spent on each social media, and the sales column is the revenue that was earned from each set of spending from social media.


With this dataset, the goal is to come up with an advertising plan for next year, meaning how much money should the company spend on each social media platform in order to maximize the revenue. The total budget is $100,000. The unit for the dataset is in thousand. I am going to try multiple linear, quadratic and cubic models for this dataset.R is the programming language for this project.











Let's do EDA to see if there is linear relationship between each social media platform

and sales revenue, and put them together. In order to do it, we need to set the Sales feature as y axis, which will be assigned to the left column, then the other features will be assigned to the right.


library(ggplot2)

library(reshape2)


# reshape the dataset

advertising1 <- melt(advertising, id.vars = c("Sales"))

head(advertising1)












# rename some columns

advertising1 <- advertising1 %>%

rename(Channel = variable,

Budget = value)

head(advertising1)












# EDA

ggplot(data=advertising1,aes(x=Budget,y=Sales))+

geom_point()+

stat_smooth(method="lm")+

facet_wrap(~Channel,scales="free_x")+

xlab("Budget")


From the plots, it seems that advertising on Facebook does have a linear relationship, the more money invested, the higher sales; But to TikTok, it is not the case; Instagram seems to be varied.


But what do you think this? better?

Let's see the correlation coefficient between features. Remember we will still use the original dataset for the below analysis, instead of the transformed dataset we did for the EDA.


cor(advertising)

We can see that Facebook has the strongest correlation with sales, then Instagram, then TikTok. Instagram and TikTok have 0.35 correlation.What does it mean? In markets where we spend on Instagram advertisement, we automatically also spend money on TikTok.


# build the model

lm.fit1 <- lm(Sales ~ ., data=advertising)

summary(lm.fit1)


















The output tells me that these features are all statistically significant, except TikTok channel. We receive 1.662 RSE, this model explains 90% of the variation in Sales.

The overall model is statistically significant because we receive very small p value.


Let's diagnose the model to see if there are any violations? non-linearity, heteroskedasticity,

autocorrelation, multicollinearity, normality of errors, exogeneity?


par(mfrow=c(2,2))

plot(lm.fit1)

The residual plot shows that it does not show a pattern. The Normal Q-Q plot also

looks fine, thought there are a little deviation at the bottom and the top.


# multicollinearity

library(car)

vif(lm.fit1)




The result suggests no evidence of collinearity. If VIF is more than 10, multicolinearity is strongly suggested.


Overall, the model looks fine.


# another way to know which channel is statistically significant

confint(lm.fit1)







The confidence interval for TikTok is near 0, recall that this channel is not statistically significant. We can say that TikTok generates the least money, we could choose not to advertise to this channel, but put more money to other channels.On the other hand, Instagram generates the most money, the 97.5% confidence interval is 0.12374384,

which is the highest among the channels.


From this model, we can say that advertising does affect sales. But is there interaction effect between channels?


lm.fit2 <- lm(Sales ~ FaceBook * Instagram * TikTok,

options(scipen=10),data=advertising)

summary(lm.fit2)




















The output tells us that the combination of Facebook and Instagram does generate a synergy effect, because it shows statistically significant.When we do interaction model, it does not matter if the single channel becomes insignificant. For example, recall that Instagram was significant from the previous model, but it does not significant now. What we really care is if the channels generate synergy effect. Compared to the previous model, this model generates lower RSE and higher adjusted r-squared, we would prefer this model. Let' use this model to create our portfolio.


# we will drop TikTok for this plan

newData <- data.frame(FaceBook=seq(0,100,by=10),

Instagram =seq(100,0,by=-10),

TikTok = 0)

newData$SalesPrediction <- predict(lm.fit2,newData)

newData














From the output, we can choose either 50/50 or 60/40 for the appropriate

portfolio. You can also add 95% confidence interval to the predict function, you may have more information from the result.


# what if the company wants to give TikTok one more chance, add it to the plan. $10,000 for # TikTok, and $90,000 for FaceBook and Instagram.














OK. Will polynomial models perform better? Recall, I plotted the non-linear graphs earlier. Let's test it.


qua.fit1 <- lm(Sales ~ . + poly(Instagram,2), data=adversting)

summary(qua.fit1)


















qua.fit2 <- lm(Sales ~ . + poly(FaceBook,2), data=adversting)

summary(qua.fit2)


















cubic.fit3 <- lm(Sales ~ . + poly(Instagram,3), data=adversting)

summary(cubic.fit3)




















cubic.fit4 <- lm(Sales ~ . + poly(FaceBook,3), data=adversting)

summary(cubic.fit4)



















From the outputs generated from different polynomial models, you may notice that there is NA from the outputs, it simply means explaining nothing. It is because the feature with degree one is already included in the model. With NA in the model doesn't hurt the model.


When comparing the RSE and adjusted r-squared, we would prefer cubic.fit4 model because it generates the lower RSE, higher adjusted r-squared.


Let's check the residuals for cubic.fit4.
















We can observe that the plots of residuals and Normal Q-Q look better than the linear model. This cubic model even does better than the linear model when compare the RSE and adjusted r-squared. There is no clear answer that can we compare the linear model with polynomial models with RSE and adjusted r-squared. But we are free to use cubic.fit4 model for the prediction. With the cubic.fit4 model, the portfolio without TikTok is shown below.
















But how about combine the polynomial functions together?


qua.fit5 <- lm(Sales ~ . + poly(Instagram,2)+poly(FaceBook,2), data=adversting)

summary(qua.fit5)


















cubic.fit6 <- lm(Sales ~ . + poly(Instagram,3)+poly(FaceBook,3), data=adversting)

summary(cubic.fit6)






















Compared the RSE and adjusted r-squared, the cubic.fit6 performs better.


Let's check the model plots
















This Normal Q-Q of this model seems perform a bit poorer than the cubic.fit6 model.

From the above multiple linear model, quadratic models and cubic models, based on the RSE and adjusted r squared, I would say cubic.fit4 model performs the best. And I am not worried about the overfitting problem because from the linear model with 90% adjusted r squared to the best cubic.fit6 model with 92.6% adjusted r squared. A few points up wouldn't be a problem in this situation. However, you may select the model you feel comfortable with the most.


17 views0 comments

Recent Posts

See All

Comments


© 2023 by EMILIA COLE. Proudly created with Wix.com

bottom of page