程序代写案例-DJW2019

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top
DJW2019 Marketing Mix Model Assignment

The goal of this assignment is to code a marketing mix model to estimate the impact of
advertising on consumers' brand quality attitudes, as in Du, Joo, Wilbur (2019).

Create an RMD file to show your code and output. Make your code readable and include
comments as appropriate. Make your outputs clear, complete and parsimonious.

SECTION 1: Prepare the data
1. Load randomized_data_for_hw.csv using read.csv.
2. Here are the variables available in the dataset.
Identifiers
● Brand​ = id for each brand
● Industry​ = id for each industry
● time_period​ = week identifier
● yrqtr​ = quarter identifier

Brand Attitude Metrics
● qua​ = proportion of quality survey respondents who indicate positive impression
of brand quality
● val​ = proportion of value survey respondents who indicate positive impression of
brand value
● sat​ = proportion of satisfaction survey respondents who indicate positive
impression of brand satisfaction

Volume variable
● qua_vol​ = number of quality survey respondents

Ad Metrics
● nat ​= national ad spend for the brand ($)
● loc​ = local ad spend for the brand ($)
● dig​ = digital ad spend for the brand ($)

Competitor Ad Metrics
● compnat​ = competitor national ad spend ($)
● comploc​ = competitor local ad spend ($)
● compdig​ = competitor digital ad spend ($)

3. Log-transform ad metrics, competitor ad metrics, and brand attitude metrics using the log
of (x+1).
4. Create 13 lag variables for each brand attitude metric.
a. Example code for creating 13 lags for a variable using tidyverse:
dat<- dat %>% group_by(Brand) %>%
mutate(lag1var= lag(var, n=1),
lag2var = lag(var, n=2),
lag3var = lag(var, n=3)
.
. (​keep increasing value of n​)
.
lag13var = lag(var, n=13))

5. Create 5 lags for each advertising spend metric (both own brand and competitor).
6. Drop the first 13 observations for each brand, since the lagged brand attitude metrics
contain NAs during the first 13 weeks of the data.
a. Example code to drop first 13 observations for each brand using tidyverse:
dat <- dat %>%
group_by(Brand) %>%
slice(14:n())

SECTION 2: Build Regressions
Using the data you’ve prepared in Section 1, reproduce the du-joo-wilbur Quality regression.

1. Regress quality on each of the 3 ad metrics, including 5 lags of each of the 3 ad metrics,
5 lags of each of the competitor ad metrics, 13 lags of each of the brand attitude metrics,
week fixed effects and brand fixed effects. Use the lm command.

As a starting point, you can modify the following command:
lm(y~x1+x2+x3+as.factor(brand)+as.factor(week), data=dat)

2. Using the same regression equation in question 1, use the felm command from the lfe
package. Your results should be the same as in the previous step.

Starting point: felm(y~x1+x2+x3|as.factor(brand)+as.factor(week), data=dat)

3. Now on the regression you ran in #2, weight the data by qua_vol. How do the results
change?

Hint: felm command documentation explains the weights option.

4. Now on the regression you ran in #3, replace the brand fixed effects with brand-quarter
fixed effects. Notice how the results change.

5. Now on the regression you ran in #4, replace the week fixed effects with industry-week
fixed effects. Notice how the results change.

6. Create a pretty table that shows your advertising coefficient estimates for #2, 3, 4, and 5
side by side. You can omit the lagged brand attitude coefficient estimates in the table.

Hint: Use the stargazer command in the stargazer package.
Note: ​Your advertising parameter estimates should resemble those in the paper but will
not be exactly equal, as we have partially disguised the data.

Each team should upload 1 zip file containing 1 data cleaning script, 1 estimation script,
and 1 document containing:
● the results table
● interpretation of how the findings change across the columns in the results table
● summary of what you learned from the exercise.
Make sure your code is clean, well commented, and includes only the necessary
commands.

Each individual member of the team should have the team’s work available for reference
in class on the day the assignment is due.

欢迎咨询51作业君
51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468