#Question 1 My hypothesis is that running a display campaign will positively impact revenue, that increased daily spending will correlate with increased daily revenue, that a higher click-through-rate will lead to more transactions, and that a higher conversion rate will result in greater daily revenue. #Upload data
data <- read.csv("Display_data.csv") # Replace with your data file
head(data) # Inspect the first few rows
## spend clicks impressions display transactions revenue ctr con_rate
## 1 22.61 165 8672 0 2 58.88 1.90 1.21
## 2 37.28 228 11875 0 2 44.92 1.92 0.88
## 3 55.57 291 14631 0 3 141.56 1.99 1.03
## 4 45.42 247 11709 0 2 209.76 2.11 0.81
## 5 50.22 290 14768 0 3 197.68 1.96 1.03
## 6 33.05 172 8698 0 2 204.36 1.98 1.16
Below is a regression model of my hypothesis, comparing the impact of revenue that higher click-through-rate will lead to more transactions.
# Load ggplot2 library
library(ggplot2)
# Create the scatter plot with regression line using ggplot2
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point(color = "pink") + # Scatter plot
geom_smooth(method = "lm", col = "lavender", size = 1.5) + # Linear regression line
labs(title = "Scatter Plot with Regression Line",
x = "Revenue",
y = "Clicks") +
theme_minimal()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## `geom_smooth()` using formula = 'y ~ x'
#Question 2 My hypothesis is no significant relationship between advertising campaign exposure and product purchase.
data <- read.csv("ab_testing1.csv") # Replace with your data file
head(data) # Inspect the first few rows
## Ads Purchase
## 1 1 152
## 2 0 21
## 3 2 77
## 4 0 65
## 5 1 183
## 6 1 87
#Creating a regression model.
# Load ggplot2 library
library(ggplot2)
# Create the scatter plot with regression line using ggplot2
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point(color = "lightblue") + # Scatter plot
geom_smooth(method = "lm", col = "lightgreen", size = 1.5) + # Linear regression line
labs(title = "Scatter Plot with Regression Line",
x = "Ads",
y = "Purchase") +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'