Pr. 12 Regression

You might also like

Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 4

rd

Tribhuvan University
Level: BSc.CSIT (3 Sem) Amrit Campus
Roll no: 06 Statistics-II Date: 2081/01/08
Sec: B Practical Number: 12
A B C D E F G H I J K L M N
1
2 Q no. 12) A researcher wanted to examine how the lifetime of a personal computer which is used by children is affected by
3 the time (in hours) spends by the children per day to play games and the available random-access memory
4 (RAM) measured in megabytes (MB) of a used computer. The data is provided in the following table.
Lifetime
5 5 1 7 2 3 4 6
(years)

Play
time
6 2 8 1 5 6 3 2
(hours
/day)
RAM
7 8 2 6 3 2 4 7
(in GB)
8
9 i) Fit the multiple regression model.
10 ii) Predict the lifetime of a computer which have play time 4 hours per day and RAM is 5 GB.
11 iii) How much variation in life time of computer is explained by Play time and RAM?
12 iv) Compute standard error of the estimate.
13 v) Test the significance of regression coefficients and overall fit of the regression equation.
14 vi) Conduct the residual analysis.
15
16 Working expression:
17 The multiple linear regression equation of Y on X1 and X2 is ;
18 Y = b0 + b1X1 + b2X2
19 where, Y = Dependent variable ( Lifetime )
20 X1 = Play time
21 X2 = RAM
22 b0 = sample Y- intercept
23 b1 = sample regression coeff. of Y on X1 kepping X2 as constant
24 b2 = sample regression coeff. of Y on X2 keeping X1 as constant
25 Standard error of estimate (Se) is given as :
26 𝑆𝑒=√(𝑆𝑆𝐸/(𝑛−𝑘−1))
27
28
29
30 Calculation:
31 1) Using SPSS:
32
33 SPSS Syntax:
34 REGRESSION
35 /DESCRIPTIVES MEAN STDDEV CORR SIG N
36 /MISSING LISTWISE
37 /STATISTICS COEFF OUTS CI(95) R ANOVA CHANGE ZPP
38 /CRITERIA=PIN(.05) POUT(.10)
39 /NOORIGIN
40 /DEPENDENT Lifetime
41 /METHOD=ENTER Playtime RAM
42 /PARTIALPLOT ALL
43 /SCATTERPLOT=(*ZRESID ,*ZPRED)
44 /RESIDUALS NORMPROB(ZRESID).
45
46 SPSS Output :
47
48 Descriptive Statistics
49
Mean Std. Deviation N
Lifetime 4.00 2.160 7
50 (years)
Play time 3.86 2.545 7
(hours
51 /day)

RAM 4.57 2.440 7


52 (in GB)
53
54
55 Variables Entered/Removeda

Kritisha Shrestha 1 of 1
rd
Tribhuvan University
Level: BSc.CSIT (3 Sem) Amrit Campus
Roll no: 06 Statistics-II Date: 2081/01/08
Sec: B Practical Number: 12
A B C D E F G H I J K L M N

56
Variables Variables
Model Entered Removed Method
1 RAM (in GB), Enter
Play
57 time(hours/
day)b

58 a. Dependent Variable: Lifetime(years)


59 b. All requested variables entered.
60
61 Coefficientsa
95.0%
62 Unstandardized Standardized Confidence
Coefficients Coefficients Interval for B Correlations

63 Lower Upper Zero-


Model B Std. Error Beta t Sig. Bound Bound order Partial Part
64 1 (Constant) 6.961 2.482 2.805 0.049 0.071 13.851
Play -0.785 0.295 -0.925 -2.666 0.056 -1.603 0.032 -0.940 -0.800 -0.455
65 time(hours/
day)
RAM (in GB) 0.015 0.307 0.017 0.048 0.964 -0.838 0.868 0.822 0.024 0.008
66
67 a. Dependent Variable: Lifetime(years)
68
69 i) The multiple linear regression model of lifetime on Playtime(years) and RAM(in GB) is;
70 Y = 6.961 + (-0.785)X1 + (0.015)X2
71
72 ii) When, play time is 4 hours per day and RAM is 5 GB.Then,
73 X1 = 4
74 X2 = 5
75 Y = 6.961 + (-0.785) × 4 + (0.015) × 5
76 3.896
77 Therefore, the lifetime of a computer is 3.896 when the playtime is 4 hours per day and RAM is 5GB.
78
79 Model Summaryb
80 Change Statistics

81 Adjusted Std. Error of R Square F Sig. F


