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(3030.29 + ,0 + ,2803.47 + ,0 + ,2767.63 + ,0 + ,2882.6 + ,0 + ,2863.36 + ,0 + ,2897.06 + ,0 + ,3012.61 + ,0 + ,3142.95 + ,0 + ,3032.93 + ,0 + ,3045.78 + ,0 + ,3110.52 + ,0 + ,3013.24 + ,0 + ,2987.1 + ,0 + ,2995.55 + ,0 + ,2833.18 + ,0 + ,2848.96 + ,0 + ,2794.83 + ,0 + ,2845.26 + ,0 + ,2915.02 + ,0 + ,2892.63 + ,0 + ,2604.42 + ,0 + ,2641.65 + ,0 + ,2659.81 + ,0 + ,2638.53 + ,0 + ,2720.25 + ,0 + ,2745.88 + ,0 + ,2735.7 + ,0 + ,2811.7 + ,0 + ,2799.43 + ,0 + ,2555.28 + ,0 + ,2304.98 + ,0 + ,2214.95 + ,0 + ,2065.81 + ,0 + ,1940.49 + ,0 + ,2042 + ,0 + ,1995.37 + ,0 + ,1946.81 + ,0 + ,1765.9 + ,0 + ,1635.25 + ,0 + ,1833.42 + ,0 + ,1910.43 + ,0 + ,1959.67 + ,0 + ,1969.6 + ,0 + ,2061.41 + ,0 + ,2093.48 + ,0 + ,2120.88 + ,0 + ,2174.56 + ,0 + ,2196.72 + ,0 + ,2350.44 + ,0 + ,2440.25 + ,0 + ,2408.64 + ,0 + ,2472.81 + ,0 + ,2407.6 + ,0 + ,2454.62 + ,0 + ,2448.05 + ,0 + ,2497.84 + ,0 + ,2645.64 + ,0 + ,2756.76 + ,0 + ,2849.27 + ,0 + ,2921.44 + ,0 + ,2981.85 + ,0 + ,3080.58 + ,0 + ,3106.22 + ,0 + ,3119.31 + ,0 + ,3061.26 + ,0 + ,3097.31 + ,0 + ,3161.69 + ,0 + ,3257.16 + ,0 + ,3277.01 + ,0 + ,3295.32 + ,0 + ,3363.99 + ,0 + ,3494.17 + ,0 + ,3667.03 + ,0 + ,3813.06 + ,0 + ,3917.96 + ,0 + ,3895.51 + ,0 + ,3801.06 + ,0 + ,3570.12 + ,0 + ,3701.61 + ,0 + ,3862.27 + ,0 + ,3970.1 + ,0 + ,4138.52 + ,0 + ,4199.75 + ,0 + ,4290.89 + ,0 + ,4443.91 + ,0 + ,4502.64 + ,0 + ,4356.98 + ,0 + ,4591.27 + ,0 + ,4696.96 + ,0 + ,4621.4 + ,0 + ,4562.84 + ,1 + ,4202.52 + ,1 + ,4296.49 + ,1 + ,4435.23 + ,1 + ,4105.18 + ,1 + ,4116.68 + ,1 + ,3844.49 + ,1 + ,3720.98 + ,1 + ,3674.4 + ,1 + ,3857.62 + ,1 + ,3801.06 + ,1 + ,3504.37 + ,1 + ,3032.6 + ,1 + ,3047.03 + ,1 + ,2962.34 + ,1 + ,2197.82 + ,1 + ,2014.45 + ,1) + ,dim=c(2 + ,107) + ,dimnames=list(c('BEL20' + ,'Wel(1)_geen(0)_financiële_crisis') + ,1:107)) > y <- array(NA,dim=c(2,107),dimnames=list(c('BEL20','Wel(1)_geen(0)_financiële_crisis'),1:107)) > 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 BEL20 Wel(1)_geen(0)_financi\353le_crisis M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 1 3030.29 0 1 0 0 0 0 0 0 0 0 0 2 2803.47 0 0 1 0 0 0 0 0 0 0 0 3 2767.63 0 0 0 1 0 0 0 0 0 0 0 4 2882.60 0 0 0 0 1 0 0 0 0 0 0 5 2863.36 0 0 0 0 0 1 0 0 0 0 0 6 2897.06 0 0 0 0 0 0 1 0 0 0 0 7 3012.61 0 0 0 0 0 0 0 1 0 0 0 8 3142.95 0 0 0 0 0 0 0 0 1 0 0 9 3032.93 0 0 0 0 0 0 0 0 0 1 0 10 3045.78 0 0 0 0 0 0 0 0 0 0 1 11 3110.52 0 0 0 0 0 0 0 0 0 0 0 12 3013.24 0 0 0 0 0 0 0 0 0 0 0 13 2987.10 0 1 0 0 0 0 0 0 0 0 0 14 2995.55 0 0 1 0 0 0 0 0 0 0 0 15 2833.18 0 0 0 1 0 0 0 0 0 0 0 16 2848.96 0 0 0 0 1 0 0 0 0 0 0 17 2794.83 0 0 0 0 0 1 0 0 0 0 0 18 2845.26 0 0 0 0 0 0 1 0 0 0 0 19 2915.02 0 0 0 0 0 0 0 1 0 0 0 20 2892.63 0 0 0 0 0 0 0 0 1 0 0 21 2604.42 0 0 0 0 0 0 0 0 0 1 0 22 2641.65 0 0 0 0 0 0 0 0 0 0 1 23 2659.81 0 0 0 0 0 0 0 0 0 0 0 24 2638.53 0 0 0 0 0 0 0 0 0 0 0 25 2720.25 0 1 0 0 0 0 0 0 0 0 0 26 2745.88 0 0 1 0 0 0 0 0 0 0 0 27 2735.70 0 0 0 1 0 0 0 0 0 0 0 28 2811.70 0 0 0 0 1 0 0 0 0 0 0 29 2799.43 0 0 0 0 0 1 0 0 0 0 0 30 2555.28 0 0 0 0 0 0 1 0 0 0 0 31 2304.98 0 0 0 0 0 0 0 1 0 0 0 32 2214.95 0 0 0 0 0 0 0 0 1 0 0 33 2065.81 0 0 0 0 0 0 0 0 0 1 0 34 1940.49 0 0 0 0 0 0 0 0 0 0 1 35 2042.00 0 0 0 0 0 0 0 0 0 0 0 36 1995.37 0 0 0 0 0 0 0 0 0 0 0 37 1946.81 0 1 0 0 0 0 0 0 0 0 0 38 1765.90 0 0 1 0 0 0 0 0 0 0 0 39 1635.25 0 0 0 1 0 0 0 0 0 0 0 40 1833.42 0 0 0 0 1 0 0 0 0 0 0 41 1910.43 0 0 0 0 0 1 0 0 0 0 0 42 1959.67 0 0 0 0 0 0 1 0 0 0 0 43 1969.60 0 0 0 0 0 0 0 1 0 0 0 44 2061.41 0 0 0 0 0 0 0 0 1 0 0 45 2093.48 0 0 0 0 0 0 0 0 0 1 0 46 2120.88 0 0 0 0 0 0 0 0 0 0 1 47 2174.56 0 0 0 0 0 0 0 0 0 0 0 48 2196.72 0 0 0 0 0 0 0 0 0 0 0 49 2350.44 0 1 0 0 0 0 0 0 0 0 0 50 2440.25 0 0 1 0 0 0 0 0 0 0 0 51 2408.64 0 0 0 1 0 0 0 0 0 0 0 52 2472.81 0 0 0 0 1 0 0 0 0 0 0 53 2407.60 0 0 0 0 0 1 0 0 0 0 0 54 2454.62 0 0 0 0 0 0 1 0 0 0 0 55 2448.05 0 0 0 0 0 0 0 1 0 0 0 56 2497.84 0 0 0 0 0 0 0 0 1 0 0 57 2645.64 0 0 0 0 0 0 0 0 0 1 0 58 2756.76 0 0 0 0 0 0 0 0 0 0 1 59 2849.27 0 0 0 0 0 0 0 0 0 0 0 60 2921.44 0 0 0 0 0 0 0 0 0 0 0 61 2981.85 0 1 0 0 0 0 0 0 0 0 0 62 3080.58 0 0 1 0 0 0 0 0 0 0 0 63 3106.22 0 0 0 1 0 0 0 0 0 0 0 64 3119.31 0 0 0 0 1 0 0 0 0 0 0 65 3061.26 0 0 0 0 0 1 0 0 0 0 0 66 3097.31 0 0 0 0 0 0 1 0 0 0 0 67 3161.69 0 0 0 0 0 0 0 1 0 0 0 68 3257.16 0 0 0 0 0 0 0 0 1 0 0 69 3277.01 0 0 0 0 0 0 0 0 0 1 0 70 3295.32 0 0 0 0 0 0 0 0 0 0 1 71 3363.99 0 0 0 0 0 0 0 0 0 0 0 72 3494.17 0 0 0 0 0 0 0 0 0 0 0 73 3667.03 0 1 0 0 0 0 0 0 0 0 0 74 3813.06 0 0 1 0 0 0 0 0 0 0 0 75 3917.96 0 0 0 1 0 0 0 0 0 0 0 76 3895.51 0 0 0 0 1 0 0 0 0 0 0 77 3801.06 0 0 0 0 0 1 0 0 0 0 0 78 3570.12 0 0 0 0 0 0 1 0 0 0 0 79 3701.61 0 0 0 0 0 0 0 1 0 0 0 80 3862.27 0 0 0 0 0 0 0 0 1 0 0 81 3970.10 0 0 0 0 0 0 0 0 0 1 0 82 4138.52 0 0 0 0 0 0 0 0 0 0 1 83 4199.75 0 0 0 0 0 0 0 0 0 0 0 84 4290.89 0 0 0 0 0 0 0 0 0 0 0 85 4443.91 0 1 0 0 0 0 0 0 0 0 0 86 4502.64 0 0 1 0 0 0 0 0 0 0 0 87 4356.98 0 0 0 1 0 0 0 0 0 0 0 88 4591.27 0 0 0 0 1 0 0 0 0 0 0 89 4696.96 0 0 0 0 0 1 0 0 0 0 0 90 4621.40 0 0 0 0 0 0 1 0 0 0 0 91 4562.84 1 0 0 0 0 0 0 1 0 0 0 92 4202.52 1 0 0 0 0 0 0 0 1 0 0 93 4296.49 1 0 0 0 0 0 0 0 0 1 0 94 4435.23 1 0 0 0 0 0 0 0 0 0 1 95 4105.18 1 0 0 0 0 0 0 0 0 0 0 96 4116.68 1 0 0 0 0 0 0 0 0 0 0 97 3844.49 1 1 0 0 0 0 0 0 0 0 0 98 3720.98 1 0 1 0 0 0 0 0 0 0 0 99 3674.40 1 0 0 1 0 0 0 0 0 0 0 100 3857.62 1 0 0 0 1 0 0 0 0 0 0 101 3801.06 1 0 0 0 0 1 0 0 0 0 0 102 3504.37 1 0 0 0 0 0 1 0 0 0 0 103 3032.60 1 0 0 0 0 0 0 1 0 0 0 104 3047.03 1 0 0 0 0 0 0 0 1 0 0 105 2962.34 1 0 0 0 0 0 0 0 0 1 0 106 2197.82 1 0 0 0 0 0 0 0 0 0 1 107 2014.45 1 0 0 0 0 0 0 0 0 0 0 M11 t 1 0 1 2 0 2 3 0 3 4 0 4 5 0 5 6 0 6 7 0 7 8 0 8 9 0 9 10 0 10 11 1 11 12 0 12 13 0 13 14 0 14 15 0 15 16 0 16 17 0 17 18 0 18 19 0 19 20 0 20 21 0 21 22 0 22 23 1 23 24 0 24 25 0 25 26 0 26 27 0 27 28 0 28 29 0 29 30 0 30 31 0 31 32 0 32 33 0 33 34 0 34 35 1 35 36 0 36 37 0 37 38 0 38 39 0 39 40 0 40 41 0 41 42 0 42 43 0 43 44 0 44 45 0 45 46 0 46 47 1 47 48 0 48 49 0 49 50 0 50 51 0 51 52 0 52 53 0 53 54 0 54 55 0 55 56 0 56 57 0 57 58 0 58 59 1 59 60 0 60 61 0 61 62 0 62 63 0 63 64 0 64 65 0 65 66 0 66 67 0 67 68 0 68 69 0 69 70 0 70 71 1 71 72 0 72 73 0 73 74 0 74 75 0 75 76 0 76 77 0 77 78 0 78 79 0 79 80 0 80 81 0 81 82 0 82 83 1 83 84 0 84 85 0 85 86 0 86 87 0 87 88 0 88 89 0 89 90 0 90 91 0 91 92 0 92 93 0 93 94 0 94 95 1 95 96 0 96 97 0 97 98 0 98 99 0 99 100 0 100 101 0 101 102 0 102 103 0 103 104 0 104 105 0 105 106 0 106 107 1 107 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `Wel(1)_geen(0)_financi\353le_crisis` 2279.778 -106.144 M1 M2 98.801 72.134 M3 M4 8.967 91.311 M5 M6 56.494 -28.733 M7 M8 -76.077 -83.453 M9 M10 -124.195 -181.075 M11 t -202.082 15.127 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1575.71 -576.40 43.08 451.23 1088.71 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2279.778 267.282 8.529 2.63e-13 *** `Wel(1)_geen(0)_financi\353le_crisis` -106.144 228.220 -0.465 0.643 M1 98.801 322.030 0.307 0.760 M2 72.134 321.946 0.224 0.823 M3 8.967 321.884 0.028 0.978 M4 91.311 321.845 0.284 0.777 M5 56.494 321.828 0.176 0.861 M6 -28.733 321.833 -0.089 0.929 M7 -76.077 322.476 -0.236 0.814 M8 -83.453 322.393 -0.259 0.796 M9 -124.195 322.333 -0.385 0.701 M10 -181.075 322.295 -0.562 0.576 M11 -202.082 322.279 -0.627 0.532 t 15.127 2.684 5.635 1.86e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 662.3 on 93 degrees of freedom Multiple R-squared: 0.3431, Adjusted R-squared: 0.2513 F-statistic: 3.736 on 13 and 93 DF, p-value: 8.576e-05 > postscript(file="/var/www/html/rcomp/tmp/1sixv1228655466.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/25r1n1228655466.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/3j9w01228655466.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/45mkk1228655466.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/5nr581228655466.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 = 107 Frequency = 1 1 2 3 4 5 636.5839441 421.3039441 433.5028330 451.0017219 451.4517219 6 7 8 9 10 555.2517219 703.0179178 825.6068067 741.2023622 795.8045845 11 12 13 14 15 866.4245845 551.9352779 411.8672849 431.8572849 317.5261737 16 17 18 19 20 235.8350626 201.3950626 321.9250626 423.9012585 393.7601474 21 22 23 24 25 131.1657029 210.1479252 234.1879252 -4.3013814 -36.5093744 26 27 28 29 30 0.6606256 38.5195145 17.0484033 24.4684033 -149.5815967 31 32 33 34 35 -367.6654008 -465.4465119 -588.9709563 -672.5387341 -565.1487341 36 37 38 39 40 -828.9880407 -991.4760337 -1160.8460337 -1243.4571448 -1142.7582559 41 42 43 44 45 -1046.0582559 -926.7182559 -884.5720601 -800.5131712 -742.8276156 46 47 48 49 50 -673.6753934 -614.1153934 -809.1647000 -769.3726930 -668.0226930 51 52 53 54 55 -651.5938041 -684.8949152 -730.4149152 -613.2949152 -587.6487194 56 57 58 59 60 -545.6098305 -372.1942749 -219.3220527 -120.9320527 -265.9713593 61 62 63 64 65 -319.4893523 -209.2193523 -135.5404634 -219.9215745 -258.2815745 66 67 68 69 70 -152.1315745 -55.5353787 32.1835102 77.6490658 137.7112880 71 72 73 74 75 212.2612880 125.2319814 184.1639884 341.7339884 494.6728773 76 77 78 79 80 374.7517662 299.9917662 139.1517662 302.8579621 455.7668509 81 82 83 84 85 589.2124065 799.3846287 866.4946287 740.4253221 779.5173291 86 87 88 89 90 849.7873291 752.1662180 888.9851069 1014.3651069 1008.9051069 91 92 93 94 95 1088.7055399 720.6344288 840.2199844 1020.7122066 696.5422066 96 97 98 99 100 490.8329000 104.7149070 -7.2550930 -5.7962041 79.9526847 101 102 103 104 105 43.0826847 -183.5073153 -623.0611194 -616.3822305 -675.4566749 106 107 -1398.2244527 -1575.7144527 > postscript(file="/var/www/html/rcomp/tmp/6su4i1228655466.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 = 107 Frequency = 1 lag(myerror, k = 1) myerror 0 636.5839441 NA 1 421.3039441 636.5839441 2 433.5028330 421.3039441 3 451.0017219 433.5028330 4 451.4517219 451.0017219 5 555.2517219 451.4517219 6 703.0179178 555.2517219 7 825.6068067 703.0179178 8 741.2023622 825.6068067 9 795.8045845 741.2023622 10 866.4245845 795.8045845 11 551.9352779 866.4245845 12 411.8672849 551.9352779 13 431.8572849 411.8672849 14 317.5261737 431.8572849 15 235.8350626 317.5261737 16 201.3950626 235.8350626 17 321.9250626 201.3950626 18 423.9012585 321.9250626 19 393.7601474 423.9012585 20 131.1657029 393.7601474 21 210.1479252 131.1657029 22 234.1879252 210.1479252 23 -4.3013814 234.1879252 24 -36.5093744 -4.3013814 25 0.6606256 -36.5093744 26 38.5195145 0.6606256 27 17.0484033 38.5195145 28 24.4684033 17.0484033 29 -149.5815967 24.4684033 30 -367.6654008 -149.5815967 31 -465.4465119 -367.6654008 32 -588.9709563 -465.4465119 33 -672.5387341 -588.9709563 34 -565.1487341 -672.5387341 35 -828.9880407 -565.1487341 36 -991.4760337 -828.9880407 37 -1160.8460337 -991.4760337 38 -1243.4571448 -1160.8460337 39 -1142.7582559 -1243.4571448 40 -1046.0582559 -1142.7582559 41 -926.7182559 -1046.0582559 42 -884.5720601 -926.7182559 43 -800.5131712 -884.5720601 44 -742.8276156 -800.5131712 45 -673.6753934 -742.8276156 46 -614.1153934 -673.6753934 47 -809.1647000 -614.1153934 48 -769.3726930 -809.1647000 49 -668.0226930 -769.3726930 50 -651.5938041 -668.0226930 51 -684.8949152 -651.5938041 52 -730.4149152 -684.8949152 53 -613.2949152 -730.4149152 54 -587.6487194 -613.2949152 55 -545.6098305 -587.6487194 56 -372.1942749 -545.6098305 57 -219.3220527 -372.1942749 58 -120.9320527 -219.3220527 59 -265.9713593 -120.9320527 60 -319.4893523 -265.9713593 61 -209.2193523 -319.4893523 62 -135.5404634 -209.2193523 63 -219.9215745 -135.5404634 64 -258.2815745 -219.9215745 65 -152.1315745 -258.2815745 66 -55.5353787 -152.1315745 67 32.1835102 -55.5353787 68 77.6490658 32.1835102 69 137.7112880 77.6490658 70 212.2612880 137.7112880 71 125.2319814 212.2612880 72 184.1639884 125.2319814 73 341.7339884 184.1639884 74 494.6728773 341.7339884 75 374.7517662 494.6728773 76 299.9917662 374.7517662 77 139.1517662 299.9917662 78 302.8579621 139.1517662 79 455.7668509 302.8579621 80 589.2124065 455.7668509 81 799.3846287 589.2124065 82 866.4946287 799.3846287 83 740.4253221 866.4946287 84 779.5173291 740.4253221 85 849.7873291 779.5173291 86 752.1662180 849.7873291 87 888.9851069 752.1662180 88 1014.3651069 888.9851069 89 1008.9051069 1014.3651069 90 1088.7055399 1008.9051069 91 720.6344288 1088.7055399 92 840.2199844 720.6344288 93 1020.7122066 840.2199844 94 696.5422066 1020.7122066 95 490.8329000 696.5422066 96 104.7149070 490.8329000 97 -7.2550930 104.7149070 98 -5.7962041 -7.2550930 99 79.9526847 -5.7962041 100 43.0826847 79.9526847 101 -183.5073153 43.0826847 102 -623.0611194 -183.5073153 103 -616.3822305 -623.0611194 104 -675.4566749 -616.3822305 105 -1398.2244527 -675.4566749 106 -1575.7144527 -1398.2244527 107 NA -1575.7144527 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 421.3039441 636.5839441 [2,] 433.5028330 421.3039441 [3,] 451.0017219 433.5028330 [4,] 451.4517219 451.0017219 [5,] 555.2517219 451.4517219 [6,] 703.0179178 555.2517219 [7,] 825.6068067 703.0179178 [8,] 741.2023622 825.6068067 [9,] 795.8045845 741.2023622 [10,] 866.4245845 795.8045845 [11,] 551.9352779 866.4245845 [12,] 411.8672849 551.9352779 [13,] 431.8572849 411.8672849 [14,] 317.5261737 431.8572849 [15,] 235.8350626 317.5261737 [16,] 201.3950626 235.8350626 [17,] 321.9250626 201.3950626 [18,] 423.9012585 321.9250626 [19,] 393.7601474 423.9012585 [20,] 131.1657029 393.7601474 [21,] 210.1479252 131.1657029 [22,] 234.1879252 210.1479252 [23,] -4.3013814 234.1879252 [24,] -36.5093744 -4.3013814 [25,] 0.6606256 -36.5093744 [26,] 38.5195145 0.6606256 [27,] 17.0484033 38.5195145 [28,] 24.4684033 17.0484033 [29,] -149.5815967 24.4684033 [30,] -367.6654008 -149.5815967 [31,] -465.4465119 -367.6654008 [32,] -588.9709563 -465.4465119 [33,] -672.5387341 -588.9709563 [34,] -565.1487341 -672.5387341 [35,] -828.9880407 -565.1487341 [36,] -991.4760337 -828.9880407 [37,] -1160.8460337 -991.4760337 [38,] -1243.4571448 -1160.8460337 [39,] -1142.7582559 -1243.4571448 [40,] -1046.0582559 -1142.7582559 [41,] -926.7182559 -1046.0582559 [42,] -884.5720601 -926.7182559 [43,] -800.5131712 -884.5720601 [44,] -742.8276156 -800.5131712 [45,] -673.6753934 -742.8276156 [46,] -614.1153934 -673.6753934 [47,] -809.1647000 -614.1153934 [48,] -769.3726930 -809.1647000 [49,] -668.0226930 -769.3726930 [50,] -651.5938041 -668.0226930 [51,] -684.8949152 -651.5938041 [52,] -730.4149152 -684.8949152 [53,] -613.2949152 -730.4149152 [54,] -587.6487194 -613.2949152 [55,] -545.6098305 -587.6487194 [56,] -372.1942749 -545.6098305 [57,] -219.3220527 -372.1942749 [58,] -120.9320527 -219.3220527 [59,] -265.9713593 -120.9320527 [60,] -319.4893523 -265.9713593 [61,] -209.2193523 -319.4893523 [62,] -135.5404634 -209.2193523 [63,] -219.9215745 -135.5404634 [64,] -258.2815745 -219.9215745 [65,] -152.1315745 -258.2815745 [66,] -55.5353787 -152.1315745 [67,] 32.1835102 -55.5353787 [68,] 77.6490658 32.1835102 [69,] 137.7112880 77.6490658 [70,] 212.2612880 137.7112880 [71,] 125.2319814 212.2612880 [72,] 184.1639884 125.2319814 [73,] 341.7339884 184.1639884 [74,] 494.6728773 341.7339884 [75,] 374.7517662 494.6728773 [76,] 299.9917662 374.7517662 [77,] 139.1517662 299.9917662 [78,] 302.8579621 139.1517662 [79,] 455.7668509 302.8579621 [80,] 589.2124065 455.7668509 [81,] 799.3846287 589.2124065 [82,] 866.4946287 799.3846287 [83,] 740.4253221 866.4946287 [84,] 779.5173291 740.4253221 [85,] 849.7873291 779.5173291 [86,] 752.1662180 849.7873291 [87,] 888.9851069 752.1662180 [88,] 1014.3651069 888.9851069 [89,] 1008.9051069 1014.3651069 [90,] 1088.7055399 1008.9051069 [91,] 720.6344288 1088.7055399 [92,] 840.2199844 720.6344288 [93,] 1020.7122066 840.2199844 [94,] 696.5422066 1020.7122066 [95,] 490.8329000 696.5422066 [96,] 104.7149070 490.8329000 [97,] -7.2550930 104.7149070 [98,] -5.7962041 -7.2550930 [99,] 79.9526847 -5.7962041 [100,] 43.0826847 79.9526847 [101,] -183.5073153 43.0826847 [102,] -623.0611194 -183.5073153 [103,] -616.3822305 -623.0611194 [104,] -675.4566749 -616.3822305 [105,] -1398.2244527 -675.4566749 [106,] -1575.7144527 -1398.2244527 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 421.3039441 636.5839441 2 433.5028330 421.3039441 3 451.0017219 433.5028330 4 451.4517219 451.0017219 5 555.2517219 451.4517219 6 703.0179178 555.2517219 7 825.6068067 703.0179178 8 741.2023622 825.6068067 9 795.8045845 741.2023622 10 866.4245845 795.8045845 11 551.9352779 866.4245845 12 411.8672849 551.9352779 13 431.8572849 411.8672849 14 317.5261737 431.8572849 15 235.8350626 317.5261737 16 201.3950626 235.8350626 17 321.9250626 201.3950626 18 423.9012585 321.9250626 19 393.7601474 423.9012585 20 131.1657029 393.7601474 21 210.1479252 131.1657029 22 234.1879252 210.1479252 23 -4.3013814 234.1879252 24 -36.5093744 -4.3013814 25 0.6606256 -36.5093744 26 38.5195145 0.6606256 27 17.0484033 38.5195145 28 24.4684033 17.0484033 29 -149.5815967 24.4684033 30 -367.6654008 -149.5815967 31 -465.4465119 -367.6654008 32 -588.9709563 -465.4465119 33 -672.5387341 -588.9709563 34 -565.1487341 -672.5387341 35 -828.9880407 -565.1487341 36 -991.4760337 -828.9880407 37 -1160.8460337 -991.4760337 38 -1243.4571448 -1160.8460337 39 -1142.7582559 -1243.4571448 40 -1046.0582559 -1142.7582559 41 -926.7182559 -1046.0582559 42 -884.5720601 -926.7182559 43 -800.5131712 -884.5720601 44 -742.8276156 -800.5131712 45 -673.6753934 -742.8276156 46 -614.1153934 -673.6753934 47 -809.1647000 -614.1153934 48 -769.3726930 -809.1647000 49 -668.0226930 -769.3726930 50 -651.5938041 -668.0226930 51 -684.8949152 -651.5938041 52 -730.4149152 -684.8949152 53 -613.2949152 -730.4149152 54 -587.6487194 -613.2949152 55 -545.6098305 -587.6487194 56 -372.1942749 -545.6098305 57 -219.3220527 -372.1942749 58 -120.9320527 -219.3220527 59 -265.9713593 -120.9320527 60 -319.4893523 -265.9713593 61 -209.2193523 -319.4893523 62 -135.5404634 -209.2193523 63 -219.9215745 -135.5404634 64 -258.2815745 -219.9215745 65 -152.1315745 -258.2815745 66 -55.5353787 -152.1315745 67 32.1835102 -55.5353787 68 77.6490658 32.1835102 69 137.7112880 77.6490658 70 212.2612880 137.7112880 71 125.2319814 212.2612880 72 184.1639884 125.2319814 73 341.7339884 184.1639884 74 494.6728773 341.7339884 75 374.7517662 494.6728773 76 299.9917662 374.7517662 77 139.1517662 299.9917662 78 302.8579621 139.1517662 79 455.7668509 302.8579621 80 589.2124065 455.7668509 81 799.3846287 589.2124065 82 866.4946287 799.3846287 83 740.4253221 866.4946287 84 779.5173291 740.4253221 85 849.7873291 779.5173291 86 752.1662180 849.7873291 87 888.9851069 752.1662180 88 1014.3651069 888.9851069 89 1008.9051069 1014.3651069 90 1088.7055399 1008.9051069 91 720.6344288 1088.7055399 92 840.2199844 720.6344288 93 1020.7122066 840.2199844 94 696.5422066 1020.7122066 95 490.8329000 696.5422066 96 104.7149070 490.8329000 97 -7.2550930 104.7149070 98 -5.7962041 -7.2550930 99 79.9526847 -5.7962041 100 43.0826847 79.9526847 101 -183.5073153 43.0826847 102 -623.0611194 -183.5073153 103 -616.3822305 -623.0611194 104 -675.4566749 -616.3822305 105 -1398.2244527 -675.4566749 106 -1575.7144527 -1398.2244527 > 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/7hs8z1228655466.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/8mt3r1228655466.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/9azg01228655466.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/10813w1228655467.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/11btm61228655467.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/12lvea1228655467.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/13jcsj1228655467.tab") > > system("convert tmp/1sixv1228655466.ps tmp/1sixv1228655466.png") > system("convert tmp/25r1n1228655466.ps tmp/25r1n1228655466.png") > system("convert tmp/3j9w01228655466.ps tmp/3j9w01228655466.png") > system("convert tmp/45mkk1228655466.ps tmp/45mkk1228655466.png") > system("convert tmp/5nr581228655466.ps tmp/5nr581228655466.png") > system("convert tmp/6su4i1228655466.ps tmp/6su4i1228655466.png") > system("convert tmp/7hs8z1228655466.ps tmp/7hs8z1228655466.png") > system("convert tmp/8mt3r1228655466.ps tmp/8mt3r1228655466.png") > system("convert tmp/9azg01228655466.ps tmp/9azg01228655466.png") > > > proc.time() user system elapsed 2.153 1.500 2.876