install.packages(“readr”)

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

Note: this analysis was performed using the open source software R and Rstudio.

Objective

The objective of this tutorial is to explain how bivariate analysis works.This analysis can be used by marketers to make decisions about their pricing strategies, advertising strategies, and promotion stratgies among others.

Bivariate analysis is one of the simplest forms of statistical analysis. It is generally used to find out if there is a relationship between two sets of values (or two variables). That said, it usually involves the variables X and Y (statisticshowto.com).

Dataset - We will be using two online datasets available in R for this tutorial

plot(y3 ~ x2, data = anscombe, pch = 16)
abline(lm(y3 ~ x3, anscombe), col = "grey20")

Question 1:is there a relationship between x and y? If so, what does the relationship look like?

There is a positive relationship between x and y.

library(readr)
library(readr)
ad_sales <- read_csv('https://raw.githubusercontent.com/utjimmyx/regression/master/advertising.csv')
## New names:
## Rows: 200 Columns: 6
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," dbl
## (6): ...1, X1, TV, radio, newspaper, sales
## ℹ 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.
## • `` -> `...1`
plot(sales ~ TV, data = ad_sales)

Question 2:Is there a relationship between TV advertising and Sales? If so, what does the relationship look like?

yes there is a positive relationship.

Question 3:Can you plot the relationship between radio advertising and Sales? If so, what does the relationship look like?

plot(sales ~ TV, data = ad_sales)
abline(lm(sales ~ TV, data = ad_sales), col = "blue")

###Question 4:Three things you learned from this tutorial ### 1)How to make scatter plots using r markdown 2) what ’’’r means at the beginning 3) how to use scatter plots to look at relationships

#Are there any other kinds of exploratory analysis you can perform using R? If so, please include your analysis and results in your final report.

summary(ad_sales)

…1 X1 TV radio newspaper sales

Min. : 1.00 Min. : 1.00 Min. : 0.70 Min. : 0.000 Min. : 0.30 Min. : 1.60

1st Qu.: 50.75 1st Qu.: 50.75 1st Qu.: 74.38 1st Qu.: 9.975 1st Qu.: 12.75 1st Qu.:10.38

Median :100.50 Median :100.50 Median :149.75 Median :22.900 Median : 25.75 Median :12.90

Mean :100.50 Mean :100.50 Mean :147.04 Mean :23.264 Mean : 30.55 Mean :14.02

3rd Qu.:150.25 3rd Qu.:150.25 3rd Qu.:218.82 3rd Qu.:36.525 3rd Qu.: 45.10 3rd Qu.:17.40

Max. :200.00 Max. :200.00 Max. :296.40 Max. :49.600 Max. :114.00 Max. :27.00

References

Bivariate Analysis Definition & Example https://www.statisticshowto.com/bivariate-analysis/#:~:text=Bivariate%20analysis%20means%20the%20analysis,the%20variables%20X%20and%20Y.

https://www.sciencedirect.com/topics/mathematics/bivariate-data