# Load necessary package and data
library(readr)
display_data <- read_csv("Display_data.csv")
## Rows: 29 Columns: 8
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (8): spend, clicks, impressions, display, transactions, revenue, ctr, co...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(display_data)
## # A tibble: 6 × 8
##   spend clicks impressions display transactions revenue   ctr con_rate
##   <dbl>  <dbl>       <dbl>   <dbl>        <dbl>   <dbl> <dbl>    <dbl>
## 1  22.6    165        8672       0            2    58.9  1.9      1.21
## 2  37.3    228       11875       0            2    44.9  1.92     0.88
## 3  55.6    291       14631       0            3   142.   1.99     1.03
## 4  45.4    247       11709       0            2   210.   2.11     0.81
## 5  50.2    290       14768       0            3   198.   1.96     1.03
## 6  33.0    172        8698       0            2   204.   1.98     1.16

Hypothesis 1

H₀=Advertising spend has no effect on revenue. H₁=Advertising spend has a significant effect on revenue.

# Simple Linear Regression Model: revenue ~ spend
model_simple <- lm(revenue ~ spend, data = display_data)
summary(model_simple)
## 
## Call:
## lm(formula = revenue ~ spend, data = display_data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -145.210  -54.647    1.117   67.780  149.476 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  10.9397    37.9668   0.288    0.775    
## spend         4.8066     0.7775   6.182 1.31e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 86.71 on 27 degrees of freedom
## Multiple R-squared:  0.586,  Adjusted R-squared:  0.5707 
## F-statistic: 38.22 on 1 and 27 DF,  p-value: 1.311e-06

Outcome and Managerial Recommendations:

R²: 0.586: About 59% of the variation in revenue is from spend alone.

Coefficient: 4.81, p is less than 0.001 and so it is statistically significant

Interpretation: For every $1 increase in spend, revenue increases by about $4.81

Managerial Recommendation: Since there is a strong positive/significant relationship between spend and revenue, they should increase the ad spending and it should, in turn, increase the revenue.

Hypothesis 2

H₀: Display and spend have no effect on revenue H₁: Display and/or spend significantly affect revenue

# Multiple Linear Regression Model: revenue ~ spend + display
model_multiple <- lm(revenue ~ spend + display, data = display_data)
summary(model_multiple)
## 
## Call:
## lm(formula = revenue ~ spend + display, data = display_data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -176.730  -35.020    8.661   56.440  129.231 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -50.8612    40.3336  -1.261  0.21850    
## spend         5.5473     0.7415   7.482 6.07e-08 ***
## display      93.5856    33.1910   2.820  0.00908 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 77.33 on 26 degrees of freedom
## Multiple R-squared:  0.6829, Adjusted R-squared:  0.6586 
## F-statistic:    28 on 2 and 26 DF,  p-value: 3.271e-07

Outcome and Managerial Recommendations:

R squared:0.683, Model improves with Display added, roughly 68% of revenue variation explained

Spend Coefficient = 5.55, p is less than 0.001

Display Coefficient = 93.59, p = 0.009 which is also significant

Managerial Recommendations: Since display ads and spending both significantly boost revenue, the company should run more ads while also increasing the spending budget for the two.