You are on page 1of 11

> ## importing all the data

>
> source("C:\\Users\\Stark\\Desktop\\table1.txt")
Error in source("C:\\Users\\Stark\\Desktop\\table1.txt") :
C:\Users\Stark\Desktop\table1.txt:1:17: unexpected symbol
1: observation

y

^
> pesawat = read.table("C:\\Users\\Stark\\Desktop\\table1.txt" , header = TRUE)
> pesawat
observation y x1 x2 x3 x4 x5 x6
1

1 4540 2140 20640 30250 205 1732 99

2

2 4315 2016 20280 30010 195 1697 100

3

3 4095 1905 19860 29780 184 1662 97

4

4 3650 1675 18980 29330 164 1598 97

5

5 3200 1474 18100 28960 144 1541 97

6

6 4833 2239 20740 30083 216 1709 87

7

7 4617 2120 20305 29831 206 1669 87

8

8 4340 1990 19961 29604 196 1640 87

9

9 3820 1702 18916 29088 171 1572 85

10

10 3368 1487 18012 28675 149 1522 85

11

11 4445 2107 20520 30120 195 1740 101

12

12 4188 1973 20130 29920 190 1711 100

13

13 3981 1864 19780 29720 180 1682 100

14

14 3622 1674 19020 29370 161 1630 100

15 15 3125 1440 18030 28940 139 1572 101 16 16 4560 2165 20680 30160 208 1704 98 17 17 4340 2048 20340 29960 199 1679 96 18 18 4115 1916 19860 29710 187 1642 94 19 19 3630 1658 18950 29250 164 1576 94 20 20 3210 1489 18700 28890 145 1528 94 21 21 4330 2062 20500 30190 193 1748 101 22 22 4119 1929 20050 29960 183 1713 100 23 23 3891 1815 19680 29770 173 1684 100 24 24 3467 1595 18890 29360 153 1624 99 25 25 3045 1400 17870 28960 134 1569 100 26 26 4411 2047 20540 30160 193 1746 99 27 27 4203 1935 20160 29940 184 1714 99 28 28 3968 1807 19750 29760 173 1679 99 29 29 3531 1591 18890 29350 153 1621 99 30 30 3074 1388 17870 28910 133 1561 99 31 31 4350 2071 20460 30180 198 1729 100 32 32 4128 1944 20010 29940 186 1692 101 33 33 3940 1831 19640 29750 178 1667 101 34 34 3480 1612 18710 29360 156 1609 101 35 35 3064 1410 17780 28900 136 1552 101 36 36 4402 2066 20520 30170 197 1758 100 37 37 4180 1954 20150 29950 188 1729 99 38 38 3973 1835 19750 29740 178 1690 99 .

39 39 3530 1616 18850 29320 156 1616 99 40 40 3080 1407 17910 28910 137 1569 100 > > ## simplify for only required data that had been given > > mirage = c("y"."x5") > sukhoi = pesawat[mirage] > sukhoi y x1 x5 1 4540 2140 1732 2 4315 2016 1697 3 4095 1905 1662 4 3650 1675 1598 5 3200 1474 1541 6 4833 2239 1709 7 4617 2120 1669 8 4340 1990 1640 9 3820 1702 1572 10 3368 1487 1522 11 4445 2107 1740 12 4188 1973 1711 13 3981 1864 1682 14 3622 1674 1630 15 3125 1440 1572 ."x1".

16 4560 2165 1704 17 4340 2048 1679 18 4115 1916 1642 19 3630 1658 1576 20 3210 1489 1528 21 4330 2062 1748 22 4119 1929 1713 23 3891 1815 1684 24 3467 1595 1624 25 3045 1400 1569 26 4411 2047 1746 27 4203 1935 1714 28 3968 1807 1679 29 3531 1591 1621 30 3074 1388 1561 31 4350 2071 1729 32 4128 1944 1692 33 3940 1831 1667 34 3480 1612 1609 35 3064 1410 1552 36 4402 2066 1758 37 4180 1954 1729 38 3973 1835 1690 39 3530 1616 1616 .

