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?

Response: There seems to be a linear 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`
str(ad_sales)
## spc_tbl_ [200 × 6] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
##  $ ...1     : num [1:200] 1 2 3 4 5 6 7 8 9 10 ...
##  $ X1       : num [1:200] 1 2 3 4 5 6 7 8 9 10 ...
##  $ TV       : num [1:200] 230.1 44.5 17.2 151.5 180.8 ...
##  $ radio    : num [1:200] 37.8 39.3 45.9 41.3 10.8 48.9 32.8 19.6 2.1 2.6 ...
##  $ newspaper: num [1:200] 69.2 45.1 69.3 58.5 58.4 75 23.5 11.6 1 21.2 ...
##  $ sales    : num [1:200] 22.1 10.4 9.3 18.5 12.9 7.2 11.8 13.2 4.8 10.6 ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   ...1 = col_double(),
##   ..   X1 = col_double(),
##   ..   TV = col_double(),
##   ..   radio = col_double(),
##   ..   newspaper = col_double(),
##   ..   sales = col_double()
##   .. )
##  - attr(*, "problems")=<externalptr>
plot(sales ~ TV, data = ad_sales)

plot(sales ~ radio, data = ad_sales)

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

Response: There is a linear relationship between TV advertising and Sales. TV advertising causes an increase in sales.

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

Response: There appears to be a linear relationship between radio advertising and sales. The relationships shows that radio advertising causes an increase in sales.

Question 4:Three things you learned from this tutorial

Response: Three things I learned from this tutorial is that each data needs to be written the same way as the data is noted. For example, the word radio needed to be spelled the same. The second thing I learned is how to search up data codes here on R. If I do not understand a certain code, we can utlize the cite to search up the meaning. The third thing I learned is how to differentiate sections here in R. We have text chunks and shaded chunks.

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