R version 2.6.1 (2007-11-26) Copyright (C) 2007 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(25.62,0,27.5,0,24.5,0,25.66,0,28.31,0,27.85,1,24.61,0,25.68,0,25.62,1,20.54,1,18.8,0,18.71,0,19.46,0,20.12,0,23.54,0,25.6,0,25.39,0,24.09,0,25.69,0,26.56,0,28.33,0,27.5,0,24.23,0,28.23,1,31.29,0,32.72,0,30.46,0,24.89,0,25.68,0,27.52,0,28.4,0,29.71,0,26.85,0,29.62,0,28.69,0,29.76,0,31.3,0,30.86,0,33.46,0,33.15,0,37.99,0,35.24,0,38.24,0,43.16,0,43.33,0,49.67,0,43.17,0,39.56,1,44.36,0,45.22,0,53.1,0,52.1,0,48.52,0,54.84,0,57.57,0,64.14,0,62.85,0,58.75,0,55.33,0,57.03,0,63.18,0,60.19,0,62.12,0,70.12,1,69.75,1,68.56,1,73.77,1,73.23,1,61.96,0,57.81,0,58.76,0,62.47,1,53.68,1,57.56,1,62.05,1,67.49,1,67.21,1,71.05,1,76.93,1,70.76,1),dim=c(2,80),dimnames=list(c('Prijs_Brentolie','Aanslagen_Nigeria'),1:80)) > y <- array(NA,dim=c(2,80),dimnames=list(c('Prijs_Brentolie','Aanslagen_Nigeria'),1:80)) > 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 Prijs_Brentolie Aanslagen_Nigeria M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 25.62 0 1 0 0 0 0 0 0 0 0 0 0 1 2 27.50 0 0 1 0 0 0 0 0 0 0 0 0 2 3 24.50 0 0 0 1 0 0 0 0 0 0 0 0 3 4 25.66 0 0 0 0 1 0 0 0 0 0 0 0 4 5 28.31 0 0 0 0 0 1 0 0 0 0 0 0 5 6 27.85 1 0 0 0 0 0 1 0 0 0 0 0 6 7 24.61 0 0 0 0 0 0 0 1 0 0 0 0 7 8 25.68 0 0 0 0 0 0 0 0 1 0 0 0 8 9 25.62 1 0 0 0 0 0 0 0 0 1 0 0 9 10 20.54 1 0 0 0 0 0 0 0 0 0 1 0 10 11 18.80 0 0 0 0 0 0 0 0 0 0 0 1 11 12 18.71 0 0 0 0 0 0 0 0 0 0 0 0 12 13 19.46 0 1 0 0 0 0 0 0 0 0 0 0 13 14 20.12 0 0 1 0 0 0 0 0 0 0 0 0 14 15 23.54 0 0 0 1 0 0 0 0 0 0 0 0 15 16 25.60 0 0 0 0 1 0 0 0 0 0 0 0 16 17 25.39 0 0 0 0 0 1 0 0 0 0 0 0 17 18 24.09 0 0 0 0 0 0 1 0 0 0 0 0 18 19 25.69 0 0 0 0 0 0 0 1 0 0 0 0 19 20 26.56 0 0 0 0 0 0 0 0 1 0 0 0 20 21 28.33 0 0 0 0 0 0 0 0 0 1 0 0 21 22 27.50 0 0 0 0 0 0 0 0 0 0 1 0 22 23 24.23 0 0 0 0 0 0 0 0 0 0 0 1 23 24 28.23 1 0 0 0 0 0 0 0 0 0 0 0 24 25 31.29 0 1 0 0 0 0 0 0 0 0 0 0 25 26 32.72 0 0 1 0 0 0 0 0 0 0 0 0 26 27 30.46 0 0 0 1 0 0 0 0 0 0 0 0 27 28 24.89 0 0 0 0 1 0 0 0 0 0 0 0 28 29 25.68 0 0 0 0 0 1 0 0 0 0 0 0 29 30 27.52 0 0 0 0 0 0 1 0 0 0 0 0 30 31 28.40 0 0 0 0 0 0 0 1 0 0 0 0 31 32 29.71 0 0 0 0 0 0 0 0 1 0 0 0 32 33 26.85 0 0 0 0 0 0 0 0 0 1 0 0 33 34 29.62 0 0 0 0 0 0 0 0 0 0 1 0 34 35 28.69 0 0 0 0 0 0 0 0 0 0 0 1 35 36 29.76 0 0 0 0 0 0 0 0 0 0 0 0 36 37 31.30 0 1 0 0 0 0 0 0 0 0 0 0 37 38 30.86 0 0 1 0 0 0 0 0 0 0 0 0 38 39 33.46 0 0 0 1 0 0 0 0 0 0 0 0 39 40 33.15 0 0 0 0 1 0 0 0 0 0 0 0 40 41 37.99 0 0 0 0 0 1 0 0 0 0 0 0 41 42 35.24 0 0 0 0 0 0 1 0 0 0 0 0 42 43 38.24 0 0 0 0 0 0 0 1 0 0 0 0 43 44 43.16 0 0 0 0 0 0 0 0 1 0 0 0 44 45 43.33 0 0 0 0 0 0 0 0 0 1 0 0 45 46 49.67 0 0 0 0 0 0 0 0 0 0 1 0 46 47 43.17 0 0 0 0 0 0 0 0 0 0 0 1 47 48 39.56 1 0 0 0 0 0 0 0 0 0 0 0 48 49 44.36 0 1 0 0 0 0 0 0 0 0 0 0 49 50 45.22 0 0 1 0 0 0 0 0 0 0 0 0 50 51 53.10 0 0 0 1 0 0 0 0 0 0 0 0 51 52 52.10 0 0 0 0 1 0 0 0 0 0 0 0 52 53 48.52 0 0 0 0 0 1 0 0 0 0 0 0 53 54 54.84 0 0 0 0 0 0 1 0 0 0 0 0 54 55 57.57 0 0 0 0 0 0 0 1 0 0 0 0 55 56 64.14 0 0 0 0 0 0 0 0 1 0 0 0 56 57 62.85 0 0 0 0 0 0 0 0 0 1 0 0 57 58 58.75 0 0 0 0 0 0 0 0 0 0 1 0 58 59 55.33 0 0 0 0 0 0 0 0 0 0 0 1 59 60 57.03 0 0 0 0 0 0 0 0 0 0 0 0 60 61 63.18 0 1 0 0 0 0 0 0 0 0 0 0 61 62 60.19 0 0 1 0 0 0 0 0 0 0 0 0 62 63 62.12 0 0 0 1 0 0 0 0 0 0 0 0 63 64 70.12 1 0 0 0 1 0 0 0 0 0 0 0 64 65 69.75 1 0 0 0 0 1 0 0 0 0 0 0 65 66 68.56 1 0 0 0 0 0 1 0 0 0 0 0 66 67 73.77 1 0 0 0 0 0 0 1 0 0 0 0 67 68 73.23 1 0 0 0 0 0 0 0 1 0 0 0 68 69 61.96 0 0 0 0 0 0 0 0 0 1 0 0 69 70 57.81 0 0 0 0 0 0 0 0 0 0 1 0 70 71 58.76 0 0 0 0 0 0 0 0 0 0 0 1 71 72 62.47 1 0 0 0 0 0 0 0 0 0 0 0 72 73 53.68 1 1 0 0 0 0 0 0 0 0 0 0 73 74 57.56 1 0 1 0 0 0 0 0 0 0 0 0 74 75 62.05 1 0 0 1 0 0 0 0 0 0 0 0 75 76 67.49 1 0 0 0 1 0 0 0 0 0 0 0 76 77 67.21 1 0 0 0 0 1 0 0 0 0 0 0 77 78 71.05 1 0 0 0 0 0 1 0 0 0 0 0 78 79 76.93 1 0 0 0 0 0 0 1 0 0 0 0 79 80 70.76 1 0 0 0 0 0 0 0 1 0 0 0 80 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Aanslagen_Nigeria M1 M2 9.346 4.290 3.961 4.054 M3 M4 M5 M6 5.543 5.666 5.552 5.177 M7 M8 M9 M10 7.423 7.908 5.613 4.109 M11 t 1.677 0.662 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -12.2405 -3.8519 -0.6457 4.6943 12.7761 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 9.34617 2.97856 3.138 0.00254 ** Aanslagen_Nigeria 4.29012 1.99149 2.154 0.03488 * M1 3.96148 3.66493 1.081 0.28367 M2 4.05381 3.66643 1.106 0.27289 M3 5.54329 3.66826 1.511 0.13552 M4 5.66560 3.62849 1.561 0.12321 M5 5.55222 3.62981 1.530 0.13089 M6 5.17739 3.60911 1.435 0.15614 M7 7.42259 3.63346 2.043 0.04506 * M8 7.90778 3.63579 2.175 0.03322 * M9 5.61257 3.79418 1.479 0.14383 M10 4.10895 3.79608 1.082 0.28301 M11 1.67701 3.86881 0.433 0.66609 t 0.66195 0.03512 18.848 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.482 on 66 degrees of freedom Multiple R-Squared: 0.8851, Adjusted R-squared: 0.8625 F-statistic: 39.12 on 13 and 66 DF, p-value: < 2.2e-16 > postscript(file="/var/www/html/rcomp/tmp/1coz81199373526.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/2nlcp1199373526.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/37jta1199373526.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/4esz91199373526.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/59sxn1199373526.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 = 80 Frequency = 1 1 2 3 4 5 11.650391799 12.776106085 7.624677514 8.000408769 10.101837341 6 7 8 9 10 5.064592664 3.207551626 3.130408769 0.413546700 -3.824786633 11 12 13 14 15 0.495312358 1.420371753 -2.453066477 -2.547352191 -1.278780763 16 17 18 19 20 -0.003049507 -0.761620936 -2.348746823 -3.655906650 -3.933049507 21 22 23 24 25 -0.529792787 -0.518126120 -2.018145919 -1.293205313 1.433475246 26 27 28 29 30 2.109189532 -2.302239039 -8.656507784 -8.415079212 -6.862205099 31 32 33 34 35 -8.889364926 -8.726507784 -9.953251063 -6.341584397 -5.501604195 36 37 38 39 40 -3.416544800 -6.499983030 -7.694268744 -7.245697316 -8.339966060 41 42 43 44 45 -4.048537489 -7.085663376 -6.992823203 -3.219966060 -1.416709340 46 47 48 49 50 5.764957327 1.034937528 -5.850121866 -1.383441307 -1.277727021 51 52 53 54 55 4.450844408 2.666575663 -1.461995765 4.570878348 4.393718521 56 57 58 59 60 9.816575663 10.159832384 6.901499050 5.251479252 7.966538647 61 62 63 64 65 9.493100417 5.748814703 5.527386131 8.452998597 7.534427169 66 67 68 69 70 6.057301282 8.360141454 6.672998597 1.326374107 -1.981959226 71 72 73 74 75 0.738020975 1.172961581 -12.240476649 -9.114762363 -6.776190935 76 77 78 79 80 -2.120459679 -2.949031108 0.603843005 3.576683178 -3.740459679 > postscript(file="/var/www/html/rcomp/tmp/6bvnf1199373526.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 = 80 Frequency = 1 lag(myerror, k = 1) myerror 0 11.650391799 NA 1 12.776106085 11.650391799 2 7.624677514 12.776106085 3 8.000408769 7.624677514 4 10.101837341 8.000408769 5 5.064592664 10.101837341 6 3.207551626 5.064592664 7 3.130408769 3.207551626 8 0.413546700 3.130408769 9 -3.824786633 0.413546700 10 0.495312358 -3.824786633 11 1.420371753 0.495312358 12 -2.453066477 1.420371753 13 -2.547352191 -2.453066477 14 -1.278780763 -2.547352191 15 -0.003049507 -1.278780763 16 -0.761620936 -0.003049507 17 -2.348746823 -0.761620936 18 -3.655906650 -2.348746823 19 -3.933049507 -3.655906650 20 -0.529792787 -3.933049507 21 -0.518126120 -0.529792787 22 -2.018145919 -0.518126120 23 -1.293205313 -2.018145919 24 1.433475246 -1.293205313 25 2.109189532 1.433475246 26 -2.302239039 2.109189532 27 -8.656507784 -2.302239039 28 -8.415079212 -8.656507784 29 -6.862205099 -8.415079212 30 -8.889364926 -6.862205099 31 -8.726507784 -8.889364926 32 -9.953251063 -8.726507784 33 -6.341584397 -9.953251063 34 -5.501604195 -6.341584397 35 -3.416544800 -5.501604195 36 -6.499983030 -3.416544800 37 -7.694268744 -6.499983030 38 -7.245697316 -7.694268744 39 -8.339966060 -7.245697316 40 -4.048537489 -8.339966060 41 -7.085663376 -4.048537489 42 -6.992823203 -7.085663376 43 -3.219966060 -6.992823203 44 -1.416709340 -3.219966060 45 5.764957327 -1.416709340 46 1.034937528 5.764957327 47 -5.850121866 1.034937528 48 -1.383441307 -5.850121866 49 -1.277727021 -1.383441307 50 4.450844408 -1.277727021 51 2.666575663 4.450844408 52 -1.461995765 2.666575663 53 4.570878348 -1.461995765 54 4.393718521 4.570878348 55 9.816575663 4.393718521 56 10.159832384 9.816575663 57 6.901499050 10.159832384 58 5.251479252 6.901499050 59 7.966538647 5.251479252 60 9.493100417 7.966538647 61 5.748814703 9.493100417 62 5.527386131 5.748814703 63 8.452998597 5.527386131 64 7.534427169 8.452998597 65 6.057301282 7.534427169 66 8.360141454 6.057301282 67 6.672998597 8.360141454 68 1.326374107 6.672998597 69 -1.981959226 1.326374107 70 0.738020975 -1.981959226 71 1.172961581 0.738020975 72 -12.240476649 1.172961581 73 -9.114762363 -12.240476649 74 -6.776190935 -9.114762363 75 -2.120459679 -6.776190935 76 -2.949031108 -2.120459679 77 0.603843005 -2.949031108 78 3.576683178 0.603843005 79 -3.740459679 3.576683178 80 NA -3.740459679 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 12.776106085 11.650391799 [2,] 7.624677514 12.776106085 [3,] 8.000408769 7.624677514 [4,] 10.101837341 8.000408769 [5,] 5.064592664 10.101837341 [6,] 3.207551626 5.064592664 [7,] 3.130408769 3.207551626 [8,] 0.413546700 3.130408769 [9,] -3.824786633 0.413546700 [10,] 0.495312358 -3.824786633 [11,] 1.420371753 0.495312358 [12,] -2.453066477 1.420371753 [13,] -2.547352191 -2.453066477 [14,] -1.278780763 -2.547352191 [15,] -0.003049507 -1.278780763 [16,] -0.761620936 -0.003049507 [17,] -2.348746823 -0.761620936 [18,] -3.655906650 -2.348746823 [19,] -3.933049507 -3.655906650 [20,] -0.529792787 -3.933049507 [21,] -0.518126120 -0.529792787 [22,] -2.018145919 -0.518126120 [23,] -1.293205313 -2.018145919 [24,] 1.433475246 -1.293205313 [25,] 2.109189532 1.433475246 [26,] -2.302239039 2.109189532 [27,] -8.656507784 -2.302239039 [28,] -8.415079212 -8.656507784 [29,] -6.862205099 -8.415079212 [30,] -8.889364926 -6.862205099 [31,] -8.726507784 -8.889364926 [32,] -9.953251063 -8.726507784 [33,] -6.341584397 -9.953251063 [34,] -5.501604195 -6.341584397 [35,] -3.416544800 -5.501604195 [36,] -6.499983030 -3.416544800 [37,] -7.694268744 -6.499983030 [38,] -7.245697316 -7.694268744 [39,] -8.339966060 -7.245697316 [40,] -4.048537489 -8.339966060 [41,] -7.085663376 -4.048537489 [42,] -6.992823203 -7.085663376 [43,] -3.219966060 -6.992823203 [44,] -1.416709340 -3.219966060 [45,] 5.764957327 -1.416709340 [46,] 1.034937528 5.764957327 [47,] -5.850121866 1.034937528 [48,] -1.383441307 -5.850121866 [49,] -1.277727021 -1.383441307 [50,] 4.450844408 -1.277727021 [51,] 2.666575663 4.450844408 [52,] -1.461995765 2.666575663 [53,] 4.570878348 -1.461995765 [54,] 4.393718521 4.570878348 [55,] 9.816575663 4.393718521 [56,] 10.159832384 9.816575663 [57,] 6.901499050 10.159832384 [58,] 5.251479252 6.901499050 [59,] 7.966538647 5.251479252 [60,] 9.493100417 7.966538647 [61,] 5.748814703 9.493100417 [62,] 5.527386131 5.748814703 [63,] 8.452998597 5.527386131 [64,] 7.534427169 8.452998597 [65,] 6.057301282 7.534427169 [66,] 8.360141454 6.057301282 [67,] 6.672998597 8.360141454 [68,] 1.326374107 6.672998597 [69,] -1.981959226 1.326374107 [70,] 0.738020975 -1.981959226 [71,] 1.172961581 0.738020975 [72,] -12.240476649 1.172961581 [73,] -9.114762363 -12.240476649 [74,] -6.776190935 -9.114762363 [75,] -2.120459679 -6.776190935 [76,] -2.949031108 -2.120459679 [77,] 0.603843005 -2.949031108 [78,] 3.576683178 0.603843005 [79,] -3.740459679 3.576683178 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 12.776106085 11.650391799 2 7.624677514 12.776106085 3 8.000408769 7.624677514 4 10.101837341 8.000408769 5 5.064592664 10.101837341 6 3.207551626 5.064592664 7 3.130408769 3.207551626 8 0.413546700 3.130408769 9 -3.824786633 0.413546700 10 0.495312358 -3.824786633 11 1.420371753 0.495312358 12 -2.453066477 1.420371753 13 -2.547352191 -2.453066477 14 -1.278780763 -2.547352191 15 -0.003049507 -1.278780763 16 -0.761620936 -0.003049507 17 -2.348746823 -0.761620936 18 -3.655906650 -2.348746823 19 -3.933049507 -3.655906650 20 -0.529792787 -3.933049507 21 -0.518126120 -0.529792787 22 -2.018145919 -0.518126120 23 -1.293205313 -2.018145919 24 1.433475246 -1.293205313 25 2.109189532 1.433475246 26 -2.302239039 2.109189532 27 -8.656507784 -2.302239039 28 -8.415079212 -8.656507784 29 -6.862205099 -8.415079212 30 -8.889364926 -6.862205099 31 -8.726507784 -8.889364926 32 -9.953251063 -8.726507784 33 -6.341584397 -9.953251063 34 -5.501604195 -6.341584397 35 -3.416544800 -5.501604195 36 -6.499983030 -3.416544800 37 -7.694268744 -6.499983030 38 -7.245697316 -7.694268744 39 -8.339966060 -7.245697316 40 -4.048537489 -8.339966060 41 -7.085663376 -4.048537489 42 -6.992823203 -7.085663376 43 -3.219966060 -6.992823203 44 -1.416709340 -3.219966060 45 5.764957327 -1.416709340 46 1.034937528 5.764957327 47 -5.850121866 1.034937528 48 -1.383441307 -5.850121866 49 -1.277727021 -1.383441307 50 4.450844408 -1.277727021 51 2.666575663 4.450844408 52 -1.461995765 2.666575663 53 4.570878348 -1.461995765 54 4.393718521 4.570878348 55 9.816575663 4.393718521 56 10.159832384 9.816575663 57 6.901499050 10.159832384 58 5.251479252 6.901499050 59 7.966538647 5.251479252 60 9.493100417 7.966538647 61 5.748814703 9.493100417 62 5.527386131 5.748814703 63 8.452998597 5.527386131 64 7.534427169 8.452998597 65 6.057301282 7.534427169 66 8.360141454 6.057301282 67 6.672998597 8.360141454 68 1.326374107 6.672998597 69 -1.981959226 1.326374107 70 0.738020975 -1.981959226 71 1.172961581 0.738020975 72 -12.240476649 1.172961581 73 -9.114762363 -12.240476649 74 -6.776190935 -9.114762363 75 -2.120459679 -6.776190935 76 -2.949031108 -2.120459679 77 0.603843005 -2.949031108 78 3.576683178 0.603843005 79 -3.740459679 3.576683178 > 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/7vzby1199373526.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/8qe421199373526.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/9777e1199373526.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 > 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/108b9w1199373526.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/11a7vh1199373526.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/123oig1199373526.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/131ppd1199373526.tab") > > system("convert tmp/1coz81199373526.ps tmp/1coz81199373526.png") > system("convert tmp/2nlcp1199373526.ps tmp/2nlcp1199373526.png") > system("convert tmp/37jta1199373526.ps tmp/37jta1199373526.png") > system("convert tmp/4esz91199373526.ps tmp/4esz91199373526.png") > system("convert tmp/59sxn1199373526.ps tmp/59sxn1199373526.png") > system("convert tmp/6bvnf1199373526.ps tmp/6bvnf1199373526.png") > system("convert tmp/7vzby1199373526.ps tmp/7vzby1199373526.png") > system("convert tmp/8qe421199373526.ps tmp/8qe421199373526.png") > system("convert tmp/9777e1199373526.ps tmp/9777e1199373526.png") > > > proc.time() user system elapsed 4.089 2.463 4.420