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(86.9,0,99.7,0,109.1,0,94.6,0,111.2,0,112.8,0,53.5,0,107.5,0,105.2,0,122.8,0,103.4,0,76.9,0,89.6,0,92.8,0,107.6,0,104.6,0,103,0,106.9,0,56.3,0,93.4,0,109.1,0,113.8,0,97.4,0,72.5,0,82.7,0,88.9,0,105.9,0,100.8,0,94,0,105,0,58.5,0,87.6,0,113.1,0,112.5,0,89.6,0,74.5,0,82.7,0,90.1,0,109.4,0,96,0,89.2,0,109.1,0,49.1,0,92.9,0,107.7,0,103.5,0,91.1,0,79.8,0,71.9,0,82.9,0,90.1,0,100.7,0,90.7,0,108.8,0,44.1,0,93.6,0,107.4,0,96.5,0,93.6,0,76.5,0,76.7,0,84,0,103.3,0,88.5,0,99,0,105.9,0,44.7,0,94,0,107.1,0,104.8,0,102.5,0,77.7,0,85.2,0,91.3,0,106.5,0,92.4,0,97.5,0,107,0,51.1,1,98.6,1,102.2,1,114.3,1,99.4,1,72.5,1,92.3,1,99.4,1,85.9,1,109.4,1,97.6,1,104.7,1,56.9,1,86.7,1,108.5,1),dim=c(2,93),dimnames=list(c('Bouwnijverheid','Wel(1)_geen(0)_financiële_crisis'),1:93)) > y <- array(NA,dim=c(2,93),dimnames=list(c('Bouwnijverheid','Wel(1)_geen(0)_financiële_crisis'),1:93)) > 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 Bouwnijverheid Wel(1)_geen(0)_financi\353le_crisis M1 M2 M3 M4 M5 M6 M7 M8 1 86.9 0 1 0 0 0 0 0 0 0 2 99.7 0 0 1 0 0 0 0 0 0 3 109.1 0 0 0 1 0 0 0 0 0 4 94.6 0 0 0 0 1 0 0 0 0 5 111.2 0 0 0 0 0 1 0 0 0 6 112.8 0 0 0 0 0 0 1 0 0 7 53.5 0 0 0 0 0 0 0 1 0 8 107.5 0 0 0 0 0 0 0 0 1 9 105.2 0 0 0 0 0 0 0 0 0 10 122.8 0 0 0 0 0 0 0 0 0 11 103.4 0 0 0 0 0 0 0 0 0 12 76.9 0 0 0 0 0 0 0 0 0 13 89.6 0 1 0 0 0 0 0 0 0 14 92.8 0 0 1 0 0 0 0 0 0 15 107.6 0 0 0 1 0 0 0 0 0 16 104.6 0 0 0 0 1 0 0 0 0 17 103.0 0 0 0 0 0 1 0 0 0 18 106.9 0 0 0 0 0 0 1 0 0 19 56.3 0 0 0 0 0 0 0 1 0 20 93.4 0 0 0 0 0 0 0 0 1 21 109.1 0 0 0 0 0 0 0 0 0 22 113.8 0 0 0 0 0 0 0 0 0 23 97.4 0 0 0 0 0 0 0 0 0 24 72.5 0 0 0 0 0 0 0 0 0 25 82.7 0 1 0 0 0 0 0 0 0 26 88.9 0 0 1 0 0 0 0 0 0 27 105.9 0 0 0 1 0 0 0 0 0 28 100.8 0 0 0 0 1 0 0 0 0 29 94.0 0 0 0 0 0 1 0 0 0 30 105.0 0 0 0 0 0 0 1 0 0 31 58.5 0 0 0 0 0 0 0 1 0 32 87.6 0 0 0 0 0 0 0 0 1 33 113.1 0 0 0 0 0 0 0 0 0 34 112.5 0 0 0 0 0 0 0 0 0 35 89.6 0 0 0 0 0 0 0 0 0 36 74.5 0 0 0 0 0 0 0 0 0 37 82.7 0 1 0 0 0 0 0 0 0 38 90.1 0 0 1 0 0 0 0 0 0 39 109.4 0 0 0 1 0 0 0 0 0 40 96.0 0 0 0 0 1 0 0 0 0 41 89.2 0 0 0 0 0 1 0 0 0 42 109.1 0 0 0 0 0 0 1 0 0 43 49.1 0 0 0 0 0 0 0 1 0 44 92.9 0 0 0 0 0 0 0 0 1 45 107.7 0 0 0 0 0 0 0 0 0 46 103.5 0 0 0 0 0 0 0 0 0 47 91.1 0 0 0 0 0 0 0 0 0 48 79.8 0 0 0 0 0 0 0 0 0 49 71.9 0 1 0 0 0 0 0 0 0 50 82.9 0 0 1 0 0 0 0 0 0 51 90.1 0 0 0 1 0 0 0 0 0 52 100.7 0 0 0 0 1 0 0 0 0 53 90.7 0 0 0 0 0 1 0 0 0 54 108.8 0 0 0 0 0 0 1 0 0 55 44.1 0 0 0 0 0 0 0 1 0 56 93.6 0 0 0 0 0 0 0 0 1 57 107.4 0 0 0 0 0 0 0 0 0 58 96.5 0 0 0 0 0 0 0 0 0 59 93.6 0 0 0 0 0 0 0 0 0 60 76.5 0 0 0 0 0 0 0 0 0 61 76.7 0 1 0 0 0 0 0 0 0 62 84.0 0 0 1 0 0 0 0 0 0 63 103.3 0 0 0 1 0 0 0 0 0 64 88.5 0 0 0 0 1 0 0 0 0 65 99.0 0 0 0 0 0 1 0 0 0 66 105.9 0 0 0 0 0 0 1 0 0 67 44.7 0 0 0 0 0 0 0 1 0 68 94.0 0 0 0 0 0 0 0 0 1 69 107.1 0 0 0 0 0 0 0 0 0 70 104.8 0 0 0 0 0 0 0 0 0 71 102.5 0 0 0 0 0 0 0 0 0 72 77.7 0 0 0 0 0 0 0 0 0 73 85.2 0 1 0 0 0 0 0 0 0 74 91.3 0 0 1 0 0 0 0 0 0 75 106.5 0 0 0 1 0 0 0 0 0 76 92.4 0 0 0 0 1 0 0 0 0 77 97.5 0 0 0 0 0 1 0 0 0 78 107.0 0 0 0 0 0 0 1 0 0 79 51.1 1 0 0 0 0 0 0 1 0 80 98.6 1 0 0 0 0 0 0 0 1 81 102.2 1 0 0 0 0 0 0 0 0 82 114.3 1 0 0 0 0 0 0 0 0 83 99.4 1 0 0 0 0 0 0 0 0 84 72.5 1 0 0 0 0 0 0 0 0 85 92.3 1 1 0 0 0 0 0 0 0 86 99.4 1 0 1 0 0 0 0 0 0 87 85.9 1 0 0 1 0 0 0 0 0 88 109.4 1 0 0 0 1 0 0 0 0 89 97.6 1 0 0 0 0 1 0 0 0 90 104.7 1 0 0 0 0 0 1 0 0 91 56.9 1 0 0 0 0 0 0 1 0 92 86.7 1 0 0 0 0 0 0 0 1 93 108.5 1 0 0 0 0 0 0 0 0 M9 M10 M11 t 1 0 0 0 1 2 0 0 0 2 3 0 0 0 3 4 0 0 0 4 5 0 0 0 5 6 0 0 0 6 7 0 0 0 7 8 0 0 0 8 9 1 0 0 9 10 0 1 0 10 11 0 0 1 11 12 0 0 0 12 13 0 0 0 13 14 0 0 0 14 15 0 0 0 15 16 0 0 0 16 17 0 0 0 17 18 0 0 0 18 19 0 0 0 19 20 0 0 0 20 21 1 0 0 21 22 0 1 0 22 23 0 0 1 23 24 0 0 0 24 25 0 0 0 25 26 0 0 0 26 27 0 0 0 27 28 0 0 0 28 29 0 0 0 29 30 0 0 0 30 31 0 0 0 31 32 0 0 0 32 33 1 0 0 33 34 0 1 0 34 35 0 0 1 35 36 0 0 0 36 37 0 0 0 37 38 0 0 0 38 39 0 0 0 39 40 0 0 0 40 41 0 0 0 41 42 0 0 0 42 43 0 0 0 43 44 0 0 0 44 45 1 0 0 45 46 0 1 0 46 47 0 0 1 47 48 0 0 0 48 49 0 0 0 49 50 0 0 0 50 51 0 0 0 51 52 0 0 0 52 53 0 0 0 53 54 0 0 0 54 55 0 0 0 55 56 0 0 0 56 57 1 0 0 57 58 0 1 0 58 59 0 0 1 59 60 0 0 0 60 61 0 0 0 61 62 0 0 0 62 63 0 0 0 63 64 0 0 0 64 65 0 0 0 65 66 0 0 0 66 67 0 0 0 67 68 0 0 0 68 69 1 0 0 69 70 0 1 0 70 71 0 0 1 71 72 0 0 0 72 73 0 0 0 73 74 0 0 0 74 75 0 0 0 75 76 0 0 0 76 77 0 0 0 77 78 0 0 0 78 79 0 0 0 79 80 0 0 0 80 81 1 0 0 81 82 0 1 0 82 83 0 0 1 83 84 0 0 0 84 85 0 0 0 85 86 0 0 0 86 87 0 0 0 87 88 0 0 0 88 89 0 0 0 89 90 0 0 0 90 91 0 0 0 91 92 0 0 0 92 93 1 0 0 93 > 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` 80.4039 6.1396 M1 M2 7.2643 15.0166 M3 M4 26.2189 22.4836 M5 M6 21.9984 31.8632 M7 M8 -24.5395 18.0878 M9 M10 31.4526 33.7419 M11 t 20.8281 -0.1148 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -16.876 -3.536 1.009 3.431 10.474 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 80.40386 2.48594 32.343 < 2e-16 *** `Wel(1)_geen(0)_financi\353le_crisis` 6.13955 2.11912 2.897 0.004869 ** M1 7.26430 2.97280 2.444 0.016772 * M2 15.01658 2.97178 5.053 2.74e-06 *** M3 26.21886 2.97103 8.825 2.14e-13 *** M4 22.48364 2.97057 7.569 6.00e-11 *** M5 21.99842 2.97038 7.406 1.24e-10 *** M6 31.86321 2.97047 10.727 < 2e-16 *** M7 -24.53946 2.97764 -8.241 2.95e-12 *** M8 18.08783 2.97666 6.077 4.08e-08 *** M9 31.45261 2.97596 10.569 < 2e-16 *** M10 33.74187 3.06819 10.997 < 2e-16 *** M11 20.82808 3.06778 6.789 1.88e-09 *** t -0.11478 0.02884 -3.980 0.000152 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.739 on 79 degrees of freedom Multiple R-squared: 0.9003, Adjusted R-squared: 0.8839 F-statistic: 54.88 on 13 and 79 DF, p-value: < 2.2e-16 > postscript(file="/var/www/html/freestat/rcomp/tmp/1ispd1228654540.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/255f21228654540.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/3ce6t1228654540.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/45fof1228654540.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/5dsew1228654540.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 = 93 Frequency = 1 1 2 3 4 5 6 -0.6533782 4.5091218 2.8216218 -7.8283782 9.3716218 1.2216218 7 8 9 10 11 12 -1.5609340 9.9265660 -5.6234340 9.8020885 3.4306599 -2.1264830 13 14 15 16 17 18 3.4239996 -1.0135004 2.6989996 3.5489996 2.5489996 -3.3010004 19 20 21 22 23 24 2.6164437 -2.7960563 -0.3460563 2.1794663 -1.1919623 -5.1491052 25 26 27 28 29 30 -2.0986226 -3.5361226 2.3763774 1.1263774 -5.0736226 -3.8236226 31 32 33 34 35 36 6.1938215 -7.2186785 5.0313215 2.2568441 -7.6145845 -1.7717274 37 38 39 40 41 42 -0.7212448 -0.9587448 7.2537552 -2.2962448 -8.4962448 1.6537552 43 44 45 46 47 48 -1.8288007 -0.5413007 1.0086993 -5.3657782 -4.7372067 4.9056504 49 50 51 52 53 54 -10.1438670 -6.7813670 -10.6688670 3.7811330 -5.6188670 2.7311330 55 56 57 58 59 60 -5.4514229 1.5360771 2.0860771 -10.9884004 -0.8598289 2.9830282 61 62 63 64 65 66 -3.9664892 -4.3039892 3.9085108 -7.0414892 4.0585108 1.2085108 67 68 69 70 71 72 -3.4740451 3.3134549 3.1634549 -1.3110226 9.4175489 5.5604060 73 74 75 76 77 78 5.9108886 4.3733886 8.4858886 -1.7641114 3.9358886 3.6858886 79 80 81 82 83 84 -1.8362202 3.1512798 -6.4987202 3.4268023 1.5553737 -4.4017691 85 86 87 88 89 90 8.2487135 7.7112135 -16.8762865 10.4737135 -0.7262865 -3.3762865 91 92 93 5.3411576 -7.3713424 1.1786576 > postscript(file="/var/www/html/freestat/rcomp/tmp/6rtt11228654540.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 = 93 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.6533782 NA 1 4.5091218 -0.6533782 2 2.8216218 4.5091218 3 -7.8283782 2.8216218 4 9.3716218 -7.8283782 5 1.2216218 9.3716218 6 -1.5609340 1.2216218 7 9.9265660 -1.5609340 8 -5.6234340 9.9265660 9 9.8020885 -5.6234340 10 3.4306599 9.8020885 11 -2.1264830 3.4306599 12 3.4239996 -2.1264830 13 -1.0135004 3.4239996 14 2.6989996 -1.0135004 15 3.5489996 2.6989996 16 2.5489996 3.5489996 17 -3.3010004 2.5489996 18 2.6164437 -3.3010004 19 -2.7960563 2.6164437 20 -0.3460563 -2.7960563 21 2.1794663 -0.3460563 22 -1.1919623 2.1794663 23 -5.1491052 -1.1919623 24 -2.0986226 -5.1491052 25 -3.5361226 -2.0986226 26 2.3763774 -3.5361226 27 1.1263774 2.3763774 28 -5.0736226 1.1263774 29 -3.8236226 -5.0736226 30 6.1938215 -3.8236226 31 -7.2186785 6.1938215 32 5.0313215 -7.2186785 33 2.2568441 5.0313215 34 -7.6145845 2.2568441 35 -1.7717274 -7.6145845 36 -0.7212448 -1.7717274 37 -0.9587448 -0.7212448 38 7.2537552 -0.9587448 39 -2.2962448 7.2537552 40 -8.4962448 -2.2962448 41 1.6537552 -8.4962448 42 -1.8288007 1.6537552 43 -0.5413007 -1.8288007 44 1.0086993 -0.5413007 45 -5.3657782 1.0086993 46 -4.7372067 -5.3657782 47 4.9056504 -4.7372067 48 -10.1438670 4.9056504 49 -6.7813670 -10.1438670 50 -10.6688670 -6.7813670 51 3.7811330 -10.6688670 52 -5.6188670 3.7811330 53 2.7311330 -5.6188670 54 -5.4514229 2.7311330 55 1.5360771 -5.4514229 56 2.0860771 1.5360771 57 -10.9884004 2.0860771 58 -0.8598289 -10.9884004 59 2.9830282 -0.8598289 60 -3.9664892 2.9830282 61 -4.3039892 -3.9664892 62 3.9085108 -4.3039892 63 -7.0414892 3.9085108 64 4.0585108 -7.0414892 65 1.2085108 4.0585108 66 -3.4740451 1.2085108 67 3.3134549 -3.4740451 68 3.1634549 3.3134549 69 -1.3110226 3.1634549 70 9.4175489 -1.3110226 71 5.5604060 9.4175489 72 5.9108886 5.5604060 73 4.3733886 5.9108886 74 8.4858886 4.3733886 75 -1.7641114 8.4858886 76 3.9358886 -1.7641114 77 3.6858886 3.9358886 78 -1.8362202 3.6858886 79 3.1512798 -1.8362202 80 -6.4987202 3.1512798 81 3.4268023 -6.4987202 82 1.5553737 3.4268023 83 -4.4017691 1.5553737 84 8.2487135 -4.4017691 85 7.7112135 8.2487135 86 -16.8762865 7.7112135 87 10.4737135 -16.8762865 88 -0.7262865 10.4737135 89 -3.3762865 -0.7262865 90 5.3411576 -3.3762865 91 -7.3713424 5.3411576 92 1.1786576 -7.3713424 93 NA 1.1786576 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 4.5091218 -0.6533782 [2,] 2.8216218 4.5091218 [3,] -7.8283782 2.8216218 [4,] 9.3716218 -7.8283782 [5,] 1.2216218 9.3716218 [6,] -1.5609340 1.2216218 [7,] 9.9265660 -1.5609340 [8,] -5.6234340 9.9265660 [9,] 9.8020885 -5.6234340 [10,] 3.4306599 9.8020885 [11,] -2.1264830 3.4306599 [12,] 3.4239996 -2.1264830 [13,] -1.0135004 3.4239996 [14,] 2.6989996 -1.0135004 [15,] 3.5489996 2.6989996 [16,] 2.5489996 3.5489996 [17,] -3.3010004 2.5489996 [18,] 2.6164437 -3.3010004 [19,] -2.7960563 2.6164437 [20,] -0.3460563 -2.7960563 [21,] 2.1794663 -0.3460563 [22,] -1.1919623 2.1794663 [23,] -5.1491052 -1.1919623 [24,] -2.0986226 -5.1491052 [25,] -3.5361226 -2.0986226 [26,] 2.3763774 -3.5361226 [27,] 1.1263774 2.3763774 [28,] -5.0736226 1.1263774 [29,] -3.8236226 -5.0736226 [30,] 6.1938215 -3.8236226 [31,] -7.2186785 6.1938215 [32,] 5.0313215 -7.2186785 [33,] 2.2568441 5.0313215 [34,] -7.6145845 2.2568441 [35,] -1.7717274 -7.6145845 [36,] -0.7212448 -1.7717274 [37,] -0.9587448 -0.7212448 [38,] 7.2537552 -0.9587448 [39,] -2.2962448 7.2537552 [40,] -8.4962448 -2.2962448 [41,] 1.6537552 -8.4962448 [42,] -1.8288007 1.6537552 [43,] -0.5413007 -1.8288007 [44,] 1.0086993 -0.5413007 [45,] -5.3657782 1.0086993 [46,] -4.7372067 -5.3657782 [47,] 4.9056504 -4.7372067 [48,] -10.1438670 4.9056504 [49,] -6.7813670 -10.1438670 [50,] -10.6688670 -6.7813670 [51,] 3.7811330 -10.6688670 [52,] -5.6188670 3.7811330 [53,] 2.7311330 -5.6188670 [54,] -5.4514229 2.7311330 [55,] 1.5360771 -5.4514229 [56,] 2.0860771 1.5360771 [57,] -10.9884004 2.0860771 [58,] -0.8598289 -10.9884004 [59,] 2.9830282 -0.8598289 [60,] -3.9664892 2.9830282 [61,] -4.3039892 -3.9664892 [62,] 3.9085108 -4.3039892 [63,] -7.0414892 3.9085108 [64,] 4.0585108 -7.0414892 [65,] 1.2085108 4.0585108 [66,] -3.4740451 1.2085108 [67,] 3.3134549 -3.4740451 [68,] 3.1634549 3.3134549 [69,] -1.3110226 3.1634549 [70,] 9.4175489 -1.3110226 [71,] 5.5604060 9.4175489 [72,] 5.9108886 5.5604060 [73,] 4.3733886 5.9108886 [74,] 8.4858886 4.3733886 [75,] -1.7641114 8.4858886 [76,] 3.9358886 -1.7641114 [77,] 3.6858886 3.9358886 [78,] -1.8362202 3.6858886 [79,] 3.1512798 -1.8362202 [80,] -6.4987202 3.1512798 [81,] 3.4268023 -6.4987202 [82,] 1.5553737 3.4268023 [83,] -4.4017691 1.5553737 [84,] 8.2487135 -4.4017691 [85,] 7.7112135 8.2487135 [86,] -16.8762865 7.7112135 [87,] 10.4737135 -16.8762865 [88,] -0.7262865 10.4737135 [89,] -3.3762865 -0.7262865 [90,] 5.3411576 -3.3762865 [91,] -7.3713424 5.3411576 [92,] 1.1786576 -7.3713424 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 4.5091218 -0.6533782 2 2.8216218 4.5091218 3 -7.8283782 2.8216218 4 9.3716218 -7.8283782 5 1.2216218 9.3716218 6 -1.5609340 1.2216218 7 9.9265660 -1.5609340 8 -5.6234340 9.9265660 9 9.8020885 -5.6234340 10 3.4306599 9.8020885 11 -2.1264830 3.4306599 12 3.4239996 -2.1264830 13 -1.0135004 3.4239996 14 2.6989996 -1.0135004 15 3.5489996 2.6989996 16 2.5489996 3.5489996 17 -3.3010004 2.5489996 18 2.6164437 -3.3010004 19 -2.7960563 2.6164437 20 -0.3460563 -2.7960563 21 2.1794663 -0.3460563 22 -1.1919623 2.1794663 23 -5.1491052 -1.1919623 24 -2.0986226 -5.1491052 25 -3.5361226 -2.0986226 26 2.3763774 -3.5361226 27 1.1263774 2.3763774 28 -5.0736226 1.1263774 29 -3.8236226 -5.0736226 30 6.1938215 -3.8236226 31 -7.2186785 6.1938215 32 5.0313215 -7.2186785 33 2.2568441 5.0313215 34 -7.6145845 2.2568441 35 -1.7717274 -7.6145845 36 -0.7212448 -1.7717274 37 -0.9587448 -0.7212448 38 7.2537552 -0.9587448 39 -2.2962448 7.2537552 40 -8.4962448 -2.2962448 41 1.6537552 -8.4962448 42 -1.8288007 1.6537552 43 -0.5413007 -1.8288007 44 1.0086993 -0.5413007 45 -5.3657782 1.0086993 46 -4.7372067 -5.3657782 47 4.9056504 -4.7372067 48 -10.1438670 4.9056504 49 -6.7813670 -10.1438670 50 -10.6688670 -6.7813670 51 3.7811330 -10.6688670 52 -5.6188670 3.7811330 53 2.7311330 -5.6188670 54 -5.4514229 2.7311330 55 1.5360771 -5.4514229 56 2.0860771 1.5360771 57 -10.9884004 2.0860771 58 -0.8598289 -10.9884004 59 2.9830282 -0.8598289 60 -3.9664892 2.9830282 61 -4.3039892 -3.9664892 62 3.9085108 -4.3039892 63 -7.0414892 3.9085108 64 4.0585108 -7.0414892 65 1.2085108 4.0585108 66 -3.4740451 1.2085108 67 3.3134549 -3.4740451 68 3.1634549 3.3134549 69 -1.3110226 3.1634549 70 9.4175489 -1.3110226 71 5.5604060 9.4175489 72 5.9108886 5.5604060 73 4.3733886 5.9108886 74 8.4858886 4.3733886 75 -1.7641114 8.4858886 76 3.9358886 -1.7641114 77 3.6858886 3.9358886 78 -1.8362202 3.6858886 79 3.1512798 -1.8362202 80 -6.4987202 3.1512798 81 3.4268023 -6.4987202 82 1.5553737 3.4268023 83 -4.4017691 1.5553737 84 8.2487135 -4.4017691 85 7.7112135 8.2487135 86 -16.8762865 7.7112135 87 10.4737135 -16.8762865 88 -0.7262865 10.4737135 89 -3.3762865 -0.7262865 90 5.3411576 -3.3762865 91 -7.3713424 5.3411576 92 1.1786576 -7.3713424 > 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/7olh01228654540.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/801cs1228654540.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/9lzd61228654540.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/10irb31228654540.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/11lfi61228654540.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/129j9h1228654540.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/13elvn1228654540.tab") > > system("convert tmp/1ispd1228654540.ps tmp/1ispd1228654540.png") > system("convert tmp/255f21228654540.ps tmp/255f21228654540.png") > system("convert tmp/3ce6t1228654540.ps tmp/3ce6t1228654540.png") > system("convert tmp/45fof1228654540.ps tmp/45fof1228654540.png") > system("convert tmp/5dsew1228654540.ps tmp/5dsew1228654540.png") > system("convert tmp/6rtt11228654540.ps tmp/6rtt11228654540.png") > system("convert tmp/7olh01228654540.ps tmp/7olh01228654540.png") > system("convert tmp/801cs1228654540.ps tmp/801cs1228654540.png") > system("convert tmp/9lzd61228654540.ps tmp/9lzd61228654540.png") > > > proc.time() user system elapsed 3.180 2.345 5.587