R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(27951,29781,32914,33488,35652,36488,35387,35676,34844,32447,31068,29010,29812,30951,32974,32936,34012,32946,31948,30599,27691,25073,23406,22248,22896,25317,26558,26471,27543,26198,24725,25005,23462,20780,19815,19761,21454,23899,24939,23580,24562,24696,23785,23812,21917,19713,19282,18788,21453,24482,27474,27264,27349,30632,29429,30084,26290,24379,23335,21346,21106,24514,28353,30805,31348,34556,33855,34787,32529,29998,29257,28155,30466,35704,39327,39351,42234,43630,43722,43121,37985,37135,34646,33026,35087,38846,42013,43908,42868,44423,44167,43636,44382,42142,43452,36912,42413,45344,44873,47510,49554,47369,45998,48140,48441,44928,40454,38661,37246,36843,36424,37594,38144,38737,34560,36080,33508,35462,33374,32110,35533,35532,37903,36763,40399,44164,44496,43110,43880),dim=c(1,129),dimnames=list(c('Y'),1:129)) > y <- array(NA,dim=c(1,129),dimnames=list(c('Y'),1:129)) > 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 Y M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 27951 1 0 0 0 0 0 0 0 0 0 0 1 2 29781 0 1 0 0 0 0 0 0 0 0 0 2 3 32914 0 0 1 0 0 0 0 0 0 0 0 3 4 33488 0 0 0 1 0 0 0 0 0 0 0 4 5 35652 0 0 0 0 1 0 0 0 0 0 0 5 6 36488 0 0 0 0 0 1 0 0 0 0 0 6 7 35387 0 0 0 0 0 0 1 0 0 0 0 7 8 35676 0 0 0 0 0 0 0 1 0 0 0 8 9 34844 0 0 0 0 0 0 0 0 1 0 0 9 10 32447 0 0 0 0 0 0 0 0 0 1 0 10 11 31068 0 0 0 0 0 0 0 0 0 0 1 11 12 29010 0 0 0 0 0 0 0 0 0 0 0 12 13 29812 1 0 0 0 0 0 0 0 0 0 0 13 14 30951 0 1 0 0 0 0 0 0 0 0 0 14 15 32974 0 0 1 0 0 0 0 0 0 0 0 15 16 32936 0 0 0 1 0 0 0 0 0 0 0 16 17 34012 0 0 0 0 1 0 0 0 0 0 0 17 18 32946 0 0 0 0 0 1 0 0 0 0 0 18 19 31948 0 0 0 0 0 0 1 0 0 0 0 19 20 30599 0 0 0 0 0 0 0 1 0 0 0 20 21 27691 0 0 0 0 0 0 0 0 1 0 0 21 22 25073 0 0 0 0 0 0 0 0 0 1 0 22 23 23406 0 0 0 0 0 0 0 0 0 0 1 23 24 22248 0 0 0 0 0 0 0 0 0 0 0 24 25 22896 1 0 0 0 0 0 0 0 0 0 0 25 26 25317 0 1 0 0 0 0 0 0 0 0 0 26 27 26558 0 0 1 0 0 0 0 0 0 0 0 27 28 26471 0 0 0 1 0 0 0 0 0 0 0 28 29 27543 0 0 0 0 1 0 0 0 0 0 0 29 30 26198 0 0 0 0 0 1 0 0 0 0 0 30 31 24725 0 0 0 0 0 0 1 0 0 0 0 31 32 25005 0 0 0 0 0 0 0 1 0 0 0 32 33 23462 0 0 0 0 0 0 0 0 1 0 0 33 34 20780 0 0 0 0 0 0 0 0 0 1 0 34 35 19815 0 0 0 0 0 0 0 0 0 0 1 35 36 19761 0 0 0 0 0 0 0 0 0 0 0 36 37 21454 1 0 0 0 0 0 0 0 0 0 0 37 38 23899 0 1 0 0 0 0 0 0 0 0 0 38 39 24939 0 0 1 0 0 0 0 0 0 0 0 39 40 23580 0 0 0 1 0 0 0 0 0 0 0 40 41 24562 0 0 0 0 1 0 0 0 0 0 0 41 42 24696 0 0 0 0 0 1 0 0 0 0 0 42 43 23785 0 0 0 0 0 0 1 0 0 0 0 43 44 23812 0 0 0 0 0 0 0 1 0 0 0 44 45 21917 0 0 0 0 0 0 0 0 1 0 0 45 46 19713 0 0 0 0 0 0 0 0 0 1 0 46 47 19282 0 0 0 0 0 0 0 0 0 0 1 47 48 18788 0 0 0 0 0 0 0 0 0 0 0 48 49 21453 1 0 0 0 0 0 0 0 0 0 0 49 50 24482 0 1 0 0 0 0 0 0 0 0 0 50 51 27474 0 0 1 0 0 0 0 0 0 0 0 51 52 27264 0 0 0 1 0 0 0 0 0 0 0 52 53 27349 0 0 0 0 1 0 0 0 0 0 0 53 54 30632 0 0 0 0 0 1 0 0 0 0 0 54 55 29429 0 0 0 0 0 0 1 0 0 0 0 55 56 30084 0 0 0 0 0 0 0 1 0 0 0 56 57 26290 0 0 0 0 0 0 0 0 1 0 0 57 58 24379 0 0 0 0 0 0 0 0 0 1 0 58 59 23335 0 0 0 0 0 0 0 0 0 0 1 59 60 21346 0 0 0 0 0 0 0 0 0 0 0 60 61 21106 1 0 0 0 0 0 0 0 0 0 0 61 62 24514 0 1 0 0 0 0 0 0 0 0 0 62 63 28353 0 0 1 0 0 0 0 0 0 0 0 63 64 30805 0 0 0 1 0 0 0 0 0 0 0 64 65 31348 0 0 0 0 1 0 0 0 0 0 0 65 66 34556 0 0 0 0 0 1 0 0 0 0 0 66 67 33855 0 0 0 0 0 0 1 0 0 0 0 67 68 34787 0 0 0 0 0 0 0 1 0 0 0 68 69 32529 0 0 0 0 0 0 0 0 1 0 0 69 70 29998 0 0 0 0 0 0 0 0 0 1 0 70 71 29257 0 0 0 0 0 0 0 0 0 0 1 71 72 28155 0 0 0 0 0 0 0 0 0 0 0 72 73 30466 1 0 0 0 0 0 0 0 0 0 0 73 74 35704 0 1 0 0 0 0 0 0 0 0 0 74 75 39327 0 0 1 0 0 0 0 0 0 0 0 75 76 39351 0 0 0 1 0 0 0 0 0 0 0 76 77 42234 0 0 0 0 1 0 0 0 0 0 0 77 78 43630 0 0 0 0 0 1 0 0 0 0 0 78 79 43722 0 0 0 0 0 0 1 0 0 0 0 79 80 43121 0 0 0 0 0 0 0 1 0 0 0 80 81 37985 0 0 0 0 0 0 0 0 1 0 0 81 82 37135 0 0 0 0 0 0 0 0 0 1 0 82 83 34646 0 0 0 0 0 0 0 0 0 0 1 83 84 33026 0 0 0 0 0 0 0 0 0 0 0 84 85 35087 1 0 0 0 0 0 0 0 0 0 0 85 86 38846 0 1 0 0 0 0 0 0 0 0 0 86 87 42013 0 0 1 0 0 0 0 0 0 0 0 87 88 43908 0 0 0 1 0 0 0 0 0 0 0 88 89 42868 0 0 0 0 1 0 0 0 0 0 0 89 90 44423 0 0 0 0 0 1 0 0 0 0 0 90 91 44167 0 0 0 0 0 0 1 0 0 0 0 91 92 43636 0 0 0 0 0 0 0 1 0 0 0 92 93 44382 0 0 0 0 0 0 0 0 1 0 0 93 94 42142 0 0 0 0 0 0 0 0 0 1 0 94 95 43452 0 0 0 0 0 0 0 0 0 0 1 95 96 36912 0 0 0 0 0 0 0 0 0 0 0 96 97 42413 1 0 0 0 0 0 0 0 0 0 0 97 98 45344 0 1 0 0 0 0 0 0 0 0 0 98 99 44873 0 0 1 0 0 0 0 0 0 0 0 99 100 47510 0 0 0 1 0 0 0 0 0 0 0 100 101 49554 0 0 0 0 1 0 0 0 0 0 0 101 102 47369 0 0 0 0 0 1 0 0 0 0 0 102 103 45998 0 0 0 0 0 0 1 0 0 0 0 103 104 48140 0 0 0 0 0 0 0 1 0 0 0 104 105 48441 0 0 0 0 0 0 0 0 1 0 0 105 106 44928 0 0 0 0 0 0 0 0 0 1 0 106 107 40454 0 0 0 0 0 0 0 0 0 0 1 107 108 38661 0 0 0 0 0 0 0 0 0 0 0 108 109 37246 1 0 0 0 0 0 0 0 0 0 0 109 110 36843 0 1 0 0 0 0 0 0 0 0 0 110 111 36424 0 0 1 0 0 0 0 0 0 0 0 111 112 37594 0 0 0 1 0 0 0 0 0 0 0 112 113 38144 0 0 0 0 1 0 0 0 0 0 0 113 114 38737 0 0 0 0 0 1 0 0 0 0 0 114 115 34560 0 0 0 0 0 0 1 0 0 0 0 115 116 36080 0 0 0 0 0 0 0 1 0 0 0 116 117 33508 0 0 0 0 0 0 0 0 1 0 0 117 118 35462 0 0 0 0 0 0 0 0 0 1 0 118 119 33374 0 0 0 0 0 0 0 0 0 0 1 119 120 32110 0 0 0 0 0 0 0 0 0 0 0 120 121 35533 1 0 0 0 0 0 0 0 0 0 0 121 122 35532 0 1 0 0 0 0 0 0 0 0 0 122 123 37903 0 0 1 0 0 0 0 0 0 0 0 123 124 36763 0 0 0 1 0 0 0 0 0 0 0 124 125 40399 0 0 0 0 1 0 0 0 0 0 0 125 126 44164 0 0 0 0 0 1 0 0 0 0 0 126 127 44496 0 0 0 0 0 0 1 0 0 0 0 127 128 43110 0 0 0 0 0 0 0 1 0 0 0 128 129 43880 0 0 0 0 0 0 0 0 1 0 0 129 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) M1 M2 M3 M4 M5 19301.7 2240.8 4454.0 6371.2 6777.4 7917.8 M6 M7 M8 M9 M10 M11 8710.9 7509.4 7557.4 5687.3 3467.6 1939.0 t 131.8 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -9120.0 -4921.6 -699.2 5323.8 9688.5 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 19301.68 2068.55 9.331 8.77e-16 *** M1 2240.76 2563.01 0.874 0.383779 M2 4454.03 2562.67 1.738 0.084857 . M3 6371.21 2562.41 2.486 0.014327 * M4 6777.39 2562.22 2.645 0.009298 ** M5 7917.85 2562.11 3.090 0.002503 ** M6 8710.94 2562.07 3.400 0.000925 *** M7 7509.39 2562.11 2.931 0.004071 ** M8 7557.39 2562.22 2.950 0.003850 ** M9 5687.30 2562.41 2.220 0.028397 * M10 3467.64 2622.51 1.322 0.188683 M11 1939.02 2622.40 0.739 0.461154 t 131.82 13.89 9.490 3.73e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5864 on 116 degrees of freedom Multiple R-squared: 0.5049, Adjusted R-squared: 0.4537 F-statistic: 9.859 on 12 and 116 DF, p-value: 4.906e-13 > postscript(file="/var/www/html/rcomp/tmp/14jnv1291111772.ps",horizontal=F,onefile=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/2fbmg1291111772.ps",horizontal=F,onefile=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/3fbmg1291111772.ps",horizontal=F,onefile=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/4fbmg1291111772.ps",horizontal=F,onefile=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/5fbmg1291111772.ps",horizontal=F,onefile=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 = 129 Frequency = 1 1 2 3 4 5 6 6276.74949 5761.65859 6845.65859 6881.65859 7773.38586 7684.47677 7 8 9 10 11 12 7653.20404 7762.38586 8668.65859 8359.50182 8377.30182 8126.50182 13 14 15 16 17 18 6555.92687 5349.83596 5323.83596 4747.83596 4551.56323 2560.65414 19 20 21 22 23 24 2632.38141 1103.56323 -66.16404 -596.32081 -866.52081 -217.32081 25 26 27 28 29 30 -1941.89576 -1865.98667 -2673.98667 -3298.98667 -3499.25939 -5769.16848 31 32 33 34 35 36 -6172.44121 -6072.25939 -5876.98667 -6471.14343 -6039.34343 -4286.14343 37 38 39 40 41 42 -4965.71838 -4865.80929 -5874.80929 -7771.80929 -8062.08202 -8852.99111 43 44 45 46 47 48 -8694.26384 -8847.08202 -9003.80929 -9119.96606 -8154.16606 -6840.96606 49 50 51 52 53 54 -6548.54101 -5864.63192 -4921.63192 -5669.63192 -6856.90465 -4498.81374 55 56 57 58 59 60 -4632.08646 -4156.90465 -6212.63192 -6035.78869 -5682.98869 -5864.78869 61 62 63 64 65 66 -8477.36364 -7414.45455 -5624.45455 -3710.45455 -4439.72727 -2156.63636 67 68 69 70 71 72 -1787.90909 -1035.72727 -1555.45455 -1998.61131 -1342.81131 -637.61131 73 74 75 76 77 78 -699.18626 2193.72283 3767.72283 3253.72283 4864.45010 5335.54101 79 80 81 82 83 84 6497.26828 5716.45010 2318.72283 3556.56606 2464.36606 2651.56606 85 86 87 88 89 90 2339.99111 3753.90020 4871.90020 6228.90020 3916.62747 4546.71838 91 92 93 94 95 96 5360.44566 4649.62747 7133.90020 6981.74343 9688.54343 4955.74343 97 98 99 100 101 102 8084.16848 8670.07758 6150.07758 8249.07758 9020.80485 5910.89576 103 104 105 106 107 108 5609.62303 7571.80485 9611.07758 8185.92081 5108.72081 5122.92081 109 110 111 112 113 114 1335.34586 -1412.74505 -3880.74505 -3248.74505 -3971.01778 -4302.92687 115 116 117 118 119 120 -7410.19960 -6070.01778 -6903.74505 -2861.90182 -3553.10182 -3009.90182 121 122 123 124 125 126 -1959.47677 -4305.56768 -3983.56768 -5661.56768 -3297.84040 -457.74949 127 128 129 943.97778 -621.84040 1886.43232 > postscript(file="/var/www/html/rcomp/tmp/6qk3j1291111772.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 129 Frequency = 1 lag(myerror, k = 1) myerror 0 6276.74949 NA 1 5761.65859 6276.74949 2 6845.65859 5761.65859 3 6881.65859 6845.65859 4 7773.38586 6881.65859 5 7684.47677 7773.38586 6 7653.20404 7684.47677 7 7762.38586 7653.20404 8 8668.65859 7762.38586 9 8359.50182 8668.65859 10 8377.30182 8359.50182 11 8126.50182 8377.30182 12 6555.92687 8126.50182 13 5349.83596 6555.92687 14 5323.83596 5349.83596 15 4747.83596 5323.83596 16 4551.56323 4747.83596 17 2560.65414 4551.56323 18 2632.38141 2560.65414 19 1103.56323 2632.38141 20 -66.16404 1103.56323 21 -596.32081 -66.16404 22 -866.52081 -596.32081 23 -217.32081 -866.52081 24 -1941.89576 -217.32081 25 -1865.98667 -1941.89576 26 -2673.98667 -1865.98667 27 -3298.98667 -2673.98667 28 -3499.25939 -3298.98667 29 -5769.16848 -3499.25939 30 -6172.44121 -5769.16848 31 -6072.25939 -6172.44121 32 -5876.98667 -6072.25939 33 -6471.14343 -5876.98667 34 -6039.34343 -6471.14343 35 -4286.14343 -6039.34343 36 -4965.71838 -4286.14343 37 -4865.80929 -4965.71838 38 -5874.80929 -4865.80929 39 -7771.80929 -5874.80929 40 -8062.08202 -7771.80929 41 -8852.99111 -8062.08202 42 -8694.26384 -8852.99111 43 -8847.08202 -8694.26384 44 -9003.80929 -8847.08202 45 -9119.96606 -9003.80929 46 -8154.16606 -9119.96606 47 -6840.96606 -8154.16606 48 -6548.54101 -6840.96606 49 -5864.63192 -6548.54101 50 -4921.63192 -5864.63192 51 -5669.63192 -4921.63192 52 -6856.90465 -5669.63192 53 -4498.81374 -6856.90465 54 -4632.08646 -4498.81374 55 -4156.90465 -4632.08646 56 -6212.63192 -4156.90465 57 -6035.78869 -6212.63192 58 -5682.98869 -6035.78869 59 -5864.78869 -5682.98869 60 -8477.36364 -5864.78869 61 -7414.45455 -8477.36364 62 -5624.45455 -7414.45455 63 -3710.45455 -5624.45455 64 -4439.72727 -3710.45455 65 -2156.63636 -4439.72727 66 -1787.90909 -2156.63636 67 -1035.72727 -1787.90909 68 -1555.45455 -1035.72727 69 -1998.61131 -1555.45455 70 -1342.81131 -1998.61131 71 -637.61131 -1342.81131 72 -699.18626 -637.61131 73 2193.72283 -699.18626 74 3767.72283 2193.72283 75 3253.72283 3767.72283 76 4864.45010 3253.72283 77 5335.54101 4864.45010 78 6497.26828 5335.54101 79 5716.45010 6497.26828 80 2318.72283 5716.45010 81 3556.56606 2318.72283 82 2464.36606 3556.56606 83 2651.56606 2464.36606 84 2339.99111 2651.56606 85 3753.90020 2339.99111 86 4871.90020 3753.90020 87 6228.90020 4871.90020 88 3916.62747 6228.90020 89 4546.71838 3916.62747 90 5360.44566 4546.71838 91 4649.62747 5360.44566 92 7133.90020 4649.62747 93 6981.74343 7133.90020 94 9688.54343 6981.74343 95 4955.74343 9688.54343 96 8084.16848 4955.74343 97 8670.07758 8084.16848 98 6150.07758 8670.07758 99 8249.07758 6150.07758 100 9020.80485 8249.07758 101 5910.89576 9020.80485 102 5609.62303 5910.89576 103 7571.80485 5609.62303 104 9611.07758 7571.80485 105 8185.92081 9611.07758 106 5108.72081 8185.92081 107 5122.92081 5108.72081 108 1335.34586 5122.92081 109 -1412.74505 1335.34586 110 -3880.74505 -1412.74505 111 -3248.74505 -3880.74505 112 -3971.01778 -3248.74505 113 -4302.92687 -3971.01778 114 -7410.19960 -4302.92687 115 -6070.01778 -7410.19960 116 -6903.74505 -6070.01778 117 -2861.90182 -6903.74505 118 -3553.10182 -2861.90182 119 -3009.90182 -3553.10182 120 -1959.47677 -3009.90182 121 -4305.56768 -1959.47677 122 -3983.56768 -4305.56768 123 -5661.56768 -3983.56768 124 -3297.84040 -5661.56768 125 -457.74949 -3297.84040 126 943.97778 -457.74949 127 -621.84040 943.97778 128 1886.43232 -621.84040 129 NA 1886.43232 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 5761.65859 6276.74949 [2,] 6845.65859 5761.65859 [3,] 6881.65859 6845.65859 [4,] 7773.38586 6881.65859 [5,] 7684.47677 7773.38586 [6,] 7653.20404 7684.47677 [7,] 7762.38586 7653.20404 [8,] 8668.65859 7762.38586 [9,] 8359.50182 8668.65859 [10,] 8377.30182 8359.50182 [11,] 8126.50182 8377.30182 [12,] 6555.92687 8126.50182 [13,] 5349.83596 6555.92687 [14,] 5323.83596 5349.83596 [15,] 4747.83596 5323.83596 [16,] 4551.56323 4747.83596 [17,] 2560.65414 4551.56323 [18,] 2632.38141 2560.65414 [19,] 1103.56323 2632.38141 [20,] -66.16404 1103.56323 [21,] -596.32081 -66.16404 [22,] -866.52081 -596.32081 [23,] -217.32081 -866.52081 [24,] -1941.89576 -217.32081 [25,] -1865.98667 -1941.89576 [26,] -2673.98667 -1865.98667 [27,] -3298.98667 -2673.98667 [28,] -3499.25939 -3298.98667 [29,] -5769.16848 -3499.25939 [30,] -6172.44121 -5769.16848 [31,] -6072.25939 -6172.44121 [32,] -5876.98667 -6072.25939 [33,] -6471.14343 -5876.98667 [34,] -6039.34343 -6471.14343 [35,] -4286.14343 -6039.34343 [36,] -4965.71838 -4286.14343 [37,] -4865.80929 -4965.71838 [38,] -5874.80929 -4865.80929 [39,] -7771.80929 -5874.80929 [40,] -8062.08202 -7771.80929 [41,] -8852.99111 -8062.08202 [42,] -8694.26384 -8852.99111 [43,] -8847.08202 -8694.26384 [44,] -9003.80929 -8847.08202 [45,] -9119.96606 -9003.80929 [46,] -8154.16606 -9119.96606 [47,] -6840.96606 -8154.16606 [48,] -6548.54101 -6840.96606 [49,] -5864.63192 -6548.54101 [50,] -4921.63192 -5864.63192 [51,] -5669.63192 -4921.63192 [52,] -6856.90465 -5669.63192 [53,] -4498.81374 -6856.90465 [54,] -4632.08646 -4498.81374 [55,] -4156.90465 -4632.08646 [56,] -6212.63192 -4156.90465 [57,] -6035.78869 -6212.63192 [58,] -5682.98869 -6035.78869 [59,] -5864.78869 -5682.98869 [60,] -8477.36364 -5864.78869 [61,] -7414.45455 -8477.36364 [62,] -5624.45455 -7414.45455 [63,] -3710.45455 -5624.45455 [64,] -4439.72727 -3710.45455 [65,] -2156.63636 -4439.72727 [66,] -1787.90909 -2156.63636 [67,] -1035.72727 -1787.90909 [68,] -1555.45455 -1035.72727 [69,] -1998.61131 -1555.45455 [70,] -1342.81131 -1998.61131 [71,] -637.61131 -1342.81131 [72,] -699.18626 -637.61131 [73,] 2193.72283 -699.18626 [74,] 3767.72283 2193.72283 [75,] 3253.72283 3767.72283 [76,] 4864.45010 3253.72283 [77,] 5335.54101 4864.45010 [78,] 6497.26828 5335.54101 [79,] 5716.45010 6497.26828 [80,] 2318.72283 5716.45010 [81,] 3556.56606 2318.72283 [82,] 2464.36606 3556.56606 [83,] 2651.56606 2464.36606 [84,] 2339.99111 2651.56606 [85,] 3753.90020 2339.99111 [86,] 4871.90020 3753.90020 [87,] 6228.90020 4871.90020 [88,] 3916.62747 6228.90020 [89,] 4546.71838 3916.62747 [90,] 5360.44566 4546.71838 [91,] 4649.62747 5360.44566 [92,] 7133.90020 4649.62747 [93,] 6981.74343 7133.90020 [94,] 9688.54343 6981.74343 [95,] 4955.74343 9688.54343 [96,] 8084.16848 4955.74343 [97,] 8670.07758 8084.16848 [98,] 6150.07758 8670.07758 [99,] 8249.07758 6150.07758 [100,] 9020.80485 8249.07758 [101,] 5910.89576 9020.80485 [102,] 5609.62303 5910.89576 [103,] 7571.80485 5609.62303 [104,] 9611.07758 7571.80485 [105,] 8185.92081 9611.07758 [106,] 5108.72081 8185.92081 [107,] 5122.92081 5108.72081 [108,] 1335.34586 5122.92081 [109,] -1412.74505 1335.34586 [110,] -3880.74505 -1412.74505 [111,] -3248.74505 -3880.74505 [112,] -3971.01778 -3248.74505 [113,] -4302.92687 -3971.01778 [114,] -7410.19960 -4302.92687 [115,] -6070.01778 -7410.19960 [116,] -6903.74505 -6070.01778 [117,] -2861.90182 -6903.74505 [118,] -3553.10182 -2861.90182 [119,] -3009.90182 -3553.10182 [120,] -1959.47677 -3009.90182 [121,] -4305.56768 -1959.47677 [122,] -3983.56768 -4305.56768 [123,] -5661.56768 -3983.56768 [124,] -3297.84040 -5661.56768 [125,] -457.74949 -3297.84040 [126,] 943.97778 -457.74949 [127,] -621.84040 943.97778 [128,] 1886.43232 -621.84040 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 5761.65859 6276.74949 2 6845.65859 5761.65859 3 6881.65859 6845.65859 4 7773.38586 6881.65859 5 7684.47677 7773.38586 6 7653.20404 7684.47677 7 7762.38586 7653.20404 8 8668.65859 7762.38586 9 8359.50182 8668.65859 10 8377.30182 8359.50182 11 8126.50182 8377.30182 12 6555.92687 8126.50182 13 5349.83596 6555.92687 14 5323.83596 5349.83596 15 4747.83596 5323.83596 16 4551.56323 4747.83596 17 2560.65414 4551.56323 18 2632.38141 2560.65414 19 1103.56323 2632.38141 20 -66.16404 1103.56323 21 -596.32081 -66.16404 22 -866.52081 -596.32081 23 -217.32081 -866.52081 24 -1941.89576 -217.32081 25 -1865.98667 -1941.89576 26 -2673.98667 -1865.98667 27 -3298.98667 -2673.98667 28 -3499.25939 -3298.98667 29 -5769.16848 -3499.25939 30 -6172.44121 -5769.16848 31 -6072.25939 -6172.44121 32 -5876.98667 -6072.25939 33 -6471.14343 -5876.98667 34 -6039.34343 -6471.14343 35 -4286.14343 -6039.34343 36 -4965.71838 -4286.14343 37 -4865.80929 -4965.71838 38 -5874.80929 -4865.80929 39 -7771.80929 -5874.80929 40 -8062.08202 -7771.80929 41 -8852.99111 -8062.08202 42 -8694.26384 -8852.99111 43 -8847.08202 -8694.26384 44 -9003.80929 -8847.08202 45 -9119.96606 -9003.80929 46 -8154.16606 -9119.96606 47 -6840.96606 -8154.16606 48 -6548.54101 -6840.96606 49 -5864.63192 -6548.54101 50 -4921.63192 -5864.63192 51 -5669.63192 -4921.63192 52 -6856.90465 -5669.63192 53 -4498.81374 -6856.90465 54 -4632.08646 -4498.81374 55 -4156.90465 -4632.08646 56 -6212.63192 -4156.90465 57 -6035.78869 -6212.63192 58 -5682.98869 -6035.78869 59 -5864.78869 -5682.98869 60 -8477.36364 -5864.78869 61 -7414.45455 -8477.36364 62 -5624.45455 -7414.45455 63 -3710.45455 -5624.45455 64 -4439.72727 -3710.45455 65 -2156.63636 -4439.72727 66 -1787.90909 -2156.63636 67 -1035.72727 -1787.90909 68 -1555.45455 -1035.72727 69 -1998.61131 -1555.45455 70 -1342.81131 -1998.61131 71 -637.61131 -1342.81131 72 -699.18626 -637.61131 73 2193.72283 -699.18626 74 3767.72283 2193.72283 75 3253.72283 3767.72283 76 4864.45010 3253.72283 77 5335.54101 4864.45010 78 6497.26828 5335.54101 79 5716.45010 6497.26828 80 2318.72283 5716.45010 81 3556.56606 2318.72283 82 2464.36606 3556.56606 83 2651.56606 2464.36606 84 2339.99111 2651.56606 85 3753.90020 2339.99111 86 4871.90020 3753.90020 87 6228.90020 4871.90020 88 3916.62747 6228.90020 89 4546.71838 3916.62747 90 5360.44566 4546.71838 91 4649.62747 5360.44566 92 7133.90020 4649.62747 93 6981.74343 7133.90020 94 9688.54343 6981.74343 95 4955.74343 9688.54343 96 8084.16848 4955.74343 97 8670.07758 8084.16848 98 6150.07758 8670.07758 99 8249.07758 6150.07758 100 9020.80485 8249.07758 101 5910.89576 9020.80485 102 5609.62303 5910.89576 103 7571.80485 5609.62303 104 9611.07758 7571.80485 105 8185.92081 9611.07758 106 5108.72081 8185.92081 107 5122.92081 5108.72081 108 1335.34586 5122.92081 109 -1412.74505 1335.34586 110 -3880.74505 -1412.74505 111 -3248.74505 -3880.74505 112 -3971.01778 -3248.74505 113 -4302.92687 -3971.01778 114 -7410.19960 -4302.92687 115 -6070.01778 -7410.19960 116 -6903.74505 -6070.01778 117 -2861.90182 -6903.74505 118 -3553.10182 -2861.90182 119 -3009.90182 -3553.10182 120 -1959.47677 -3009.90182 121 -4305.56768 -1959.47677 122 -3983.56768 -4305.56768 123 -5661.56768 -3983.56768 124 -3297.84040 -5661.56768 125 -457.74949 -3297.84040 126 943.97778 -457.74949 127 -621.84040 943.97778 128 1886.43232 -621.84040 > 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/7jblm1291111772.ps",horizontal=F,onefile=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/8jblm1291111772.ps",horizontal=F,onefile=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/9jblm1291111772.ps",horizontal=F,onefile=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/10fliu1291111772.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/11n76p1291111772.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/12evxr1291111772.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/130wvx1291111772.tab") > > try(system("convert tmp/14jnv1291111772.ps tmp/14jnv1291111772.png",intern=TRUE)) character(0) > try(system("convert tmp/2fbmg1291111772.ps tmp/2fbmg1291111772.png",intern=TRUE)) character(0) > try(system("convert tmp/3fbmg1291111772.ps tmp/3fbmg1291111772.png",intern=TRUE)) character(0) > try(system("convert tmp/4fbmg1291111772.ps tmp/4fbmg1291111772.png",intern=TRUE)) character(0) > try(system("convert tmp/5fbmg1291111772.ps tmp/5fbmg1291111772.png",intern=TRUE)) character(0) > try(system("convert tmp/6qk3j1291111772.ps tmp/6qk3j1291111772.png",intern=TRUE)) character(0) > try(system("convert tmp/7jblm1291111772.ps tmp/7jblm1291111772.png",intern=TRUE)) character(0) > try(system("convert tmp/8jblm1291111772.ps tmp/8jblm1291111772.png",intern=TRUE)) character(0) > try(system("convert tmp/9jblm1291111772.ps tmp/9jblm1291111772.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.251 1.526 7.738