Linear regression models are used to show or predict the relationship between two variables or factors which are the dependent variable and independent variable. Simple Linear Regression Analysis is the simplest form of regression analysis which uses one dependent variable and independent variable, and a straight line approximates the reltionship between the dependent variable and independent variable (https://www.thebalancesmb.com/what-is-simple-linear-regression-2296697).
To start with simple linear regression activity, we need to clear the global environment.
rm(list=ls())
We will then set our work directory. This is the directory that contains the input files and will also be the location where output files are saved. getwd() checks to see if we are in the right directory.
setwd("C:\\Handouts\\Handout No6")
getwd()
## [1] "C:/Handouts/Handout No6"
survey<-read.csv("STDNTSURVEY.csv")
names(survey)
## [1] "PROG" "FULLPART" "SEM" "STAGE"
## [5] "GWA" "FINSUPPORT" "EMPLOYED" "SEX"
## [9] "CIVILSTATUS" "RELIGION" "AGE" "AVESLEEP"
## [13] "EXERCISE" "UNSTRESS" "STUDYAREA" "HOURSNET"
## [17] "SOCIALNET" "CUPRICELUNCH" "VIANDLUNCH" "BFASTDRINK"
## [21] "SOCIALDRINK" "SMOKER" "TVSTA" "MOBILEPROV"
## [25] "NUMGADGETS" "WEIGHT" "HEIGHT" "WAIST"
## [29] "PALM" "LEGLEN" "ARMLEN" "ARMSPAN"
## [33] "SHOULDERWD" "SHOESIZE"
head(survey)
## PROG FULLPART SEM STAGE GWA FINSUPPORT EMPLOYED SEX CIVILSTATUS
## 1 1 1 3 1 1.20 3 2 1 2
## 2 1 1 5 1 1.75 1 2 1 2
## 3 1 2 3 1 1.60 2 1 2 2
## 4 1 1 1 1 NA 1 2 1 2
## 5 1 2 4 2 1.25 2 1 2 1
## 6 2 2 7 1 1.50 2 1 1 2
## RELIGION AGE AVESLEEP EXERCISE UNSTRESS STUDYAREA HOURSNET SOCIALNET
## 1 Agnostic 23 4.0 1 2 1 5 1
## 2 Catholic 23 6.0 2 3 4 4 1
## 3 Catholic 23 6.0 2 5 1 5 1
## 4 Catholic 21 9.0 2 1 3 4 1
## 5 Catholic 24 6.5 1 3 4 12 1
## 6 Agnostic 29 6.0 1 3 1 12 1
## CUPRICELUNCH VIANDLUNCH BFASTDRINK SOCIALDRINK SMOKER TVSTA MOBILEPROV
## 1 0 2 1 3 1 5 2
## 2 1 2 1 3 1 1 2
## 3 1 4 3 3 2 1 2
## 4 1 4 2 3 2 NA 2
## 5 1 2 4 3 2 NA 4
## 6 2 2 5 3 1 5 2
## NUMGADGETS WEIGHT HEIGHT WAIST PALM LEGLEN ARMLEN ARMSPAN SHOULDERWD
## 1 2 155.0 71.0 30.5 3.80 38.0 31.2 71.0 19.0
## 2 2 155.0 64.0 34.0 3.50 34.5 26.4 68.0 18.0
## 3 3 113.2 61.5 26.0 3.00 32.4 26.0 59.5 16.0
## 4 2 184.0 72.0 32.5 3.50 39.0 29.9 72.0 18.0
## 5 3 96.0 59.0 26.5 2.80 29.4 25.0 58.0 14.9
## 6 2 132.0 66.0 31.0 3.45 37.0 28.7 67.0 17.0
## SHOESIZE
## 1 11.5
## 2 9.0
## 3 10.0
## 4 11.5
## 5 8.5
## 6 11.5
We were instructed to append/write to file, output also sent to terminal >> split=TRUE. The output was then directed to myfile.txt in specified directory, output was appended to existing file.
selvar1 <-c("WEIGHT","ARMSPAN","HEIGHT","WAIST","HOURSNET","GWA","AVESLEEP")
regvar1 <- survey[selvar1]
head(regvar1)
## WEIGHT ARMSPAN HEIGHT WAIST HOURSNET GWA AVESLEEP
## 1 155.0 71.0 71.0 30.5 5 1.20 4.0
## 2 155.0 68.0 64.0 34.0 4 1.75 6.0
## 3 113.2 59.5 61.5 26.0 5 1.60 6.0
## 4 184.0 72.0 72.0 32.5 4 NA 9.0
## 5 96.0 58.0 59.0 26.5 12 1.25 6.5
## 6 132.0 67.0 66.0 31.0 12 1.50 6.0
Fitting the Model-Linear Regression Example (WEIGHT~HEIGHT)
fit1 <-lm(WEIGHT~HEIGHT, data=regvar1)
summary(fit1)
##
## Call:
## lm(formula = WEIGHT ~ HEIGHT, data = regvar1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -35.197 -14.172 -3.352 10.428 105.663
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -166.5091 38.7081 -4.302 4.55e-05 ***
## HEIGHT 4.7001 0.6088 7.721 2.19e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 21.45 on 84 degrees of freedom
## Multiple R-squared: 0.4151, Adjusted R-squared: 0.4081
## F-statistic: 59.61 on 1 and 84 DF, p-value: 2.193e-11
fit1glm <- glm(WEIGHT~HEIGHT, data=regvar1)
summary(fit1glm)
##
## Call:
## glm(formula = WEIGHT ~ HEIGHT, data = regvar1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -35.197 -14.172 -3.352 10.428 105.663
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -166.5091 38.7081 -4.302 4.55e-05 ***
## HEIGHT 4.7001 0.6088 7.721 2.19e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 460.172)
##
## Null deviance: 66084 on 85 degrees of freedom
## Residual deviance: 38654 on 84 degrees of freedom
## AIC: 775.35
##
## Number of Fisher Scoring iterations: 2
Fitting the Model-Linear Regression Example (AVEGRADE~NETHRS)
fit2 <-lm(GWA~HOURSNET, data=regvar1)
summary(fit2)
##
## Call:
## lm(formula = GWA ~ HOURSNET, data = regvar1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.4501 -0.1920 -0.0429 0.1660 0.9861
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.586381 0.063192 25.104 <2e-16 ***
## HOURSNET -0.007247 0.007327 -0.989 0.326
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.275 on 74 degrees of freedom
## (10 observations deleted due to missingness)
## Multiple R-squared: 0.01305, Adjusted R-squared: -0.0002903
## F-statistic: 0.9782 on 1 and 74 DF, p-value: 0.3259
fit2glm <-glm(GWA~HOURSNET, data=regvar1)
summary(fit2glm)
##
## Call:
## glm(formula = GWA ~ HOURSNET, data = regvar1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.4501 -0.1920 -0.0429 0.1660 0.9861
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.586381 0.063192 25.104 <2e-16 ***
## HOURSNET -0.007247 0.007327 -0.989 0.326
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.0756073)
##
## Null deviance: 5.6689 on 75 degrees of freedom
## Residual deviance: 5.5949 on 74 degrees of freedom
## (10 observations deleted due to missingness)
## AIC: 23.404
##
## Number of Fisher Scoring iterations: 2
Fitting the Model-Linear Regression Example (WEIGHT~WAISTLINE)
fit3 <-lm(WEIGHT~WAIST, data=regvar1)
summary(fit3)
##
## Call:
## lm(formula = WEIGHT ~ WAIST, data = regvar1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -52.582 -8.497 -0.589 9.876 40.010
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -57.4206 14.8372 -3.87 0.000214 ***
## WAIST 6.1973 0.4825 12.84 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 16.29 on 84 degrees of freedom
## Multiple R-squared: 0.6626, Adjusted R-squared: 0.6586
## F-statistic: 165 on 1 and 84 DF, p-value: < 2.2e-16
fit3glm <-glm(WEIGHT~WAIST, data=regvar1)
summary(fit3glm)
##
## Call:
## glm(formula = WEIGHT ~ WAIST, data = regvar1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -52.582 -8.497 -0.589 9.876 40.010
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -57.4206 14.8372 -3.87 0.000214 ***
## WAIST 6.1973 0.4825 12.84 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 265.4369)
##
## Null deviance: 66084 on 85 degrees of freedom
## Residual deviance: 22297 on 84 degrees of freedom
## AIC: 728.03
##
## Number of Fisher Scoring iterations: 2
Model coefficients
coefficients(fit1)
## (Intercept) HEIGHT
## -166.509059 4.700091
coefficients(fit2)
## (Intercept) HOURSNET
## 1.586380906 -0.007246565
coefficients(fit3)
## (Intercept) WAIST
## -57.420615 6.197255
ANOVA Table
anova(fit1)
## Analysis of Variance Table
##
## Response: WEIGHT
## Df Sum Sq Mean Sq F value Pr(>F)
## HEIGHT 1 27429 27429.4 59.607 2.193e-11 ***
## Residuals 84 38654 460.2
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(fit2)
## Analysis of Variance Table
##
## Response: GWA
## Df Sum Sq Mean Sq F value Pr(>F)
## HOURSNET 1 0.0740 0.073961 0.9782 0.3259
## Residuals 74 5.5949 0.075607
anova(fit3)
## Analysis of Variance Table
##
## Response: WEIGHT
## Df Sum Sq Mean Sq F value Pr(>F)
## WAIST 1 43787 43787 164.96 < 2.2e-16 ***
## Residuals 84 22297 265
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Cls for model parameters
confint(fit1, level=0.95)
## 2.5 % 97.5 %
## (Intercept) -243.484440 -89.533679
## HEIGHT 3.489471 5.910712
confint(fit2, level=0.95)
## 2.5 % 97.5 %
## (Intercept) 1.46046770 1.71229411
## HOURSNET -0.02184544 0.00735231
confint(fit3, level=0.95)
## 2.5 % 97.5 %
## (Intercept) -86.92606 -27.915173
## WAIST 5.23773 7.156781
Predicted Values
fitted(fit1)
## 1 2 3 4 5 6 7
## 167.19743 134.29679 122.54656 171.89752 110.79634 143.69698 135.23681
## 8 9 10 11 12 13 14
## 129.59670 153.09716 162.96735 143.69698 148.39707 134.29679 138.05687
## 15 16 17 18 19 20 21
## 134.29679 110.79634 110.79634 134.29679 110.79634 134.29679 115.49643
## 22 23 24 25 26 27 28
## 138.99688 120.19652 109.38631 134.29679 110.79634 160.14730 68.49551
## 29 30 31 32 33 34 35
## 113.14638 110.79634 129.59670 106.09624 138.05687 124.89661 124.89661
## 36 37 38 39 40 41 42
## 146.04702 129.59670 120.19652 143.69698 134.29679 115.49643 134.29679
## 43 44 45 46 47 48 49
## 124.89661 138.99688 115.49643 115.49643 143.69698 143.69698 134.29679
## 50 51 52 53 54 55 56
## 136.64684 124.89661 115.49643 167.19743 162.49734 129.59670 153.09716
## 57 58 59 60 61 62 63
## 138.99688 142.75696 153.09716 115.49643 138.99688 129.59670 153.09716
## 64 65 66 67 68 69 70
## 138.99688 153.09716 106.09624 121.13654 114.55641 115.49643 148.39707
## 71 72 73 74 75 76 77
## 91.99597 120.19652 143.69698 110.79634 148.39707 115.49643 134.29679
## 78 79 80 81 82 83 84
## 153.09716 153.09716 138.99688 115.49643 115.49643 143.69698 143.69698
## 85 86
## 134.29679 136.64684
fitted(fit2)
## 1 2 3 5 6 7 8 9
## 1.550148 1.557395 1.550148 1.499422 1.499422 1.499422 1.528408 1.528408
## 10 11 12 15 17 18 19 20
## 1.477682 1.455943 1.550148 1.499422 1.528408 1.528408 1.528408 1.550148
## 21 22 23 24 25 26 27 28
## 1.542902 1.542902 1.579134 1.499422 1.550148 1.557395 1.557395 1.470436
## 29 30 31 32 33 34 35 36
## 1.564641 1.513915 1.557395 1.557395 1.528408 1.553771 1.542902 1.513915
## 37 38 39 40 41 42 43 44
## 1.528408 1.477682 1.557395 1.550148 1.564641 1.542902 1.550148 1.542902
## 45 46 47 48 49 50 51 52
## 1.426956 1.571888 1.542902 1.571888 1.564641 1.499422 1.542902 1.557395
## 53 54 55 56 57 59 61 62
## 1.553771 1.513915 1.499422 1.571888 1.528408 1.528408 1.528408 1.528408
## 63 64 65 68 70 71 72 73
## 1.542902 1.557395 1.499422 1.528408 1.528408 1.542902 1.550148 1.521162
## 74 75 76 78 79 80 81 82
## 1.542902 1.528408 1.550148 1.513915 1.513915 1.542902 1.426956 1.571888
## 83 84 85 86
## 1.542902 1.571888 1.564641 1.499422
fitted(fit3)
## 1 2 3 4 5 6 7
## 131.59567 153.28607 103.70802 143.99018 106.80665 134.69430 209.06137
## 8 9 10 11 12 13 14
## 140.89156 153.28607 165.68058 128.49705 147.08881 116.10254 109.90528
## 15 16 17 18 19 20 21
## 122.29979 109.90528 116.10254 128.49705 93.79242 140.89156 91.31351
## 22 23 24 25 26 27 28
## 116.10254 97.51077 122.29979 162.58195 190.46960 140.89156 128.49705
## 29 30 31 32 33 34 35
## 97.51077 109.90528 131.59567 103.70802 122.29979 103.70802 116.10254
## 36 37 38 39 40 41 42
## 165.68058 153.28607 116.10254 153.28607 159.48332 128.49705 140.89156
## 43 44 45 46 47 48 49
## 109.90528 159.48332 128.49705 140.89156 147.08881 128.49705 128.49705
## 50 51 52 53 54 55 56
## 140.89156 122.29979 103.70802 184.27234 147.08881 140.89156 134.69430
## 57 58 59 60 61 62 63
## 128.49705 134.69430 159.48332 109.90528 128.49705 91.31351 134.69430
## 64 65 66 67 68 69 70
## 128.49705 140.89156 109.90528 103.70802 122.29979 109.90528 140.89156
## 71 72 73 74 75 76 77
## 116.10254 103.70802 128.49705 159.48332 128.49705 140.89156 97.51077
## 78 79 80 81 82 83 84
## 159.48332 159.48332 159.48332 128.49705 140.89156 147.08881 128.49705
## 85 86
## 128.49705 140.89156
Residuals
Residual is the difference between a subject’s predicted score and his/her actual score.
residuals(fit1)
## 1 2 3 4 5 6
## -12.1974327 20.7032073 -9.3465641 12.1024758 -14.7963355 -11.6969755
## 7 8 9 10 11 12
## 105.6631890 -5.5967012 -12.0971584 34.0326496 -0.6969755 16.6029330
## 13 14 15 16 17 18
## -1.9967927 -3.5568658 -1.9967927 -18.1963355 -15.9963355 -12.9967927
## 19 20 21 22 23 24
## -13.7963355 25.7032073 -25.4964269 2.0031159 -35.1965184 -17.3863080
## 25 26 27 28 29 30
## -24.2967927 54.2036645 -3.1472956 54.7044875 -17.6463812 -31.3963355
## 31 32 33 34 35 36
## -15.1967012 -9.0962440 -16.7568658 -34.4966098 -23.4966098 18.9529787
## 37 38 39 40 41 42
## 30.4032988 -5.1965184 10.6030245 -2.2967927 5.5035731 -6.3967927
## 43 44 45 46 47 48
## -21.8966098 3.0031159 12.5035731 30.5035731 -10.6969755 -22.3969755
## 49 50 51 52 53 54
## -14.2967927 8.3531616 -10.2966098 -14.4964269 27.8025673 2.5026587
## 55 56 57 58 59 60
## 24.4032988 0.9028416 -3.9968841 2.4430427 12.3028416 -6.3964269
## 61 62 63 64 65 66
## -0.9968841 -10.4967012 -6.0971584 -17.9968841 8.9028416 -3.5962440
## 67 68 69 70 71 72
## -11.1365366 -0.5564086 -5.4964269 0.6029330 20.0040303 -0.1965184
## 73 74 75 76 77 78
## 6.3030245 11.2036645 -16.3970670 16.5035731 -28.2967927 9.9028416
## 79 80 81 82 83 84
## 11.9028416 3.0031159 12.5035731 30.5035731 -10.6969755 -22.3969755
## 85 86
## -14.2967927 8.3531616
residuals(fit2)
## 1 2 3 5 6
## -0.3501480816 0.1926053535 0.0498519184 -0.2494221273 0.0005778727
## 7 8 9 10 11
## 0.0005778727 0.2215916131 0.2215916131 -0.2276824326 -0.2059427379
## 12 15 17 18 19
## -0.4501480816 0.5005778727 0.4715916131 0.4715916131 -0.2784083869
## 20 21 22 23 24
## 0.0123519184 -0.2929015167 0.1570984833 0.1208656588 0.0005778727
## 25 26 27 28 29
## 0.4498519184 -0.0573946465 -0.3073946465 0.2795641323 0.6853587886
## 30 31 32 33 34
## 0.9860847429 0.1926053535 -0.2573946465 -0.3984083869 0.0462286360
## 35 36 37 38 39
## -0.0429015167 -0.1639152571 -0.0284083869 0.2723175674 -0.1873946465
## 40 41 42 43 44
## -0.2501480816 -0.1346412114 -0.0429015167 -0.0501480816 -0.0429015167
## 45 46 47 48 49
## -0.1769564783 -0.0718877763 -0.2929015167 -0.3218877763 -0.0646412114
## 50 51 52 53 54
## 0.0005778727 0.3434984833 -0.3073946465 0.1962286360 -0.2639152571
## 55 56 57 59 61
## 0.2505778727 0.4281122237 -0.2784083869 -0.1784083869 -0.2784083869
## 62 63 64 65 68
## -0.0284083869 0.4570984833 -0.0873946465 0.0005778727 0.1215916131
## 70 71 72 73 74
## -0.1284083869 0.1070984833 0.4498519184 -0.1211618220 -0.1429015167
## 75 76 78 79 80
## -0.0284083869 0.1998519184 -0.1139152571 -0.0139152571 -0.0429015167
## 81 82 83 84 85
## -0.1769564783 -0.0718877763 -0.2929015167 -0.3218877763 -0.0646412114
## 86
## 0.0005778727
residuals(fit3)
## 1 2 3 4 5
## 23.40432605 1.71393226 9.49197522 40.00981531 -10.80665247
## 6 7 8 9 10
## -2.69430163 31.83863393 -16.89155700 -12.28606774 31.31942152
## 11 12 13 14 15
## 14.50295374 17.91118763 16.19746448 24.59471985 10.00020911
## 16 17 18 19 20
## -17.30528015 -21.30253552 -7.19704626 3.20758381 19.10844300
## 21 22 23 24 25
## -1.31351404 24.89746448 -12.51076941 -30.29979089 -52.58195080
## 26 27 28 29 30
## -25.46959996 16.10844300 -5.29704626 -2.01076941 -30.50528015
## 31 32 33 34 35
## -17.19567395 -6.70802478 -0.99979089 -13.30802478 -14.70253552
## 36 37 38 39 40
## -0.68057848 6.71393226 -1.10253552 1.01393226 -27.48332311
## 41 42 43 44 45
## -7.49704626 -12.99155700 -6.90528015 -17.48332311 -0.49704626
## 46 47 48 49 50
## 5.10844300 -14.08881237 -7.19704626 -8.49704626 4.10844300
## 51 52 53 54 55
## -7.69979089 -2.70802478 10.72765541 17.91118763 13.10844300
## 56 57 58 59 60
## 19.30569837 6.50295374 10.50569837 5.91667689 -0.80528015
## 61 62 63 64 65
## 9.50295374 27.78648596 12.30569837 -7.49704626 21.10844300
## 66 67 68 69 70
## -7.40528015 6.29197522 -8.29979089 0.09471985 8.10844300
## 71 72 73 74 75
## -4.10253552 16.29197522 21.50295374 -37.48332311 3.50295374
## 76 77 78 79 80
## -8.89155700 8.48923059 3.51667689 5.51667689 -17.48332311
## 81 82 83 84 85
## -0.49704626 5.10844300 -14.08881237 -7.19704626 -8.49704626
## 86
## 4.10844300
Covariance matrix for model parameters
vcov(fit1)
## (Intercept) HEIGHT
## (Intercept) 1498.32006 -23.5225255
## HEIGHT -23.52253 0.3706099
vcov(fit2)
## (Intercept) HOURSNET
## (Intercept) 0.0039932540 -4.011972e-04
## HOURSNET -0.0004011972 5.368131e-05
vcov(fit3)
## (Intercept) WAIST
## (Intercept) 220.143145 -7.1087527
## WAIST -7.108753 0.2328165
Regression diagnostics
influence(fit1)
## $hat
## 1 2 3 4 5 6
## 0.05729608 0.01185433 0.01475274 0.07023073 0.02771830 0.01678396
## 7 8 9 10 11 12
## 0.01205736 0.01180564 0.02815657 0.04703207 0.01678396 0.02166490
## 13 14 15 16 17 18
## 0.01185433 0.01305303 0.01185433 0.02771830 0.02771830 0.01185433
## 19 20 21 22 23 24
## 0.02771830 0.01185433 0.02132402 0.01351378 0.01654048 0.02995068
## 25 26 27 28 29 30
## 0.01185433 0.02771830 0.04091424 0.15775038 0.02431982 0.02771830
## 31 32 33 34 35 36
## 0.01180564 0.03572333 0.01305303 0.01336769 0.01336769 0.01902309
## 37 38 39 40 41 42
## 0.01180564 0.01654048 0.01678396 0.01185433 0.02132402 0.01185433
## 43 44 45 46 47 48
## 0.01336769 0.01351378 0.02132402 0.02132402 0.01678396 0.01678396
## 49 50 51 52 53 54
## 0.01185433 0.01248271 0.01336769 0.02132402 0.05729608 0.04597216
## 55 56 57 58 59 60
## 0.01180564 0.02815657 0.01351378 0.01600107 0.02815657 0.02132402
## 61 62 63 64 65 66
## 0.01351378 0.01180564 0.02815657 0.01351378 0.02815657 0.03572333
## 67 68 69 70 71 72
## 0.01577706 0.02247401 0.02132402 0.02166490 0.06940289 0.01654048
## 73 74 75 76 77 78
## 0.01678396 0.02771830 0.02166490 0.02132402 0.01185433 0.02815657
## 79 80 81 82 83 84
## 0.02815657 0.01351378 0.02132402 0.02132402 0.01678396 0.01678396
## 85 86
## 0.01185433 0.01248271
##
## $coefficients
## (Intercept) HEIGHT
## 1 4.82996072 -0.0784690378
## 2 -0.32424424 0.0089470502
## 3 -1.06548880 0.0150493772
## 4 -5.52439863 0.0894245432
## 5 -3.65400354 0.0547827472
## 6 1.40034861 -0.0242427504
## 7 -2.74860572 0.0628999064
## 8 -0.20185460 0.0021427400
## 9 2.73777310 -0.0454155298
## 10 -11.68821294 0.1906966482
## 11 0.08344112 -0.0014445276
## 12 -2.86508372 0.0482499998
## 13 0.03127286 -0.0008629293
## 14 0.20314988 -0.0038609845
## 15 0.03127286 -0.0008629293
## 16 -4.49364468 0.0673710899
## 17 -3.95034747 0.0592256917
## 18 0.20354987 -0.0056166639
## 19 -3.40705026 0.0510802935
## 20 -0.40255197 0.0111078386
## 21 -4.92359481 0.0728010396
## 22 -0.13522023 0.0025024725
## 23 -4.93431964 0.0711862472
## 24 -4.57833843 0.0688505765
## 25 0.38052534 -0.0105000457
## 26 13.38577260 -0.2006865590
## 27 0.97337027 -0.0159371614
## 28 45.47566623 -0.7045941761
## 29 -3.88039719 0.0578242567
## 30 -7.75342795 0.1162434789
## 31 -0.54809501 0.0058181738
## 32 -2.74719216 0.0415552718
## 33 0.95706600 -0.0181896092
## 34 -3.03339697 0.0413872457
## 35 -2.06613187 0.0281900154
## 36 -2.76800973 0.0471510611
## 37 1.09654695 -0.0116401364
## 38 -0.72851759 0.0105101487
## 39 -1.26938203 0.0219754649
## 40 0.03597132 -0.0009925766
## 41 1.06279064 -0.0157145879
## 42 0.10018366 -0.0027644231
## 43 -1.92543877 0.0262704183
## 44 -0.20272517 0.0037517624
## 45 2.41455510 -0.0357019876
## 46 5.89052084 -0.0870981584
## 47 1.28062975 -0.0221701847
## 48 2.68134044 -0.0464192035
## 49 0.22390988 -0.0061784689
## 50 -0.34709882 0.0070184025
## 51 -0.90541375 0.0123533391
## 52 -2.79939352 0.0413922685
## 53 -11.00930915 0.1788606462
## 54 -0.84515188 0.0137964087
## 55 0.88014669 -0.0093429904
## 56 -0.20432694 0.0033894760
## 57 0.26980944 -0.0049932670
## 58 -0.26686334 0.0046594271
## 59 -2.78432236 0.0461877119
## 60 -1.23520894 0.0182639917
## 61 0.06729461 -0.0012453973
## 62 -0.37858148 0.0040187427
## 63 1.37988077 -0.0228901425
## 64 1.21487865 -0.0224833259
## 65 -2.01485004 0.0334233258
## 66 -1.08611570 0.0164290775
## 67 -1.44438005 0.0206840153
## 68 -0.11339318 0.0016822902
## 69 -1.06141065 0.0156941831
## 70 -0.10404508 0.0017521915
## 71 9.55655173 -0.1466304302
## 72 -0.02755058 0.0003974656
## 73 -0.75459092 0.0130634323
## 74 2.76678167 -0.0414810493
## 75 2.82955846 -0.0476517299
## 76 3.18699193 -0.0471233589
## 77 0.44317153 -0.0122286765
## 78 -2.24116543 0.0371775570
## 79 -2.69379621 0.0446860195
## 80 -0.20272517 0.0037517624
## 81 2.41455510 -0.0357019876
## 82 5.89052084 -0.0870981584
## 83 1.28062975 -0.0221701847
## 84 2.68134044 -0.0464192035
## 85 0.22390988 -0.0061784689
## 86 -0.34709882 0.0070184025
##
## $sigma
## 1 2 3 4 5 6 7 8
## 21.53636 21.45904 21.55570 21.53644 21.51751 21.54158 18.15379 21.57161
## 9 10 11 12 13 14 15 16
## 21.53839 21.23848 21.58032 21.50166 21.57933 21.57688 21.57933 21.48519
## 17 18 19 20 21 22 23 24
## 21.50687 21.53269 21.52574 21.39301 21.39424 21.57933 21.22593 21.49330
## 25 26 27 28 29 30 31 32
## 21.41304 20.71978 21.57758 20.56473 21.49118 21.29557 21.51513 21.55649
## 33 34 35 36 37 38 39 40
## 21.50090 21.24110 21.42369 21.47800 21.31775 21.57279 21.54852 21.57897
## 41 42 43 44 45 46 47 48
## 21.57182 21.56890 21.44438 21.57791 21.53582 21.31341 21.54795 21.43757
## 49 50 51 52 53 54 55 56
## 21.52264 21.56073 21.55044 21.52044 21.35034 21.57863 21.41158 21.58023
## 57 58 59 60 61 62 63 64
## 21.57594 21.57877 21.53694 21.56879 21.58018 21.54931 21.56978 21.48861
## 65 66 67 68 69 70 71 72
## 21.55768 21.57672 21.54526 21.58037 21.57184 21.58036 21.46009 21.58045
## 73 74 75 76 77 78 79 80
## 21.56918 21.54439 21.50361 21.50263 21.35307 21.55227 21.53973 21.57791
## 81 82 83 84 85 86
## 21.53582 21.31341 21.54795 21.43757 21.52264 21.56073
##
## $wt.res
## 1 2 3 4 5 6
## -12.1974327 20.7032073 -9.3465641 12.1024758 -14.7963355 -11.6969755
## 7 8 9 10 11 12
## 105.6631890 -5.5967012 -12.0971584 34.0326496 -0.6969755 16.6029330
## 13 14 15 16 17 18
## -1.9967927 -3.5568658 -1.9967927 -18.1963355 -15.9963355 -12.9967927
## 19 20 21 22 23 24
## -13.7963355 25.7032073 -25.4964269 2.0031159 -35.1965184 -17.3863080
## 25 26 27 28 29 30
## -24.2967927 54.2036645 -3.1472956 54.7044875 -17.6463812 -31.3963355
## 31 32 33 34 35 36
## -15.1967012 -9.0962440 -16.7568658 -34.4966098 -23.4966098 18.9529787
## 37 38 39 40 41 42
## 30.4032988 -5.1965184 10.6030245 -2.2967927 5.5035731 -6.3967927
## 43 44 45 46 47 48
## -21.8966098 3.0031159 12.5035731 30.5035731 -10.6969755 -22.3969755
## 49 50 51 52 53 54
## -14.2967927 8.3531616 -10.2966098 -14.4964269 27.8025673 2.5026587
## 55 56 57 58 59 60
## 24.4032988 0.9028416 -3.9968841 2.4430427 12.3028416 -6.3964269
## 61 62 63 64 65 66
## -0.9968841 -10.4967012 -6.0971584 -17.9968841 8.9028416 -3.5962440
## 67 68 69 70 71 72
## -11.1365366 -0.5564086 -5.4964269 0.6029330 20.0040303 -0.1965184
## 73 74 75 76 77 78
## 6.3030245 11.2036645 -16.3970670 16.5035731 -28.2967927 9.9028416
## 79 80 81 82 83 84
## 11.9028416 3.0031159 12.5035731 30.5035731 -10.6969755 -22.3969755
## 85 86
## -14.2967927 8.3531616
influence(fit2)
## $hat
## 1 2 3 5 6 7
## 0.01750248 0.02172512 0.01750248 0.02770408 0.02770408 0.02770408
## 8 9 10 11 12 15
## 0.01335457 0.01335457 0.05337624 0.09182844 0.01750248 0.02770408
## 17 18 19 20 21 22
## 0.01335457 0.01335457 0.01335457 0.01750248 0.01469984 0.01469984
## 23 24 25 26 27 28
## 0.04291306 0.02770408 0.01750248 0.02172512 0.02172512 0.06477364
## 29 30 31 32 33 34
## 0.02736776 0.01768932 0.02172512 0.02172512 0.01335457 0.01943630
## 35 36 37 38 39 40
## 0.01469984 0.01768932 0.01335457 0.05337624 0.02172512 0.01750248
## 41 42 43 44 45 46
## 0.02736776 0.01469984 0.01750248 0.01469984 0.16297808 0.03443041
## 47 48 49 50 51 52
## 0.01469984 0.03443041 0.02736776 0.02770408 0.01469984 0.02172512
## 53 54 55 56 57 59
## 0.01943630 0.01768932 0.02770408 0.03443041 0.01335457 0.01335457
## 61 62 63 64 65 68
## 0.01335457 0.01335457 0.01469984 0.02172512 0.02770408 0.01335457
## 70 71 72 73 74 75
## 0.01335457 0.01469984 0.01750248 0.01481194 0.01469984 0.01335457
## 76 78 79 80 81 82
## 0.01750248 0.01768932 0.01768932 0.01469984 0.16297808 0.03443041
## 83 84 85 86
## 0.01469984 0.03443041 0.02736776 0.02770408
##
## $coefficients
## (Intercept) HOURSNET
## 1 -9.367269e-03 6.259273e-04
## 2 6.219602e-03 -4.855759e-04
## 3 1.333654e-03 -8.911566e-05
## 5 2.785962e-03 -8.244052e-04
## 6 -6.454647e-06 1.910020e-06
## 7 -6.454647e-06 1.910020e-06
## 8 2.327905e-03 8.392628e-05
## 9 2.327905e-03 8.392628e-05
## 10 6.440949e-03 -1.285269e-03
## 11 9.682513e-03 -1.694784e-03
## 12 -1.204250e-02 8.046881e-04
## 15 -5.591289e-03 1.654541e-03
## 17 4.954252e-03 1.786120e-04
## 18 4.954252e-03 1.786120e-04
## 19 -2.924787e-03 -1.054452e-04
## 20 3.304423e-04 -2.208038e-05
## 21 -6.236083e-03 3.110405e-04
## 22 3.344739e-03 -1.668273e-04
## 23 5.999720e-03 -5.804468e-04
## 24 -6.454647e-06 1.910020e-06
## 25 1.203458e-02 -8.041587e-04
## 26 -1.853385e-03 1.446972e-04
## 27 -9.926373e-03 7.749704e-04
## 28 -9.591224e-03 1.809612e-03
## 29 2.599904e-02 -2.238175e-03
## 30 -2.485175e-04 1.800580e-03
## 31 6.219602e-03 -4.855759e-04
## 32 -8.311775e-03 6.489158e-04
## 33 -4.185434e-03 -1.508944e-04
## 34 1.364245e-03 -9.953813e-05
## 35 -9.134041e-04 4.555834e-05
## 36 4.131066e-05 -2.993074e-04
## 37 -2.984410e-04 -1.075948e-05
## 38 -7.703640e-03 1.537234e-03
## 39 -6.051339e-03 4.724393e-04
## 40 -6.692038e-03 4.471666e-04
## 41 -5.107604e-03 4.396976e-04
## 42 -9.134041e-04 4.555834e-05
## 43 -1.341577e-03 8.964509e-05
## 44 -9.134041e-04 4.555834e-05
## 45 1.351420e-02 -2.180442e-03
## 46 -3.142067e-03 2.893414e-04
## 47 -6.236083e-03 3.110405e-04
## 48 -1.406905e-02 1.295567e-03
## 49 -2.452160e-03 2.110987e-04
## 50 -6.454647e-06 1.910020e-06
## 51 7.313329e-03 -3.647708e-04
## 52 -9.926373e-03 7.749704e-04
## 53 5.790868e-03 -4.225137e-04
## 54 6.651312e-05 -4.819063e-04
## 55 -2.798872e-03 8.282253e-04
## 56 1.871190e-02 -1.723111e-03
## 57 -2.924787e-03 -1.054452e-04
## 59 -1.874249e-03 -6.757094e-05
## 61 -2.924787e-03 -1.054452e-04
## 62 -2.984410e-04 -1.075948e-05
## 63 9.731955e-03 -4.854059e-04
## 64 -2.822144e-03 2.203300e-04
## 65 -6.454647e-06 1.910020e-06
## 68 1.277367e-03 4.605198e-05
## 70 -1.348980e-03 -4.863378e-05
## 71 2.280204e-03 -1.137309e-04
## 72 1.203458e-02 -8.041587e-04
## 73 -6.221440e-04 -1.332755e-04
## 74 -3.042476e-03 1.517512e-04
## 75 -2.984410e-04 -1.075948e-05
## 76 5.346500e-03 -3.572568e-04
## 78 2.870944e-05 -2.080080e-04
## 79 3.506986e-06 -2.540911e-05
## 80 -9.134041e-04 4.555834e-05
## 81 1.351420e-02 -2.180442e-03
## 82 -3.142067e-03 2.893414e-04
## 83 -6.236083e-03 3.110405e-04
## 84 -1.406905e-02 1.295567e-03
## 85 -2.452160e-03 2.110987e-04
## 86 -6.454647e-06 1.910020e-06
##
## $sigma
## 1 2 3 5 6 7 8
## 0.2737400 0.2759050 0.2767822 0.2752572 0.2768447 0.2768447 0.2756107
## 9 10 11 12 15 17 18
## 0.2756107 0.2754866 0.2756869 0.2716943 0.2703935 0.2712107 0.2712107
## 19 20 21 22 23 24 25
## 0.2748943 0.2768409 0.2746821 0.2762244 0.2764669 0.2768447 0.2717011
## 26 27 28 29 30 31 32
## 0.2767614 0.2744447 0.2747694 0.2646271 0.2511635 0.2759050 0.2751641
## 33 34 35 36 37 38 39
## 0.2728355 0.2767908 0.2767985 0.2761672 0.2768245 0.2748998 0.2759552
## 40 41 42 43 44 45 46
## 0.2752645 0.2763832 0.2767985 0.2767814 0.2767985 0.2759176 0.2767123
## 47 48 49 50 51 52 53
## 0.2746821 0.2741771 0.2767385 0.2768447 0.2738660 0.2744447 0.2758715
## 54 55 56 57 59 61 62
## 0.2750849 0.2752424 0.2721081 0.2748943 0.2760455 0.2748943 0.2768245
## 63 64 65 68 70 71 72
## 0.2715477 0.2766515 0.2768447 0.2764738 0.2764310 0.2765566 0.2717011
## 73 74 75 76 78 79 80
## 0.2764759 0.2763315 0.2768245 0.2758372 0.2765177 0.2768399 0.2767985
## 81 82 83 84 85 86
## 0.2759176 0.2767123 0.2746821 0.2741771 0.2767385 0.2768447
##
## $wt.res
## 1 2 3 5 6
## -0.3501480816 0.1926053535 0.0498519184 -0.2494221273 0.0005778727
## 7 8 9 10 11
## 0.0005778727 0.2215916131 0.2215916131 -0.2276824326 -0.2059427379
## 12 15 17 18 19
## -0.4501480816 0.5005778727 0.4715916131 0.4715916131 -0.2784083869
## 20 21 22 23 24
## 0.0123519184 -0.2929015167 0.1570984833 0.1208656588 0.0005778727
## 25 26 27 28 29
## 0.4498519184 -0.0573946465 -0.3073946465 0.2795641323 0.6853587886
## 30 31 32 33 34
## 0.9860847429 0.1926053535 -0.2573946465 -0.3984083869 0.0462286360
## 35 36 37 38 39
## -0.0429015167 -0.1639152571 -0.0284083869 0.2723175674 -0.1873946465
## 40 41 42 43 44
## -0.2501480816 -0.1346412114 -0.0429015167 -0.0501480816 -0.0429015167
## 45 46 47 48 49
## -0.1769564783 -0.0718877763 -0.2929015167 -0.3218877763 -0.0646412114
## 50 51 52 53 54
## 0.0005778727 0.3434984833 -0.3073946465 0.1962286360 -0.2639152571
## 55 56 57 59 61
## 0.2505778727 0.4281122237 -0.2784083869 -0.1784083869 -0.2784083869
## 62 63 64 65 68
## -0.0284083869 0.4570984833 -0.0873946465 0.0005778727 0.1215916131
## 70 71 72 73 74
## -0.1284083869 0.1070984833 0.4498519184 -0.1211618220 -0.1429015167
## 75 76 78 79 80
## -0.0284083869 0.1998519184 -0.1139152571 -0.0139152571 -0.0429015167
## 81 82 83 84 85
## -0.1769564783 -0.0718877763 -0.2929015167 -0.3218877763 -0.0646412114
## 86
## 0.0005778727
influence(fit3)
## $hat
## 1 2 3 4 5 6
## 0.01162890 0.02216642 0.02965651 0.01501902 0.02589923 0.01181860
## 7 8 9 10 11 12
## 0.14793740 0.01351366 0.02216642 0.03783604 0.01187776 0.01696294
## 13 14 15 16 17 18
## 0.01725871 0.02258050 0.01369112 0.02258050 0.01725871 0.01187776
## 19 20 21 22 23 24
## 0.04462688 0.01351366 0.04907116 0.01725871 0.03848673 0.01369112
## 25 26 27 28 29 30
## 0.03326080 0.09022582 0.01351366 0.01187776 0.03848673 0.02258050
## 31 32 33 34 35 36
## 0.01162890 0.02965651 0.01369112 0.02965651 0.01725871 0.03783604
## 37 38 39 40 41 42
## 0.02216642 0.01725871 0.02216642 0.02912412 0.01187776 0.01351366
## 43 44 45 46 47 48
## 0.02258050 0.02912412 0.01187776 0.01351366 0.01696294 0.01187776
## 49 50 51 52 53 54
## 0.01187776 0.01351366 0.01369112 0.02965651 0.07449705 0.01696294
## 55 56 57 58 59 60
## 0.01351366 0.01181860 0.01187776 0.01181860 0.02912412 0.02258050
## 61 62 63 64 65 66
## 0.01187776 0.04907116 0.01181860 0.01187776 0.01351366 0.02258050
## 67 68 69 70 71 72
## 0.02965651 0.01369112 0.02258050 0.01351366 0.01725871 0.02965651
## 73 74 75 76 77 78
## 0.01187776 0.02912412 0.01187776 0.01351366 0.03848673 0.02912412
## 79 80 81 82 83 84
## 0.02912412 0.02912412 0.01187776 0.01351366 0.01696294 0.01187776
## 85 86
## 0.01187776 0.01351366
##
## $coefficients
## (Intercept) WAIST
## 1 0.296730218 -0.0007003708
## 2 -0.142332568 0.0053289867
## 3 1.301475881 -0.0388989864
## 4 -1.666701406 0.0700545365
## 5 -1.327464536 0.0392505321
## 6 0.002343903 -0.0011150847
## 7 -12.040831256 0.4085753574
## 8 0.473295417 -0.0220215380
## 9 1.020289787 -0.0382000462
## 10 -4.386781437 0.1560661970
## 11 0.380459690 -0.0068708810
## 12 -0.991588746 0.0394138729
## 13 1.310054331 -0.0366284898
## 14 2.673953140 -0.0779911874
## 15 0.534356896 -0.0136393881
## 16 -1.881440751 0.0548759797
## 17 -1.722953550 0.0481729536
## 18 -0.188801953 0.0034096536
## 19 0.590559550 -0.0180626477
## 20 -0.535411774 0.0249116943
## 21 -0.257763119 0.0079158888
## 22 2.013712160 -0.0563024247
## 23 -2.079612631 0.0631536408
## 24 -1.619056365 0.0413261967
## 25 6.601747885 -0.2369250004
## 26 6.771881715 -0.2324450078
## 27 -0.451352842 0.0210005916
## 28 -0.138958768 0.0025095146
## 29 -0.334241750 0.0101502477
## 30 -3.316552908 0.0967338940
## 31 -0.218014228 0.0005145779
## 32 -0.919759298 0.0274901017
## 33 -0.053423399 0.0013636251
## 34 -1.824706963 0.0545375080
## 35 -1.189144163 0.0332478996
## 36 0.095325805 -0.0033913556
## 37 -0.557554838 0.0208750698
## 38 -0.089173305 0.0024932428
## 39 -0.084201451 0.0031525350
## 40 3.056813241 -0.1108929131
## 41 -0.196671929 0.0035517808
## 42 0.364018805 -0.0169371045
## 43 -0.750746325 0.0218970170
## 44 1.944570290 -0.0705437484
## 45 -0.013039142 0.0002354793
## 46 -0.143136755 0.0066598817
## 47 0.779976632 -0.0310026712
## 48 -0.188801953 0.0034096536
## 49 -0.222905185 0.0040255381
## 50 -0.115117111 0.0053561808
## 51 -0.411435032 0.0105018240
## 52 -0.371306167 0.0110977343
## 53 -2.493378570 0.0860740013
## 54 -0.991588746 0.0394138729
## 55 -0.367293909 0.0170894889
## 56 -0.016794955 0.0079900072
## 57 0.170593646 -0.0030808221
## 58 -0.009139412 0.0043479704
## 59 -0.658078216 0.0238732970
## 60 -0.087550556 0.0025535869
## 61 0.249293413 -0.0045020942
## 62 5.452801463 -0.1674551821
## 63 -0.010705319 0.0050929325
## 64 -0.196671929 0.0035517808
## 65 -0.591451063 0.0275190961
## 66 -0.805106634 0.0234825441
## 67 0.862713377 -0.0257850924
## 68 -0.443495776 0.0113201702
## 69 0.010298000 -0.0003003618
## 70 -0.227195688 0.0105709844
## 71 -0.331813935 0.0092773582
## 72 2.233846203 -0.0667660110
## 73 0.564092478 -0.0101871824
## 74 4.169056192 -0.1512420778
## 75 0.091893880 -0.0016595501
## 76 0.249138264 -0.0115919308
## 77 1.411129131 -0.0428531453
## 78 -0.391139908 0.0141894975
## 79 -0.613588498 0.0222593304
## 80 1.944570290 -0.0705437484
## 81 -0.013039142 0.0002354793
## 82 -0.143136755 0.0066598817
## 83 0.779976632 -0.0310026712
## 84 -0.188801953 0.0034096536
## 85 -0.222905185 0.0040255381
## 86 -0.115117111 0.0053561808
##
## $sigma
## 1 2 3 4 5 6 7 8
## 16.18511 16.38898 16.35592 15.78145 16.34596 16.38739 15.94682 16.28343
## 9 10 11 12 13 14 15 16
## 16.33325 16.01100 16.31166 16.26970 16.29167 16.16102 16.35278 16.27708
## 17 18 19 20 21 22 23 24
## 16.21948 16.37081 16.38613 16.25348 16.38942 16.15659 16.33015 16.04432
## 25 26 27 28 29 30 31 32
## 15.30285 16.12588 16.29312 16.37965 16.38854 16.03634 16.27976 16.37303
## 33 34 35 36 37 38 39 40
## 16.38971 16.32287 16.30904 16.38991 16.37313 16.38963 16.38970 16.10160
## 41 42 43 44 45 46 47 48
## 16.36917 16.32708 16.37215 16.27396 16.38999 16.38036 16.31570 16.37081
## 49 50 51 52 53 54 55 56
## 16.36321 16.38380 16.36798 16.38731 16.34432 16.26970 16.32594 16.25087
## 57 58 59 60 61 62 63 64
## 16.37435 16.34898 16.37683 16.38984 16.35646 16.08890 16.33367 16.36917
## 65 66 67 68 69 70 71 72
## 16.22323 16.36945 16.37508 16.36440 16.39008 16.36557 16.38379 16.28924
## 73 74 75 76 77 78 79 80
## 16.21719 15.84927 16.38552 16.36060 16.36251 16.38540 16.37856 16.27396
## 81 82 83 84 85 86
## 16.38999 16.38036 16.31570 16.37081 16.36321 16.38380
##
## $wt.res
## 1 2 3 4 5
## 23.40432605 1.71393226 9.49197522 40.00981531 -10.80665247
## 6 7 8 9 10
## -2.69430163 31.83863393 -16.89155700 -12.28606774 31.31942152
## 11 12 13 14 15
## 14.50295374 17.91118763 16.19746448 24.59471985 10.00020911
## 16 17 18 19 20
## -17.30528015 -21.30253552 -7.19704626 3.20758381 19.10844300
## 21 22 23 24 25
## -1.31351404 24.89746448 -12.51076941 -30.29979089 -52.58195080
## 26 27 28 29 30
## -25.46959996 16.10844300 -5.29704626 -2.01076941 -30.50528015
## 31 32 33 34 35
## -17.19567395 -6.70802478 -0.99979089 -13.30802478 -14.70253552
## 36 37 38 39 40
## -0.68057848 6.71393226 -1.10253552 1.01393226 -27.48332311
## 41 42 43 44 45
## -7.49704626 -12.99155700 -6.90528015 -17.48332311 -0.49704626
## 46 47 48 49 50
## 5.10844300 -14.08881237 -7.19704626 -8.49704626 4.10844300
## 51 52 53 54 55
## -7.69979089 -2.70802478 10.72765541 17.91118763 13.10844300
## 56 57 58 59 60
## 19.30569837 6.50295374 10.50569837 5.91667689 -0.80528015
## 61 62 63 64 65
## 9.50295374 27.78648596 12.30569837 -7.49704626 21.10844300
## 66 67 68 69 70
## -7.40528015 6.29197522 -8.29979089 0.09471985 8.10844300
## 71 72 73 74 75
## -4.10253552 16.29197522 21.50295374 -37.48332311 3.50295374
## 76 77 78 79 80
## -8.89155700 8.48923059 3.51667689 5.51667689 -17.48332311
## 81 82 83 84 85
## -0.49704626 5.10844300 -14.08881237 -7.19704626 -8.49704626
## 86
## 4.10844300
We did the simple scatterplot using the codes below.
attach(survey)
jpeg("scatterplot.jpg")
layout(matrix(c(1,3,2,4),2,2))
plot(WEIGHT, HEIGHT,
main="1. Scatterplot for Weight vs Height",
xlab="Weight,lbs",
ylab="Height,in", pch=19)
abline(lm(HEIGHT~WEIGHT), col="red")
plot(WEIGHT, WAIST,
main="2. Scatterplot for Weight vs Waistline",
xlab="Weight,lbs",
ylab="Waistline,in", pch=19)
abline(lm(GWA~HOURSNET), col="red")
plot(HOURSNET,GWA,
main="3. Scatterplot for Nethrs vs Avegrade",
xlab="Net Hours",
ylab="Ave Grade", pch=19)
abline(lm(GWA~HOURSNET), col="red")
plot(AVESLEEP,GWA,
main="4. Scatterplot for Hrsleep vs Avegrade",
xlab="Hours Sleep",
ylab="Ave Grade", pch=19)
abline(lm(GWA~AVESLEEP), col="red")
dev.off()
## png
## 2
Diagnostic plots provide checks for heteroscedasticity, normality, and influential observations
jpeg("plotfit1.jpg")
layout(matrix(c(1,2,3,4),2,2))
plot(fit1)
dev.off()
## png
## 2
jpeg("plotfit2.jpg")
layout(matrix(c(1,2,3,4),2,2))
plot(fit2)
dev.off()
## png
## 2
jpeg("plotfit3.jpg")
layout(matrix(c(1,2,3,4),2,2))
plot(fit3)
dev.off
## function (which = dev.cur())
## {
## if (which == 1)
## stop("cannot shut down device 1 (the null device)")
## .External(C_devoff, as.integer(which))
## dev.cur()
## }
## <bytecode: 0x000000001759bd80>
## <environment: namespace:grDevices>
sink(type="message")
sink()
Fit1: WEIGHT~HEIGHT
confint(fit1, level=0.95)
## 2.5 % 97.5 %
## (Intercept) -243.484440 -89.533679
## HEIGHT 3.489471 5.910712
Fit2: GWA~HOURSNET
confint(fit2, level=0.95)
## 2.5 % 97.5 %
## (Intercept) 1.46046770 1.71229411
## HOURSNET -0.02184544 0.00735231
Fit3: WEIGHT~WAIST
confint(fit3, level=0.95)
## 2.5 % 97.5 %
## (Intercept) -86.92606 -27.915173
## WAIST 5.23773 7.156781