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(92.7,0,105.2,0,91.5,0,75.3,0,60.5,0,80.4,0,84.5,0,93.9,0,78,0,92.3,0,90,0,72.1,0,76.9,0,76,0,88.7,0,55.4,0,46.6,0,90.9,0,84.9,0,89,0,90.2,0,72.3,0,83,0,71.6,0,75.4,0,85.1,0,81.2,0,68.7,0,68.4,0,93.7,0,96.6,0,101.8,0,93.6,0,88.9,0,114.1,0,82.3,0,96.4,0,104,0,88.2,0,85.2,0,87.1,0,85.5,0,89.1,0,105.2,0,82.9,0,86.8,0,112,0,97.4,0,88.9,0,109.4,0,87.8,0,90.5,0,79.3,0,114.9,0,118.8,0,125,0,96.1,0,116.7,0,119.5,0,104.1,0,121,0,127.3,0,117.7,0,108,0,89.4,0,137.4,1,142,1,137.3,1,122.8,1,126.1,1,147.6,1,115.7,1,139.2,1,151.2,1,123.8,1,109,1,112.1,1,136.4,1,135.5,1,138.7,1,137.5,1,141.5,1,143.6,1,146.5,1,200.7,1),dim=c(2,85),dimnames=list(c('L&S','D'),1:85)) > y <- array(NA,dim=c(2,85),dimnames=list(c('L&S','D'),1:85)) > 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 = 'Include Monthly 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 L&S D M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 92.7 0 1 0 0 0 0 0 0 0 0 0 0 1 2 105.2 0 0 1 0 0 0 0 0 0 0 0 0 2 3 91.5 0 0 0 1 0 0 0 0 0 0 0 0 3 4 75.3 0 0 0 0 1 0 0 0 0 0 0 0 4 5 60.5 0 0 0 0 0 1 0 0 0 0 0 0 5 6 80.4 0 0 0 0 0 0 1 0 0 0 0 0 6 7 84.5 0 0 0 0 0 0 0 1 0 0 0 0 7 8 93.9 0 0 0 0 0 0 0 0 1 0 0 0 8 9 78.0 0 0 0 0 0 0 0 0 0 1 0 0 9 10 92.3 0 0 0 0 0 0 0 0 0 0 1 0 10 11 90.0 0 0 0 0 0 0 0 0 0 0 0 1 11 12 72.1 0 0 0 0 0 0 0 0 0 0 0 0 12 13 76.9 0 1 0 0 0 0 0 0 0 0 0 0 13 14 76.0 0 0 1 0 0 0 0 0 0 0 0 0 14 15 88.7 0 0 0 1 0 0 0 0 0 0 0 0 15 16 55.4 0 0 0 0 1 0 0 0 0 0 0 0 16 17 46.6 0 0 0 0 0 1 0 0 0 0 0 0 17 18 90.9 0 0 0 0 0 0 1 0 0 0 0 0 18 19 84.9 0 0 0 0 0 0 0 1 0 0 0 0 19 20 89.0 0 0 0 0 0 0 0 0 1 0 0 0 20 21 90.2 0 0 0 0 0 0 0 0 0 1 0 0 21 22 72.3 0 0 0 0 0 0 0 0 0 0 1 0 22 23 83.0 0 0 0 0 0 0 0 0 0 0 0 1 23 24 71.6 0 0 0 0 0 0 0 0 0 0 0 0 24 25 75.4 0 1 0 0 0 0 0 0 0 0 0 0 25 26 85.1 0 0 1 0 0 0 0 0 0 0 0 0 26 27 81.2 0 0 0 1 0 0 0 0 0 0 0 0 27 28 68.7 0 0 0 0 1 0 0 0 0 0 0 0 28 29 68.4 0 0 0 0 0 1 0 0 0 0 0 0 29 30 93.7 0 0 0 0 0 0 1 0 0 0 0 0 30 31 96.6 0 0 0 0 0 0 0 1 0 0 0 0 31 32 101.8 0 0 0 0 0 0 0 0 1 0 0 0 32 33 93.6 0 0 0 0 0 0 0 0 0 1 0 0 33 34 88.9 0 0 0 0 0 0 0 0 0 0 1 0 34 35 114.1 0 0 0 0 0 0 0 0 0 0 0 1 35 36 82.3 0 0 0 0 0 0 0 0 0 0 0 0 36 37 96.4 0 1 0 0 0 0 0 0 0 0 0 0 37 38 104.0 0 0 1 0 0 0 0 0 0 0 0 0 38 39 88.2 0 0 0 1 0 0 0 0 0 0 0 0 39 40 85.2 0 0 0 0 1 0 0 0 0 0 0 0 40 41 87.1 0 0 0 0 0 1 0 0 0 0 0 0 41 42 85.5 0 0 0 0 0 0 1 0 0 0 0 0 42 43 89.1 0 0 0 0 0 0 0 1 0 0 0 0 43 44 105.2 0 0 0 0 0 0 0 0 1 0 0 0 44 45 82.9 0 0 0 0 0 0 0 0 0 1 0 0 45 46 86.8 0 0 0 0 0 0 0 0 0 0 1 0 46 47 112.0 0 0 0 0 0 0 0 0 0 0 0 1 47 48 97.4 0 0 0 0 0 0 0 0 0 0 0 0 48 49 88.9 0 1 0 0 0 0 0 0 0 0 0 0 49 50 109.4 0 0 1 0 0 0 0 0 0 0 0 0 50 51 87.8 0 0 0 1 0 0 0 0 0 0 0 0 51 52 90.5 0 0 0 0 1 0 0 0 0 0 0 0 52 53 79.3 0 0 0 0 0 1 0 0 0 0 0 0 53 54 114.9 0 0 0 0 0 0 1 0 0 0 0 0 54 55 118.8 0 0 0 0 0 0 0 1 0 0 0 0 55 56 125.0 0 0 0 0 0 0 0 0 1 0 0 0 56 57 96.1 0 0 0 0 0 0 0 0 0 1 0 0 57 58 116.7 0 0 0 0 0 0 0 0 0 0 1 0 58 59 119.5 0 0 0 0 0 0 0 0 0 0 0 1 59 60 104.1 0 0 0 0 0 0 0 0 0 0 0 0 60 61 121.0 0 1 0 0 0 0 0 0 0 0 0 0 61 62 127.3 0 0 1 0 0 0 0 0 0 0 0 0 62 63 117.7 0 0 0 1 0 0 0 0 0 0 0 0 63 64 108.0 0 0 0 0 1 0 0 0 0 0 0 0 64 65 89.4 0 0 0 0 0 1 0 0 0 0 0 0 65 66 137.4 1 0 0 0 0 0 1 0 0 0 0 0 66 67 142.0 1 0 0 0 0 0 0 1 0 0 0 0 67 68 137.3 1 0 0 0 0 0 0 0 1 0 0 0 68 69 122.8 1 0 0 0 0 0 0 0 0 1 0 0 69 70 126.1 1 0 0 0 0 0 0 0 0 0 1 0 70 71 147.6 1 0 0 0 0 0 0 0 0 0 0 1 71 72 115.7 1 0 0 0 0 0 0 0 0 0 0 0 72 73 139.2 1 1 0 0 0 0 0 0 0 0 0 0 73 74 151.2 1 0 1 0 0 0 0 0 0 0 0 0 74 75 123.8 1 0 0 1 0 0 0 0 0 0 0 0 75 76 109.0 1 0 0 0 1 0 0 0 0 0 0 0 76 77 112.1 1 0 0 0 0 1 0 0 0 0 0 0 77 78 136.4 1 0 0 0 0 0 1 0 0 0 0 0 78 79 135.5 1 0 0 0 0 0 0 1 0 0 0 0 79 80 138.7 1 0 0 0 0 0 0 0 1 0 0 0 80 81 137.5 1 0 0 0 0 0 0 0 0 1 0 0 81 82 141.5 1 0 0 0 0 0 0 0 0 0 1 0 82 83 143.6 1 0 0 0 0 0 0 0 0 0 0 1 83 84 146.5 1 0 0 0 0 0 0 0 0 0 0 0 84 85 200.7 1 1 0 0 0 0 0 0 0 0 0 0 85 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) D M1 M2 M3 M4 65.0887 20.0648 16.4742 18.4244 6.5186 -6.4586 M5 M6 M7 M8 M9 M10 -13.9930 10.5348 11.7004 16.7661 3.3603 6.1402 M11 t 17.7344 0.5772 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -20.9472 -6.5204 0.7596 6.1024 50.0077 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 65.0887 5.2120 12.488 < 2e-16 *** D 20.0648 4.3986 4.562 2.07e-05 *** M1 16.4742 5.9878 2.751 0.00753 ** M2 18.4244 6.1990 2.972 0.00404 ** M3 6.5186 6.1959 1.052 0.29633 M4 -6.4586 6.1936 -1.043 0.30059 M5 -13.9930 6.1923 -2.260 0.02691 * M6 10.5348 6.1939 1.701 0.09335 . M7 11.7004 6.1888 1.891 0.06276 . M8 16.7661 6.1846 2.711 0.00841 ** M9 3.3603 6.1814 0.544 0.58841 M10 6.1402 6.1790 0.994 0.32374 M11 17.7344 6.1776 2.871 0.00539 ** t 0.5772 0.0757 7.625 8.28e-11 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 11.56 on 71 degrees of freedom Multiple R-squared: 0.8337, Adjusted R-squared: 0.8033 F-statistic: 27.39 on 13 and 71 DF, p-value: < 2.2e-16 > postscript(file="/var/www/html/rcomp/tmp/1ofdn1227793249.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/20zqy1227793249.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/30vh61227793249.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/4rszj1227793249.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/51jbk1227793249.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 = 85 Frequency = 1 1 2 3 4 5 6 10.55985099 20.53238529 18.16095672 14.36095672 6.51809957 1.31307356 7 8 9 10 11 12 3.67021641 7.42735927 4.35593070 15.29878784 0.82735927 0.08450213 13 14 15 16 17 18 -12.16690516 -15.59437086 8.43420057 -12.46579943 -14.30865658 4.88631741 19 20 21 22 23 24 -2.85653974 -4.39939688 9.62917455 -11.62796831 -13.09939688 -7.34225402 25 26 27 28 29 30 -20.59366131 -13.42112701 -5.99255558 -6.09255558 0.56458728 0.75956126 31 32 33 34 35 36 1.91670412 1.47384697 6.10241840 -1.95472446 11.07384697 -3.56901017 37 38 39 40 41 42 -6.52041746 -1.44788316 -5.91931173 3.48068827 12.33783113 -14.36719489 43 44 45 46 47 48 -12.51005203 -2.05290918 -11.52433775 -10.98148061 2.04709082 4.60423368 49 50 51 52 53 54 -20.94717360 -2.97463931 -13.24606788 1.85393212 -2.38892502 8.10604896 55 56 57 58 59 60 10.26319182 10.82033467 -5.25109390 11.99176325 2.62033467 4.37747753 61 62 63 64 65 66 4.22607025 7.99860454 9.72717597 12.42717597 0.78431883 3.61447493 67 68 69 70 71 72 6.47161779 -3.87123936 -5.54266793 -5.59981079 3.72876064 -11.01409650 73 74 75 76 77 78 -4.56550378 4.90703051 -11.16439806 -13.56439806 -3.50725520 -4.31228122 79 80 81 82 83 84 -6.95513836 -9.39799551 2.23057592 2.87343307 -7.19799551 12.85914735 85 50.00774007 > postscript(file="/var/www/html/rcomp/tmp/6dz4z1227793249.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 = 85 Frequency = 1 lag(myerror, k = 1) myerror 0 10.55985099 NA 1 20.53238529 10.55985099 2 18.16095672 20.53238529 3 14.36095672 18.16095672 4 6.51809957 14.36095672 5 1.31307356 6.51809957 6 3.67021641 1.31307356 7 7.42735927 3.67021641 8 4.35593070 7.42735927 9 15.29878784 4.35593070 10 0.82735927 15.29878784 11 0.08450213 0.82735927 12 -12.16690516 0.08450213 13 -15.59437086 -12.16690516 14 8.43420057 -15.59437086 15 -12.46579943 8.43420057 16 -14.30865658 -12.46579943 17 4.88631741 -14.30865658 18 -2.85653974 4.88631741 19 -4.39939688 -2.85653974 20 9.62917455 -4.39939688 21 -11.62796831 9.62917455 22 -13.09939688 -11.62796831 23 -7.34225402 -13.09939688 24 -20.59366131 -7.34225402 25 -13.42112701 -20.59366131 26 -5.99255558 -13.42112701 27 -6.09255558 -5.99255558 28 0.56458728 -6.09255558 29 0.75956126 0.56458728 30 1.91670412 0.75956126 31 1.47384697 1.91670412 32 6.10241840 1.47384697 33 -1.95472446 6.10241840 34 11.07384697 -1.95472446 35 -3.56901017 11.07384697 36 -6.52041746 -3.56901017 37 -1.44788316 -6.52041746 38 -5.91931173 -1.44788316 39 3.48068827 -5.91931173 40 12.33783113 3.48068827 41 -14.36719489 12.33783113 42 -12.51005203 -14.36719489 43 -2.05290918 -12.51005203 44 -11.52433775 -2.05290918 45 -10.98148061 -11.52433775 46 2.04709082 -10.98148061 47 4.60423368 2.04709082 48 -20.94717360 4.60423368 49 -2.97463931 -20.94717360 50 -13.24606788 -2.97463931 51 1.85393212 -13.24606788 52 -2.38892502 1.85393212 53 8.10604896 -2.38892502 54 10.26319182 8.10604896 55 10.82033467 10.26319182 56 -5.25109390 10.82033467 57 11.99176325 -5.25109390 58 2.62033467 11.99176325 59 4.37747753 2.62033467 60 4.22607025 4.37747753 61 7.99860454 4.22607025 62 9.72717597 7.99860454 63 12.42717597 9.72717597 64 0.78431883 12.42717597 65 3.61447493 0.78431883 66 6.47161779 3.61447493 67 -3.87123936 6.47161779 68 -5.54266793 -3.87123936 69 -5.59981079 -5.54266793 70 3.72876064 -5.59981079 71 -11.01409650 3.72876064 72 -4.56550378 -11.01409650 73 4.90703051 -4.56550378 74 -11.16439806 4.90703051 75 -13.56439806 -11.16439806 76 -3.50725520 -13.56439806 77 -4.31228122 -3.50725520 78 -6.95513836 -4.31228122 79 -9.39799551 -6.95513836 80 2.23057592 -9.39799551 81 2.87343307 2.23057592 82 -7.19799551 2.87343307 83 12.85914735 -7.19799551 84 50.00774007 12.85914735 85 NA 50.00774007 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 20.53238529 10.55985099 [2,] 18.16095672 20.53238529 [3,] 14.36095672 18.16095672 [4,] 6.51809957 14.36095672 [5,] 1.31307356 6.51809957 [6,] 3.67021641 1.31307356 [7,] 7.42735927 3.67021641 [8,] 4.35593070 7.42735927 [9,] 15.29878784 4.35593070 [10,] 0.82735927 15.29878784 [11,] 0.08450213 0.82735927 [12,] -12.16690516 0.08450213 [13,] -15.59437086 -12.16690516 [14,] 8.43420057 -15.59437086 [15,] -12.46579943 8.43420057 [16,] -14.30865658 -12.46579943 [17,] 4.88631741 -14.30865658 [18,] -2.85653974 4.88631741 [19,] -4.39939688 -2.85653974 [20,] 9.62917455 -4.39939688 [21,] -11.62796831 9.62917455 [22,] -13.09939688 -11.62796831 [23,] -7.34225402 -13.09939688 [24,] -20.59366131 -7.34225402 [25,] -13.42112701 -20.59366131 [26,] -5.99255558 -13.42112701 [27,] -6.09255558 -5.99255558 [28,] 0.56458728 -6.09255558 [29,] 0.75956126 0.56458728 [30,] 1.91670412 0.75956126 [31,] 1.47384697 1.91670412 [32,] 6.10241840 1.47384697 [33,] -1.95472446 6.10241840 [34,] 11.07384697 -1.95472446 [35,] -3.56901017 11.07384697 [36,] -6.52041746 -3.56901017 [37,] -1.44788316 -6.52041746 [38,] -5.91931173 -1.44788316 [39,] 3.48068827 -5.91931173 [40,] 12.33783113 3.48068827 [41,] -14.36719489 12.33783113 [42,] -12.51005203 -14.36719489 [43,] -2.05290918 -12.51005203 [44,] -11.52433775 -2.05290918 [45,] -10.98148061 -11.52433775 [46,] 2.04709082 -10.98148061 [47,] 4.60423368 2.04709082 [48,] -20.94717360 4.60423368 [49,] -2.97463931 -20.94717360 [50,] -13.24606788 -2.97463931 [51,] 1.85393212 -13.24606788 [52,] -2.38892502 1.85393212 [53,] 8.10604896 -2.38892502 [54,] 10.26319182 8.10604896 [55,] 10.82033467 10.26319182 [56,] -5.25109390 10.82033467 [57,] 11.99176325 -5.25109390 [58,] 2.62033467 11.99176325 [59,] 4.37747753 2.62033467 [60,] 4.22607025 4.37747753 [61,] 7.99860454 4.22607025 [62,] 9.72717597 7.99860454 [63,] 12.42717597 9.72717597 [64,] 0.78431883 12.42717597 [65,] 3.61447493 0.78431883 [66,] 6.47161779 3.61447493 [67,] -3.87123936 6.47161779 [68,] -5.54266793 -3.87123936 [69,] -5.59981079 -5.54266793 [70,] 3.72876064 -5.59981079 [71,] -11.01409650 3.72876064 [72,] -4.56550378 -11.01409650 [73,] 4.90703051 -4.56550378 [74,] -11.16439806 4.90703051 [75,] -13.56439806 -11.16439806 [76,] -3.50725520 -13.56439806 [77,] -4.31228122 -3.50725520 [78,] -6.95513836 -4.31228122 [79,] -9.39799551 -6.95513836 [80,] 2.23057592 -9.39799551 [81,] 2.87343307 2.23057592 [82,] -7.19799551 2.87343307 [83,] 12.85914735 -7.19799551 [84,] 50.00774007 12.85914735 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 20.53238529 10.55985099 2 18.16095672 20.53238529 3 14.36095672 18.16095672 4 6.51809957 14.36095672 5 1.31307356 6.51809957 6 3.67021641 1.31307356 7 7.42735927 3.67021641 8 4.35593070 7.42735927 9 15.29878784 4.35593070 10 0.82735927 15.29878784 11 0.08450213 0.82735927 12 -12.16690516 0.08450213 13 -15.59437086 -12.16690516 14 8.43420057 -15.59437086 15 -12.46579943 8.43420057 16 -14.30865658 -12.46579943 17 4.88631741 -14.30865658 18 -2.85653974 4.88631741 19 -4.39939688 -2.85653974 20 9.62917455 -4.39939688 21 -11.62796831 9.62917455 22 -13.09939688 -11.62796831 23 -7.34225402 -13.09939688 24 -20.59366131 -7.34225402 25 -13.42112701 -20.59366131 26 -5.99255558 -13.42112701 27 -6.09255558 -5.99255558 28 0.56458728 -6.09255558 29 0.75956126 0.56458728 30 1.91670412 0.75956126 31 1.47384697 1.91670412 32 6.10241840 1.47384697 33 -1.95472446 6.10241840 34 11.07384697 -1.95472446 35 -3.56901017 11.07384697 36 -6.52041746 -3.56901017 37 -1.44788316 -6.52041746 38 -5.91931173 -1.44788316 39 3.48068827 -5.91931173 40 12.33783113 3.48068827 41 -14.36719489 12.33783113 42 -12.51005203 -14.36719489 43 -2.05290918 -12.51005203 44 -11.52433775 -2.05290918 45 -10.98148061 -11.52433775 46 2.04709082 -10.98148061 47 4.60423368 2.04709082 48 -20.94717360 4.60423368 49 -2.97463931 -20.94717360 50 -13.24606788 -2.97463931 51 1.85393212 -13.24606788 52 -2.38892502 1.85393212 53 8.10604896 -2.38892502 54 10.26319182 8.10604896 55 10.82033467 10.26319182 56 -5.25109390 10.82033467 57 11.99176325 -5.25109390 58 2.62033467 11.99176325 59 4.37747753 2.62033467 60 4.22607025 4.37747753 61 7.99860454 4.22607025 62 9.72717597 7.99860454 63 12.42717597 9.72717597 64 0.78431883 12.42717597 65 3.61447493 0.78431883 66 6.47161779 3.61447493 67 -3.87123936 6.47161779 68 -5.54266793 -3.87123936 69 -5.59981079 -5.54266793 70 3.72876064 -5.59981079 71 -11.01409650 3.72876064 72 -4.56550378 -11.01409650 73 4.90703051 -4.56550378 74 -11.16439806 4.90703051 75 -13.56439806 -11.16439806 76 -3.50725520 -13.56439806 77 -4.31228122 -3.50725520 78 -6.95513836 -4.31228122 79 -9.39799551 -6.95513836 80 2.23057592 -9.39799551 81 2.87343307 2.23057592 82 -7.19799551 2.87343307 83 12.85914735 -7.19799551 84 50.00774007 12.85914735 > 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/79dfr1227793249.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/824ns1227793249.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/9wtqv1227793249.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/10h1771227793249.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/118bv91227793249.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/124er81227793250.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/133fbg1227793250.tab") > > system("convert tmp/1ofdn1227793249.ps tmp/1ofdn1227793249.png") > system("convert tmp/20zqy1227793249.ps tmp/20zqy1227793249.png") > system("convert tmp/30vh61227793249.ps tmp/30vh61227793249.png") > system("convert tmp/4rszj1227793249.ps tmp/4rszj1227793249.png") > system("convert tmp/51jbk1227793249.ps tmp/51jbk1227793249.png") > system("convert tmp/6dz4z1227793249.ps tmp/6dz4z1227793249.png") > system("convert tmp/79dfr1227793249.ps tmp/79dfr1227793249.png") > system("convert tmp/824ns1227793249.ps tmp/824ns1227793249.png") > system("convert tmp/9wtqv1227793249.ps tmp/9wtqv1227793249.png") > > > proc.time() user system elapsed 2.017 1.423 3.840