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.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

Problem 2.21 from textbook

Are the advertising dollars spent by a company related to total sales revenue? The following data represent the advertising dollars and the sales revenues for various companies in a given industry during a recent year. Construct a scatter plot of the data from the two variables and discuss the relationship between the two variables.

To solve this problem, we first assign values to advertising and sales as given in the problem. Then use the plot function of R with proper/perfered arguments.

advertising = c(4.2, 1.6, 6.3, 2.7, 10.4, 7.1, 5.5, 8.3)
sales = c(155.7, 87.3, 135.6, 99.0, 168.2, 136.9, 101.4, 158.2)

plot(advertising, sales, main='Advertising dollars spent vs Revenue', 
     pch=2, cex=1.0, col='purple',
     xlab="Advertising dollars spent (in $ millions)",
     ylab="Total Sales Revenue(in $ millions)")

From the result we can tell, although, the overall trend is sales will increase as the advertising dollars spent increases, there are “outliners” that worth further attention: 4.2 vs 155.7 5.5 vs 101.4

We can check the effective of each advertising spending by below chart too. The effectiveness of Advertising spending actually decreases as the spending increases

plot(advertising, sales/advertising, main='Sales generated per million $ Advertising spent', 
     pch=2, cex=1.0, col='purple',
     xlab="Advertising dollars spent (in $ millions)",
     ylab="Sales per Advertising spent (in $ millions)")

Peek at the advertising vs sales/advertising values

advertising
## [1]  4.2  1.6  6.3  2.7 10.4  7.1  5.5  8.3
sales/advertising
## [1] 37.07143 54.56250 21.52381 36.66667 16.17308 19.28169 18.43636 19.06024