R version 2.8.0 (2008-10-20) 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('Slachtoffer/maand' + ,'Dumivariabele') + ,1:192)) > y <- array(NA,dim=c(2,192),dimnames=list(c('Slachtoffer/maand','Dumivariabele'),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 = 'No 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 Slachtoffer/maand Dumivariabele 1 1687 0 2 1508 0 3 1507 0 4 1385 0 5 1632 0 6 1511 0 7 1559 0 8 1630 0 9 1579 0 10 1653 0 11 2152 0 12 2148 0 13 1752 0 14 1765 0 15 1717 0 16 1558 0 17 1575 0 18 1520 0 19 1805 0 20 1800 0 21 1719 0 22 2008 0 23 2242 0 24 2478 0 25 2030 0 26 1655 0 27 1693 0 28 1623 0 29 1805 0 30 1746 0 31 1795 0 32 1926 0 33 1619 0 34 1992 0 35 2233 0 36 2192 0 37 2080 0 38 1768 0 39 1835 0 40 1569 0 41 1976 0 42 1853 0 43 1965 0 44 1689 0 45 1778 0 46 1976 0 47 2397 0 48 2654 0 49 2097 0 50 1963 0 51 1677 0 52 1941 0 53 2003 0 54 1813 0 55 2012 0 56 1912 0 57 2084 0 58 2080 0 59 2118 0 60 2150 0 61 1608 0 62 1503 0 63 1548 0 64 1382 0 65 1731 0 66 1798 0 67 1779 0 68 1887 0 69 2004 0 70 2077 0 71 2092 0 72 2051 0 73 1577 0 74 1356 0 75 1652 0 76 1382 0 77 1519 0 78 1421 0 79 1442 0 80 1543 0 81 1656 0 82 1561 0 83 1905 0 84 2199 0 85 1473 0 86 1655 0 87 1407 0 88 1395 0 89 1530 0 90 1309 0 91 1526 0 92 1327 0 93 1627 0 94 1748 0 95 1958 0 96 2274 0 97 1648 0 98 1401 0 99 1411 0 100 1403 0 101 1394 0 102 1520 0 103 1528 0 104 1643 0 105 1515 0 106 1685 0 107 2000 0 108 2215 0 109 1956 0 110 1462 0 111 1563 0 112 1459 0 113 1446 0 114 1622 0 115 1657 0 116 1638 0 117 1643 0 118 1683 0 119 2050 0 120 2262 0 121 1813 0 122 1445 0 123 1762 0 124 1461 0 125 1556 0 126 1431 0 127 1427 0 128 1554 0 129 1645 0 130 1653 0 131 2016 0 132 2207 0 133 1665 0 134 1361 0 135 1506 0 136 1360 0 137 1453 0 138 1522 0 139 1460 0 140 1552 0 141 1548 0 142 1827 0 143 1737 0 144 1941 0 145 1474 0 146 1458 0 147 1542 0 148 1404 0 149 1522 0 150 1385 0 151 1641 0 152 1510 0 153 1681 0 154 1938 0 155 1868 0 156 1726 0 157 1456 0 158 1445 0 159 1456 0 160 1365 0 161 1487 0 162 1558 0 163 1488 0 164 1684 0 165 1594 0 166 1850 0 167 1998 0 168 2079 0 169 1494 0 170 1057 1 171 1218 1 172 1168 1 173 1236 1 174 1076 1 175 1174 1 176 1139 1 177 1427 1 178 1487 1 179 1483 1 180 1513 1 181 1357 1 182 1165 1 183 1282 1 184 1110 1 185 1297 1 186 1185 1 187 1222 1 188 1284 1 189 1444 1 190 1575 1 191 1737 1 192 1763 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Dumivariabele 1717.8 -396.1 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -408.75 -198.00 -63.75 188.26 936.25 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1717.75 20.00 85.886 < 2e-16 *** Dumivariabele -396.06 57.79 -6.854 9.76e-11 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 260 on 190 degrees of freedom Multiple R-squared: 0.1982, Adjusted R-squared: 0.194 F-statistic: 46.97 on 1 and 190 DF, p-value: 9.763e-11 > postscript(file="/var/www/html/rcomp/tmp/1262j1228049951.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/2x8if1228049951.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/3o9a21228049951.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/4ln5x1228049951.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/5uclp1228049951.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 -30.7514793 -209.7514793 -210.7514793 -332.7514793 -85.7514793 -206.7514793 7 8 9 10 11 12 -158.7514793 -87.7514793 -138.7514793 -64.7514793 434.2485207 430.2485207 13 14 15 16 17 18 34.2485207 47.2485207 -0.7514793 -159.7514793 -142.7514793 -197.7514793 19 20 21 22 23 24 87.2485207 82.2485207 1.2485207 290.2485207 524.2485207 760.2485207 25 26 27 28 29 30 312.2485207 -62.7514793 -24.7514793 -94.7514793 87.2485207 28.2485207 31 32 33 34 35 36 77.2485207 208.2485207 -98.7514793 274.2485207 515.2485207 474.2485207 37 38 39 40 41 42 362.2485207 50.2485207 117.2485207 -148.7514793 258.2485207 135.2485207 43 44 45 46 47 48 247.2485207 -28.7514793 60.2485207 258.2485207 679.2485207 936.2485207 49 50 51 52 53 54 379.2485207 245.2485207 -40.7514793 223.2485207 285.2485207 95.2485207 55 56 57 58 59 60 294.2485207 194.2485207 366.2485207 362.2485207 400.2485207 432.2485207 61 62 63 64 65 66 -109.7514793 -214.7514793 -169.7514793 -335.7514793 13.2485207 80.2485207 67 68 69 70 71 72 61.2485207 169.2485207 286.2485207 359.2485207 374.2485207 333.2485207 73 74 75 76 77 78 -140.7514793 -361.7514793 -65.7514793 -335.7514793 -198.7514793 -296.7514793 79 80 81 82 83 84 -275.7514793 -174.7514793 -61.7514793 -156.7514793 187.2485207 481.2485207 85 86 87 88 89 90 -244.7514793 -62.7514793 -310.7514793 -322.7514793 -187.7514793 -408.7514793 91 92 93 94 95 96 -191.7514793 -390.7514793 -90.7514793 30.2485207 240.2485207 556.2485207 97 98 99 100 101 102 -69.7514793 -316.7514793 -306.7514793 -314.7514793 -323.7514793 -197.7514793 103 104 105 106 107 108 -189.7514793 -74.7514793 -202.7514793 -32.7514793 282.2485207 497.2485207 109 110 111 112 113 114 238.2485207 -255.7514793 -154.7514793 -258.7514793 -271.7514793 -95.7514793 115 116 117 118 119 120 -60.7514793 -79.7514793 -74.7514793 -34.7514793 332.2485207 544.2485207 121 122 123 124 125 126 95.2485207 -272.7514793 44.2485207 -256.7514793 -161.7514793 -286.7514793 127 128 129 130 131 132 -290.7514793 -163.7514793 -72.7514793 -64.7514793 298.2485207 489.2485207 133 134 135 136 137 138 -52.7514793 -356.7514793 -211.7514793 -357.7514793 -264.7514793 -195.7514793 139 140 141 142 143 144 -257.7514793 -165.7514793 -169.7514793 109.2485207 19.2485207 223.2485207 145 146 147 148 149 150 -243.7514793 -259.7514793 -175.7514793 -313.7514793 -195.7514793 -332.7514793 151 152 153 154 155 156 -76.7514793 -207.7514793 -36.7514793 220.2485207 150.2485207 8.2485207 157 158 159 160 161 162 -261.7514793 -272.7514793 -261.7514793 -352.7514793 -230.7514793 -159.7514793 163 164 165 166 167 168 -229.7514793 -33.7514793 -123.7514793 132.2485207 280.2485207 361.2485207 169 170 171 172 173 174 -223.7514793 -264.6956522 -103.6956522 -153.6956522 -85.6956522 -245.6956522 175 176 177 178 179 180 -147.6956522 -182.6956522 105.3043478 165.3043478 161.3043478 191.3043478 181 182 183 184 185 186 35.3043478 -156.6956522 -39.6956522 -211.6956522 -24.6956522 -136.6956522 187 188 189 190 191 192 -99.6956522 -37.6956522 122.3043478 253.3043478 415.3043478 441.3043478 > postscript(file="/var/www/html/rcomp/tmp/6hhe51228049951.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 -30.7514793 NA 1 -209.7514793 -30.7514793 2 -210.7514793 -209.7514793 3 -332.7514793 -210.7514793 4 -85.7514793 -332.7514793 5 -206.7514793 -85.7514793 6 -158.7514793 -206.7514793 7 -87.7514793 -158.7514793 8 -138.7514793 -87.7514793 9 -64.7514793 -138.7514793 10 434.2485207 -64.7514793 11 430.2485207 434.2485207 12 34.2485207 430.2485207 13 47.2485207 34.2485207 14 -0.7514793 47.2485207 15 -159.7514793 -0.7514793 16 -142.7514793 -159.7514793 17 -197.7514793 -142.7514793 18 87.2485207 -197.7514793 19 82.2485207 87.2485207 20 1.2485207 82.2485207 21 290.2485207 1.2485207 22 524.2485207 290.2485207 23 760.2485207 524.2485207 24 312.2485207 760.2485207 25 -62.7514793 312.2485207 26 -24.7514793 -62.7514793 27 -94.7514793 -24.7514793 28 87.2485207 -94.7514793 29 28.2485207 87.2485207 30 77.2485207 28.2485207 31 208.2485207 77.2485207 32 -98.7514793 208.2485207 33 274.2485207 -98.7514793 34 515.2485207 274.2485207 35 474.2485207 515.2485207 36 362.2485207 474.2485207 37 50.2485207 362.2485207 38 117.2485207 50.2485207 39 -148.7514793 117.2485207 40 258.2485207 -148.7514793 41 135.2485207 258.2485207 42 247.2485207 135.2485207 43 -28.7514793 247.2485207 44 60.2485207 -28.7514793 45 258.2485207 60.2485207 46 679.2485207 258.2485207 47 936.2485207 679.2485207 48 379.2485207 936.2485207 49 245.2485207 379.2485207 50 -40.7514793 245.2485207 51 223.2485207 -40.7514793 52 285.2485207 223.2485207 53 95.2485207 285.2485207 54 294.2485207 95.2485207 55 194.2485207 294.2485207 56 366.2485207 194.2485207 57 362.2485207 366.2485207 58 400.2485207 362.2485207 59 432.2485207 400.2485207 60 -109.7514793 432.2485207 61 -214.7514793 -109.7514793 62 -169.7514793 -214.7514793 63 -335.7514793 -169.7514793 64 13.2485207 -335.7514793 65 80.2485207 13.2485207 66 61.2485207 80.2485207 67 169.2485207 61.2485207 68 286.2485207 169.2485207 69 359.2485207 286.2485207 70 374.2485207 359.2485207 71 333.2485207 374.2485207 72 -140.7514793 333.2485207 73 -361.7514793 -140.7514793 74 -65.7514793 -361.7514793 75 -335.7514793 -65.7514793 76 -198.7514793 -335.7514793 77 -296.7514793 -198.7514793 78 -275.7514793 -296.7514793 79 -174.7514793 -275.7514793 80 -61.7514793 -174.7514793 81 -156.7514793 -61.7514793 82 187.2485207 -156.7514793 83 481.2485207 187.2485207 84 -244.7514793 481.2485207 85 -62.7514793 -244.7514793 86 -310.7514793 -62.7514793 87 -322.7514793 -310.7514793 88 -187.7514793 -322.7514793 89 -408.7514793 -187.7514793 90 -191.7514793 -408.7514793 91 -390.7514793 -191.7514793 92 -90.7514793 -390.7514793 93 30.2485207 -90.7514793 94 240.2485207 30.2485207 95 556.2485207 240.2485207 96 -69.7514793 556.2485207 97 -316.7514793 -69.7514793 98 -306.7514793 -316.7514793 99 -314.7514793 -306.7514793 100 -323.7514793 -314.7514793 101 -197.7514793 -323.7514793 102 -189.7514793 -197.7514793 103 -74.7514793 -189.7514793 104 -202.7514793 -74.7514793 105 -32.7514793 -202.7514793 106 282.2485207 -32.7514793 107 497.2485207 282.2485207 108 238.2485207 497.2485207 109 -255.7514793 238.2485207 110 -154.7514793 -255.7514793 111 -258.7514793 -154.7514793 112 -271.7514793 -258.7514793 113 -95.7514793 -271.7514793 114 -60.7514793 -95.7514793 115 -79.7514793 -60.7514793 116 -74.7514793 -79.7514793 117 -34.7514793 -74.7514793 118 332.2485207 -34.7514793 119 544.2485207 332.2485207 120 95.2485207 544.2485207 121 -272.7514793 95.2485207 122 44.2485207 -272.7514793 123 -256.7514793 44.2485207 124 -161.7514793 -256.7514793 125 -286.7514793 -161.7514793 126 -290.7514793 -286.7514793 127 -163.7514793 -290.7514793 128 -72.7514793 -163.7514793 129 -64.7514793 -72.7514793 130 298.2485207 -64.7514793 131 489.2485207 298.2485207 132 -52.7514793 489.2485207 133 -356.7514793 -52.7514793 134 -211.7514793 -356.7514793 135 -357.7514793 -211.7514793 136 -264.7514793 -357.7514793 137 -195.7514793 -264.7514793 138 -257.7514793 -195.7514793 139 -165.7514793 -257.7514793 140 -169.7514793 -165.7514793 141 109.2485207 -169.7514793 142 19.2485207 109.2485207 143 223.2485207 19.2485207 144 -243.7514793 223.2485207 145 -259.7514793 -243.7514793 146 -175.7514793 -259.7514793 147 -313.7514793 -175.7514793 148 -195.7514793 -313.7514793 149 -332.7514793 -195.7514793 150 -76.7514793 -332.7514793 151 -207.7514793 -76.7514793 152 -36.7514793 -207.7514793 153 220.2485207 -36.7514793 154 150.2485207 220.2485207 155 8.2485207 150.2485207 156 -261.7514793 8.2485207 157 -272.7514793 -261.7514793 158 -261.7514793 -272.7514793 159 -352.7514793 -261.7514793 160 -230.7514793 -352.7514793 161 -159.7514793 -230.7514793 162 -229.7514793 -159.7514793 163 -33.7514793 -229.7514793 164 -123.7514793 -33.7514793 165 132.2485207 -123.7514793 166 280.2485207 132.2485207 167 361.2485207 280.2485207 168 -223.7514793 361.2485207 169 -264.6956522 -223.7514793 170 -103.6956522 -264.6956522 171 -153.6956522 -103.6956522 172 -85.6956522 -153.6956522 173 -245.6956522 -85.6956522 174 -147.6956522 -245.6956522 175 -182.6956522 -147.6956522 176 105.3043478 -182.6956522 177 165.3043478 105.3043478 178 161.3043478 165.3043478 179 191.3043478 161.3043478 180 35.3043478 191.3043478 181 -156.6956522 35.3043478 182 -39.6956522 -156.6956522 183 -211.6956522 -39.6956522 184 -24.6956522 -211.6956522 185 -136.6956522 -24.6956522 186 -99.6956522 -136.6956522 187 -37.6956522 -99.6956522 188 122.3043478 -37.6956522 189 253.3043478 122.3043478 190 415.3043478 253.3043478 191 441.3043478 415.3043478 192 NA 441.3043478 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -209.7514793 -30.7514793 [2,] -210.7514793 -209.7514793 [3,] -332.7514793 -210.7514793 [4,] -85.7514793 -332.7514793 [5,] -206.7514793 -85.7514793 [6,] -158.7514793 -206.7514793 [7,] -87.7514793 -158.7514793 [8,] -138.7514793 -87.7514793 [9,] -64.7514793 -138.7514793 [10,] 434.2485207 -64.7514793 [11,] 430.2485207 434.2485207 [12,] 34.2485207 430.2485207 [13,] 47.2485207 34.2485207 [14,] -0.7514793 47.2485207 [15,] -159.7514793 -0.7514793 [16,] -142.7514793 -159.7514793 [17,] -197.7514793 -142.7514793 [18,] 87.2485207 -197.7514793 [19,] 82.2485207 87.2485207 [20,] 1.2485207 82.2485207 [21,] 290.2485207 1.2485207 [22,] 524.2485207 290.2485207 [23,] 760.2485207 524.2485207 [24,] 312.2485207 760.2485207 [25,] -62.7514793 312.2485207 [26,] -24.7514793 -62.7514793 [27,] -94.7514793 -24.7514793 [28,] 87.2485207 -94.7514793 [29,] 28.2485207 87.2485207 [30,] 77.2485207 28.2485207 [31,] 208.2485207 77.2485207 [32,] -98.7514793 208.2485207 [33,] 274.2485207 -98.7514793 [34,] 515.2485207 274.2485207 [35,] 474.2485207 515.2485207 [36,] 362.2485207 474.2485207 [37,] 50.2485207 362.2485207 [38,] 117.2485207 50.2485207 [39,] -148.7514793 117.2485207 [40,] 258.2485207 -148.7514793 [41,] 135.2485207 258.2485207 [42,] 247.2485207 135.2485207 [43,] -28.7514793 247.2485207 [44,] 60.2485207 -28.7514793 [45,] 258.2485207 60.2485207 [46,] 679.2485207 258.2485207 [47,] 936.2485207 679.2485207 [48,] 379.2485207 936.2485207 [49,] 245.2485207 379.2485207 [50,] -40.7514793 245.2485207 [51,] 223.2485207 -40.7514793 [52,] 285.2485207 223.2485207 [53,] 95.2485207 285.2485207 [54,] 294.2485207 95.2485207 [55,] 194.2485207 294.2485207 [56,] 366.2485207 194.2485207 [57,] 362.2485207 366.2485207 [58,] 400.2485207 362.2485207 [59,] 432.2485207 400.2485207 [60,] -109.7514793 432.2485207 [61,] -214.7514793 -109.7514793 [62,] -169.7514793 -214.7514793 [63,] -335.7514793 -169.7514793 [64,] 13.2485207 -335.7514793 [65,] 80.2485207 13.2485207 [66,] 61.2485207 80.2485207 [67,] 169.2485207 61.2485207 [68,] 286.2485207 169.2485207 [69,] 359.2485207 286.2485207 [70,] 374.2485207 359.2485207 [71,] 333.2485207 374.2485207 [72,] -140.7514793 333.2485207 [73,] -361.7514793 -140.7514793 [74,] -65.7514793 -361.7514793 [75,] -335.7514793 -65.7514793 [76,] -198.7514793 -335.7514793 [77,] -296.7514793 -198.7514793 [78,] -275.7514793 -296.7514793 [79,] -174.7514793 -275.7514793 [80,] -61.7514793 -174.7514793 [81,] -156.7514793 -61.7514793 [82,] 187.2485207 -156.7514793 [83,] 481.2485207 187.2485207 [84,] -244.7514793 481.2485207 [85,] -62.7514793 -244.7514793 [86,] -310.7514793 -62.7514793 [87,] -322.7514793 -310.7514793 [88,] -187.7514793 -322.7514793 [89,] -408.7514793 -187.7514793 [90,] -191.7514793 -408.7514793 [91,] -390.7514793 -191.7514793 [92,] -90.7514793 -390.7514793 [93,] 30.2485207 -90.7514793 [94,] 240.2485207 30.2485207 [95,] 556.2485207 240.2485207 [96,] -69.7514793 556.2485207 [97,] -316.7514793 -69.7514793 [98,] -306.7514793 -316.7514793 [99,] -314.7514793 -306.7514793 [100,] -323.7514793 -314.7514793 [101,] -197.7514793 -323.7514793 [102,] -189.7514793 -197.7514793 [103,] -74.7514793 -189.7514793 [104,] -202.7514793 -74.7514793 [105,] -32.7514793 -202.7514793 [106,] 282.2485207 -32.7514793 [107,] 497.2485207 282.2485207 [108,] 238.2485207 497.2485207 [109,] -255.7514793 238.2485207 [110,] -154.7514793 -255.7514793 [111,] -258.7514793 -154.7514793 [112,] -271.7514793 -258.7514793 [113,] -95.7514793 -271.7514793 [114,] -60.7514793 -95.7514793 [115,] -79.7514793 -60.7514793 [116,] -74.7514793 -79.7514793 [117,] -34.7514793 -74.7514793 [118,] 332.2485207 -34.7514793 [119,] 544.2485207 332.2485207 [120,] 95.2485207 544.2485207 [121,] -272.7514793 95.2485207 [122,] 44.2485207 -272.7514793 [123,] -256.7514793 44.2485207 [124,] -161.7514793 -256.7514793 [125,] -286.7514793 -161.7514793 [126,] -290.7514793 -286.7514793 [127,] -163.7514793 -290.7514793 [128,] -72.7514793 -163.7514793 [129,] -64.7514793 -72.7514793 [130,] 298.2485207 -64.7514793 [131,] 489.2485207 298.2485207 [132,] -52.7514793 489.2485207 [133,] -356.7514793 -52.7514793 [134,] -211.7514793 -356.7514793 [135,] -357.7514793 -211.7514793 [136,] -264.7514793 -357.7514793 [137,] -195.7514793 -264.7514793 [138,] -257.7514793 -195.7514793 [139,] -165.7514793 -257.7514793 [140,] -169.7514793 -165.7514793 [141,] 109.2485207 -169.7514793 [142,] 19.2485207 109.2485207 [143,] 223.2485207 19.2485207 [144,] -243.7514793 223.2485207 [145,] -259.7514793 -243.7514793 [146,] -175.7514793 -259.7514793 [147,] -313.7514793 -175.7514793 [148,] -195.7514793 -313.7514793 [149,] -332.7514793 -195.7514793 [150,] -76.7514793 -332.7514793 [151,] -207.7514793 -76.7514793 [152,] -36.7514793 -207.7514793 [153,] 220.2485207 -36.7514793 [154,] 150.2485207 220.2485207 [155,] 8.2485207 150.2485207 [156,] -261.7514793 8.2485207 [157,] -272.7514793 -261.7514793 [158,] -261.7514793 -272.7514793 [159,] -352.7514793 -261.7514793 [160,] -230.7514793 -352.7514793 [161,] -159.7514793 -230.7514793 [162,] -229.7514793 -159.7514793 [163,] -33.7514793 -229.7514793 [164,] -123.7514793 -33.7514793 [165,] 132.2485207 -123.7514793 [166,] 280.2485207 132.2485207 [167,] 361.2485207 280.2485207 [168,] -223.7514793 361.2485207 [169,] -264.6956522 -223.7514793 [170,] -103.6956522 -264.6956522 [171,] -153.6956522 -103.6956522 [172,] -85.6956522 -153.6956522 [173,] -245.6956522 -85.6956522 [174,] -147.6956522 -245.6956522 [175,] -182.6956522 -147.6956522 [176,] 105.3043478 -182.6956522 [177,] 165.3043478 105.3043478 [178,] 161.3043478 165.3043478 [179,] 191.3043478 161.3043478 [180,] 35.3043478 191.3043478 [181,] -156.6956522 35.3043478 [182,] -39.6956522 -156.6956522 [183,] -211.6956522 -39.6956522 [184,] -24.6956522 -211.6956522 [185,] -136.6956522 -24.6956522 [186,] -99.6956522 -136.6956522 [187,] -37.6956522 -99.6956522 [188,] 122.3043478 -37.6956522 [189,] 253.3043478 122.3043478 [190,] 415.3043478 253.3043478 [191,] 441.3043478 415.3043478 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -209.7514793 -30.7514793 2 -210.7514793 -209.7514793 3 -332.7514793 -210.7514793 4 -85.7514793 -332.7514793 5 -206.7514793 -85.7514793 6 -158.7514793 -206.7514793 7 -87.7514793 -158.7514793 8 -138.7514793 -87.7514793 9 -64.7514793 -138.7514793 10 434.2485207 -64.7514793 11 430.2485207 434.2485207 12 34.2485207 430.2485207 13 47.2485207 34.2485207 14 -0.7514793 47.2485207 15 -159.7514793 -0.7514793 16 -142.7514793 -159.7514793 17 -197.7514793 -142.7514793 18 87.2485207 -197.7514793 19 82.2485207 87.2485207 20 1.2485207 82.2485207 21 290.2485207 1.2485207 22 524.2485207 290.2485207 23 760.2485207 524.2485207 24 312.2485207 760.2485207 25 -62.7514793 312.2485207 26 -24.7514793 -62.7514793 27 -94.7514793 -24.7514793 28 87.2485207 -94.7514793 29 28.2485207 87.2485207 30 77.2485207 28.2485207 31 208.2485207 77.2485207 32 -98.7514793 208.2485207 33 274.2485207 -98.7514793 34 515.2485207 274.2485207 35 474.2485207 515.2485207 36 362.2485207 474.2485207 37 50.2485207 362.2485207 38 117.2485207 50.2485207 39 -148.7514793 117.2485207 40 258.2485207 -148.7514793 41 135.2485207 258.2485207 42 247.2485207 135.2485207 43 -28.7514793 247.2485207 44 60.2485207 -28.7514793 45 258.2485207 60.2485207 46 679.2485207 258.2485207 47 936.2485207 679.2485207 48 379.2485207 936.2485207 49 245.2485207 379.2485207 50 -40.7514793 245.2485207 51 223.2485207 -40.7514793 52 285.2485207 223.2485207 53 95.2485207 285.2485207 54 294.2485207 95.2485207 55 194.2485207 294.2485207 56 366.2485207 194.2485207 57 362.2485207 366.2485207 58 400.2485207 362.2485207 59 432.2485207 400.2485207 60 -109.7514793 432.2485207 61 -214.7514793 -109.7514793 62 -169.7514793 -214.7514793 63 -335.7514793 -169.7514793 64 13.2485207 -335.7514793 65 80.2485207 13.2485207 66 61.2485207 80.2485207 67 169.2485207 61.2485207 68 286.2485207 169.2485207 69 359.2485207 286.2485207 70 374.2485207 359.2485207 71 333.2485207 374.2485207 72 -140.7514793 333.2485207 73 -361.7514793 -140.7514793 74 -65.7514793 -361.7514793 75 -335.7514793 -65.7514793 76 -198.7514793 -335.7514793 77 -296.7514793 -198.7514793 78 -275.7514793 -296.7514793 79 -174.7514793 -275.7514793 80 -61.7514793 -174.7514793 81 -156.7514793 -61.7514793 82 187.2485207 -156.7514793 83 481.2485207 187.2485207 84 -244.7514793 481.2485207 85 -62.7514793 -244.7514793 86 -310.7514793 -62.7514793 87 -322.7514793 -310.7514793 88 -187.7514793 -322.7514793 89 -408.7514793 -187.7514793 90 -191.7514793 -408.7514793 91 -390.7514793 -191.7514793 92 -90.7514793 -390.7514793 93 30.2485207 -90.7514793 94 240.2485207 30.2485207 95 556.2485207 240.2485207 96 -69.7514793 556.2485207 97 -316.7514793 -69.7514793 98 -306.7514793 -316.7514793 99 -314.7514793 -306.7514793 100 -323.7514793 -314.7514793 101 -197.7514793 -323.7514793 102 -189.7514793 -197.7514793 103 -74.7514793 -189.7514793 104 -202.7514793 -74.7514793 105 -32.7514793 -202.7514793 106 282.2485207 -32.7514793 107 497.2485207 282.2485207 108 238.2485207 497.2485207 109 -255.7514793 238.2485207 110 -154.7514793 -255.7514793 111 -258.7514793 -154.7514793 112 -271.7514793 -258.7514793 113 -95.7514793 -271.7514793 114 -60.7514793 -95.7514793 115 -79.7514793 -60.7514793 116 -74.7514793 -79.7514793 117 -34.7514793 -74.7514793 118 332.2485207 -34.7514793 119 544.2485207 332.2485207 120 95.2485207 544.2485207 121 -272.7514793 95.2485207 122 44.2485207 -272.7514793 123 -256.7514793 44.2485207 124 -161.7514793 -256.7514793 125 -286.7514793 -161.7514793 126 -290.7514793 -286.7514793 127 -163.7514793 -290.7514793 128 -72.7514793 -163.7514793 129 -64.7514793 -72.7514793 130 298.2485207 -64.7514793 131 489.2485207 298.2485207 132 -52.7514793 489.2485207 133 -356.7514793 -52.7514793 134 -211.7514793 -356.7514793 135 -357.7514793 -211.7514793 136 -264.7514793 -357.7514793 137 -195.7514793 -264.7514793 138 -257.7514793 -195.7514793 139 -165.7514793 -257.7514793 140 -169.7514793 -165.7514793 141 109.2485207 -169.7514793 142 19.2485207 109.2485207 143 223.2485207 19.2485207 144 -243.7514793 223.2485207 145 -259.7514793 -243.7514793 146 -175.7514793 -259.7514793 147 -313.7514793 -175.7514793 148 -195.7514793 -313.7514793 149 -332.7514793 -195.7514793 150 -76.7514793 -332.7514793 151 -207.7514793 -76.7514793 152 -36.7514793 -207.7514793 153 220.2485207 -36.7514793 154 150.2485207 220.2485207 155 8.2485207 150.2485207 156 -261.7514793 8.2485207 157 -272.7514793 -261.7514793 158 -261.7514793 -272.7514793 159 -352.7514793 -261.7514793 160 -230.7514793 -352.7514793 161 -159.7514793 -230.7514793 162 -229.7514793 -159.7514793 163 -33.7514793 -229.7514793 164 -123.7514793 -33.7514793 165 132.2485207 -123.7514793 166 280.2485207 132.2485207 167 361.2485207 280.2485207 168 -223.7514793 361.2485207 169 -264.6956522 -223.7514793 170 -103.6956522 -264.6956522 171 -153.6956522 -103.6956522 172 -85.6956522 -153.6956522 173 -245.6956522 -85.6956522 174 -147.6956522 -245.6956522 175 -182.6956522 -147.6956522 176 105.3043478 -182.6956522 177 165.3043478 105.3043478 178 161.3043478 165.3043478 179 191.3043478 161.3043478 180 35.3043478 191.3043478 181 -156.6956522 35.3043478 182 -39.6956522 -156.6956522 183 -211.6956522 -39.6956522 184 -24.6956522 -211.6956522 185 -136.6956522 -24.6956522 186 -99.6956522 -136.6956522 187 -37.6956522 -99.6956522 188 122.3043478 -37.6956522 189 253.3043478 122.3043478 190 415.3043478 253.3043478 191 441.3043478 415.3043478 > 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/7dok51228049951.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/8dnoc1228049951.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/9vl3m1228049951.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/10y5fj1228049951.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/11k8sg1228049951.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/12jz761228049951.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/133kmi1228049951.tab") > > system("convert tmp/1262j1228049951.ps tmp/1262j1228049951.png") > system("convert tmp/2x8if1228049951.ps tmp/2x8if1228049951.png") > system("convert tmp/3o9a21228049951.ps tmp/3o9a21228049951.png") > system("convert tmp/4ln5x1228049951.ps tmp/4ln5x1228049951.png") > system("convert tmp/5uclp1228049951.ps tmp/5uclp1228049951.png") > system("convert tmp/6hhe51228049951.ps tmp/6hhe51228049951.png") > system("convert tmp/7dok51228049951.ps tmp/7dok51228049951.png") > system("convert tmp/8dnoc1228049951.ps tmp/8dnoc1228049951.png") > system("convert tmp/9vl3m1228049951.ps tmp/9vl3m1228049951.png") > > > proc.time() user system elapsed 2.530 1.575 2.957