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(103.3,107.9,101,94.6,94.2,92.3,107.1,102.6,103.1,104.1,92.7,87,109.3,113.9,103.3,100.8,97.4,98.9,110.8,103.5,99.8,104.9,95.2,85.7,110,113.7,101.1,103.6,96.2,98.3,119.7,109.4,103.5,118.2,98.7,96.8,121.8,124,119.6,122.5,109.7,111.6,131.2,124.4,116.9,131.8,107.4,111,134,126.2,131.2,130.1,123.1,126.3,148.6,130.1,142.3,154.4,121.6,124.8,143.6,146.9,144.6,137.1,134.7,130.8,153.5,137.6,146.5,156.7,137.6,131.4,147.4,158.5,151.5,142.5,131.3,133.4,136.9,143.2,136.4,145.9,138.8,122.9),dim=c(1,84),dimnames=list(c('Bewerkende_industrie'),1:84)) > y <- array(NA,dim=c(1,84),dimnames=list(c('Bewerkende_industrie'),1:84)) > 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) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > 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 Bewerkende_industrie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 103.3 1 0 0 0 0 0 0 0 0 0 0 1 2 107.9 0 1 0 0 0 0 0 0 0 0 0 2 3 101.0 0 0 1 0 0 0 0 0 0 0 0 3 4 94.6 0 0 0 1 0 0 0 0 0 0 0 4 5 94.2 0 0 0 0 1 0 0 0 0 0 0 5 6 92.3 0 0 0 0 0 1 0 0 0 0 0 6 7 107.1 0 0 0 0 0 0 1 0 0 0 0 7 8 102.6 0 0 0 0 0 0 0 1 0 0 0 8 9 103.1 0 0 0 0 0 0 0 0 1 0 0 9 10 104.1 0 0 0 0 0 0 0 0 0 1 0 10 11 92.7 0 0 0 0 0 0 0 0 0 0 1 11 12 87.0 0 0 0 0 0 0 0 0 0 0 0 12 13 109.3 1 0 0 0 0 0 0 0 0 0 0 13 14 113.9 0 1 0 0 0 0 0 0 0 0 0 14 15 103.3 0 0 1 0 0 0 0 0 0 0 0 15 16 100.8 0 0 0 1 0 0 0 0 0 0 0 16 17 97.4 0 0 0 0 1 0 0 0 0 0 0 17 18 98.9 0 0 0 0 0 1 0 0 0 0 0 18 19 110.8 0 0 0 0 0 0 1 0 0 0 0 19 20 103.5 0 0 0 0 0 0 0 1 0 0 0 20 21 99.8 0 0 0 0 0 0 0 0 1 0 0 21 22 104.9 0 0 0 0 0 0 0 0 0 1 0 22 23 95.2 0 0 0 0 0 0 0 0 0 0 1 23 24 85.7 0 0 0 0 0 0 0 0 0 0 0 24 25 110.0 1 0 0 0 0 0 0 0 0 0 0 25 26 113.7 0 1 0 0 0 0 0 0 0 0 0 26 27 101.1 0 0 1 0 0 0 0 0 0 0 0 27 28 103.6 0 0 0 1 0 0 0 0 0 0 0 28 29 96.2 0 0 0 0 1 0 0 0 0 0 0 29 30 98.3 0 0 0 0 0 1 0 0 0 0 0 30 31 119.7 0 0 0 0 0 0 1 0 0 0 0 31 32 109.4 0 0 0 0 0 0 0 1 0 0 0 32 33 103.5 0 0 0 0 0 0 0 0 1 0 0 33 34 118.2 0 0 0 0 0 0 0 0 0 1 0 34 35 98.7 0 0 0 0 0 0 0 0 0 0 1 35 36 96.8 0 0 0 0 0 0 0 0 0 0 0 36 37 121.8 1 0 0 0 0 0 0 0 0 0 0 37 38 124.0 0 1 0 0 0 0 0 0 0 0 0 38 39 119.6 0 0 1 0 0 0 0 0 0 0 0 39 40 122.5 0 0 0 1 0 0 0 0 0 0 0 40 41 109.7 0 0 0 0 1 0 0 0 0 0 0 41 42 111.6 0 0 0 0 0 1 0 0 0 0 0 42 43 131.2 0 0 0 0 0 0 1 0 0 0 0 43 44 124.4 0 0 0 0 0 0 0 1 0 0 0 44 45 116.9 0 0 0 0 0 0 0 0 1 0 0 45 46 131.8 0 0 0 0 0 0 0 0 0 1 0 46 47 107.4 0 0 0 0 0 0 0 0 0 0 1 47 48 111.0 0 0 0 0 0 0 0 0 0 0 0 48 49 134.0 1 0 0 0 0 0 0 0 0 0 0 49 50 126.2 0 1 0 0 0 0 0 0 0 0 0 50 51 131.2 0 0 1 0 0 0 0 0 0 0 0 51 52 130.1 0 0 0 1 0 0 0 0 0 0 0 52 53 123.1 0 0 0 0 1 0 0 0 0 0 0 53 54 126.3 0 0 0 0 0 1 0 0 0 0 0 54 55 148.6 0 0 0 0 0 0 1 0 0 0 0 55 56 130.1 0 0 0 0 0 0 0 1 0 0 0 56 57 142.3 0 0 0 0 0 0 0 0 1 0 0 57 58 154.4 0 0 0 0 0 0 0 0 0 1 0 58 59 121.6 0 0 0 0 0 0 0 0 0 0 1 59 60 124.8 0 0 0 0 0 0 0 0 0 0 0 60 61 143.6 1 0 0 0 0 0 0 0 0 0 0 61 62 146.9 0 1 0 0 0 0 0 0 0 0 0 62 63 144.6 0 0 1 0 0 0 0 0 0 0 0 63 64 137.1 0 0 0 1 0 0 0 0 0 0 0 64 65 134.7 0 0 0 0 1 0 0 0 0 0 0 65 66 130.8 0 0 0 0 0 1 0 0 0 0 0 66 67 153.5 0 0 0 0 0 0 1 0 0 0 0 67 68 137.6 0 0 0 0 0 0 0 1 0 0 0 68 69 146.5 0 0 0 0 0 0 0 0 1 0 0 69 70 156.7 0 0 0 0 0 0 0 0 0 1 0 70 71 137.6 0 0 0 0 0 0 0 0 0 0 1 71 72 131.4 0 0 0 0 0 0 0 0 0 0 0 72 73 147.4 1 0 0 0 0 0 0 0 0 0 0 73 74 158.5 0 1 0 0 0 0 0 0 0 0 0 74 75 151.5 0 0 1 0 0 0 0 0 0 0 0 75 76 142.5 0 0 0 1 0 0 0 0 0 0 0 76 77 131.3 0 0 0 0 1 0 0 0 0 0 0 77 78 133.4 0 0 0 0 0 1 0 0 0 0 0 78 79 136.9 0 0 0 0 0 0 1 0 0 0 0 79 80 143.2 0 0 0 0 0 0 0 1 0 0 0 80 81 136.4 0 0 0 0 0 0 0 0 1 0 0 81 82 145.9 0 0 0 0 0 0 0 0 0 1 0 82 83 138.8 0 0 0 0 0 0 0 0 0 0 1 83 84 122.9 0 0 0 0 0 0 0 0 0 0 0 84 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) M1 M2 M3 M4 M5 75.4798 23.2561 25.6679 19.4368 15.7343 8.6747 M6 M7 M8 M9 M10 M11 8.7007 24.6125 15.7814 14.7647 23.7193 5.3168 t 0.6882 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -17.5616 -3.9917 0.7571 3.9045 15.2842 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 75.4798 2.8125 26.837 < 2e-16 *** M1 23.2561 3.4597 6.722 3.78e-09 *** M2 25.6679 3.4571 7.425 1.94e-10 *** M3 19.4368 3.4547 5.626 3.42e-07 *** M4 15.7343 3.4526 4.557 2.10e-05 *** M5 8.6747 3.4508 2.514 0.0142 * M6 8.7007 3.4491 2.523 0.0139 * M7 24.6125 3.4478 7.139 6.53e-10 *** M8 15.7814 3.4466 4.579 1.94e-05 *** M9 14.7647 3.4458 4.285 5.65e-05 *** M10 23.7193 3.4451 6.885 1.91e-09 *** M11 5.3168 3.4448 1.543 0.1272 t 0.6882 0.0293 23.491 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.444 on 71 degrees of freedom Multiple R-squared: 0.9014, Adjusted R-squared: 0.8847 F-statistic: 54.07 on 12 and 71 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 1.052478e-02 2.104956e-02 0.9894752 [2,] 2.760824e-03 5.521647e-03 0.9972392 [3,] 7.410449e-04 1.482090e-03 0.9992590 [4,] 1.581416e-04 3.162832e-04 0.9998419 [5,] 1.705524e-04 3.411048e-04 0.9998294 [6,] 1.269198e-03 2.538395e-03 0.9987308 [7,] 5.655277e-04 1.131055e-03 0.9994345 [8,] 1.710282e-04 3.420565e-04 0.9998290 [9,] 1.219828e-04 2.439656e-04 0.9998780 [10,] 3.674680e-05 7.349360e-05 0.9999633 [11,] 1.138232e-05 2.276465e-05 0.9999886 [12,] 1.825082e-05 3.650164e-05 0.9999817 [13,] 9.186592e-06 1.837318e-05 0.9999908 [14,] 5.197546e-06 1.039509e-05 0.9999948 [15,] 1.713516e-06 3.427032e-06 0.9999983 [16,] 8.671285e-06 1.734257e-05 0.9999913 [17,] 3.879802e-06 7.759604e-06 0.9999961 [18,] 2.329628e-06 4.659256e-06 0.9999977 [19,] 3.177095e-05 6.354190e-05 0.9999682 [20,] 1.598420e-05 3.196839e-05 0.9999840 [21,] 2.014153e-05 4.028306e-05 0.9999799 [22,] 4.332146e-05 8.664292e-05 0.9999567 [23,] 3.518210e-05 7.036420e-05 0.9999648 [24,] 1.661394e-04 3.322789e-04 0.9998339 [25,] 1.489398e-03 2.978797e-03 0.9985106 [26,] 1.087893e-03 2.175786e-03 0.9989121 [27,] 8.433896e-04 1.686779e-03 0.9991566 [28,] 9.507228e-04 1.901446e-03 0.9990493 [29,] 1.003578e-03 2.007156e-03 0.9989964 [30,] 1.153466e-03 2.306933e-03 0.9988465 [31,] 2.811444e-03 5.622889e-03 0.9971886 [32,] 4.664429e-03 9.328859e-03 0.9953356 [33,] 6.125808e-03 1.225162e-02 0.9938742 [34,] 5.799158e-03 1.159832e-02 0.9942008 [35,] 3.324899e-02 6.649798e-02 0.9667510 [36,] 7.164828e-02 1.432966e-01 0.9283517 [37,] 8.001649e-02 1.600330e-01 0.9199835 [38,] 8.540181e-02 1.708036e-01 0.9145982 [39,] 8.330293e-02 1.666059e-01 0.9166971 [40,] 1.178180e-01 2.356359e-01 0.8821820 [41,] 1.166222e-01 2.332443e-01 0.8833778 [42,] 1.798381e-01 3.596761e-01 0.8201619 [43,] 2.777186e-01 5.554373e-01 0.7222814 [44,] 4.729056e-01 9.458112e-01 0.5270944 [45,] 4.255395e-01 8.510791e-01 0.5744605 [46,] 3.585258e-01 7.170516e-01 0.6414742 [47,] 4.702746e-01 9.405492e-01 0.5297254 [48,] 5.168018e-01 9.663965e-01 0.4831982 [49,] 5.432692e-01 9.134616e-01 0.4567308 [50,] 4.301261e-01 8.602523e-01 0.5698739 [51,] 4.152809e-01 8.305619e-01 0.5847191 [52,] 5.097364e-01 9.805272e-01 0.4902636 [53,] 7.001451e-01 5.997098e-01 0.2998549 > postscript(file="/var/www/html/rcomp/tmp/11z341230126604.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/2mutb1230126604.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/31aa41230126604.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/4io061230126604.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/57z0m1230126604.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 84 Frequency = 1 1 2 3 4 5 6 3.8758929 5.3758929 4.0187500 0.6330357 6.6044643 3.9901786 7 8 9 10 11 12 2.1901786 5.8330357 6.6616071 -1.9812500 4.3330357 3.2616071 13 14 15 16 17 18 1.6172619 3.1172619 -1.9398810 -1.4255952 1.5458333 2.3315476 19 20 21 22 23 24 -2.3684524 -1.5255952 -4.8970238 -9.4398810 -1.4255952 -6.2970238 25 26 27 28 29 30 -5.9413690 -5.3413690 -12.3985119 -6.8842262 -7.9127976 -6.5270833 31 32 33 34 35 36 -1.7270833 -3.8842262 -9.4556548 -4.3985119 -6.1842262 -3.4556548 37 38 39 40 41 42 -2.4000000 -3.3000000 -2.1571429 3.7571429 -2.6714286 -1.4857143 43 44 45 46 47 48 1.5142857 2.8571429 -4.3142857 0.9428571 -5.7428571 2.4857143 49 50 51 52 53 54 1.5413690 -9.3586310 1.1842262 3.0985119 2.4699405 4.9556548 55 56 57 58 59 60 10.6556548 0.2985119 12.8270833 15.2842262 0.1985119 8.0270833 61 62 63 64 65 66 2.8827381 3.0827381 6.3255952 1.8398810 5.8113095 1.1970238 67 68 69 70 71 72 7.2970238 -0.4601190 8.7684524 9.3255952 7.9398810 6.3684524 73 74 75 76 77 78 -1.5758929 6.4241071 4.9669643 -1.0187500 -5.8473214 -4.4616071 79 80 81 82 83 84 -17.5616071 -3.1187500 -9.5901786 -9.7330357 0.8812500 -10.3901786 > postscript(file="/var/www/html/rcomp/tmp/6079f1230126604.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 = 84 Frequency = 1 lag(myerror, k = 1) myerror 0 3.8758929 NA 1 5.3758929 3.8758929 2 4.0187500 5.3758929 3 0.6330357 4.0187500 4 6.6044643 0.6330357 5 3.9901786 6.6044643 6 2.1901786 3.9901786 7 5.8330357 2.1901786 8 6.6616071 5.8330357 9 -1.9812500 6.6616071 10 4.3330357 -1.9812500 11 3.2616071 4.3330357 12 1.6172619 3.2616071 13 3.1172619 1.6172619 14 -1.9398810 3.1172619 15 -1.4255952 -1.9398810 16 1.5458333 -1.4255952 17 2.3315476 1.5458333 18 -2.3684524 2.3315476 19 -1.5255952 -2.3684524 20 -4.8970238 -1.5255952 21 -9.4398810 -4.8970238 22 -1.4255952 -9.4398810 23 -6.2970238 -1.4255952 24 -5.9413690 -6.2970238 25 -5.3413690 -5.9413690 26 -12.3985119 -5.3413690 27 -6.8842262 -12.3985119 28 -7.9127976 -6.8842262 29 -6.5270833 -7.9127976 30 -1.7270833 -6.5270833 31 -3.8842262 -1.7270833 32 -9.4556548 -3.8842262 33 -4.3985119 -9.4556548 34 -6.1842262 -4.3985119 35 -3.4556548 -6.1842262 36 -2.4000000 -3.4556548 37 -3.3000000 -2.4000000 38 -2.1571429 -3.3000000 39 3.7571429 -2.1571429 40 -2.6714286 3.7571429 41 -1.4857143 -2.6714286 42 1.5142857 -1.4857143 43 2.8571429 1.5142857 44 -4.3142857 2.8571429 45 0.9428571 -4.3142857 46 -5.7428571 0.9428571 47 2.4857143 -5.7428571 48 1.5413690 2.4857143 49 -9.3586310 1.5413690 50 1.1842262 -9.3586310 51 3.0985119 1.1842262 52 2.4699405 3.0985119 53 4.9556548 2.4699405 54 10.6556548 4.9556548 55 0.2985119 10.6556548 56 12.8270833 0.2985119 57 15.2842262 12.8270833 58 0.1985119 15.2842262 59 8.0270833 0.1985119 60 2.8827381 8.0270833 61 3.0827381 2.8827381 62 6.3255952 3.0827381 63 1.8398810 6.3255952 64 5.8113095 1.8398810 65 1.1970238 5.8113095 66 7.2970238 1.1970238 67 -0.4601190 7.2970238 68 8.7684524 -0.4601190 69 9.3255952 8.7684524 70 7.9398810 9.3255952 71 6.3684524 7.9398810 72 -1.5758929 6.3684524 73 6.4241071 -1.5758929 74 4.9669643 6.4241071 75 -1.0187500 4.9669643 76 -5.8473214 -1.0187500 77 -4.4616071 -5.8473214 78 -17.5616071 -4.4616071 79 -3.1187500 -17.5616071 80 -9.5901786 -3.1187500 81 -9.7330357 -9.5901786 82 0.8812500 -9.7330357 83 -10.3901786 0.8812500 84 NA -10.3901786 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 5.3758929 3.8758929 [2,] 4.0187500 5.3758929 [3,] 0.6330357 4.0187500 [4,] 6.6044643 0.6330357 [5,] 3.9901786 6.6044643 [6,] 2.1901786 3.9901786 [7,] 5.8330357 2.1901786 [8,] 6.6616071 5.8330357 [9,] -1.9812500 6.6616071 [10,] 4.3330357 -1.9812500 [11,] 3.2616071 4.3330357 [12,] 1.6172619 3.2616071 [13,] 3.1172619 1.6172619 [14,] -1.9398810 3.1172619 [15,] -1.4255952 -1.9398810 [16,] 1.5458333 -1.4255952 [17,] 2.3315476 1.5458333 [18,] -2.3684524 2.3315476 [19,] -1.5255952 -2.3684524 [20,] -4.8970238 -1.5255952 [21,] -9.4398810 -4.8970238 [22,] -1.4255952 -9.4398810 [23,] -6.2970238 -1.4255952 [24,] -5.9413690 -6.2970238 [25,] -5.3413690 -5.9413690 [26,] -12.3985119 -5.3413690 [27,] -6.8842262 -12.3985119 [28,] -7.9127976 -6.8842262 [29,] -6.5270833 -7.9127976 [30,] -1.7270833 -6.5270833 [31,] -3.8842262 -1.7270833 [32,] -9.4556548 -3.8842262 [33,] -4.3985119 -9.4556548 [34,] -6.1842262 -4.3985119 [35,] -3.4556548 -6.1842262 [36,] -2.4000000 -3.4556548 [37,] -3.3000000 -2.4000000 [38,] -2.1571429 -3.3000000 [39,] 3.7571429 -2.1571429 [40,] -2.6714286 3.7571429 [41,] -1.4857143 -2.6714286 [42,] 1.5142857 -1.4857143 [43,] 2.8571429 1.5142857 [44,] -4.3142857 2.8571429 [45,] 0.9428571 -4.3142857 [46,] -5.7428571 0.9428571 [47,] 2.4857143 -5.7428571 [48,] 1.5413690 2.4857143 [49,] -9.3586310 1.5413690 [50,] 1.1842262 -9.3586310 [51,] 3.0985119 1.1842262 [52,] 2.4699405 3.0985119 [53,] 4.9556548 2.4699405 [54,] 10.6556548 4.9556548 [55,] 0.2985119 10.6556548 [56,] 12.8270833 0.2985119 [57,] 15.2842262 12.8270833 [58,] 0.1985119 15.2842262 [59,] 8.0270833 0.1985119 [60,] 2.8827381 8.0270833 [61,] 3.0827381 2.8827381 [62,] 6.3255952 3.0827381 [63,] 1.8398810 6.3255952 [64,] 5.8113095 1.8398810 [65,] 1.1970238 5.8113095 [66,] 7.2970238 1.1970238 [67,] -0.4601190 7.2970238 [68,] 8.7684524 -0.4601190 [69,] 9.3255952 8.7684524 [70,] 7.9398810 9.3255952 [71,] 6.3684524 7.9398810 [72,] -1.5758929 6.3684524 [73,] 6.4241071 -1.5758929 [74,] 4.9669643 6.4241071 [75,] -1.0187500 4.9669643 [76,] -5.8473214 -1.0187500 [77,] -4.4616071 -5.8473214 [78,] -17.5616071 -4.4616071 [79,] -3.1187500 -17.5616071 [80,] -9.5901786 -3.1187500 [81,] -9.7330357 -9.5901786 [82,] 0.8812500 -9.7330357 [83,] -10.3901786 0.8812500 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 5.3758929 3.8758929 2 4.0187500 5.3758929 3 0.6330357 4.0187500 4 6.6044643 0.6330357 5 3.9901786 6.6044643 6 2.1901786 3.9901786 7 5.8330357 2.1901786 8 6.6616071 5.8330357 9 -1.9812500 6.6616071 10 4.3330357 -1.9812500 11 3.2616071 4.3330357 12 1.6172619 3.2616071 13 3.1172619 1.6172619 14 -1.9398810 3.1172619 15 -1.4255952 -1.9398810 16 1.5458333 -1.4255952 17 2.3315476 1.5458333 18 -2.3684524 2.3315476 19 -1.5255952 -2.3684524 20 -4.8970238 -1.5255952 21 -9.4398810 -4.8970238 22 -1.4255952 -9.4398810 23 -6.2970238 -1.4255952 24 -5.9413690 -6.2970238 25 -5.3413690 -5.9413690 26 -12.3985119 -5.3413690 27 -6.8842262 -12.3985119 28 -7.9127976 -6.8842262 29 -6.5270833 -7.9127976 30 -1.7270833 -6.5270833 31 -3.8842262 -1.7270833 32 -9.4556548 -3.8842262 33 -4.3985119 -9.4556548 34 -6.1842262 -4.3985119 35 -3.4556548 -6.1842262 36 -2.4000000 -3.4556548 37 -3.3000000 -2.4000000 38 -2.1571429 -3.3000000 39 3.7571429 -2.1571429 40 -2.6714286 3.7571429 41 -1.4857143 -2.6714286 42 1.5142857 -1.4857143 43 2.8571429 1.5142857 44 -4.3142857 2.8571429 45 0.9428571 -4.3142857 46 -5.7428571 0.9428571 47 2.4857143 -5.7428571 48 1.5413690 2.4857143 49 -9.3586310 1.5413690 50 1.1842262 -9.3586310 51 3.0985119 1.1842262 52 2.4699405 3.0985119 53 4.9556548 2.4699405 54 10.6556548 4.9556548 55 0.2985119 10.6556548 56 12.8270833 0.2985119 57 15.2842262 12.8270833 58 0.1985119 15.2842262 59 8.0270833 0.1985119 60 2.8827381 8.0270833 61 3.0827381 2.8827381 62 6.3255952 3.0827381 63 1.8398810 6.3255952 64 5.8113095 1.8398810 65 1.1970238 5.8113095 66 7.2970238 1.1970238 67 -0.4601190 7.2970238 68 8.7684524 -0.4601190 69 9.3255952 8.7684524 70 7.9398810 9.3255952 71 6.3684524 7.9398810 72 -1.5758929 6.3684524 73 6.4241071 -1.5758929 74 4.9669643 6.4241071 75 -1.0187500 4.9669643 76 -5.8473214 -1.0187500 77 -4.4616071 -5.8473214 78 -17.5616071 -4.4616071 79 -3.1187500 -17.5616071 80 -9.5901786 -3.1187500 81 -9.7330357 -9.5901786 82 0.8812500 -9.7330357 83 -10.3901786 0.8812500 > 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/71rq51230126604.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/847431230126604.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/9erlc1230126604.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 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10cztm1230126604.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + 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/119bqw1230126604.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/12j8981230126605.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/13c8qk1230126605.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/147mk41230126605.tab") > if (n > n25) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-values',header=TRUE) + a<-table.element(a,'Alternative Hypothesis',3,header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'breakpoint index',header=TRUE) + a<-table.element(a,'greater',header=TRUE) + a<-table.element(a,'2-sided',header=TRUE) + a<-table.element(a,'less',header=TRUE) + a<-table.row.end(a) + for (mypoint in kp3:nmkm3) { + a<-table.row.start(a) + a<-table.element(a,mypoint,header=TRUE) + a<-table.element(a,gqarr[mypoint-kp3+1,1]) + a<-table.element(a,gqarr[mypoint-kp3+1,2]) + a<-table.element(a,gqarr[mypoint-kp3+1,3]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/15maps1230126605.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Description',header=TRUE) + a<-table.element(a,'# significant tests',header=TRUE) + a<-table.element(a,'% significant tests',header=TRUE) + a<-table.element(a,'OK/NOK',header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'1% type I error level',header=TRUE) + a<-table.element(a,numsignificant1) + a<-table.element(a,numsignificant1/numgqtests) + if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'5% type I error level',header=TRUE) + a<-table.element(a,numsignificant5) + a<-table.element(a,numsignificant5/numgqtests) + if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'10% type I error level',header=TRUE) + a<-table.element(a,numsignificant10) + a<-table.element(a,numsignificant10/numgqtests) + if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/16n7kj1230126605.tab") + } > > system("convert tmp/11z341230126604.ps tmp/11z341230126604.png") > system("convert tmp/2mutb1230126604.ps tmp/2mutb1230126604.png") > system("convert tmp/31aa41230126604.ps tmp/31aa41230126604.png") > system("convert tmp/4io061230126604.ps tmp/4io061230126604.png") > system("convert tmp/57z0m1230126604.ps tmp/57z0m1230126604.png") > system("convert tmp/6079f1230126604.ps tmp/6079f1230126604.png") > system("convert tmp/71rq51230126604.ps tmp/71rq51230126604.png") > system("convert tmp/847431230126604.ps tmp/847431230126604.png") > system("convert tmp/9erlc1230126604.ps tmp/9erlc1230126604.png") > system("convert tmp/10cztm1230126604.ps tmp/10cztm1230126604.png") > > > proc.time() user system elapsed 2.731 1.568 3.729