IE582 Fall 2021 Assignment-4 Due Date- 10/23/2021 11:59
PM Instructions • Please complete this assignment in the same group
formed for the assignment2. • There are three question sets in this
assignment. ◦
Question Set 1: Simple Linear Regression Calculation ◦
Question Set 2: Multiple Linear Regression Matrix Derivation ◦
Question
Set 3: Forward, Backward and Stepwise Selection Linear Regression
•
Question sets 1 and 2 are for calculator-based calculations and
derivations. • You are only required to answer interpretative questions
based on the Appendix Output section. (Question Sets 3) Question Set 1:
Simple Linear Regression Calculation The table 1 dataset provides ht
(Height in cms) and wt (Weight in kgs) for , 18-year-old girls. This
dataset is obtained from alr4 package. Based on the dataset, please
answer the following questions by assuming ht to be the independent
variable.
## [1] "Question Set 1 Dataset"
## ht wt
## 1 169.6 71.2
## 2
166.8 58.2
## 3 157.1 56.0
## 4 181.1 64.5
## 5 158.4 53.0
## 6 165.6
52.4
## 7 166.7 56.8
## 8 156.5 49.2
## 9 168.1 55.6
## 10 165.3 77.8
•
Compute estimates of the slope and the intercept for the simple linear
regression.
• Find the residuals or errors associated with the fitted
model. Calculate associated mean and standard deviation(sample).
•
Estimate for the fitted line. What would be the correlation between two
variables?
• Predict the weight range for a group having the height
range in 140 cm to 190 cm.
Question Set 2: Multiple Linear Regression
Matrix n = 10 β1 β0 R2 Page 1 of
35IE582_F2021_Assignment_4.utf8 10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html Derivation Consider
the following equation for observation of dependent variable using as
an indepedent variable. Where
• Based on the provided set of equations,
first state the necessary assumptions to convert the same into Multiple
Linear Regression framework
• Derive the appropriate solution for and
using Matrix Calculus.
• Verify your solution with the simple linear
regression equations. Please provide sufficient reasoning for your
steps Question Set 3: Forward, Backward and Stepwise Selection Linear
Regression Introduction: The assignment is based on the bike sharing
dataset listed on UCI Machine Learning Repository. The dataset is
provided at two levels:
• Day Level: Question Set 3 is based on the
same.
Useful links:
• Data Dictionary File:
http://personal.psu.edu/mzm6664/Readme.txt (http://personal.psu.edu/mzm6664/Readme.txt) ith
Y X = + + + ⋯ + + +Yi β0 β1Xi1 β2Xi2 βp−1Xi(p−1) βpXip ei i = 1, 2, . .
. ,n j = 0, 1, 2, . . . , p = indepedent variable value for
observation Xij jth ith = error assocaited with the prediction of
observation ei ith X e Page 2 of
35IE582_F2021_Assignment_4.utf8 10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html •
Original Data Source Link:
https://archive.ics.uci.edu/ml/datasets/Bike+Sharing+Dataset# (https://archive.ics.uci.edu/ml/datasets/Bike+Sharing+Dataset#) •
Processed day level data:
http://personal.psu.edu/mul490/cnt_day.csv (http://personal.psu.edu/mul490/cnt_day.csv)
This
question is based on Day Level dataset. An approach is presented to
develop a linear regression model using combination of Forward, Backward
and Stepwise selection methods with VIF based insights. Three
iterations have been utilized to decide the final model. Please answer
the following
questions:
• Please verify if all the three methods-
Forward, Backward and Stepwise selection result to the same model at the
end of iteration one. Report the number of steps taken by each of
the methods to reach to the final model of the first iteration.
• By
interpreting results, please provide reasoning for the second and third
stage of iteration. • Based on the beta values of the final model(at the
end of third iteration), identify factors that are negatively related
to count of renting bikes on a given day.
• Please comments on residuals
and standardized residuals graphs with respect to multiple
linear regression assumptions.
• Post results on the given approach,
please list possible two actions that can be taken to improve the model
performance. (You are only required to list actions.) Appendix
Output: The R Output for questions
3
## [1] "Forward selection using
AIC" Page 3 of
35IE582_F2021_Assignment_4.utf8 10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
##
Start: AIC=11066.88
## cnt ~ 1
## ## Df Sum of Sq RSS AIC
## + atemp 1
1091003307 1648532085 10698
## + dteday 1 1083287662 1656247730 10701
##
+ temp 1 1078688585 1660846807 10703
## + yr 1 879828893 1859706499
10786
## + season 1 451797359 2287738033 10937
## + weathersit 1
242288753 2497246639 11001
## + mnth 1 214744463 2524790929 11009
## +
windspeed 1 150705556 2588829836 11028
## + hum 1 27757373 2711778019
11061
## + holiday 1 12797494 2726737898 11066
## + weekday 1 12461089
2727074303 11066
## + workingday 1 10246038 2729289354 11066
##2739535392 11067
##
## Step: AIC=10697.61
## cnt ~ atemp
##
## Df Sum of Sq RSS AIC
## + dteday 1 795359095 853172990 10218
## + yr 1 793490560 855041526 10220
## + weathersit 1 135396795 1513135291 10637
## + season 1 111746784 1536785302 10648
## + hum 1 99815222 1548716864 10654
## + mnth 1 53778021 1594754064 10675
## + windspeed 1 39915579 1608616506 10682
## + weekday 1 14281507 1634250579 10693
## + holiday 1 6274901 1642257184 10697
## 1648532085 10698
## + workingday 1 2188508 1646343578 10699
## + temp 1 459595 1648072490 10699
##
## Step: AIC=10218.11
## cnt ~ atemp + dteday
##
## Df Sum of Sq RSS AIC
## + weathersit 1 133452058 719720932 10096
## + hum 1 96963223 756209767 10132
## + yr 1 54252535 798920455 10172
## + mnth 1 50029657 803143333 10176
## + windspeed 1 15030949 838142041 10207
## + weekday 1 14037921 839135069 10208
## + holiday 1 9661567 843511424 10212
## + workingday 1 3352652 849820338 10217
## 853172990 10218
Page 4 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## + temp 1 728614 852444377 10220
## + season 1 153918 853019073 10220
##
## Step: AIC=10095.77
## cnt ~ atemp + dteday + weathersit
##
## Df Sum of Sq RSS AIC
## + yr 1 41334322 678386610 10054
## + mnth 1 37294687 682426245 10059
## + weekday 1 16808470 702912462 10080
## + windspeed 1 13515306 706205626 10084
## + holiday 1 12670759 707050173 10085
## + hum 1 11808590 707912342 10086
## + workingday 1 6885102 712835830 10091
## 719720932 10096
## + temp 1 723954 718996978 10097
## + season 1 195187 719525744 10098
##
## Step: AIC=10054.54
## cnt ~ atemp + dteday + weathersit + yr
##
## Df Sum of Sq RSS AIC
## + season 1 77272986 601113624 9968.1
## + windspeed 1 21986578 656400032 10032.5
## + weekday 1 17337618 661048992 10037.6
## + holiday 1 11696849 666689762 10043.8
## + mnth 1 8842366 669544244 10046.9
## + workingday 1 6268305 672118305 10049.7
## + hum 1 4052876 674333734 10052.2
## 678386610 10054.5
## + temp 1 346829 678039781 10056.2
##
## Step: AIC=9968.13
## cnt ~ atemp + dteday + weathersit + yr + season
##
## Df Sum of Sq RSS AIC
## + weekday 1 18664218 582449406 9947.1
## + windspeed 1 16580863 584532760 9949.7
## + holiday 1 9629495 591484129 9958.3
## + workingday 1 5666401 595447223 9963.2
## + hum 1 4074912 597038711 9965.2
## + mnth 1 3159464 597954159 9966.3
## 601113624 9968.1
## + temp 1 685429 600428195 9969.3
##
## Step: AIC=9947.08
## cnt ~ atemp + dteday + weathersit + yr + season + weekday
##
## Df Sum of Sq RSS AIC
Page 5 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## + windspeed 1 17050294 565399112 9927.4
## + holiday 1 7158445 575290961 9940.0
## + workingday 1 4980654 577468752 9942.8
## + mnth 1 3110659 579338747 9945.2
## + hum 1 2615525 579833881 9945.8
## 582449406 9947.1
## + temp 1 340094 582109312 9948.6
##
## Step: AIC=9927.36
## cnt ~ atemp + dteday + weathersit + yr + season + weekday + windspeed
##
## Df Sum of Sq RSS AIC
## + hum 1 8463043 556936069 9918.3
## + holiday 1 7048537 558350575 9920.2
## + workingday 1 4723335 560675777 9923.2
## + mnth 1 2702129 562696983 9925.9
## + temp 1 1889398 563509714 9926.9
## 565399112 9927.4
##
## Step: AIC=9918.33
## cnt ~ atemp + dteday + weathersit + yr + season + weekday + windspeed +
## hum
##
## Df Sum of Sq RSS AIC
## + holiday 1 6997589 549938480 9911.1
## + workingday 1 4349936 552586133 9914.6
## + mnth 1 2117245 554818824 9917.5
## 556936069 9918.3
## + temp 1 1458231 555477838 9918.4
##
## Step: AIC=9911.09
## cnt ~ atemp + dteday + weathersit + yr + season + weekday + windspeed +
## hum + holiday
##
## Df Sum of Sq RSS AIC
## + mnth 1 2256628 547681852 9910.1
## + workingday 1 2184847 547753633 9910.2
## + temp 1 1690699 548247781 9910.8
## 549938480 9911.1
##
## Step: AIC=9910.08
## cnt ~ atemp + dteday + weathersit + yr + season + weekday + windspeed +
## hum + holiday + mnth
##
## Df Sum of Sq RSS AIC
## + workingday 1 2246570 545435282 9909.1
## + temp 1 1887052 545794800 9909.6
## 547681852 9910.1
##
Page 6 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## Step: AIC=9909.08
## cnt ~ atemp + dteday + weathersit + yr + season + weekday + windspeed +
## hum + holiday + mnth + workingday
##
## Df Sum of Sq RSS AIC
## + temp 1 1829683 543605599 9908.6
## 545435282 9909.1
##
## Step: AIC=9908.62
## cnt ~ atemp + dteday + weathersit + yr + season + weekday + windspeed +
## hum + holiday + mnth + workingday + temp
Page 7 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "fwd_AIC1"
## [1] "Summary Statistics of the model as follows:"
##
## Call:
## lm(formula = cnt ~ atemp + dteday + weathersit + yr + season +
## weekday + windspeed + hum + holiday + mnth + workingday +
## temp, data = cnt_day)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4035.5 -446.9 46.5 548.2 2956.1
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 121837.719 54951.668 2.217 0.026923 *
## atemp 3391.410 1587.380 2.136 0.032978 *
## dteday -8.048 3.674 -2.190 0.028811 *
## weathersit -623.752 78.374 -7.959 6.79e-15 ***
## yr 4986.655 1346.467 3.704 0.000229 ***
## season 508.276 54.617 9.306 < 2e-16 ***
## weekday 69.187 16.256 4.256 2.36e-05 ***
## windspeed -2520.931 455.384 -5.536 4.35e-08 ***
## hum -960.439 314.303 -3.056 0.002328 **
## holiday -522.868 200.519 -2.608 0.009308 **
## mnth 206.655 113.424 1.822 0.068877 .
## workingday 122.130 71.822 1.700 0.089480 .
## temp 2178.956 1401.652 1.555 0.120491
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 870.1 on 718 degrees of freedom
## Multiple R-squared: 0.8016, Adjusted R-squared: 0.7983
## F-statistic: 241.7 on 12 and 718 DF, p-value: < 2.2e-16
##
## [1] "VIF Stats for the model as follows:"
## atemp dteday weathersit yr season weekday windspee
d
## 64.519865 580.385357 1.758463 437.611155 3.548970 1.024089 1.20087
9
## hum holiday mnth workingday temp
## 1.932223 1.083210 147.806746 1.076529 63.472881
## [1] "Now plotting Residual vs Fitted Values Graph"
Page 8 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "Now plotting Std Residual vs Fitted Values Graph"
Page 9 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "Now plotting Frequnecy Distribution of Std. residuals"
Page 10 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "Backward selection using AIC"
## Start: AIC=9908.62
## cnt ~ dteday + season + yr + mnth + holiday + weekday + workingday +
## weathersit + temp + atemp + hum + windspeed
Page 11 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "bwd_AIC1"
## [1] "Summary Statistics of the model as follows:"
##
## Call:
## lm(formula = cnt ~ dteday + season + yr + mnth + holiday + weekday +
## workingday + weathersit + temp + atemp + hum + windspeed,
## data = cnt_day)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4035.5 -446.9 46.5 548.2 2956.1
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 121837.719 54951.668 2.217 0.026923 *
## dteday -8.048 3.674 -2.190 0.028811 *
## season 508.276 54.617 9.306 < 2e-16 ***
## yr 4986.655 1346.467 3.704 0.000229 ***
## mnth 206.655 113.424 1.822 0.068877 .
## holiday -522.868 200.519 -2.608 0.009308 **
## weekday 69.187 16.256 4.256 2.36e-05 ***
## workingday 122.130 71.822 1.700 0.089480 .
## weathersit -623.752 78.374 -7.959 6.79e-15 ***
## temp 2178.956 1401.652 1.555 0.120491
## atemp 3391.410 1587.380 2.136 0.032978 *
## hum -960.439 314.303 -3.056 0.002328 **
## windspeed -2520.931 455.384 -5.536 4.35e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 870.1 on 718 degrees of freedom
## Multiple R-squared: 0.8016, Adjusted R-squared: 0.7983
## F-statistic: 241.7 on 12 and 718 DF, p-value: < 2.2e-16
##
## [1] "VIF Stats for the model as follows:"
## dteday season yr mnth holiday weekday workingda
y
## 580.385357 3.548970 437.611155 147.806746 1.083210 1.024089 1.07652
9
## weathersit temp atemp hum windspeed
## 1.758463 63.472881 64.519865 1.932223 1.200879
## [1] "Now plotting Residual vs Fitted Values Graph"
Page 12 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "Now plotting Std Residual vs Fitted Values Graph"
Page 13 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "Now plotting Frequnecy Distribution of Std. residuals"
Page 14 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "Stepwise selection using AIC"
Page 15 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## Start: AIC=11066.88
## cnt ~ 1
##
## Df Sum of Sq RSS AIC
## + atemp 1 1091003307 1648532085 10698
## + dteday 1 1083287662 1656247730 10701
## + temp 1 1078688585 1660846807 10703
## + yr 1 879828893 1859706499 10786
## + season 1 451797359 2287738033 10937
## + weathersit 1 242288753 2497246639 11001
## + mnth 1 214744463 2524790929 11009
## + windspeed 1 150705556 2588829836 11028
## + hum 1 27757373 2711778019 11061
## + holiday 1 12797494 2726737898 11066
## + weekday 1 12461089 2727074303 11066
## + workingday 1 10246038 2729289354 11066
## 2739535392 11067
##
## Step: AIC=10697.61
## cnt ~ atemp
##
## Df Sum of Sq RSS AIC
## + dteday 1 795359095 853172990 10218
## + yr 1 793490560 855041526 10220
## + weathersit 1 135396795 1513135291 10637
## + season 1 111746784 1536785302 10648
## + hum 1 99815222 1548716864 10654
## + mnth 1 53778021 1594754064 10675
## + windspeed 1 39915579 1608616506 10682
## + weekday 1 14281507 1634250579 10693
## + holiday 1 6274901 1642257184 10697
## 1648532085 10698
## + workingday 1 2188508 1646343578 10699
## + temp 1 459595 1648072490 10699
## - atemp 1 1091003307 2739535392 11067
##
## Step: AIC=10218.11
## cnt ~ atemp + dteday
##
## Df Sum of Sq RSS AIC
## + weathersit 1 133452058 719720932 10096
## + hum 1 96963223 756209767 10132
## + yr 1 54252535 798920455 10172
## + mnth 1 50029657 803143333 10176
## + windspeed 1 15030949 838142041 10207
## + weekday 1 14037921 839135069 10208
## + holiday 1 9661567 843511424 10212
## + workingday 1 3352652 849820338 10217
Page 16 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## 853172990 10218
## + temp 1 728614 852444377 10220
## + season 1 153918 853019073 10220
## - dteday 1 795359095 1648532085 10698
## - atemp 1 803074740 1656247730 10701
##
## Step: AIC=10095.77
## cnt ~ atemp + dteday + weathersit
##
## Df Sum of Sq RSS AIC
## + yr 1 41334322 678386610 10054
## + mnth 1 37294687 682426245 10059
## + weekday 1 16808470 702912462 10080
## + windspeed 1 13515306 706205626 10084
## + holiday 1 12670759 707050173 10085
## + hum 1 11808590 707912342 10086
## + workingday 1 6885102 712835830 10091
## 719720932 10096
## + temp 1 723954 718996978 10097
## + season 1 195187 719525744 10098
## - weathersit 1 133452058 853172990 10218
## - atemp 1 715642731 1435363663 10598
## - dteday 1 793414359 1513135291 10637
##
## Step: AIC=10054.54
## cnt ~ atemp + dteday + weathersit + yr
##
## Df Sum of Sq RSS AIC
## + season 1 77272986 601113624 9968.1
## + windspeed 1 21986578 656400032 10032.5
## + weekday 1 17337618 661048992 10037.6
## + holiday 1 11696849 666689762 10043.8
## + mnth 1 8842366 669544244 10046.9
## + workingday 1 6268305 672118305 10049.7
## + hum 1 4052876 674333734 10052.2
## 678386610 10054.5
## + temp 1 346829 678039781 10056.2
## - yr 1 41334322 719720932 10095.8
## - dteday 1 68061379 746447989 10122.4
## - weathersit 1 120533845 798920455 10172.1
## - atemp 1 754951746 1433338356 10599.4
##
## Step: AIC=9968.13
## cnt ~ atemp + dteday + weathersit + yr + season
##
## Df Sum of Sq RSS AIC
## + weekday 1 18664218 582449406 9947.1
## + windspeed 1 16580863 584532760 9949.7
## + holiday 1 9629495 591484129 9958.3
Page 17 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## + workingday 1 5666401 595447223 9963.2
## + hum 1 4074912 597038711 9965.2
## + mnth 1 3159464 597954159 9966.3
## 601113624 9968.1
## + temp 1 685429 600428195 9969.3
## - dteday 1 6085093 607198716 9973.5
## - season 1 77272986 678386610 10054.5
## - yr 1 118412121 719525744 10097.6
## - weathersit 1 122731142 723844766 10101.9
## - atemp 1 567649018 1168762642 10452.2
##
## Step: AIC=9947.08
## cnt ~ atemp + dteday + weathersit + yr + season + weekday
##
## Df Sum of Sq RSS AIC
## + windspeed 1 17050294 565399112 9927.4
## + holiday 1 7158445 575290961 9940.0
## + workingday 1 4980654 577468752 9942.8
## + mnth 1 3110659 579338747 9945.2
## + hum 1 2615525 579833881 9945.8
## 582449406 9947.1
## + temp 1 340094 582109312 9948.6
## - dteday 1 6512285 588961691 9953.2
## - weekday 1 18664218 601113624 9968.1
## - season 1 78599587 661048992 10037.6
## - yr 1 120255889 702705295 10082.3
## - weathersit 1 125479214 707928619 10087.7
## - atemp 1 567729672 1150179078 10442.5
##
## Step: AIC=9927.36
## cnt ~ atemp + dteday + weathersit + yr + season + weekday + windspeed
##
## Df Sum of Sq RSS AIC
## + hum 1 8463043 556936069 9918.3
## + holiday 1 7048537 558350575 9920.2
## + workingday 1 4723335 560675777 9923.2
## + mnth 1 2702129 562696983 9925.9
## + temp 1 1889398 563509714 9926.9
## 565399112 9927.4
## - dteday 1 7420496 572819608 9934.9
## - windspeed 1 17050294 582449406 9947.1
## - weekday 1 19133648 584532760 9949.7
## - season 1 73092941 638492053 10014.2
## - weathersit 1 122551626 687950738 10068.8
## - yr 1 123587318 688986430 10069.9
## - atemp 1 538463868 1103862980 10414.4
##
## Step: AIC=9918.33
## cnt ~ atemp + dteday + weathersit + yr + season + weekday + windspeed +
Page 18 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## hum
##
## Df Sum of Sq RSS AIC
## + holiday 1 6997589 549938480 9911.1
## + workingday 1 4349936 552586133 9914.6
## + mnth 1 2117245 554818824 9917.5
## 556936069 9918.3
## + temp 1 1458231 555477838 9918.4
## - dteday 1 5694227 562630296 9923.8
## - hum 1 8463043 565399112 9927.4
## - weekday 1 16637179 573573248 9937.9
## - windspeed 1 22897812 579833881 9945.8
## - weathersit 1 43965125 600901194 9971.9
## - season 1 71959370 628895439 10005.2
## - yr 1 112133687 669069757 10050.4
## - atemp 1 544266252 1101202322 10414.7
##
## Step: AIC=9911.09
## cnt ~ atemp + dteday + weathersit + yr + season + weekday + windspeed +
## hum + holiday
##
## Df Sum of Sq RSS AIC
## + mnth 1 2256628 547681852 9910.1
## + workingday 1 2184847 547753633 9910.2
## + temp 1 1690699 548247781 9910.8
## 549938480 9911.1
## - dteday 1 5087209 555025689 9915.8
## - holiday 1 6997589 556936069 9918.3
## - hum 1 8412095 558350575 9920.2
## - weekday 1 14358422 564296902 9927.9
## - windspeed 1 22752099 572690579 9938.7
## - weathersit 1 45011292 594949772 9966.6
## - season 1 70173653 620112133 9996.9
## - yr 1 109501042 659439522 10041.8
## - atemp 1 539999383 1089937863 10409.1
##
## Step: AIC=9910.08
## cnt ~ atemp + dteday + weathersit + yr + season + weekday + windspeed +
## hum + holiday + mnth
##
## Df Sum of Sq RSS AIC
## + workingday 1 2246570 545435282 9909.1
## + temp 1 1887052 545794800 9909.6
## 547681852 9910.1
## - mnth 1 2256628 549938480 9911.1
## - dteday 1 3327884 551009736 9912.5
## - holiday 1 7136972 554818824 9917.5
## - hum 1 7811076 555492928 9918.4
## - yr 1 9876949 557558801 9921.2
Page 19 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## - weekday 1 14368444 562050296 9927.0
## - windspeed 1 22035631 569717483 9936.9
## - weathersit 1 46153160 593835012 9967.2
## - season 1 65563120 613244973 9990.7
## - atemp 1 539353368 1087035220 10409.2
##
## Step: AIC=9909.08
## cnt ~ atemp + dteday + weathersit + yr + season + weekday + windspeed +
## hum + holiday + mnth + workingday
##
## Df Sum of Sq RSS AIC
## + temp 1 1829683 543605599 9908.6
## 545435282 9909.1
## - workingday 1 2246570 547681852 9910.1
## - mnth 1 2318351 547753633 9910.2
## - dteday 1 3393225 548828507 9911.6
## - holiday 1 4924368 550359650 9913.7
## - hum 1 7542289 552977570 9917.1
## - yr 1 9990084 555425366 9920.3
## - weekday 1 14289804 559725086 9926.0
## - windspeed 1 21714409 567149691 9935.6
## - weathersit 1 47323585 592758867 9967.9
## - season 1 65426405 610861687 9989.9
## - atemp 1 533992911 1079428193 10406.1
##
## Step: AIC=9908.62
## cnt ~ atemp + dteday + weathersit + yr + season + weekday + windspeed +
## hum + holiday + mnth + workingday + temp
##
## Df Sum of Sq RSS AIC
## 543605599 9908.6
## - temp 1 1829683 545435282 9909.1
## - workingday 1 2189201 545794800 9909.6
## - mnth 1 2513266 546118865 9910.0
## - atemp 1 3455876 547061475 9911.3
## - dteday 1 3632731 547238330 9911.5
## - holiday 1 5147918 548753517 9913.5
## - hum 1 7069728 550675326 9916.1
## - yr 1 10384532 553990130 9920.5
## - weekday 1 13714066 557319665 9924.8
## - windspeed 1 23201990 566807589 9937.2
## - weathersit 1 47955480 591561079 9968.4
## - season 1 65568683 609174282 9989.9
Page 20 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "step_AIC1"
## [1] "Summary Statistics of the model as follows:"
##
## Call:
## lm(formula = cnt ~ atemp + dteday + weathersit + yr + season +
## weekday + windspeed + hum + holiday + mnth + workingday +
## temp, data = cnt_day)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4035.5 -446.9 46.5 548.2 2956.1
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 121837.719 54951.668 2.217 0.026923 *
## atemp 3391.410 1587.380 2.136 0.032978 *
## dteday -8.048 3.674 -2.190 0.028811 *
## weathersit -623.752 78.374 -7.959 6.79e-15 ***
## yr 4986.655 1346.467 3.704 0.000229 ***
## season 508.276 54.617 9.306 < 2e-16 ***
## weekday 69.187 16.256 4.256 2.36e-05 ***
## windspeed -2520.931 455.384 -5.536 4.35e-08 ***
## hum -960.439 314.303 -3.056 0.002328 **
## holiday -522.868 200.519 -2.608 0.009308 **
## mnth 206.655 113.424 1.822 0.068877 .
## workingday 122.130 71.822 1.700 0.089480 .
## temp 2178.956 1401.652 1.555 0.120491
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 870.1 on 718 degrees of freedom
## Multiple R-squared: 0.8016, Adjusted R-squared: 0.7983
## F-statistic: 241.7 on 12 and 718 DF, p-value: < 2.2e-16
##
## [1] "VIF Stats for the model as follows:"
## atemp dteday weathersit yr season weekday windspee
d
## 64.519865 580.385357 1.758463 437.611155 3.548970 1.024089 1.20087
9
## hum holiday mnth workingday temp
## 1.932223 1.083210 147.806746 1.076529 63.472881
## [1] "Now plotting Residual vs Fitted Values Graph"
Page 21 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "Now plotting Std Residual vs Fitted Values Graph"
Page 22 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "Now plotting Frequnecy Distribution of Std. residuals"
Page 23 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
Page 24 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## Start: AIC=11066.88
## cnt ~ 1
##
## Df Sum of Sq RSS AIC
## + atemp 1 1091003307 1648532085 10698
## + temp 1 1078688585 1660846807 10703
## + yr 1 879828893 1859706499 10786
## + season 1 451797359 2287738033 10937
## + weathersit 1 242288753 2497246639 11001
## + mnth 1 214744463 2524790929 11009
## + windspeed 1 150705556 2588829836 11028
## + hum 1 27757373 2711778019 11061
## + holiday 1 12797494 2726737898 11066
## + weekday 1 12461089 2727074303 11066
## + workingday 1 10246038 2729289354 11066
## 2739535392 11067
##
## Step: AIC=10697.61
## cnt ~ atemp
##
## Df Sum of Sq RSS AIC
## + yr 1 793490560 855041526 10220
## + weathersit 1 135396795 1513135291 10637
## + season 1 111746784 1536785302 10648
## + hum 1 99815222 1548716864 10654
## + mnth 1 53778021 1594754064 10675
## + windspeed 1 39915579 1608616506 10682
## + weekday 1 14281507 1634250579 10693
## + holiday 1 6274901 1642257184 10697
## 1648532085 10698
## + workingday 1 2188508 1646343578 10699
## + temp 1 459595 1648072490 10699
##
## Step: AIC=10219.71
## cnt ~ atemp + yr
##
## Df Sum of Sq RSS AIC
## + season 1 123274829 731766697 10108
## + weathersit 1 108593537 746447989 10122
## + mnth 1 59129296 795912230 10169
## + hum 1 44927700 810113826 10182
## + windspeed 1 38710961 816330564 10188
## + weekday 1 15392535 839648991 10208
## + holiday 1 7682915 847358611 10215
## + workingday 1 2573280 852468246 10220
## 855041526 10220
## + temp 1 70539 854970986 10222
##
Page 25 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## Step: AIC=10107.9
## cnt ~ atemp + yr + season
##
## Df Sum of Sq RSS AIC
## + weathersit 1 124567980 607198716 9973.5
## + hum 1 75602053 656164644 10030.2
## + windspeed 1 18437653 713329044 10091.3
## + weekday 1 15446952 716319745 10094.3
## + holiday 1 7733909 724032788 10102.1
## + mnth 1 6584027 725182670 10103.3
## + workingday 1 2785915 728980782 10107.1
## 731766697 10107.9
## + temp 1 622536 731144161 10109.3
##
## Step: AIC=9973.5
## cnt ~ atemp + yr + season + weathersit
##
## Df Sum of Sq RSS AIC
## + weekday 1 18237026 588961691 9953.2
## + windspeed 1 15719660 591479057 9956.3
## + holiday 1 10334606 596864110 9962.9
## + workingday 1 5952537 601246179 9968.3
## + hum 1 5243703 601955013 9969.2
## + mnth 1 4722076 602476641 9969.8
## 607198716 9973.5
## + temp 1 685137 606513580 9974.7
##
## Step: AIC=9953.2
## cnt ~ atemp + yr + season + weathersit + weekday
##
## Df Sum of Sq RSS AIC
## + windspeed 1 16142083 572819608 9934.9
## + holiday 1 7823517 581138174 9945.4
## + workingday 1 5266836 583694855 9948.6
## + mnth 1 5103959 583857732 9948.8
## + hum 1 3634952 585326738 9950.7
## 588961691 9953.2
## + temp 1 343246 588618445 9954.8
##
## Step: AIC=9934.89
## cnt ~ atemp + yr + season + weathersit + weekday + windspeed
##
## Df Sum of Sq RSS AIC
## + hum 1 10189312 562630296 9923.8
## + holiday 1 7757946 565061662 9926.9
## + mnth 1 5988513 566831095 9929.2
## + workingday 1 5028453 567791155 9930.4
## + temp 1 1837880 570981728 9934.5
## 572819608 9934.9
Page 26 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
##
## Step: AIC=9923.77
## cnt ~ atemp + yr + season + weathersit + weekday + windspeed +
## hum
##
## Df Sum of Sq RSS AIC
## + holiday 1 7604608 555025689 9915.8
## + mnth 1 4582440 558047856 9919.8
## + workingday 1 4570724 558059572 9919.8
## 562630296 9923.8
## + temp 1 1382292 561248004 9924.0
##
## Step: AIC=9915.82
## cnt ~ atemp + yr + season + weathersit + weekday + windspeed +
## hum + holiday
##
## Df Sum of Sq RSS AIC
## + mnth 1 4015952 551009736 9912.5
## + workingday 1 2255010 552770678 9914.8
## + temp 1 1623012 553402677 9915.7
## 555025689 9915.8
##
## Step: AIC=9912.51
## cnt ~ atemp + yr + season + weathersit + weekday + windspeed +
## hum + holiday + mnth
##
## Df Sum of Sq RSS AIC
## + workingday 1 2181230 548828507 9911.6
## + temp 1 1645047 549364690 9912.3
## 551009736 9912.5
##
## Step: AIC=9911.61
## cnt ~ atemp + yr + season + weathersit + weekday + windspeed +
## hum + holiday + mnth + workingday
##
## Df Sum of Sq RSS AIC
## + temp 1 1590177 547238330 9911.5
## 548828507 9911.6
##
## Step: AIC=9911.49
## cnt ~ atemp + yr + season + weathersit + weekday + windspeed +
## hum + holiday + mnth + workingday + temp
Page 27 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "fwd_AIC2"
## [1] "Summary Statistics of the model as follows:"
##
## Call:
## lm(formula = cnt ~ atemp + yr + season + weathersit + weekday +
## windspeed + hum + holiday + mnth + workingday + temp, data = cnt_day)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4143.6 -442.3 49.5 546.2 2946.4
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1469.00 240.22 6.115 1.58e-09 ***
## atemp 3573.27 1589.39 2.248 0.02487 *
## yr 2040.70 65.19 31.306 < 2e-16 ***
## season 509.78 54.76 9.310 < 2e-16 ***
## weathersit -610.99 78.36 -7.797 2.23e-14 ***
## weekday 69.06 16.30 4.237 2.56e-05 ***
## windspeed -2557.57 456.28 -5.605 2.96e-08 ***
## hum -1018.86 314.00 -3.245 0.00123 **
## holiday -518.99 201.04 -2.582 0.01003 *
## mnth -38.98 17.08 -2.282 0.02276 *
## workingday 120.36 72.01 1.671 0.09507 .
## temp 2028.92 1403.67 1.445 0.14877
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 872.4 on 719 degrees of freedom
## Multiple R-squared: 0.8002, Adjusted R-squared: 0.7972
## F-statistic: 261.9 on 11 and 719 DF, p-value: < 2.2e-16
##
## [1] "VIF Stats for the model as follows:"
## atemp yr season weathersit weekday windspeed hu
m
## 64.343361 1.020253 3.548413 1.748741 1.024076 1.199259 1.91830
9
## holiday mnth workingday temp
## 1.083126 3.333672 1.076392 63.321299
## [1] "Now plotting Residual vs Fitted Values Graph"
Page 28 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "Now plotting Std Residual vs Fitted Values Graph"
Page 29 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "Now plotting Frequnecy Distribution of Std. residuals"
Page 30 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## Start: AIC=9914.61
## cnt ~ (dteday + season + yr + mnth + holiday + weekday + workingday +
## weathersit + temp + atemp + hum + windspeed) - dteday - atemp
##
## Df Sum of Sq RSS AIC
## 551085312 9914.6
## - workingday 1 2086187 553171498 9915.4
## - mnth 1 4136241 555221552 9918.1
## - holiday 1 5435628 556520940 9919.8
## - hum 1 7166299 558251611 9922.1
## - weekday 1 12975371 564060682 9929.6
## - windspeed 1 28051752 579137063 9948.9
## - weathersit 1 48194967 599280278 9973.9
## - season 1 67520352 618605663 9997.1
## - temp 1 534571941 1085657252 10408.3
## - yr 1 746080084 1297165396 10538.4
Page 31 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "bwd_AIC3"
## [1] "Summary Statistics of the model as follows:"
##
## Call:
## lm(formula = cnt ~ (dteday + season + yr + mnth + holiday + weekday +
## workingday + weathersit + temp + atemp + hum + windspeed) -
## dteday - atemp, data = cnt_day)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4072.3 -440.0 34.9 551.7 2992.4
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1626.11 230.47 7.055 4.05e-12 ***
## season 515.24 54.86 9.392 < 2e-16 ***
## yr 2040.88 65.37 31.221 < 2e-16 ***
## mnth -39.81 17.12 -2.325 0.02037 *
## holiday -536.84 201.45 -2.665 0.00787 **
## weekday 67.21 16.32 4.117 4.28e-05 ***
## workingday 119.21 72.21 1.651 0.09919 .
## weathersit -622.29 78.42 -7.935 8.05e-15 ***
## temp 5154.22 195.03 26.428 < 2e-16 ***
## hum -960.15 313.79 -3.060 0.00230 **
## windspeed -2730.42 451.02 -6.054 2.27e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 874.9 on 720 degrees of freedom
## Multiple R-squared: 0.7988, Adjusted R-squared: 0.796
## F-statistic: 285.9 on 10 and 720 DF, p-value: < 2.2e-16
##
## [1] "VIF Stats for the model as follows:"
## season yr mnth holiday weekday workingday weathersi
t
## 3.541429 1.020251 3.332130 1.081437 1.021463 1.076338 1.74154
1
## temp hum windspeed
## 1.215589 1.905040 1.165206
## [1] "Now plotting Residual vs Fitted Values Graph"
Page 32 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "Now plotting Std Residual vs Fitted Values Graph"
Page 33 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
## [1] "Now plotting Frequnecy Distribution of Std. residuals"
Page 34 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
Page 35 of 35IE582_F2021_Assignment_4.utf8
10/19/2021file:///C:/Users/zhong/OneDrive/Desktop/IE582_F2021_Assignment_4-1.html
学霸联盟