R version 2.7.0 (2008-04-22) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(1687 + ,0 + ,1508 + ,0 + ,1507 + ,0 + ,1385 + ,0 + ,1632 + ,0 + ,1511 + ,0 + ,1559 + ,0 + ,1630 + ,0 + ,1579 + ,0 + ,1653 + ,0 + ,2152 + ,0 + ,2148 + ,0 + ,1752 + ,0 + ,1765 + ,0 + ,1717 + ,0 + ,1558 + ,0 + ,1575 + ,0 + ,1520 + ,0 + ,1805 + ,0 + ,1800 + ,0 + ,1719 + ,0 + ,2008 + ,0 + ,2242 + ,0 + ,2478 + ,0 + ,2030 + ,0 + ,1655 + ,0 + ,1693 + ,0 + ,1623 + ,0 + ,1805 + ,0 + ,1746 + ,0 + ,1795 + ,0 + ,1926 + ,0 + ,1619 + ,0 + ,1992 + ,0 + ,2233 + ,0 + ,2192 + ,0 + ,2080 + ,0 + ,1768 + ,0 + ,1835 + ,0 + ,1569 + ,0 + ,1976 + ,0 + ,1853 + ,0 + ,1965 + ,0 + ,1689 + ,0 + ,1778 + ,0 + ,1976 + ,0 + ,2397 + ,0 + ,2654 + ,0 + ,2097 + ,0 + ,1963 + ,0 + ,1677 + ,0 + ,1941 + ,0 + ,2003 + ,0 + ,1813 + ,0 + ,2012 + ,0 + ,1912 + ,0 + ,2084 + ,0 + ,2080 + ,0 + ,2118 + ,0 + ,2150 + ,0 + ,1608 + ,0 + ,1503 + ,0 + ,1548 + ,0 + ,1382 + ,0 + ,1731 + ,0 + ,1798 + ,0 + ,1779 + ,0 + ,1887 + ,0 + ,2004 + ,0 + ,2077 + ,0 + ,2092 + ,0 + ,2051 + ,0 + ,1577 + ,0 + ,1356 + ,0 + ,1652 + ,0 + ,1382 + ,0 + ,1519 + ,0 + ,1421 + ,0 + ,1442 + ,0 + ,1543 + ,0 + ,1656 + ,0 + ,1561 + ,0 + ,1905 + ,0 + ,2199 + ,0 + ,1473 + ,0 + ,1655 + ,0 + ,1407 + ,0 + ,1395 + ,0 + ,1530 + ,0 + ,1309 + ,0 + ,1526 + ,0 + ,1327 + ,0 + ,1627 + ,0 + ,1748 + ,0 + ,1958 + ,0 + ,2274 + ,0 + ,1648 + ,0 + ,1401 + ,0 + ,1411 + ,0 + ,1403 + ,0 + ,1394 + ,0 + ,1520 + ,0 + ,1528 + ,0 + ,1643 + ,0 + ,1515 + ,0 + ,1685 + ,0 + ,2000 + ,0 + ,2215 + ,0 + ,1956 + ,0 + ,1462 + ,0 + ,1563 + ,0 + ,1459 + ,0 + ,1446 + ,0 + ,1622 + ,0 + ,1657 + ,0 + ,1638 + ,0 + ,1643 + ,0 + ,1683 + ,0 + ,2050 + ,0 + ,2262 + ,0 + ,1813 + ,0 + ,1445 + ,0 + ,1762 + ,0 + ,1461 + ,0 + ,1556 + ,0 + ,1431 + ,0 + ,1427 + ,0 + ,1554 + ,0 + ,1645 + ,0 + ,1653 + ,0 + ,2016 + ,0 + ,2207 + ,0 + ,1665 + ,0 + ,1361 + ,0 + ,1506 + ,0 + ,1360 + ,0 + ,1453 + ,0 + ,1522 + ,0 + ,1460 + ,0 + ,1552 + ,0 + ,1548 + ,0 + ,1827 + ,0 + ,1737 + ,0 + ,1941 + ,0 + ,1474 + ,0 + ,1458 + ,0 + ,1542 + ,0 + ,1404 + ,0 + ,1522 + ,0 + ,1385 + ,0 + ,1641 + ,0 + ,1510 + ,0 + ,1681 + ,0 + ,1938 + ,0 + ,1868 + ,0 + ,1726 + ,0 + ,1456 + ,0 + ,1445 + ,0 + ,1456 + ,0 + ,1365 + ,0 + ,1487 + ,0 + ,1558 + ,0 + ,1488 + ,0 + ,1684 + ,0 + ,1594 + ,0 + ,1850 + ,0 + ,1998 + ,0 + ,2079 + ,0 + ,1494 + ,0 + ,1057 + ,1 + ,1218 + ,1 + ,1168 + ,1 + ,1236 + ,1 + ,1076 + ,1 + ,1174 + ,1 + ,1139 + ,1 + ,1427 + ,1 + ,1487 + ,1 + ,1483 + ,1 + ,1513 + ,1 + ,1357 + ,1 + ,1165 + ,1 + ,1282 + ,1 + ,1110 + ,1 + ,1297 + ,1 + ,1185 + ,1 + ,1222 + ,1 + ,1284 + ,1 + ,1444 + ,1 + ,1575 + ,1 + ,1737 + ,1 + ,1763 + ,1) + ,dim=c(2 + ,192) + ,dimnames=list(c('y' + ,'x') + ,1:192)) > y <- array(NA,dim=c(2,192),dimnames=list(c('y','x'),1:192)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x y x t 1 1687 0 1 2 1508 0 2 3 1507 0 3 4 1385 0 4 5 1632 0 5 6 1511 0 6 7 1559 0 7 8 1630 0 8 9 1579 0 9 10 1653 0 10 11 2152 0 11 12 2148 0 12 13 1752 0 13 14 1765 0 14 15 1717 0 15 16 1558 0 16 17 1575 0 17 18 1520 0 18 19 1805 0 19 20 1800 0 20 21 1719 0 21 22 2008 0 22 23 2242 0 23 24 2478 0 24 25 2030 0 25 26 1655 0 26 27 1693 0 27 28 1623 0 28 29 1805 0 29 30 1746 0 30 31 1795 0 31 32 1926 0 32 33 1619 0 33 34 1992 0 34 35 2233 0 35 36 2192 0 36 37 2080 0 37 38 1768 0 38 39 1835 0 39 40 1569 0 40 41 1976 0 41 42 1853 0 42 43 1965 0 43 44 1689 0 44 45 1778 0 45 46 1976 0 46 47 2397 0 47 48 2654 0 48 49 2097 0 49 50 1963 0 50 51 1677 0 51 52 1941 0 52 53 2003 0 53 54 1813 0 54 55 2012 0 55 56 1912 0 56 57 2084 0 57 58 2080 0 58 59 2118 0 59 60 2150 0 60 61 1608 0 61 62 1503 0 62 63 1548 0 63 64 1382 0 64 65 1731 0 65 66 1798 0 66 67 1779 0 67 68 1887 0 68 69 2004 0 69 70 2077 0 70 71 2092 0 71 72 2051 0 72 73 1577 0 73 74 1356 0 74 75 1652 0 75 76 1382 0 76 77 1519 0 77 78 1421 0 78 79 1442 0 79 80 1543 0 80 81 1656 0 81 82 1561 0 82 83 1905 0 83 84 2199 0 84 85 1473 0 85 86 1655 0 86 87 1407 0 87 88 1395 0 88 89 1530 0 89 90 1309 0 90 91 1526 0 91 92 1327 0 92 93 1627 0 93 94 1748 0 94 95 1958 0 95 96 2274 0 96 97 1648 0 97 98 1401 0 98 99 1411 0 99 100 1403 0 100 101 1394 0 101 102 1520 0 102 103 1528 0 103 104 1643 0 104 105 1515 0 105 106 1685 0 106 107 2000 0 107 108 2215 0 108 109 1956 0 109 110 1462 0 110 111 1563 0 111 112 1459 0 112 113 1446 0 113 114 1622 0 114 115 1657 0 115 116 1638 0 116 117 1643 0 117 118 1683 0 118 119 2050 0 119 120 2262 0 120 121 1813 0 121 122 1445 0 122 123 1762 0 123 124 1461 0 124 125 1556 0 125 126 1431 0 126 127 1427 0 127 128 1554 0 128 129 1645 0 129 130 1653 0 130 131 2016 0 131 132 2207 0 132 133 1665 0 133 134 1361 0 134 135 1506 0 135 136 1360 0 136 137 1453 0 137 138 1522 0 138 139 1460 0 139 140 1552 0 140 141 1548 0 141 142 1827 0 142 143 1737 0 143 144 1941 0 144 145 1474 0 145 146 1458 0 146 147 1542 0 147 148 1404 0 148 149 1522 0 149 150 1385 0 150 151 1641 0 151 152 1510 0 152 153 1681 0 153 154 1938 0 154 155 1868 0 155 156 1726 0 156 157 1456 0 157 158 1445 0 158 159 1456 0 159 160 1365 0 160 161 1487 0 161 162 1558 0 162 163 1488 0 163 164 1684 0 164 165 1594 0 165 166 1850 0 166 167 1998 0 167 168 2079 0 168 169 1494 0 169 170 1057 1 170 171 1218 1 171 172 1168 1 172 173 1236 1 173 174 1076 1 174 175 1174 1 175 176 1139 1 176 177 1427 1 177 178 1487 1 178 179 1483 1 179 180 1513 1 180 181 1357 1 181 182 1165 1 182 183 1282 1 183 184 1110 1 184 185 1297 1 185 186 1185 1 186 187 1222 1 187 188 1284 1 188 189 1444 1 189 190 1575 1 190 191 1737 1 191 192 1763 1 192 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x t 1846.030 -251.177 -1.509 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -454.99 -181.86 -60.57 183.96 880.41 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1846.0300 38.7814 47.601 < 2e-16 *** x -251.1766 67.5209 -3.720 0.000263 *** t -1.5092 0.3956 -3.815 0.000184 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 251.2 on 189 degrees of freedom Multiple R-squared: 0.2556, Adjusted R-squared: 0.2477 F-statistic: 32.44 on 2 and 189 DF, p-value: 7.73e-13 > postscript(file="/var/www/html/rcomp/tmp/1psov1227522804.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2v9hv1227522804.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3t6hk1227522804.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/48ut91227522804.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5bpn31227522804.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 192 Frequency = 1 1 2 3 4 5 6 -157.5207932 -335.0116347 -334.5024762 -454.9933177 -206.4841592 -325.9750007 7 8 9 10 11 12 -276.4658422 -203.9566837 -253.4475252 -177.9383667 322.5707918 320.0799503 13 14 15 16 17 18 -74.4108912 -59.9017327 -106.3925742 -263.8834157 -245.3742572 -298.8650987 19 20 21 22 23 24 -12.3559402 -15.8467817 -95.3376232 195.1715353 430.6806938 668.1898523 25 26 27 28 29 30 221.6990108 -151.7918308 -112.2826723 -180.7735138 2.7356447 -54.7551968 31 32 33 34 35 36 -4.2460383 128.2631202 -177.2277213 197.2814372 439.7905957 400.2997542 37 38 39 40 41 42 289.8089127 -20.6819288 47.8272297 -216.6636118 191.8455467 70.3547052 43 44 45 46 47 48 183.8638637 -90.6269778 -0.1178193 199.3913392 621.9004977 880.4096562 49 50 51 52 53 54 324.9188147 192.4279732 -92.0628683 173.4462902 236.9554487 48.4646072 55 56 57 58 59 60 248.9737657 150.4829242 323.9920827 321.5012412 361.0103997 394.5195582 61 62 63 64 65 66 -145.9712833 -249.4621248 -202.9529663 -367.4438078 -16.9346493 51.5745092 67 68 69 70 71 72 34.0836677 143.5928262 262.1019847 336.6111432 353.1203017 313.6294602 73 74 75 76 77 78 -158.8613813 -378.3522228 -80.8430643 -349.3339058 -210.8247473 -307.3155888 79 80 81 82 83 84 -284.8064303 -182.2972718 -67.7881133 -161.2789548 184.2302037 479.7393622 85 86 87 88 89 90 -244.7514793 -61.2423208 -307.7331623 -318.2240038 -181.7148453 -401.2056868 91 92 93 94 95 96 -182.6965283 -380.1873698 -78.6782113 43.8309472 255.3401057 572.8492642 97 98 99 100 101 102 -51.6415773 -297.1324188 -285.6232603 -292.1141018 -299.6049433 -172.0957848 103 104 105 106 107 108 -162.5866263 -46.0774678 -172.5683093 -1.0591508 315.4500077 531.9591662 109 110 111 112 113 114 274.4683247 -218.0225168 -115.5133583 -218.0041998 -229.4950413 -51.9858828 115 116 117 118 119 120 -15.4767243 -32.9675658 -26.4584073 15.0507512 383.5599097 597.0690682 121 122 123 124 125 126 149.5782267 -216.9126148 101.5965437 -197.8942978 -101.3851393 -224.8759808 127 128 129 130 131 132 -227.3668223 -98.8576638 -6.3485053 3.1606532 367.6698117 560.1789702 133 134 135 136 137 138 19.6881287 -282.8027128 -136.2935543 -280.7843958 -186.2752373 -115.7660788 139 140 141 142 143 144 -176.2569203 -82.7477618 -85.2386033 195.2705552 106.7797137 312.2888722 145 146 147 148 149 150 -153.2019693 -167.6928108 -82.1836523 -218.6744938 -99.1653353 -234.6561768 151 152 153 154 155 156 22.8529817 -106.6378598 65.8712987 324.3804572 255.8896157 115.3987742 157 158 159 160 161 162 -153.0920673 -162.5829088 -150.0737503 -239.5645918 -116.0554333 -43.5462748 163 164 165 166 167 168 -112.0371163 85.4720422 -3.0187993 254.4903592 403.9995177 486.5086762 169 170 171 172 173 174 -96.9821653 -281.2963957 -118.7872372 -167.2780787 -97.7689202 -256.2597617 175 176 177 178 179 180 -156.7506032 -190.2414447 99.2677138 160.7768723 158.2860308 189.7951893 181 182 183 184 185 186 35.3043478 -155.1864937 -36.6773352 -207.1681767 -18.6590182 -129.1498597 187 188 189 190 191 192 -90.6407012 -27.1315427 134.3776158 266.8867743 430.3959328 457.9050913 > postscript(file="/var/www/html/rcomp/tmp/6qz711227522804.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 192 Frequency = 1 lag(myerror, k = 1) myerror 0 -157.5207932 NA 1 -335.0116347 -157.5207932 2 -334.5024762 -335.0116347 3 -454.9933177 -334.5024762 4 -206.4841592 -454.9933177 5 -325.9750007 -206.4841592 6 -276.4658422 -325.9750007 7 -203.9566837 -276.4658422 8 -253.4475252 -203.9566837 9 -177.9383667 -253.4475252 10 322.5707918 -177.9383667 11 320.0799503 322.5707918 12 -74.4108912 320.0799503 13 -59.9017327 -74.4108912 14 -106.3925742 -59.9017327 15 -263.8834157 -106.3925742 16 -245.3742572 -263.8834157 17 -298.8650987 -245.3742572 18 -12.3559402 -298.8650987 19 -15.8467817 -12.3559402 20 -95.3376232 -15.8467817 21 195.1715353 -95.3376232 22 430.6806938 195.1715353 23 668.1898523 430.6806938 24 221.6990108 668.1898523 25 -151.7918308 221.6990108 26 -112.2826723 -151.7918308 27 -180.7735138 -112.2826723 28 2.7356447 -180.7735138 29 -54.7551968 2.7356447 30 -4.2460383 -54.7551968 31 128.2631202 -4.2460383 32 -177.2277213 128.2631202 33 197.2814372 -177.2277213 34 439.7905957 197.2814372 35 400.2997542 439.7905957 36 289.8089127 400.2997542 37 -20.6819288 289.8089127 38 47.8272297 -20.6819288 39 -216.6636118 47.8272297 40 191.8455467 -216.6636118 41 70.3547052 191.8455467 42 183.8638637 70.3547052 43 -90.6269778 183.8638637 44 -0.1178193 -90.6269778 45 199.3913392 -0.1178193 46 621.9004977 199.3913392 47 880.4096562 621.9004977 48 324.9188147 880.4096562 49 192.4279732 324.9188147 50 -92.0628683 192.4279732 51 173.4462902 -92.0628683 52 236.9554487 173.4462902 53 48.4646072 236.9554487 54 248.9737657 48.4646072 55 150.4829242 248.9737657 56 323.9920827 150.4829242 57 321.5012412 323.9920827 58 361.0103997 321.5012412 59 394.5195582 361.0103997 60 -145.9712833 394.5195582 61 -249.4621248 -145.9712833 62 -202.9529663 -249.4621248 63 -367.4438078 -202.9529663 64 -16.9346493 -367.4438078 65 51.5745092 -16.9346493 66 34.0836677 51.5745092 67 143.5928262 34.0836677 68 262.1019847 143.5928262 69 336.6111432 262.1019847 70 353.1203017 336.6111432 71 313.6294602 353.1203017 72 -158.8613813 313.6294602 73 -378.3522228 -158.8613813 74 -80.8430643 -378.3522228 75 -349.3339058 -80.8430643 76 -210.8247473 -349.3339058 77 -307.3155888 -210.8247473 78 -284.8064303 -307.3155888 79 -182.2972718 -284.8064303 80 -67.7881133 -182.2972718 81 -161.2789548 -67.7881133 82 184.2302037 -161.2789548 83 479.7393622 184.2302037 84 -244.7514793 479.7393622 85 -61.2423208 -244.7514793 86 -307.7331623 -61.2423208 87 -318.2240038 -307.7331623 88 -181.7148453 -318.2240038 89 -401.2056868 -181.7148453 90 -182.6965283 -401.2056868 91 -380.1873698 -182.6965283 92 -78.6782113 -380.1873698 93 43.8309472 -78.6782113 94 255.3401057 43.8309472 95 572.8492642 255.3401057 96 -51.6415773 572.8492642 97 -297.1324188 -51.6415773 98 -285.6232603 -297.1324188 99 -292.1141018 -285.6232603 100 -299.6049433 -292.1141018 101 -172.0957848 -299.6049433 102 -162.5866263 -172.0957848 103 -46.0774678 -162.5866263 104 -172.5683093 -46.0774678 105 -1.0591508 -172.5683093 106 315.4500077 -1.0591508 107 531.9591662 315.4500077 108 274.4683247 531.9591662 109 -218.0225168 274.4683247 110 -115.5133583 -218.0225168 111 -218.0041998 -115.5133583 112 -229.4950413 -218.0041998 113 -51.9858828 -229.4950413 114 -15.4767243 -51.9858828 115 -32.9675658 -15.4767243 116 -26.4584073 -32.9675658 117 15.0507512 -26.4584073 118 383.5599097 15.0507512 119 597.0690682 383.5599097 120 149.5782267 597.0690682 121 -216.9126148 149.5782267 122 101.5965437 -216.9126148 123 -197.8942978 101.5965437 124 -101.3851393 -197.8942978 125 -224.8759808 -101.3851393 126 -227.3668223 -224.8759808 127 -98.8576638 -227.3668223 128 -6.3485053 -98.8576638 129 3.1606532 -6.3485053 130 367.6698117 3.1606532 131 560.1789702 367.6698117 132 19.6881287 560.1789702 133 -282.8027128 19.6881287 134 -136.2935543 -282.8027128 135 -280.7843958 -136.2935543 136 -186.2752373 -280.7843958 137 -115.7660788 -186.2752373 138 -176.2569203 -115.7660788 139 -82.7477618 -176.2569203 140 -85.2386033 -82.7477618 141 195.2705552 -85.2386033 142 106.7797137 195.2705552 143 312.2888722 106.7797137 144 -153.2019693 312.2888722 145 -167.6928108 -153.2019693 146 -82.1836523 -167.6928108 147 -218.6744938 -82.1836523 148 -99.1653353 -218.6744938 149 -234.6561768 -99.1653353 150 22.8529817 -234.6561768 151 -106.6378598 22.8529817 152 65.8712987 -106.6378598 153 324.3804572 65.8712987 154 255.8896157 324.3804572 155 115.3987742 255.8896157 156 -153.0920673 115.3987742 157 -162.5829088 -153.0920673 158 -150.0737503 -162.5829088 159 -239.5645918 -150.0737503 160 -116.0554333 -239.5645918 161 -43.5462748 -116.0554333 162 -112.0371163 -43.5462748 163 85.4720422 -112.0371163 164 -3.0187993 85.4720422 165 254.4903592 -3.0187993 166 403.9995177 254.4903592 167 486.5086762 403.9995177 168 -96.9821653 486.5086762 169 -281.2963957 -96.9821653 170 -118.7872372 -281.2963957 171 -167.2780787 -118.7872372 172 -97.7689202 -167.2780787 173 -256.2597617 -97.7689202 174 -156.7506032 -256.2597617 175 -190.2414447 -156.7506032 176 99.2677138 -190.2414447 177 160.7768723 99.2677138 178 158.2860308 160.7768723 179 189.7951893 158.2860308 180 35.3043478 189.7951893 181 -155.1864937 35.3043478 182 -36.6773352 -155.1864937 183 -207.1681767 -36.6773352 184 -18.6590182 -207.1681767 185 -129.1498597 -18.6590182 186 -90.6407012 -129.1498597 187 -27.1315427 -90.6407012 188 134.3776158 -27.1315427 189 266.8867743 134.3776158 190 430.3959328 266.8867743 191 457.9050913 430.3959328 192 NA 457.9050913 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -335.0116347 -157.5207932 [2,] -334.5024762 -335.0116347 [3,] -454.9933177 -334.5024762 [4,] -206.4841592 -454.9933177 [5,] -325.9750007 -206.4841592 [6,] -276.4658422 -325.9750007 [7,] -203.9566837 -276.4658422 [8,] -253.4475252 -203.9566837 [9,] -177.9383667 -253.4475252 [10,] 322.5707918 -177.9383667 [11,] 320.0799503 322.5707918 [12,] -74.4108912 320.0799503 [13,] -59.9017327 -74.4108912 [14,] -106.3925742 -59.9017327 [15,] -263.8834157 -106.3925742 [16,] -245.3742572 -263.8834157 [17,] -298.8650987 -245.3742572 [18,] -12.3559402 -298.8650987 [19,] -15.8467817 -12.3559402 [20,] -95.3376232 -15.8467817 [21,] 195.1715353 -95.3376232 [22,] 430.6806938 195.1715353 [23,] 668.1898523 430.6806938 [24,] 221.6990108 668.1898523 [25,] -151.7918308 221.6990108 [26,] -112.2826723 -151.7918308 [27,] -180.7735138 -112.2826723 [28,] 2.7356447 -180.7735138 [29,] -54.7551968 2.7356447 [30,] -4.2460383 -54.7551968 [31,] 128.2631202 -4.2460383 [32,] -177.2277213 128.2631202 [33,] 197.2814372 -177.2277213 [34,] 439.7905957 197.2814372 [35,] 400.2997542 439.7905957 [36,] 289.8089127 400.2997542 [37,] -20.6819288 289.8089127 [38,] 47.8272297 -20.6819288 [39,] -216.6636118 47.8272297 [40,] 191.8455467 -216.6636118 [41,] 70.3547052 191.8455467 [42,] 183.8638637 70.3547052 [43,] -90.6269778 183.8638637 [44,] -0.1178193 -90.6269778 [45,] 199.3913392 -0.1178193 [46,] 621.9004977 199.3913392 [47,] 880.4096562 621.9004977 [48,] 324.9188147 880.4096562 [49,] 192.4279732 324.9188147 [50,] -92.0628683 192.4279732 [51,] 173.4462902 -92.0628683 [52,] 236.9554487 173.4462902 [53,] 48.4646072 236.9554487 [54,] 248.9737657 48.4646072 [55,] 150.4829242 248.9737657 [56,] 323.9920827 150.4829242 [57,] 321.5012412 323.9920827 [58,] 361.0103997 321.5012412 [59,] 394.5195582 361.0103997 [60,] -145.9712833 394.5195582 [61,] -249.4621248 -145.9712833 [62,] -202.9529663 -249.4621248 [63,] -367.4438078 -202.9529663 [64,] -16.9346493 -367.4438078 [65,] 51.5745092 -16.9346493 [66,] 34.0836677 51.5745092 [67,] 143.5928262 34.0836677 [68,] 262.1019847 143.5928262 [69,] 336.6111432 262.1019847 [70,] 353.1203017 336.6111432 [71,] 313.6294602 353.1203017 [72,] -158.8613813 313.6294602 [73,] -378.3522228 -158.8613813 [74,] -80.8430643 -378.3522228 [75,] -349.3339058 -80.8430643 [76,] -210.8247473 -349.3339058 [77,] -307.3155888 -210.8247473 [78,] -284.8064303 -307.3155888 [79,] -182.2972718 -284.8064303 [80,] -67.7881133 -182.2972718 [81,] -161.2789548 -67.7881133 [82,] 184.2302037 -161.2789548 [83,] 479.7393622 184.2302037 [84,] -244.7514793 479.7393622 [85,] -61.2423208 -244.7514793 [86,] -307.7331623 -61.2423208 [87,] -318.2240038 -307.7331623 [88,] -181.7148453 -318.2240038 [89,] -401.2056868 -181.7148453 [90,] -182.6965283 -401.2056868 [91,] -380.1873698 -182.6965283 [92,] -78.6782113 -380.1873698 [93,] 43.8309472 -78.6782113 [94,] 255.3401057 43.8309472 [95,] 572.8492642 255.3401057 [96,] -51.6415773 572.8492642 [97,] -297.1324188 -51.6415773 [98,] -285.6232603 -297.1324188 [99,] -292.1141018 -285.6232603 [100,] -299.6049433 -292.1141018 [101,] -172.0957848 -299.6049433 [102,] -162.5866263 -172.0957848 [103,] -46.0774678 -162.5866263 [104,] -172.5683093 -46.0774678 [105,] -1.0591508 -172.5683093 [106,] 315.4500077 -1.0591508 [107,] 531.9591662 315.4500077 [108,] 274.4683247 531.9591662 [109,] -218.0225168 274.4683247 [110,] -115.5133583 -218.0225168 [111,] -218.0041998 -115.5133583 [112,] -229.4950413 -218.0041998 [113,] -51.9858828 -229.4950413 [114,] -15.4767243 -51.9858828 [115,] -32.9675658 -15.4767243 [116,] -26.4584073 -32.9675658 [117,] 15.0507512 -26.4584073 [118,] 383.5599097 15.0507512 [119,] 597.0690682 383.5599097 [120,] 149.5782267 597.0690682 [121,] -216.9126148 149.5782267 [122,] 101.5965437 -216.9126148 [123,] -197.8942978 101.5965437 [124,] -101.3851393 -197.8942978 [125,] -224.8759808 -101.3851393 [126,] -227.3668223 -224.8759808 [127,] -98.8576638 -227.3668223 [128,] -6.3485053 -98.8576638 [129,] 3.1606532 -6.3485053 [130,] 367.6698117 3.1606532 [131,] 560.1789702 367.6698117 [132,] 19.6881287 560.1789702 [133,] -282.8027128 19.6881287 [134,] -136.2935543 -282.8027128 [135,] -280.7843958 -136.2935543 [136,] -186.2752373 -280.7843958 [137,] -115.7660788 -186.2752373 [138,] -176.2569203 -115.7660788 [139,] -82.7477618 -176.2569203 [140,] -85.2386033 -82.7477618 [141,] 195.2705552 -85.2386033 [142,] 106.7797137 195.2705552 [143,] 312.2888722 106.7797137 [144,] -153.2019693 312.2888722 [145,] -167.6928108 -153.2019693 [146,] -82.1836523 -167.6928108 [147,] -218.6744938 -82.1836523 [148,] -99.1653353 -218.6744938 [149,] -234.6561768 -99.1653353 [150,] 22.8529817 -234.6561768 [151,] -106.6378598 22.8529817 [152,] 65.8712987 -106.6378598 [153,] 324.3804572 65.8712987 [154,] 255.8896157 324.3804572 [155,] 115.3987742 255.8896157 [156,] -153.0920673 115.3987742 [157,] -162.5829088 -153.0920673 [158,] -150.0737503 -162.5829088 [159,] -239.5645918 -150.0737503 [160,] -116.0554333 -239.5645918 [161,] -43.5462748 -116.0554333 [162,] -112.0371163 -43.5462748 [163,] 85.4720422 -112.0371163 [164,] -3.0187993 85.4720422 [165,] 254.4903592 -3.0187993 [166,] 403.9995177 254.4903592 [167,] 486.5086762 403.9995177 [168,] -96.9821653 486.5086762 [169,] -281.2963957 -96.9821653 [170,] -118.7872372 -281.2963957 [171,] -167.2780787 -118.7872372 [172,] -97.7689202 -167.2780787 [173,] -256.2597617 -97.7689202 [174,] -156.7506032 -256.2597617 [175,] -190.2414447 -156.7506032 [176,] 99.2677138 -190.2414447 [177,] 160.7768723 99.2677138 [178,] 158.2860308 160.7768723 [179,] 189.7951893 158.2860308 [180,] 35.3043478 189.7951893 [181,] -155.1864937 35.3043478 [182,] -36.6773352 -155.1864937 [183,] -207.1681767 -36.6773352 [184,] -18.6590182 -207.1681767 [185,] -129.1498597 -18.6590182 [186,] -90.6407012 -129.1498597 [187,] -27.1315427 -90.6407012 [188,] 134.3776158 -27.1315427 [189,] 266.8867743 134.3776158 [190,] 430.3959328 266.8867743 [191,] 457.9050913 430.3959328 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -335.0116347 -157.5207932 2 -334.5024762 -335.0116347 3 -454.9933177 -334.5024762 4 -206.4841592 -454.9933177 5 -325.9750007 -206.4841592 6 -276.4658422 -325.9750007 7 -203.9566837 -276.4658422 8 -253.4475252 -203.9566837 9 -177.9383667 -253.4475252 10 322.5707918 -177.9383667 11 320.0799503 322.5707918 12 -74.4108912 320.0799503 13 -59.9017327 -74.4108912 14 -106.3925742 -59.9017327 15 -263.8834157 -106.3925742 16 -245.3742572 -263.8834157 17 -298.8650987 -245.3742572 18 -12.3559402 -298.8650987 19 -15.8467817 -12.3559402 20 -95.3376232 -15.8467817 21 195.1715353 -95.3376232 22 430.6806938 195.1715353 23 668.1898523 430.6806938 24 221.6990108 668.1898523 25 -151.7918308 221.6990108 26 -112.2826723 -151.7918308 27 -180.7735138 -112.2826723 28 2.7356447 -180.7735138 29 -54.7551968 2.7356447 30 -4.2460383 -54.7551968 31 128.2631202 -4.2460383 32 -177.2277213 128.2631202 33 197.2814372 -177.2277213 34 439.7905957 197.2814372 35 400.2997542 439.7905957 36 289.8089127 400.2997542 37 -20.6819288 289.8089127 38 47.8272297 -20.6819288 39 -216.6636118 47.8272297 40 191.8455467 -216.6636118 41 70.3547052 191.8455467 42 183.8638637 70.3547052 43 -90.6269778 183.8638637 44 -0.1178193 -90.6269778 45 199.3913392 -0.1178193 46 621.9004977 199.3913392 47 880.4096562 621.9004977 48 324.9188147 880.4096562 49 192.4279732 324.9188147 50 -92.0628683 192.4279732 51 173.4462902 -92.0628683 52 236.9554487 173.4462902 53 48.4646072 236.9554487 54 248.9737657 48.4646072 55 150.4829242 248.9737657 56 323.9920827 150.4829242 57 321.5012412 323.9920827 58 361.0103997 321.5012412 59 394.5195582 361.0103997 60 -145.9712833 394.5195582 61 -249.4621248 -145.9712833 62 -202.9529663 -249.4621248 63 -367.4438078 -202.9529663 64 -16.9346493 -367.4438078 65 51.5745092 -16.9346493 66 34.0836677 51.5745092 67 143.5928262 34.0836677 68 262.1019847 143.5928262 69 336.6111432 262.1019847 70 353.1203017 336.6111432 71 313.6294602 353.1203017 72 -158.8613813 313.6294602 73 -378.3522228 -158.8613813 74 -80.8430643 -378.3522228 75 -349.3339058 -80.8430643 76 -210.8247473 -349.3339058 77 -307.3155888 -210.8247473 78 -284.8064303 -307.3155888 79 -182.2972718 -284.8064303 80 -67.7881133 -182.2972718 81 -161.2789548 -67.7881133 82 184.2302037 -161.2789548 83 479.7393622 184.2302037 84 -244.7514793 479.7393622 85 -61.2423208 -244.7514793 86 -307.7331623 -61.2423208 87 -318.2240038 -307.7331623 88 -181.7148453 -318.2240038 89 -401.2056868 -181.7148453 90 -182.6965283 -401.2056868 91 -380.1873698 -182.6965283 92 -78.6782113 -380.1873698 93 43.8309472 -78.6782113 94 255.3401057 43.8309472 95 572.8492642 255.3401057 96 -51.6415773 572.8492642 97 -297.1324188 -51.6415773 98 -285.6232603 -297.1324188 99 -292.1141018 -285.6232603 100 -299.6049433 -292.1141018 101 -172.0957848 -299.6049433 102 -162.5866263 -172.0957848 103 -46.0774678 -162.5866263 104 -172.5683093 -46.0774678 105 -1.0591508 -172.5683093 106 315.4500077 -1.0591508 107 531.9591662 315.4500077 108 274.4683247 531.9591662 109 -218.0225168 274.4683247 110 -115.5133583 -218.0225168 111 -218.0041998 -115.5133583 112 -229.4950413 -218.0041998 113 -51.9858828 -229.4950413 114 -15.4767243 -51.9858828 115 -32.9675658 -15.4767243 116 -26.4584073 -32.9675658 117 15.0507512 -26.4584073 118 383.5599097 15.0507512 119 597.0690682 383.5599097 120 149.5782267 597.0690682 121 -216.9126148 149.5782267 122 101.5965437 -216.9126148 123 -197.8942978 101.5965437 124 -101.3851393 -197.8942978 125 -224.8759808 -101.3851393 126 -227.3668223 -224.8759808 127 -98.8576638 -227.3668223 128 -6.3485053 -98.8576638 129 3.1606532 -6.3485053 130 367.6698117 3.1606532 131 560.1789702 367.6698117 132 19.6881287 560.1789702 133 -282.8027128 19.6881287 134 -136.2935543 -282.8027128 135 -280.7843958 -136.2935543 136 -186.2752373 -280.7843958 137 -115.7660788 -186.2752373 138 -176.2569203 -115.7660788 139 -82.7477618 -176.2569203 140 -85.2386033 -82.7477618 141 195.2705552 -85.2386033 142 106.7797137 195.2705552 143 312.2888722 106.7797137 144 -153.2019693 312.2888722 145 -167.6928108 -153.2019693 146 -82.1836523 -167.6928108 147 -218.6744938 -82.1836523 148 -99.1653353 -218.6744938 149 -234.6561768 -99.1653353 150 22.8529817 -234.6561768 151 -106.6378598 22.8529817 152 65.8712987 -106.6378598 153 324.3804572 65.8712987 154 255.8896157 324.3804572 155 115.3987742 255.8896157 156 -153.0920673 115.3987742 157 -162.5829088 -153.0920673 158 -150.0737503 -162.5829088 159 -239.5645918 -150.0737503 160 -116.0554333 -239.5645918 161 -43.5462748 -116.0554333 162 -112.0371163 -43.5462748 163 85.4720422 -112.0371163 164 -3.0187993 85.4720422 165 254.4903592 -3.0187993 166 403.9995177 254.4903592 167 486.5086762 403.9995177 168 -96.9821653 486.5086762 169 -281.2963957 -96.9821653 170 -118.7872372 -281.2963957 171 -167.2780787 -118.7872372 172 -97.7689202 -167.2780787 173 -256.2597617 -97.7689202 174 -156.7506032 -256.2597617 175 -190.2414447 -156.7506032 176 99.2677138 -190.2414447 177 160.7768723 99.2677138 178 158.2860308 160.7768723 179 189.7951893 158.2860308 180 35.3043478 189.7951893 181 -155.1864937 35.3043478 182 -36.6773352 -155.1864937 183 -207.1681767 -36.6773352 184 -18.6590182 -207.1681767 185 -129.1498597 -18.6590182 186 -90.6407012 -129.1498597 187 -27.1315427 -90.6407012 188 134.3776158 -27.1315427 189 266.8867743 134.3776158 190 430.3959328 266.8867743 191 457.9050913 430.3959328 > plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals') > lines(lowess(z)) > abline(lm(z)) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/7508k1227522804.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/8fmi21227522804.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/98cxa1227522804.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/10v4h71227522804.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variable',header=TRUE) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE) > a<-table.element(a,'2-tail p-value',header=TRUE) > a<-table.element(a,'1-tail p-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:k){ + a<-table.row.start(a) + a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE) + a<-table.element(a,mysum$coefficients[i,1]) + a<-table.element(a, round(mysum$coefficients[i,2],6)) + a<-table.element(a, round(mysum$coefficients[i,3],4)) + a<-table.element(a, round(mysum$coefficients[i,4],6)) + a<-table.element(a, round(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/11dimo1227522804.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R',1,TRUE) > a<-table.element(a, sqrt(mysum$r.squared)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, mysum$r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, mysum$adj.r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, mysum$fstatistic[1]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3])) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Standard Deviation',1,TRUE) > a<-table.element(a, mysum$sigma) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, sum(myerror*myerror)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/12z3yv1227522804.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Time or Index', 1, TRUE) > a<-table.element(a, 'Actuals', 1, TRUE) > a<-table.element(a, 'Interpolation
Forecast', 1, TRUE) > a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE) > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,i, 1, TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]-mysum$resid[i]) + a<-table.element(a,mysum$resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/13r5lz1227522804.tab") > > system("convert tmp/1psov1227522804.ps tmp/1psov1227522804.png") > system("convert tmp/2v9hv1227522804.ps tmp/2v9hv1227522804.png") > system("convert tmp/3t6hk1227522804.ps tmp/3t6hk1227522804.png") > system("convert tmp/48ut91227522804.ps tmp/48ut91227522804.png") > system("convert tmp/5bpn31227522804.ps tmp/5bpn31227522804.png") > system("convert tmp/6qz711227522804.ps tmp/6qz711227522804.png") > system("convert tmp/7508k1227522804.ps tmp/7508k1227522804.png") > system("convert tmp/8fmi21227522804.ps tmp/8fmi21227522804.png") > system("convert tmp/98cxa1227522804.ps tmp/98cxa1227522804.png") > > > proc.time() user system elapsed 4.987 2.748 5.333