Model R R Square R Square the Estimate Change Change df1 df2 Change
82 1 .940 a
0.883 0.825 0.904 0.883 15.144 2 4 0.014
83 a. Predictors: (Constant), RAM (in GB), Play time(hours/day)
84 b. Dependent Variable: Lifetime(years)
85
86 iii) Here, R2 = 0.883 i.e. 88.33%
87 That means 88.33% of the total variation in dependent variable Lifetime (Y) has been explained by independent
88 variables Play time(X1) and RAM (X2) and the remaining 11.67% is unexplained variation which is the effect of other
89 factors.
90
91 iv) The standard error of estimate is,
92 Se = 0.904
93 Here, Se = 0.904 which is the average variation of observed values around the fitted regression line.
94
95 v) For the test of overall significance of regression coefficient,
96 Test hypothesis:
97 Null hypothesis (H0): βj = 0 ( j=1,2 )
98 i.e. There is no linear relationship between the dependent variable(Lifetime) and independent variable
99 (Playtime or RAM).
100 Alternative hypothesis (H1): At least one βj is different from zero .βj ≠ 0 ( j=1,2 )
101 i.e. There is linear relationship between the dependent variable (Lifetime) and at least one independent variable
102 (Playtime or RAM).
103
104
105
106 Test statistics:
107 The test statistic for the test of overall significance of regression coefficients is given as:
108 𝐹=𝑀𝑆𝑅/𝑀𝑆𝐸
109

Kritisha Shrestha 2 of 2
rd
Tribhuvan University
Level: BSc.CSIT (3 Sem) Amrit Campus
Roll no: 06 Statistics-II Date: 2081/01/08
Sec: B Practical Number: 12
𝐹=𝑀𝑆𝑅/𝑀𝑆𝐸
A B C D E F G H I J K L M N
110 where, MSR = mean sum of square due to regression
111 MSE = mean sum of square due to error
112
113 Level of significance:
114 Let α be the level of significance. Generally fix α = 0.05 unless we are given.
115 α= 0.05
116 Decision:
117 Critical value approach : Reject H0 at α level of significance if F > Ftabulated, accept otherwise.
118 p-value approach: If p-value < α, it is significant, otherwise insignificant .
119
120 Critical value:
121 At α=0.05 level of significance and, k=2 and n-k-1 =4, the critical value is,
122 Ftabulated= Fα(k,n-k-1) = 6.944
123
124 ANOVA Table:
125 ANOVAa
126 Sum of
Model Squares df Mean Square F Sig.
127 1 Regression 24.734 2 12.367 15.1439 0.014
128 Residual 3.266 4 0.817
129 Total 28.000 6
130 a. Dependent Variable: Lifetime(years)
131 b. Predictors: (Constant), RAM (in GB), Play time(hours/day)
132
133 Table 1: Hypothesis Testing
134 Cases Symbol Value

There is no linear relationship between the dependent


135
Null variable(Lifetime) and independent variable (Playtime or
hypothesis H0 RAM).

There is linear relationship between the dependent


136
Alternative variable (Lifetime) and at least one independent variable
hypothesis H1 (Playtime or RAM).
137
138 Decision:
139 Critical value approach :
140 Reject H0 at 0.05 level of significance i.e. =IF(G127>F122,"Reject H0 at 0.05 level of
141 Accept H1. significance i.e. Accept H1.","Accept H0.")
142 p-value approach :
143 =IF(H127<E115,"It is significant.","It is
It is significant.
144 insignificant.")
145
146 Conclusion:
147 Hence, there is linear relationship between the dependent variable (Lifetime) and at least one independent variable
148 (Playtime or RAM). i.e. It is significant.
149
150 vi) Residual analysis.
151 Residuals Statisticsa
152 Std.
Minimum Maximum Mean Deviation N
Predicted 0.71 6.27 4.00 2.030 7
153 Value
154 Residual -1.079 0.735 0.000 0.738 7
Std. -1.621 1.116 0.000 1.000 7
155 Predicted
Value
Std. Residual -1.194 0.813 0.000 0.816 7
156
157 a. Dependent Variable: Lifetime(years)
158
159
160
161
162
163
164
165
166
167

Kritisha Shrestha 3 of 3
rd
Tribhuvan University
Level: BSc.CSIT (3 Sem) Amrit Campus
Roll no: 06 Statistics-II Date: 2081/01/08
Sec: B Practical Number: 12
A B C D E F G H I J K L M N
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220

Kritisha Shrestha 4 of 4

You might also like