Statistics 2

In-Class Exercise 6

Yu-You Liou

Shih Chien University

2026-09-16

Data for Questions 1 to 3

A retailer records its monthly advertising expenditure (in NT$10,000) and sales revenue (in NT$100,000) for ten months.

ads   <- c(2.1, 3.4, 1.8, 4.2, 2.9, 5.1, 3.7, 1.5, 4.6, 2.5)
sales <- c(18.2, 22.6, 17.1, 29.5, 20.4, 31.8, 27.9, 15.3, 28.6, 21.7)

Question 1

Scatter Plot

Draw a scatter plot of sales against ads with ggplot() and geom_point(), and add the least-squares line with geom_smooth(method = "lm", se = FALSE).

Describe the direction and the strength of the relationship in one sentence.

Question 2

Correlation Coefficient

  1. Compute r with cor().
  2. State whether the relationship is positive or negative, and whether it is weak, moderate, or strong.
  3. A classmate concludes that spending more on advertising causes higher sales. Explain in one or two sentences why r alone does not support that conclusion.

Question 3

Testing the Significance of r

Test H_0\text{: }\rho=0 against H_1\text{: }\rho\neq0 at \alpha=0.05.

  1. Compute the test statistic t=r\sqrt{(n-2)/(1-r^2)} in R.
  2. Find the critical values with qt() and d.f.=n-2.
  3. Confirm your test statistic and P-value with cor.test(ads, sales), then state the conclusion.