Lab2

advertisement
ENGR 3302: Lab 2
Correlation Coefficient and the Least Square Line
For these problems Use Matlab to write the code that will do the calculations. You
can verify your answers with the Statistical SPSS Software in the Lab.
Objectives:
1) Learn how to use the scatter plot to determine if the least-square line is an
appropriate model to estimate the dependent variable.
2) Learn how to calculate the correlation coefficient
3) Learn how to calculate the least-square coefficients (regression coefficients)
Task 1
An engineer wants to predict the value of y when x=4.5, using the following data set.
x
y
1
2
3
4
5
6
7
8
9
10
0.2
0.3
0.5
0.5
1.3
2.3
2.9
4.5
8.7
12.0
a) Calculate the correlation coefficient r. Is there a correlation between x and y?
b) Construct a scatterplot of the points (x, y). From the scatterplot, do you think the
calculated r is a good measure of the relationship between x and y? Explain
c) Should the least-squares line be used to predict the value of y when x = 4.5? If
so, compute the least-squares line and the predicted value. If not, explain why
not.
d) Construct a scatterplot of the points (x, z), where z = ln y.
e) Use the least-squares line to predict the value of z when x = 4.5. Is this an
appropriate method of prediction? Explain why or why not.
f) Let denote the predicted value of z computed in part (d). Let
. Explain
why
is a reasonable predictor of the value of y when x = 4.5.
Task 2
A mixture of sucrose and water was heated on a hot plate, and the temperature (in oC)
was recorded each minute for 20 minutes by three thermocouples. The results are
shown in the following table.
Time
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
T1
20
18
29
32
37
36
46
46
56
58
64
72
79
84
82
87
98
103
101
103
102
T2
18
22
22
25
37
46
45
44
54
64
69
65
80
74
87
93
90
100
98
103
103
T3
21
11
26
35
35
35
46
43
63
68
62
65
80
75
78
88
91
103
109
107
104
a) Compute the least-squares line for estimating the temperature as a function of
time, using T1 as the value for temperature.
b) Compute the least-squares line for estimating the temperature as a function of
time, using T2 as the value for temperature.
c) Compute the least-squares line for estimating the temperature as a function of
time, using T3 as the value for temperature.
d) It is desired to compute a single line to estimate temperature as a function of
time. One person suggests averaging the three slope estimates to obtain a single
slope estimate, and averaging the three intercept estimates to obtain a single
intercept estimate. Find the equation of the line that result from this method.
e) Someone else suggests averaging the three temperature measurements at each
time to obtain
(T1 +T2+T3)/3. Compute the least-squares line using as the
value for temperature.
f) Are the results of parts (d) and (e) different? Explain
Download