# 13.12 Assignment 13

## Purposes

This assignment has two parts. The first part assesses your knowledge of explaining the idea of least-squares method, obtaining the least-squares regression equation, calculating and interpreting the correlation coefficient [latex]r[/latex] and the coefficient of determination [latex]r^{2}[/latex], interpreting the terms in the simple linear regression model, conducting a [latex]t[/latex] test and obtaining a [latex]t[/latex] confidence interval for the slope parameter [latex]\beta_{1}[/latex], predicting the value of the response variable given the value of the predictor variable, and calculating the fitted value and the residual of an observation. The second part assesses your skills in using R Commander to fit a least-squares simple linear regression model and conduct a [latex]t[/latex] test.

## Resources

M13_HomePrice_Regression_Q1.xlsx

M13_CrownRump_Length_Regression_Q2.xlsx

## Instructions

**Part A**

Complete the following:

- A random sample of nine custom homes currently listed for sale provided the following information on size and price. Here,
*x*denotes size, in hundreds of square feet, rounded to the nearest hundred, and*y*denotes price, in thousands of dollars, rounded to the nearest thousand.

x 26 27 33 29 29 34 30 40 22 y 540 555 575 577 606 661 738 804 496 The summaries of the data are given by

[latex]n = 9,\ \sum_{}^{}x_{i} = 270,\ \sum_{}^{}x_{i}^{2} = 8316,\ \sum_{}^{}y_{i} = 5552,\ \sum_{}^{}y_{i}^{2} = 3504412,\ \sum_{}^{}{x_{i}y_{i}} = 169993.[/latex]

- Given the summaries of the data, find the least-squares regression equation. (5 marks)
- Graph the regression equation and the data points. (4 marks)
- Interpret the slope of the regression equation obtained in part (a) in the context of the study. (2 marks)
- Calculate [latex]r[/latex], the correlation coefficient between [latex]y[/latex] and [latex]x[/latex]. Interpret the number. (4 marks)
- Calculate the coefficient of determination [latex]r^{2}[/latex]. Interpret the number. (3 marks)
- Test at the 5% significant level whether the size is a useful predictor for the price of the custom homes. You could use [latex]s_{e} = 59.62[/latex]. (8 marks)
- Obtain a 95% confidence interval for the slope of the population regression line that relates price to size for custom homes. (4 marks)
- Interpret the confidence interval obtained in part (g). Does this interval support the results of the hypothesis test in part (f)? (4 marks: 2+2)

- Researchers examined the controversial issue of the human vomeronasal organ, an auxiliary olfactory sense organ located at the base of the nasal cavity for detecting chemical stimuli, regarding its structure, function, and identity. The following table shows the age of fetuses [latex](x)[/latex] in weeks and the length of crown-rump [latex](y)[/latex] in millimeters.

x 10 10 13 13 18 19 19 23 25 28 y 66 66 108 106 161 166 177 228 235 280 The summaries of the data are given by

[latex]n = 10,\ \sum_{}^{}x_{i} = 178,\ \sum_{}^{}x_{i}^{2} = 3,522,\ \sum_{}^{}y_{i} = 1,593,\ \sum_{}^{}y_{i}^{2} = 302,027,\ \sum_{}^{}{x_{i}y_{i}} = 32,476.[/latex]

- Given the summaries of the data, find the least-squares regression equation. (5 marks)
- Interpret the slope of the regression equation obtained in part (a) in the context of the study. (2 marks)
- Calculate [latex]r[/latex], the correlation coefficient between [latex]y[/latex] and [latex]x[/latex]. Interpret the number. (4 marks)
- Calculate the coefficient of determination [latex]r^{2}[/latex]. Interpret the number. (3 marks)
- Test at the 1% significant level whether the age of fetuses is a useful predictor for the length of crown-rump. You could use [latex]s_{e} = 5.518[/latex]. (8 marks)
- Predict the crown-rump length of a 19-week-old fetus. (2 marks)
- What is the residual for the last observation with response [latex]y = 280[/latex] and [latex]x = 28[/latex]? (3 marks)

**Part B**

**Finish the following questions using R and R commander. Make sure that you copy and paste the computer outputs as required** **and write down your answers in statements.**

- Refer to Question 1 in Part A. The data are provided in the file
**M13_HomePrice_Regression_Q1.xlsx**. Import the data into R commander and complete the following questions and tasks.- Could we use a straight line to model the relationship between size and price of the custom homes? Use a proper graphical method to justify your answer. (3 marks)
- How does the price of custom homes change when the size increases? Would the slope be positive or negative? (2 marks)
- Obtain the least-squares regression equation using R commander. First copy and paste the computer and then compare the answer obtained by hand in Question 1 part (a). (3 marks)
- Obtain the coefficient of determination [latex]r^{2}[/latex] and the correlation of coefficient [latex]r[/latex] from the computer output. First copy and paste the computer output and then compare the answers with the ones you obtained by hand in Question 1 (d) and (e). (5 marks)
- Re-conduct the hypothesis test in Question 1 (f) using R commander. Make sure to include all the six components of a hypothesis test. First copy and paste the computer output and then compare the answer with the one you obtained by hand in Question 1 (f). (5 marks)

- Refer to Question 2 in Part A. The data are provided in the file
**M13_CrownRump_Length_Regression_Q2.xlsx**. Import the data into R commander and complete the following questions or tasks.- Is it reasonable to model the relationship between age and crown-rump length for fetuses using a straight line? Justify your answer by a proper graphical tool using R commander. (3 marks)
- Obtain the least-squares regression equation using R commander. Copy and paste the computer output first and then compare the answer obtained by hand in Question 2 (a). (3 marks)
- Obtain the coefficient of determination [latex]r^{2}[/latex] and the correlation of coefficient [latex]r[/latex] from the computer output. Copy and paste the computer output and then compare the answers with the ones you obtained by hand in Question 2 (c) and (d). (5 marks)
- Re-conduct the hypothesis test in Question 2 (e) using R commander. Make sure to include all the six components of a hypothesis test. Copy and paste the computer output first and then compare the answer with the one you obtained by hand in Question 2 (e). (5 marks)