Question
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
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 Ready
Finish 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
cardf
``` ## Second, Create the Ad-Stock Variables
The 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 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 variables
AdStockMatrix
z
} ```
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?
## Third, Estimate the Nine Regression Models Estimate the regression model with different ad-stock variable matrices, that are calculated from different $\\lambda$ values. Using the 'Im() function 9 times to get 9 different estimation results using a loop, and write the code below {r } # Get ready for using the function AdStockMatrix MMStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started