Subject: Marketing Analytics II – Regression Analysis (RStu

Subject: Marketing Analytics II – Regression Analysis (RStudio) My… Subject: Marketing Analytics II – Regression Analysis (RStudio)My code so far:—title: “Homework on Media Mix Modeling”author: “Nicole-Lourdes Fader”output: pdf_document: default html_notebook: default html_document: default—In this homework, with help from the following code, you are going to estimate 9 models using different values of $lambda$ with the estimation data, and using the test data to select the best model.Please replace “……” with your own code, no need to change any exisiting code.## First, Load the Data and Get ReadyFinish the code of loading the data file called “sales_ads_use.csv”, using command `read.csv()`, and name the data frame as `cardf““{r }datafile <- read.csv("sales_ads_use.csv")cardf <- df ```## Second, Create the Ad-Stock VariablesThe code below provides a function for a matrix of ad-stock variables from a matrix of the original per-period marketing variables as the data reads.```{r }# AdStockMatrix() Returns

💡 Buy the answer for only $12 Get it now →

the scale matrix for creating the adstock variable from the marketing per-period expenses# Input: #    lambda – the discounted value#    MM – the matrix with all the marketing variablesAdStockMatrix <- function(lambda, MM) {  n=nrow(MM)  r <- lambda^(seq_len(n)-1) m <- matrix(rep(r,n),nrow=n) z <- matrix(0,nrow=n,ncol=n) z[lower.tri(z,diag=TRUE)] <- m[row(m) <= (n+1-col(m))] GG <- z %*% MM GG}``` Question 1(a): I don't know how to estimate the regression model with different ad-stock variable matrices from different $lambda$ values. How do I draw that using the 'lm()' function 9 times?Image transcription text## Third, Estimate the Nine RegressionModels Estimate the regression modelwith different ad-stock var... Show more... Show more  Question 1(b): From there, what is the code to determine the highest value of $R^2$?Image transcription text## Finally, list the $R^2$ values fromthe 9 different models Which one hasthe highest value of $R^2... Show more... Show more Arts & Humanities Communications Marketing MKTG 3738

💡 Buy the answer for only $12 Get it now →