Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question (1) [15 Marks] Use the marketing data frame available in the package (datarium) in R. It contains the impact of three advertising medias

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Question (1) [15 Marks] Use the marketing data frame available in the package (datarium) in R. It contains the impact of three advertising medias (youtube, facebook and newspaper) on sales. Data are the advertising budget in thousands of dollars along with the sales. The advertising experiment has been repeated 200 times with different budgets and the observed sales have been recorded. First install the datarium package using the codes below: ### Install the datarium package install.packages("datarium") library(datarium) ### Inspect the dataset "marketing" and check the first 6 rows using the function head() in R: # Load the data data("marketing", package = "datarium") # view the first four rows of the data head(marketing, 4) In this question we want to predict future "sales" on the basis of advertising budget spent on "youtube". a) (1 mark) Create a scatter plot using the function "ggplot" in R to display the "sales" Notes: units versus "youtube" advertising budget. Label the x-axis as "youtube" and y-axis as "sales". Is the graph suggest any type of relationship (linear, non-linear, increasing, decreasing) between the two variables "sales" and "youtube". You need to load the packages below: i. tidyverse for data manipulation and visualization ii. ggpubr: creates easily a publication ready-plot www. ### i. Install the "tidyverse" package using the codes below install.packages("tidyverse") library(tidyverse) ### ii. Install the "ggpubr" package using the codes below: install.packages("ggpubr") library(ggpubr) b) (1 mark) Compute the correlation coefficient between "sales" and the "youtube" variables using the R function cor ( ) and interpret your finding. (1 mark) Perform a simple linear regression on the data using the R function 1m ( ) and name it "model" d) (3 marks) From the output of part (c) answer the following questions: i. (1 mark) Write the estimated regression line equation. ii. (1 mark) Find the intercept (B) and interpret your finding. wwwwwwww iii. (1 mark) Find the slope or the regression beta coefficient for the variable youtube (), and interpret that. e) (1 mark) Use the function stat_smooth() available in the package (ggplot2) in R to construct a scatter plot. Use the color red to your filled points (observations). Add a suitable title. To add a title to your plot, add the code + ggtitle("Your Title Here") to your line of basic ggplot code. Add the regression line onto the scatter plot. By default, the fitted line is presented with confidence interval around it. The confidence bands reflect the uncertainty about the line. If you don't want to display it, specify the option se = FALSE in the function stat_smooth ( ). For this question keep the confidence bands on the graph. f) (1 mark) Run the 'summary' function with 'model'. Is there a statistically significant relationship between the predictor and the outcome variable? Explain clearly based on the p-values.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to graph theory

Authors: Douglas B. West

2nd edition

131437372, 978-0131437371

More Books

Students also viewed these Mathematics questions