3940.1831.2066.1807.1388.4115 .1616.1561.4330.1640.2107.1748.1679.1740.1489.4119.1916 .3210.1692.2120.1679.3891.1522.1669.4128.2165.1682.1474.1684.4833.1621.2016.3650.4411.1528.4315.1729.1835.1713.2071.3080) > x1<c(2140.1407) > x5<c(1732.1522.1746.1630.1709.4203.1704.1598.40 3080 1407 1569 > > ## write in one line form > > y<c(4540.1815.3064.2239.1667.1864.1697.2047.15 > .1591.3981.3480.3125.1609.1658.4340. 4180.1690.3820.1410.1616.3368.1576.1944.1642 .4402.1624.1569) > > ## DESCRIPTIVE STATISTIC > > ## Mean > mean(y) [1] 3904 > mean(x1) [1] 1809.1702.3973.3531.1612. 1729.3467.4340.4617.4350.3530.3622.1935.1711.3074.2062.1714.1905.1674.1990.1929.1572.1973.4445.1440.4188.1487.2048.1572.1541.4095.3200.1758.1675.3045.925 > mean(x5) [1] 1651.3968.3630. 1954.1595.4560.1662.1400.1569.

925 1651.64600 251.> ## Variance > var(y) [1] 254667.95048 68.000 1809.05 > var(x5) [1] 4922.646 > sd(x1) [1] 251.16302 > > ## In summary > colMeans(sukhoi) y x1 x5 3904.6 > var(x1) [1] 63479.900 > sd(sukhoi) y x1 x5 504.849 > > ## Standard Deviation > sd(y) [1] 504.9505 > sd(x5) [1] 70.89598 Warning message: .

sd(<data. > > ## Stem > stem(y) The decimal point is 2 digit(s) to the right of the | 30 | 56783 32 | 017 34 | 7833 36 | 235 38 | 294778 40 | 022389 42 | 023445 44 | 01546 46 | 2 48 | 3 > stem(x1) The decimal point is 2 digit(s) to the right of the | 13 | 9 . sd) instead.frame>) is deprecated. Use sapply(*.

14 | 0114799 15 | 9 16 | 012678 17 | 0 18 | 12346 19 | 12344579 20 | 255677 21 | 1247 22 | 4 > stem(x5) The decimal point is 1 digit(s) to the right of the | 152 | 228 154 | 1 156 | 199226 158 | 8 160 | 96 162 | 140 164 | 02 166 | 27999 168 | 24027 170 | 49134 .

data = sukhoi) .172 | 992 174 | 0688 > boxplot(sukhoi) > boxplot(y) > boxplot(x1) > boxplot(x5) > > ## Histogram > hist(y) > hist(x1) > hist(x5) > > ## CORRELATION AND REGRESSION > ## check the linearity of the data > plot(sukhoi) > > ## fitting multiple linear regression > regression = lm(y ~ x1 + x5 . data = sukhoi) > regression Call: lm(formula = y ~ x1 + x5.

codes: 0 ‘***’ 0.1 ‘ ’ 1 Residual standard error: 47.00095 *** x1 2.055 -31.24581 -2.06722 32.9916. Error t value Pr(>|t|) (Intercept) 1085.001 ‘**’ 0.65239 0.063 24.654 0.1525 x5 -0.Coefficients: (Intercept) x1 1085. data = sukhoi) Residuals: Min 1Q Median 3Q Max -84. Adjusted R-squared: 0.9912 F-statistic: 2194 on 2 and 37 DF.38 on 37 degrees of freedom Multiple R-squared: 0.966 96.2e-16 .023 < 2e-16 *** x5 -0.01 ‘*’ 0.9051 2.90511 302.774 -3.15245 0.178 Coefficients: Estimate Std.’ 0.6524 > summary(regression) Call: lm(formula = y ~ x1 + x5.01165 * --Signif.33023 3. p-value: < 2.05 ‘.592 0.

.01 ‘*’ 0..Way ANOVA > ## ANOVA Table > > anova(regression) Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) x1 1 9833160 9833160 4380. > .1520 < 2e-16 *** x5 1 15814 15814 7. codes: 0 ‘***’ 0. Waiting to confirm page change.001 ‘**’ 0.0442 0. Waiting to confirm page change.’ 0....> > ## Analysis of Variance (ANOVA) > ## One ..01165 * Residuals 37 83063 2245 --Signif.1 ‘ ’ 1 > > plot(regression) Waiting to confirm page change. Waiting to confirm page change.05 ‘...