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(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]) + } + } > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = 'No Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > ylab = '' > xlab = '' > main = '' > #'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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 1.1608 0 1 0 0 0 0 0 0 0 0 0 0 2 1.1208 0 0 1 0 0 0 0 0 0 0 0 0 3 1.0883 0 0 0 1 0 0 0 0 0 0 0 0 4 1.0704 0 0 0 0 1 0 0 0 0 0 0 0 5 1.0628 0 0 0 0 0 1 0 0 0 0 0 0 6 1.0378 0 0 0 0 0 0 1 0 0 0 0 0 7 1.0353 0 0 0 0 0 0 0 1 0 0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 0 74 1.3014 0 0 1 0 0 0 0 0 0 0 0 0 75 1.3201 0 0 0 1 0 0 0 0 0 0 0 0 76 1.2938 0 0 0 0 1 0 0 0 0 0 0 0 77 1.2694 0 0 0 0 0 1 0 0 0 0 0 0 78 1.2165 0 0 0 0 0 0 1 0 0 0 0 0 79 1.2037 0 0 0 0 0 0 0 1 0 0 0 0 80 1.2292 0 0 0 0 0 0 0 0 1 0 0 0 81 1.2256 0 0 0 0 0 0 0 0 0 1 0 0 82 1.2015 0 0 0 0 0 0 0 0 0 0 1 0 83 1.1786 0 0 0 0 0 0 0 0 0 0 0 1 84 1.1856 0 0 0 0 0 0 0 0 0 0 0 0 85 1.2103 0 1 0 0 0 0 0 0 0 0 0 0 86 1.1938 0 0 1 0 0 0 0 0 0 0 0 0 87 1.2020 0 0 0 1 0 0 0 0 0 0 0 0 88 1.2271 0 0 0 0 1 0 0 0 0 0 0 0 89 1.2770 0 0 0 0 0 1 0 0 0 0 0 0 90 1.2650 0 0 0 0 0 0 1 0 0 0 0 0 91 1.2684 0 0 0 0 0 0 0 1 0 0 0 0 92 1.2811 0 0 0 0 0 0 0 0 1 0 0 0 93 1.2727 0 0 0 0 0 0 0 0 0 1 0 0 94 1.2611 0 0 0 0 0 0 0 0 0 0 1 0 95 1.2881 0 0 0 0 0 0 0 0 0 0 0 1 96 1.3213 0 0 0 0 0 0 0 0 0 0 0 0 97 1.2999 0 1 0 0 0 0 0 0 0 0 0 0 98 1.3074 0 0 1 0 0 0 0 0 0 0 0 0 99 1.3242 0 0 0 1 0 0 0 0 0 0 0 0 100 1.3516 0 0 0 0 1 0 0 0 0 0 0 0 101 1.3511 0 0 0 0 0 1 0 0 0 0 0 0 102 1.3419 1 0 0 0 0 0 1 0 0 0 0 0 103 1.3716 1 0 0 0 0 0 0 1 0 0 0 0 104 1.3622 1 0 0 0 0 0 0 0 1 0 0 0 105 1.3896 1 0 0 0 0 0 0 0 0 1 0 0 106 1.4227 1 0 0 0 0 0 0 0 0 0 1 0 107 1.4684 1 0 0 0 0 0 0 0 0 0 0 1 108 1.4570 1 0 0 0 0 0 0 0 0 0 0 0 109 1.4718 1 1 0 0 0 0 0 0 0 0 0 0 110 1.4748 1 0 1 0 0 0 0 0 0 0 0 0 111 1.5527 1 0 0 1 0 0 0 0 0 0 0 0 112 1.5751 1 0 0 0 1 0 0 0 0 0 0 0 113 1.5557 1 0 0 0 0 1 0 0 0 0 0 0 114 1.5553 1 0 0 0 0 0 1 0 0 0 0 0 115 1.5770 1 0 0 0 0 0 0 1 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x M1 M2 M3 M4 1.108838 0.372760 0.015236 0.005406 0.008266 0.006496 M5 M6 M7 M8 M9 M10 0.011096 -0.027950 -0.022150 -0.033944 -0.034033 -0.026222 M11 -0.018667 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.24573 -0.11862 -0.01202 0.13426 0.23627 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.108838 0.052067 21.296 < 2e-16 *** x 0.372760 0.044619 8.354 3.46e-13 *** M1 0.015236 0.071445 0.213 0.832 M2 0.005406 0.071445 0.076 0.940 M3 0.008266 0.071445 0.116 0.908 M4 0.006496 0.071445 0.091 0.928 M5 0.011096 0.071445 0.155 0.877 M6 -0.027950 0.071553 -0.391 0.697 M7 -0.022150 0.071553 -0.310 0.758 M8 -0.033944 0.073299 -0.463 0.644 M9 -0.034033 0.073299 -0.464 0.643 M10 -0.026222 0.073299 -0.358 0.721 M11 -0.018667 0.073299 -0.255 0.799 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.1555 on 102 degrees of freedom Multiple R-squared: 0.4106, Adjusted R-squared: 0.3413 F-statistic: 5.921 on 12 and 102 DF, p-value: 1.006e-07 > postscript(file="/var/www/html/rcomp/tmp/1h0m21227976381.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/2nigs1227976381.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/3cjzm1227976381.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/4z9g41227976381.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/5zgc91227976381.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.036725965 0.006555965 -0.028804035 -0.044934035 -0.057134035 -0.043088070 7 8 9 10 11 12 -0.051388070 -0.014493372 -0.024704483 -0.012015594 -0.056371150 -0.097837816 13 14 15 16 17 18 -0.110374035 -0.130844035 -0.152804035 -0.168334035 -0.213934035 -0.131688070 19 20 21 22 23 24 -0.146988070 -0.170793372 -0.202704483 -0.227415594 -0.233771150 -0.211537816 25 26 27 28 29 30 -0.185774035 -0.192544035 -0.207604035 -0.223334035 -0.245734035 -0.227688070 31 32 33 34 35 36 -0.225988070 -0.174393372 -0.163704483 -0.176715594 -0.201871150 -0.216437816 37 38 39 40 41 42 -0.240774035 -0.244244035 -0.241304035 -0.229534035 -0.202934035 -0.125488070 43 44 45 46 47 48 -0.094488070 -0.097093372 -0.094004483 -0.101515594 -0.088771150 -0.090537816 49 50 51 52 53 54 -0.061874035 -0.036944035 -0.036404035 -0.030534035 0.038265965 0.085411930 55 56 57 58 59 60 0.050511930 0.039006628 0.047395517 0.086584406 0.080028850 0.119762184 61 62 63 64 65 66 0.137225965 0.150355965 0.109095965 0.083165965 0.080765965 0.132911930 67 68 69 70 71 72 0.139911930 0.142706628 0.146995517 0.166384406 0.208928850 0.231962184 73 74 75 76 77 78 0.187825965 0.187155965 0.202995965 0.178465965 0.149465965 0.135611930 79 80 81 82 83 84 0.117011930 0.154306628 0.150795517 0.118884406 0.088428850 0.076762184 85 86 87 88 89 90 0.086225965 0.079555965 0.084895965 0.111765965 0.157065965 0.184111930 91 92 93 94 95 96 0.181711930 0.206206628 0.197895517 0.178484406 0.197928850 0.212462184 97 98 99 100 101 102 0.175825965 0.193155965 0.207095965 0.236265965 0.231165965 -0.111747722 103 104 105 106 107 108 -0.087847722 -0.085453024 -0.057964135 -0.032675247 0.005469198 -0.024597469 109 110 111 112 113 114 -0.025033687 -0.012203687 0.062836313 0.087006313 0.063006313 0.101652278 115 0.117552278 > postscript(file="/var/www/html/rcomp/tmp/6ypon1227976381.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.036725965 NA 1 0.006555965 0.036725965 2 -0.028804035 0.006555965 3 -0.044934035 -0.028804035 4 -0.057134035 -0.044934035 5 -0.043088070 -0.057134035 6 -0.051388070 -0.043088070 7 -0.014493372 -0.051388070 8 -0.024704483 -0.014493372 9 -0.012015594 -0.024704483 10 -0.056371150 -0.012015594 11 -0.097837816 -0.056371150 12 -0.110374035 -0.097837816 13 -0.130844035 -0.110374035 14 -0.152804035 -0.130844035 15 -0.168334035 -0.152804035 16 -0.213934035 -0.168334035 17 -0.131688070 -0.213934035 18 -0.146988070 -0.131688070 19 -0.170793372 -0.146988070 20 -0.202704483 -0.170793372 21 -0.227415594 -0.202704483 22 -0.233771150 -0.227415594 23 -0.211537816 -0.233771150 24 -0.185774035 -0.211537816 25 -0.192544035 -0.185774035 26 -0.207604035 -0.192544035 27 -0.223334035 -0.207604035 28 -0.245734035 -0.223334035 29 -0.227688070 -0.245734035 30 -0.225988070 -0.227688070 31 -0.174393372 -0.225988070 32 -0.163704483 -0.174393372 33 -0.176715594 -0.163704483 34 -0.201871150 -0.176715594 35 -0.216437816 -0.201871150 36 -0.240774035 -0.216437816 37 -0.244244035 -0.240774035 38 -0.241304035 -0.244244035 39 -0.229534035 -0.241304035 40 -0.202934035 -0.229534035 41 -0.125488070 -0.202934035 42 -0.094488070 -0.125488070 43 -0.097093372 -0.094488070 44 -0.094004483 -0.097093372 45 -0.101515594 -0.094004483 46 -0.088771150 -0.101515594 47 -0.090537816 -0.088771150 48 -0.061874035 -0.090537816 49 -0.036944035 -0.061874035 50 -0.036404035 -0.036944035 51 -0.030534035 -0.036404035 52 0.038265965 -0.030534035 53 0.085411930 0.038265965 54 0.050511930 0.085411930 55 0.039006628 0.050511930 56 0.047395517 0.039006628 57 0.086584406 0.047395517 58 0.080028850 0.086584406 59 0.119762184 0.080028850 60 0.137225965 0.119762184 61 0.150355965 0.137225965 62 0.109095965 0.150355965 63 0.083165965 0.109095965 64 0.080765965 0.083165965 65 0.132911930 0.080765965 66 0.139911930 0.132911930 67 0.142706628 0.139911930 68 0.146995517 0.142706628 69 0.166384406 0.146995517 70 0.208928850 0.166384406 71 0.231962184 0.208928850 72 0.187825965 0.231962184 73 0.187155965 0.187825965 74 0.202995965 0.187155965 75 0.178465965 0.202995965 76 0.149465965 0.178465965 77 0.135611930 0.149465965 78 0.117011930 0.135611930 79 0.154306628 0.117011930 80 0.150795517 0.154306628 81 0.118884406 0.150795517 82 0.088428850 0.118884406 83 0.076762184 0.088428850 84 0.086225965 0.076762184 85 0.079555965 0.086225965 86 0.084895965 0.079555965 87 0.111765965 0.084895965 88 0.157065965 0.111765965 89 0.184111930 0.157065965 90 0.181711930 0.184111930 91 0.206206628 0.181711930 92 0.197895517 0.206206628 93 0.178484406 0.197895517 94 0.197928850 0.178484406 95 0.212462184 0.197928850 96 0.175825965 0.212462184 97 0.193155965 0.175825965 98 0.207095965 0.193155965 99 0.236265965 0.207095965 100 0.231165965 0.236265965 101 -0.111747722 0.231165965 102 -0.087847722 -0.111747722 103 -0.085453024 -0.087847722 104 -0.057964135 -0.085453024 105 -0.032675247 -0.057964135 106 0.005469198 -0.032675247 107 -0.024597469 0.005469198 108 -0.025033687 -0.024597469 109 -0.012203687 -0.025033687 110 0.062836313 -0.012203687 111 0.087006313 0.062836313 112 0.063006313 0.087006313 113 0.101652278 0.063006313 114 0.117552278 0.101652278 115 NA 0.117552278 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.006555965 0.036725965 [2,] -0.028804035 0.006555965 [3,] -0.044934035 -0.028804035 [4,] -0.057134035 -0.044934035 [5,] -0.043088070 -0.057134035 [6,] -0.051388070 -0.043088070 [7,] -0.014493372 -0.051388070 [8,] -0.024704483 -0.014493372 [9,] -0.012015594 -0.024704483 [10,] -0.056371150 -0.012015594 [11,] -0.097837816 -0.056371150 [12,] -0.110374035 -0.097837816 [13,] -0.130844035 -0.110374035 [14,] -0.152804035 -0.130844035 [15,] -0.168334035 -0.152804035 [16,] -0.213934035 -0.168334035 [17,] -0.131688070 -0.213934035 [18,] -0.146988070 -0.131688070 [19,] -0.170793372 -0.146988070 [20,] -0.202704483 -0.170793372 [21,] -0.227415594 -0.202704483 [22,] -0.233771150 -0.227415594 [23,] -0.211537816 -0.233771150 [24,] -0.185774035 -0.211537816 [25,] -0.192544035 -0.185774035 [26,] -0.207604035 -0.192544035 [27,] -0.223334035 -0.207604035 [28,] -0.245734035 -0.223334035 [29,] -0.227688070 -0.245734035 [30,] -0.225988070 -0.227688070 [31,] -0.174393372 -0.225988070 [32,] -0.163704483 -0.174393372 [33,] -0.176715594 -0.163704483 [34,] -0.201871150 -0.176715594 [35,] -0.216437816 -0.201871150 [36,] -0.240774035 -0.216437816 [37,] -0.244244035 -0.240774035 [38,] -0.241304035 -0.244244035 [39,] -0.229534035 -0.241304035 [40,] -0.202934035 -0.229534035 [41,] -0.125488070 -0.202934035 [42,] -0.094488070 -0.125488070 [43,] -0.097093372 -0.094488070 [44,] -0.094004483 -0.097093372 [45,] -0.101515594 -0.094004483 [46,] -0.088771150 -0.101515594 [47,] -0.090537816 -0.088771150 [48,] -0.061874035 -0.090537816 [49,] -0.036944035 -0.061874035 [50,] -0.036404035 -0.036944035 [51,] -0.030534035 -0.036404035 [52,] 0.038265965 -0.030534035 [53,] 0.085411930 0.038265965 [54,] 0.050511930 0.085411930 [55,] 0.039006628 0.050511930 [56,] 0.047395517 0.039006628 [57,] 0.086584406 0.047395517 [58,] 0.080028850 0.086584406 [59,] 0.119762184 0.080028850 [60,] 0.137225965 0.119762184 [61,] 0.150355965 0.137225965 [62,] 0.109095965 0.150355965 [63,] 0.083165965 0.109095965 [64,] 0.080765965 0.083165965 [65,] 0.132911930 0.080765965 [66,] 0.139911930 0.132911930 [67,] 0.142706628 0.139911930 [68,] 0.146995517 0.142706628 [69,] 0.166384406 0.146995517 [70,] 0.208928850 0.166384406 [71,] 0.231962184 0.208928850 [72,] 0.187825965 0.231962184 [73,] 0.187155965 0.187825965 [74,] 0.202995965 0.187155965 [75,] 0.178465965 0.202995965 [76,] 0.149465965 0.178465965 [77,] 0.135611930 0.149465965 [78,] 0.117011930 0.135611930 [79,] 0.154306628 0.117011930 [80,] 0.150795517 0.154306628 [81,] 0.118884406 0.150795517 [82,] 0.088428850 0.118884406 [83,] 0.076762184 0.088428850 [84,] 0.086225965 0.076762184 [85,] 0.079555965 0.086225965 [86,] 0.084895965 0.079555965 [87,] 0.111765965 0.084895965 [88,] 0.157065965 0.111765965 [89,] 0.184111930 0.157065965 [90,] 0.181711930 0.184111930 [91,] 0.206206628 0.181711930 [92,] 0.197895517 0.206206628 [93,] 0.178484406 0.197895517 [94,] 0.197928850 0.178484406 [95,] 0.212462184 0.197928850 [96,] 0.175825965 0.212462184 [97,] 0.193155965 0.175825965 [98,] 0.207095965 0.193155965 [99,] 0.236265965 0.207095965 [100,] 0.231165965 0.236265965 [101,] -0.111747722 0.231165965 [102,] -0.087847722 -0.111747722 [103,] -0.085453024 -0.087847722 [104,] -0.057964135 -0.085453024 [105,] -0.032675247 -0.057964135 [106,] 0.005469198 -0.032675247 [107,] -0.024597469 0.005469198 [108,] -0.025033687 -0.024597469 [109,] -0.012203687 -0.025033687 [110,] 0.062836313 -0.012203687 [111,] 0.087006313 0.062836313 [112,] 0.063006313 0.087006313 [113,] 0.101652278 0.063006313 [114,] 0.117552278 0.101652278 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.006555965 0.036725965 2 -0.028804035 0.006555965 3 -0.044934035 -0.028804035 4 -0.057134035 -0.044934035 5 -0.043088070 -0.057134035 6 -0.051388070 -0.043088070 7 -0.014493372 -0.051388070 8 -0.024704483 -0.014493372 9 -0.012015594 -0.024704483 10 -0.056371150 -0.012015594 11 -0.097837816 -0.056371150 12 -0.110374035 -0.097837816 13 -0.130844035 -0.110374035 14 -0.152804035 -0.130844035 15 -0.168334035 -0.152804035 16 -0.213934035 -0.168334035 17 -0.131688070 -0.213934035 18 -0.146988070 -0.131688070 19 -0.170793372 -0.146988070 20 -0.202704483 -0.170793372 21 -0.227415594 -0.202704483 22 -0.233771150 -0.227415594 23 -0.211537816 -0.233771150 24 -0.185774035 -0.211537816 25 -0.192544035 -0.185774035 26 -0.207604035 -0.192544035 27 -0.223334035 -0.207604035 28 -0.245734035 -0.223334035 29 -0.227688070 -0.245734035 30 -0.225988070 -0.227688070 31 -0.174393372 -0.225988070 32 -0.163704483 -0.174393372 33 -0.176715594 -0.163704483 34 -0.201871150 -0.176715594 35 -0.216437816 -0.201871150 36 -0.240774035 -0.216437816 37 -0.244244035 -0.240774035 38 -0.241304035 -0.244244035 39 -0.229534035 -0.241304035 40 -0.202934035 -0.229534035 41 -0.125488070 -0.202934035 42 -0.094488070 -0.125488070 43 -0.097093372 -0.094488070 44 -0.094004483 -0.097093372 45 -0.101515594 -0.094004483 46 -0.088771150 -0.101515594 47 -0.090537816 -0.088771150 48 -0.061874035 -0.090537816 49 -0.036944035 -0.061874035 50 -0.036404035 -0.036944035 51 -0.030534035 -0.036404035 52 0.038265965 -0.030534035 53 0.085411930 0.038265965 54 0.050511930 0.085411930 55 0.039006628 0.050511930 56 0.047395517 0.039006628 57 0.086584406 0.047395517 58 0.080028850 0.086584406 59 0.119762184 0.080028850 60 0.137225965 0.119762184 61 0.150355965 0.137225965 62 0.109095965 0.150355965 63 0.083165965 0.109095965 64 0.080765965 0.083165965 65 0.132911930 0.080765965 66 0.139911930 0.132911930 67 0.142706628 0.139911930 68 0.146995517 0.142706628 69 0.166384406 0.146995517 70 0.208928850 0.166384406 71 0.231962184 0.208928850 72 0.187825965 0.231962184 73 0.187155965 0.187825965 74 0.202995965 0.187155965 75 0.178465965 0.202995965 76 0.149465965 0.178465965 77 0.135611930 0.149465965 78 0.117011930 0.135611930 79 0.154306628 0.117011930 80 0.150795517 0.154306628 81 0.118884406 0.150795517 82 0.088428850 0.118884406 83 0.076762184 0.088428850 84 0.086225965 0.076762184 85 0.079555965 0.086225965 86 0.084895965 0.079555965 87 0.111765965 0.084895965 88 0.157065965 0.111765965 89 0.184111930 0.157065965 90 0.181711930 0.184111930 91 0.206206628 0.181711930 92 0.197895517 0.206206628 93 0.178484406 0.197895517 94 0.197928850 0.178484406 95 0.212462184 0.197928850 96 0.175825965 0.212462184 97 0.193155965 0.175825965 98 0.207095965 0.193155965 99 0.236265965 0.207095965 100 0.231165965 0.236265965 101 -0.111747722 0.231165965 102 -0.087847722 -0.111747722 103 -0.085453024 -0.087847722 104 -0.057964135 -0.085453024 105 -0.032675247 -0.057964135 106 0.005469198 -0.032675247 107 -0.024597469 0.005469198 108 -0.025033687 -0.024597469 109 -0.012203687 -0.025033687 110 0.062836313 -0.012203687 111 0.087006313 0.062836313 112 0.063006313 0.087006313 113 0.101652278 0.063006313 114 0.117552278 0.101652278 > 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/733391227976381.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/806wq1227976381.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/92ta91227976381.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/10ljrd1227976381.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/11yzz01227976381.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/12t14r1227976382.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/13rmul1227976382.tab") > > system("convert tmp/1h0m21227976381.ps tmp/1h0m21227976381.png") > system("convert tmp/2nigs1227976381.ps tmp/2nigs1227976381.png") > system("convert tmp/3cjzm1227976381.ps tmp/3cjzm1227976381.png") > system("convert tmp/4z9g41227976381.ps tmp/4z9g41227976381.png") > system("convert tmp/5zgc91227976381.ps tmp/5zgc91227976381.png") > system("convert tmp/6ypon1227976381.ps tmp/6ypon1227976381.png") > system("convert tmp/733391227976381.ps tmp/733391227976381.png") > system("convert tmp/806wq1227976381.ps tmp/806wq1227976381.png") > system("convert tmp/92ta91227976381.ps tmp/92ta91227976381.png") > > > proc.time() user system elapsed 4.336 2.568 4.666