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(1.1608 + ,0 + ,1.1208 + ,0 + ,1.0883 + ,0 + ,1.0704 + ,0 + ,1.0628 + ,0 + ,1.0378 + ,0 + ,1.0353 + ,0 + ,1.0604 + ,0 + ,1.0501 + ,0 + ,1.0706 + ,0 + ,1.0338 + ,0 + ,1.011 + ,0 + ,1.0137 + ,0 + ,0.9834 + ,0 + ,0.9643 + ,0 + ,0.947 + ,0 + ,0.906 + ,0 + ,0.9492 + ,0 + ,0.9397 + ,0 + ,0.9041 + ,0 + ,0.8721 + ,0 + ,0.8552 + ,0 + ,0.8564 + ,0 + ,0.8973 + ,0 + ,0.9383 + ,0 + ,0.9217 + ,0 + ,0.9095 + ,0 + ,0.892 + ,0 + ,0.8742 + ,0 + ,0.8532 + ,0 + ,0.8607 + ,0 + ,0.9005 + ,0 + ,0.9111 + ,0 + ,0.9059 + ,0 + ,0.8883 + ,0 + ,0.8924 + ,0 + ,0.8833 + ,0 + ,0.87 + ,0 + ,0.8758 + ,0 + ,0.8858 + ,0 + ,0.917 + ,0 + ,0.9554 + ,0 + ,0.9922 + ,0 + ,0.9778 + ,0 + ,0.9808 + ,0 + ,0.9811 + ,0 + ,1.0014 + ,0 + ,1.0183 + ,0 + ,1.0622 + ,0 + ,1.0773 + ,0 + ,1.0807 + ,0 + ,1.0848 + ,0 + ,1.1582 + ,0 + ,1.1663 + ,0 + ,1.1372 + ,0 + ,1.1139 + ,0 + ,1.1222 + ,0 + ,1.1692 + ,0 + ,1.1702 + ,0 + ,1.2286 + ,0 + ,1.2613 + ,0 + ,1.2646 + ,0 + ,1.2262 + ,0 + ,1.1985 + ,0 + ,1.2007 + ,0 + ,1.2138 + ,0 + ,1.2266 + ,0 + ,1.2176 + ,0 + ,1.2218 + ,0 + ,1.249 + ,0 + ,1.2991 + ,0 + ,1.3408 + ,0 + ,1.3119 + ,0 + ,1.3014 + ,0 + ,1.3201 + ,0 + ,1.2938 + ,0 + ,1.2694 + ,0 + ,1.2165 + ,0 + ,1.2037 + ,0 + ,1.2292 + ,0 + ,1.2256 + ,0 + ,1.2015 + ,0 + ,1.1786 + ,0 + ,1.1856 + ,0 + ,1.2103 + ,0 + ,1.1938 + ,0 + ,1.202 + ,0 + ,1.2271 + ,0 + ,1.277 + ,0 + ,1.265 + ,0 + ,1.2684 + ,0 + ,1.2811 + ,0 + ,1.2727 + ,0 + ,1.2611 + ,0 + ,1.2881 + ,0 + ,1.3213 + ,0 + ,1.2999 + ,0 + ,1.3074 + ,0 + ,1.3242 + ,0 + ,1.3516 + ,0 + ,1.3511 + ,0 + ,1.3419 + ,1 + ,1.3716 + ,1 + ,1.3622 + ,1 + ,1.3896 + ,1 + ,1.4227 + ,1 + ,1.4684 + ,1 + ,1.457 + ,1 + ,1.4718 + ,1 + ,1.4748 + ,1 + ,1.5527 + ,1 + ,1.5751 + ,1 + ,1.5557 + ,1 + ,1.5553 + ,1 + ,1.577 + ,1) + ,dim=c(2 + ,115) + ,dimnames=list(c('y' + ,'x') + ,1:115)) > y <- array(NA,dim=c(2,115),dimnames=list(c('y','x'),1:115)) > 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 y x 1 1.1608 0 2 1.1208 0 3 1.0883 0 4 1.0704 0 5 1.0628 0 6 1.0378 0 7 1.0353 0 8 1.0604 0 9 1.0501 0 10 1.0706 0 11 1.0338 0 12 1.0110 0 13 1.0137 0 14 0.9834 0 15 0.9643 0 16 0.9470 0 17 0.9060 0 18 0.9492 0 19 0.9397 0 20 0.9041 0 21 0.8721 0 22 0.8552 0 23 0.8564 0 24 0.8973 0 25 0.9383 0 26 0.9217 0 27 0.9095 0 28 0.8920 0 29 0.8742 0 30 0.8532 0 31 0.8607 0 32 0.9005 0 33 0.9111 0 34 0.9059 0 35 0.8883 0 36 0.8924 0 37 0.8833 0 38 0.8700 0 39 0.8758 0 40 0.8858 0 41 0.9170 0 42 0.9554 0 43 0.9922 0 44 0.9778 0 45 0.9808 0 46 0.9811 0 47 1.0014 0 48 1.0183 0 49 1.0622 0 50 1.0773 0 51 1.0807 0 52 1.0848 0 53 1.1582 0 54 1.1663 0 55 1.1372 0 56 1.1139 0 57 1.1222 0 58 1.1692 0 59 1.1702 0 60 1.2286 0 61 1.2613 0 62 1.2646 0 63 1.2262 0 64 1.1985 0 65 1.2007 0 66 1.2138 0 67 1.2266 0 68 1.2176 0 69 1.2218 0 70 1.2490 0 71 1.2991 0 72 1.3408 0 73 1.3119 0 74 1.3014 0 75 1.3201 0 76 1.2938 0 77 1.2694 0 78 1.2165 0 79 1.2037 0 80 1.2292 0 81 1.2256 0 82 1.2015 0 83 1.1786 0 84 1.1856 0 85 1.2103 0 86 1.1938 0 87 1.2020 0 88 1.2271 0 89 1.2770 0 90 1.2650 0 91 1.2684 0 92 1.2811 0 93 1.2727 0 94 1.2611 0 95 1.2881 0 96 1.3213 0 97 1.2999 0 98 1.3074 0 99 1.3242 0 100 1.3516 0 101 1.3511 0 102 1.3419 1 103 1.3716 1 104 1.3622 1 105 1.3896 1 106 1.4227 1 107 1.4684 1 108 1.4570 1 109 1.4718 1 110 1.4748 1 111 1.5527 1 112 1.5751 1 113 1.5557 1 114 1.5553 1 115 1.5770 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x 1.1001 0.3696 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.2469 -0.1250 0.0021 0.1236 0.2515 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.10007 0.01481 74.266 < 2e-16 *** x 0.36963 0.04245 8.707 2.96e-14 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.1489 on 113 degrees of freedom Multiple R-squared: 0.4015, Adjusted R-squared: 0.3962 F-statistic: 75.81 on 1 and 113 DF, p-value: 2.96e-14 > postscript(file="/var/www/html/freestat/rcomp/tmp/1zfd51227462902.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/freestat/rcomp/tmp/2agdc1227462902.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/freestat/rcomp/tmp/32zcy1227462902.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/freestat/rcomp/tmp/46hjm1227462902.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/freestat/rcomp/tmp/5uhe51227462902.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 = 115 Frequency = 1 1 2 3 4 5 6 0.06072673 0.02072673 -0.01177327 -0.02967327 -0.03727327 -0.06227327 7 8 9 10 11 12 -0.06477327 -0.03967327 -0.04997327 -0.02947327 -0.06627327 -0.08907327 13 14 15 16 17 18 -0.08637327 -0.11667327 -0.13577327 -0.15307327 -0.19407327 -0.15087327 19 20 21 22 23 24 -0.16037327 -0.19597327 -0.22797327 -0.24487327 -0.24367327 -0.20277327 25 26 27 28 29 30 -0.16177327 -0.17837327 -0.19057327 -0.20807327 -0.22587327 -0.24687327 31 32 33 34 35 36 -0.23937327 -0.19957327 -0.18897327 -0.19417327 -0.21177327 -0.20767327 37 38 39 40 41 42 -0.21677327 -0.23007327 -0.22427327 -0.21427327 -0.18307327 -0.14467327 43 44 45 46 47 48 -0.10787327 -0.12227327 -0.11927327 -0.11897327 -0.09867327 -0.08177327 49 50 51 52 53 54 -0.03787327 -0.02277327 -0.01937327 -0.01527327 0.05812673 0.06622673 55 56 57 58 59 60 0.03712673 0.01382673 0.02212673 0.06912673 0.07012673 0.12852673 61 62 63 64 65 66 0.16122673 0.16452673 0.12612673 0.09842673 0.10062673 0.11372673 67 68 69 70 71 72 0.12652673 0.11752673 0.12172673 0.14892673 0.19902673 0.24072673 73 74 75 76 77 78 0.21182673 0.20132673 0.22002673 0.19372673 0.16932673 0.11642673 79 80 81 82 83 84 0.10362673 0.12912673 0.12552673 0.10142673 0.07852673 0.08552673 85 86 87 88 89 90 0.11022673 0.09372673 0.10192673 0.12702673 0.17692673 0.16492673 91 92 93 94 95 96 0.16832673 0.18102673 0.17262673 0.16102673 0.18802673 0.22122673 97 98 99 100 101 102 0.19982673 0.20732673 0.22412673 0.25152673 0.25102673 -0.12780000 103 104 105 106 107 108 -0.09810000 -0.10750000 -0.08010000 -0.04700000 -0.00130000 -0.01270000 109 110 111 112 113 114 0.00210000 0.00510000 0.08300000 0.10540000 0.08600000 0.08560000 115 0.10730000 > postscript(file="/var/www/html/freestat/rcomp/tmp/6p1gi1227462902.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 = 115 Frequency = 1 lag(myerror, k = 1) myerror 0 0.06072673 NA 1 0.02072673 0.06072673 2 -0.01177327 0.02072673 3 -0.02967327 -0.01177327 4 -0.03727327 -0.02967327 5 -0.06227327 -0.03727327 6 -0.06477327 -0.06227327 7 -0.03967327 -0.06477327 8 -0.04997327 -0.03967327 9 -0.02947327 -0.04997327 10 -0.06627327 -0.02947327 11 -0.08907327 -0.06627327 12 -0.08637327 -0.08907327 13 -0.11667327 -0.08637327 14 -0.13577327 -0.11667327 15 -0.15307327 -0.13577327 16 -0.19407327 -0.15307327 17 -0.15087327 -0.19407327 18 -0.16037327 -0.15087327 19 -0.19597327 -0.16037327 20 -0.22797327 -0.19597327 21 -0.24487327 -0.22797327 22 -0.24367327 -0.24487327 23 -0.20277327 -0.24367327 24 -0.16177327 -0.20277327 25 -0.17837327 -0.16177327 26 -0.19057327 -0.17837327 27 -0.20807327 -0.19057327 28 -0.22587327 -0.20807327 29 -0.24687327 -0.22587327 30 -0.23937327 -0.24687327 31 -0.19957327 -0.23937327 32 -0.18897327 -0.19957327 33 -0.19417327 -0.18897327 34 -0.21177327 -0.19417327 35 -0.20767327 -0.21177327 36 -0.21677327 -0.20767327 37 -0.23007327 -0.21677327 38 -0.22427327 -0.23007327 39 -0.21427327 -0.22427327 40 -0.18307327 -0.21427327 41 -0.14467327 -0.18307327 42 -0.10787327 -0.14467327 43 -0.12227327 -0.10787327 44 -0.11927327 -0.12227327 45 -0.11897327 -0.11927327 46 -0.09867327 -0.11897327 47 -0.08177327 -0.09867327 48 -0.03787327 -0.08177327 49 -0.02277327 -0.03787327 50 -0.01937327 -0.02277327 51 -0.01527327 -0.01937327 52 0.05812673 -0.01527327 53 0.06622673 0.05812673 54 0.03712673 0.06622673 55 0.01382673 0.03712673 56 0.02212673 0.01382673 57 0.06912673 0.02212673 58 0.07012673 0.06912673 59 0.12852673 0.07012673 60 0.16122673 0.12852673 61 0.16452673 0.16122673 62 0.12612673 0.16452673 63 0.09842673 0.12612673 64 0.10062673 0.09842673 65 0.11372673 0.10062673 66 0.12652673 0.11372673 67 0.11752673 0.12652673 68 0.12172673 0.11752673 69 0.14892673 0.12172673 70 0.19902673 0.14892673 71 0.24072673 0.19902673 72 0.21182673 0.24072673 73 0.20132673 0.21182673 74 0.22002673 0.20132673 75 0.19372673 0.22002673 76 0.16932673 0.19372673 77 0.11642673 0.16932673 78 0.10362673 0.11642673 79 0.12912673 0.10362673 80 0.12552673 0.12912673 81 0.10142673 0.12552673 82 0.07852673 0.10142673 83 0.08552673 0.07852673 84 0.11022673 0.08552673 85 0.09372673 0.11022673 86 0.10192673 0.09372673 87 0.12702673 0.10192673 88 0.17692673 0.12702673 89 0.16492673 0.17692673 90 0.16832673 0.16492673 91 0.18102673 0.16832673 92 0.17262673 0.18102673 93 0.16102673 0.17262673 94 0.18802673 0.16102673 95 0.22122673 0.18802673 96 0.19982673 0.22122673 97 0.20732673 0.19982673 98 0.22412673 0.20732673 99 0.25152673 0.22412673 100 0.25102673 0.25152673 101 -0.12780000 0.25102673 102 -0.09810000 -0.12780000 103 -0.10750000 -0.09810000 104 -0.08010000 -0.10750000 105 -0.04700000 -0.08010000 106 -0.00130000 -0.04700000 107 -0.01270000 -0.00130000 108 0.00210000 -0.01270000 109 0.00510000 0.00210000 110 0.08300000 0.00510000 111 0.10540000 0.08300000 112 0.08600000 0.10540000 113 0.08560000 0.08600000 114 0.10730000 0.08560000 115 NA 0.10730000 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.02072673 0.06072673 [2,] -0.01177327 0.02072673 [3,] -0.02967327 -0.01177327 [4,] -0.03727327 -0.02967327 [5,] -0.06227327 -0.03727327 [6,] -0.06477327 -0.06227327 [7,] -0.03967327 -0.06477327 [8,] -0.04997327 -0.03967327 [9,] -0.02947327 -0.04997327 [10,] -0.06627327 -0.02947327 [11,] -0.08907327 -0.06627327 [12,] -0.08637327 -0.08907327 [13,] -0.11667327 -0.08637327 [14,] -0.13577327 -0.11667327 [15,] -0.15307327 -0.13577327 [16,] -0.19407327 -0.15307327 [17,] -0.15087327 -0.19407327 [18,] -0.16037327 -0.15087327 [19,] -0.19597327 -0.16037327 [20,] -0.22797327 -0.19597327 [21,] -0.24487327 -0.22797327 [22,] -0.24367327 -0.24487327 [23,] -0.20277327 -0.24367327 [24,] -0.16177327 -0.20277327 [25,] -0.17837327 -0.16177327 [26,] -0.19057327 -0.17837327 [27,] -0.20807327 -0.19057327 [28,] -0.22587327 -0.20807327 [29,] -0.24687327 -0.22587327 [30,] -0.23937327 -0.24687327 [31,] -0.19957327 -0.23937327 [32,] -0.18897327 -0.19957327 [33,] -0.19417327 -0.18897327 [34,] -0.21177327 -0.19417327 [35,] -0.20767327 -0.21177327 [36,] -0.21677327 -0.20767327 [37,] -0.23007327 -0.21677327 [38,] -0.22427327 -0.23007327 [39,] -0.21427327 -0.22427327 [40,] -0.18307327 -0.21427327 [41,] -0.14467327 -0.18307327 [42,] -0.10787327 -0.14467327 [43,] -0.12227327 -0.10787327 [44,] -0.11927327 -0.12227327 [45,] -0.11897327 -0.11927327 [46,] -0.09867327 -0.11897327 [47,] -0.08177327 -0.09867327 [48,] -0.03787327 -0.08177327 [49,] -0.02277327 -0.03787327 [50,] -0.01937327 -0.02277327 [51,] -0.01527327 -0.01937327 [52,] 0.05812673 -0.01527327 [53,] 0.06622673 0.05812673 [54,] 0.03712673 0.06622673 [55,] 0.01382673 0.03712673 [56,] 0.02212673 0.01382673 [57,] 0.06912673 0.02212673 [58,] 0.07012673 0.06912673 [59,] 0.12852673 0.07012673 [60,] 0.16122673 0.12852673 [61,] 0.16452673 0.16122673 [62,] 0.12612673 0.16452673 [63,] 0.09842673 0.12612673 [64,] 0.10062673 0.09842673 [65,] 0.11372673 0.10062673 [66,] 0.12652673 0.11372673 [67,] 0.11752673 0.12652673 [68,] 0.12172673 0.11752673 [69,] 0.14892673 0.12172673 [70,] 0.19902673 0.14892673 [71,] 0.24072673 0.19902673 [72,] 0.21182673 0.24072673 [73,] 0.20132673 0.21182673 [74,] 0.22002673 0.20132673 [75,] 0.19372673 0.22002673 [76,] 0.16932673 0.19372673 [77,] 0.11642673 0.16932673 [78,] 0.10362673 0.11642673 [79,] 0.12912673 0.10362673 [80,] 0.12552673 0.12912673 [81,] 0.10142673 0.12552673 [82,] 0.07852673 0.10142673 [83,] 0.08552673 0.07852673 [84,] 0.11022673 0.08552673 [85,] 0.09372673 0.11022673 [86,] 0.10192673 0.09372673 [87,] 0.12702673 0.10192673 [88,] 0.17692673 0.12702673 [89,] 0.16492673 0.17692673 [90,] 0.16832673 0.16492673 [91,] 0.18102673 0.16832673 [92,] 0.17262673 0.18102673 [93,] 0.16102673 0.17262673 [94,] 0.18802673 0.16102673 [95,] 0.22122673 0.18802673 [96,] 0.19982673 0.22122673 [97,] 0.20732673 0.19982673 [98,] 0.22412673 0.20732673 [99,] 0.25152673 0.22412673 [100,] 0.25102673 0.25152673 [101,] -0.12780000 0.25102673 [102,] -0.09810000 -0.12780000 [103,] -0.10750000 -0.09810000 [104,] -0.08010000 -0.10750000 [105,] -0.04700000 -0.08010000 [106,] -0.00130000 -0.04700000 [107,] -0.01270000 -0.00130000 [108,] 0.00210000 -0.01270000 [109,] 0.00510000 0.00210000 [110,] 0.08300000 0.00510000 [111,] 0.10540000 0.08300000 [112,] 0.08600000 0.10540000 [113,] 0.08560000 0.08600000 [114,] 0.10730000 0.08560000 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.02072673 0.06072673 2 -0.01177327 0.02072673 3 -0.02967327 -0.01177327 4 -0.03727327 -0.02967327 5 -0.06227327 -0.03727327 6 -0.06477327 -0.06227327 7 -0.03967327 -0.06477327 8 -0.04997327 -0.03967327 9 -0.02947327 -0.04997327 10 -0.06627327 -0.02947327 11 -0.08907327 -0.06627327 12 -0.08637327 -0.08907327 13 -0.11667327 -0.08637327 14 -0.13577327 -0.11667327 15 -0.15307327 -0.13577327 16 -0.19407327 -0.15307327 17 -0.15087327 -0.19407327 18 -0.16037327 -0.15087327 19 -0.19597327 -0.16037327 20 -0.22797327 -0.19597327 21 -0.24487327 -0.22797327 22 -0.24367327 -0.24487327 23 -0.20277327 -0.24367327 24 -0.16177327 -0.20277327 25 -0.17837327 -0.16177327 26 -0.19057327 -0.17837327 27 -0.20807327 -0.19057327 28 -0.22587327 -0.20807327 29 -0.24687327 -0.22587327 30 -0.23937327 -0.24687327 31 -0.19957327 -0.23937327 32 -0.18897327 -0.19957327 33 -0.19417327 -0.18897327 34 -0.21177327 -0.19417327 35 -0.20767327 -0.21177327 36 -0.21677327 -0.20767327 37 -0.23007327 -0.21677327 38 -0.22427327 -0.23007327 39 -0.21427327 -0.22427327 40 -0.18307327 -0.21427327 41 -0.14467327 -0.18307327 42 -0.10787327 -0.14467327 43 -0.12227327 -0.10787327 44 -0.11927327 -0.12227327 45 -0.11897327 -0.11927327 46 -0.09867327 -0.11897327 47 -0.08177327 -0.09867327 48 -0.03787327 -0.08177327 49 -0.02277327 -0.03787327 50 -0.01937327 -0.02277327 51 -0.01527327 -0.01937327 52 0.05812673 -0.01527327 53 0.06622673 0.05812673 54 0.03712673 0.06622673 55 0.01382673 0.03712673 56 0.02212673 0.01382673 57 0.06912673 0.02212673 58 0.07012673 0.06912673 59 0.12852673 0.07012673 60 0.16122673 0.12852673 61 0.16452673 0.16122673 62 0.12612673 0.16452673 63 0.09842673 0.12612673 64 0.10062673 0.09842673 65 0.11372673 0.10062673 66 0.12652673 0.11372673 67 0.11752673 0.12652673 68 0.12172673 0.11752673 69 0.14892673 0.12172673 70 0.19902673 0.14892673 71 0.24072673 0.19902673 72 0.21182673 0.24072673 73 0.20132673 0.21182673 74 0.22002673 0.20132673 75 0.19372673 0.22002673 76 0.16932673 0.19372673 77 0.11642673 0.16932673 78 0.10362673 0.11642673 79 0.12912673 0.10362673 80 0.12552673 0.12912673 81 0.10142673 0.12552673 82 0.07852673 0.10142673 83 0.08552673 0.07852673 84 0.11022673 0.08552673 85 0.09372673 0.11022673 86 0.10192673 0.09372673 87 0.12702673 0.10192673 88 0.17692673 0.12702673 89 0.16492673 0.17692673 90 0.16832673 0.16492673 91 0.18102673 0.16832673 92 0.17262673 0.18102673 93 0.16102673 0.17262673 94 0.18802673 0.16102673 95 0.22122673 0.18802673 96 0.19982673 0.22122673 97 0.20732673 0.19982673 98 0.22412673 0.20732673 99 0.25152673 0.22412673 100 0.25102673 0.25152673 101 -0.12780000 0.25102673 102 -0.09810000 -0.12780000 103 -0.10750000 -0.09810000 104 -0.08010000 -0.10750000 105 -0.04700000 -0.08010000 106 -0.00130000 -0.04700000 107 -0.01270000 -0.00130000 108 0.00210000 -0.01270000 109 0.00510000 0.00210000 110 0.08300000 0.00510000 111 0.10540000 0.08300000 112 0.08600000 0.10540000 113 0.08560000 0.08600000 114 0.10730000 0.08560000 > 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/freestat/rcomp/tmp/7k9561227462902.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/freestat/rcomp/tmp/853og1227462902.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/freestat/rcomp/tmp/9d7du1227462902.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/10vnmx1227462902.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/freestat/rcomp/tmp/11a3nh1227462902.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/freestat/rcomp/tmp/12342h1227462902.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/freestat/rcomp/tmp/13fntu1227462902.tab") > > system("convert tmp/1zfd51227462902.ps tmp/1zfd51227462902.png") > system("convert tmp/2agdc1227462902.ps tmp/2agdc1227462902.png") > system("convert tmp/32zcy1227462902.ps tmp/32zcy1227462902.png") > system("convert tmp/46hjm1227462902.ps tmp/46hjm1227462902.png") > system("convert tmp/5uhe51227462902.ps tmp/5uhe51227462902.png") > system("convert tmp/6p1gi1227462902.ps tmp/6p1gi1227462902.png") > system("convert tmp/7k9561227462902.ps tmp/7k9561227462902.png") > system("convert tmp/853og1227462902.ps tmp/853og1227462902.png") > system("convert tmp/9d7du1227462902.ps tmp/9d7du1227462902.png") > > > proc.time() user system elapsed 3.160 2.273 3.895