Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Your file has been submitted successfully. We’re processing it now - please check back in a few minutes to view your report.
11-08-2017 05:21 AM
Marketing Optimization using Linear Programming
CMOs need to make complex decisions about budget allocation and marketing investment. Deciding which campaigns will receive funding is never easy, especially with multiple factors and obligations that need to be taken into account.
This dashboard helps marketing managers to optimize the 'Return on Marketing Investment' (ROMI) across four channels. TV Ads, SEO , Adwords and Facebook. Based on the set parameters and rules , the dashboard gives a R Linear Programming Solutions that optimizes the ROMI.
R Libraries used: linprog - for linear programming, grid, gridExtra,gtable - for plotting the results as a table
eyJrIjoiZTNlZjNkMTktMWY3Ni00ZTRlLTg0MmEtMzYxMWQ2OTI4MzIyIiwidCI6IjViNjdjODg2LTFhMjYtNDk4OC1hNzY3LTEwOTQzZTRkMTA2YyIsImMiOjEwfQ
R Code:
my_df <- `dataset`
library(linprog)
ROI <- c(my_df$`TVROI Value`/100,my_df$`SEOROI Value`/100,my_df$`ADWORDSROI Value`/100,my_df$`FacebookROI Value`/100)
bVect <- c(my_df$`Total Budget`, 0, 0, -200000, -80000, -60000, 220000, 0, my_df$`Customer Base`)
AMatrix <- rbind(
c(1,1,1,1), # TOTAL
c(0.6,-0.4,-0.4,0.6), # SEO + AdWords > 60%
c(-0.2,-0.2,-0.2,0.8), # FB < 20%
c(-1,0,0,0), # Min TV
c(0,0,0,-1), # Min FB
c(0,-1,0,0), # Min SEO
c(0,1,0,0), # Max SEO
c(0,-3,1,0), # Adwords <= 3 SEO
c(my_df$`TV Reach Value`,my_df$`SEO Reach Value`,my_df$`Adwords Reach Value`,my_df$`Facebook Reach Value`) # Campaign reach
)
lpsol <- solveLP(ROI, bVect, AMatrix, TRUE)
OptROI <- paste0("$", formatC(as.numeric(lpsol$opt), format="f", digits=0, big.mark=","))
TVSpend <- paste0("$", formatC(as.numeric(lpsol$solution[1]), format="f", digits=0, big.mark=","))
SEOSpend <- paste0("$", formatC(as.numeric(lpsol$solution[2]), format="f", digits=0, big.mark=","))
AdwordsSpend <- paste0("$", formatC(as.numeric(lpsol$solution[3]), format="f", digits=0, big.mark=","))
FacebookSpend <- paste0("$", formatC(as.numeric(lpsol$solution[4]), format="f", digits=0, big.mark=","))
plot_df <- data.frame(Description=c('Optimum ROI','TV Spend','SEO Spend','Adwords Spend','Facebook Spend'),
Value=c(OptROI,TVSpend,SEOSpend,AdwordsSpend,FacebookSpend))
library(gtable)
library(gridExtra)
library(grid)
tt <- ttheme_minimal(
core=list(bg_params = list(fill = blues9[1:5], col=NA),
fg_params=list(fontface=1,fontsize=20)),
colhead=list(fg_params=list(col="navyblue", fontface=1,fontsize=20)))
g <- tableGrob(plot_df[1:5,], rows = NULL,theme=tt)
g <- gtable_add_grob(g,
grobs = rectGrob(gp = gpar(fill = NA, lwd = 2)),
t = 2, b = nrow(g), l = 1, r = ncol(g))
g <- gtable_add_grob(g,
grobs = rectGrob(gp = gpar(fill = NA, lwd = 2)),
t = 1, l = 1, r = ncol(g))
grid.newpage()
grid.draw(g)