R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(32.68 + ,10967.87 + ,31.54 + ,10433.56 + ,32.43 + ,10665.78 + ,26.54 + ,10666.71 + ,25.85 + ,10682.74 + ,27.6 + ,10777.22 + ,25.71 + ,10052.6 + ,25.38 + ,10213.97 + ,28.57 + ,10546.82 + ,27.64 + ,10767.2 + ,25.36 + ,10444.5 + ,25.9 + ,10314.68 + ,26.29 + ,9042.56 + ,21.74 + ,9220.75 + ,19.2 + ,9721.84 + ,19.32 + ,9978.53 + ,19.82 + ,9923.81 + ,20.36 + ,9892.56 + ,24.31 + ,10500.98 + ,25.97 + ,10179.35 + ,25.61 + ,10080.48 + ,24.67 + ,9492.44 + ,25.59 + ,8616.49 + ,26.09 + ,8685.4 + ,28.37 + ,8160.67 + ,27.34 + ,8048.1 + ,24.46 + ,8641.21 + ,27.46 + ,8526.63 + ,30.23 + ,8474.21 + ,32.33 + ,7916.13 + ,29.87 + ,7977.64 + ,24.87 + ,8334.59 + ,25.48 + ,8623.36 + ,27.28 + ,9098.03 + ,28.24 + ,9154.34 + ,29.58 + ,9284.73 + ,26.95 + ,9492.49 + ,29.08 + ,9682.35 + ,28.76 + ,9762.12 + ,29.59 + ,10124.63 + ,30.7 + ,10540.05 + ,30.52 + ,10601.61 + ,32.67 + ,10323.73 + ,33.19 + ,10418.4 + ,37.13 + ,10092.96 + ,35.54 + ,10364.91 + ,37.75 + ,10152.09 + ,41.84 + ,10032.8 + ,42.94 + ,10204.59 + ,49.14 + ,10001.6 + ,44.61 + ,10411.75 + ,40.22 + ,10673.38 + ,44.23 + ,10539.51 + ,45.85 + ,10723.78 + ,53.38 + ,10682.06 + ,53.26 + ,10283.19 + ,51.8 + ,10377.18 + ,55.3 + ,10486.64 + ,57.81 + ,10545.38 + ,63.96 + ,10554.27 + ,63.77 + ,10532.54 + ,59.15 + ,10324.31 + ,56.12 + ,10695.25 + ,57.42 + ,10827.81 + ,63.52 + ,10872.48 + ,61.71 + ,10971.19 + ,63.01 + ,11145.65 + ,68.18 + ,11234.68 + ,72.03 + ,11333.88 + ,69.75 + ,10997.97 + ,74.41 + ,11036.89 + ,74.33 + ,11257.35 + ,64.24 + ,11533.59 + ,60.03 + ,11963.12 + ,59.44 + ,12185.15 + ,62.5 + ,12377.62 + ,55.04 + ,12512.89 + ,58.34 + ,12631.48 + ,61.92 + ,12268.53 + ,67.65 + ,12754.8 + ,67.68 + ,13407.75 + ,70.3 + ,13480.21 + ,75.26 + ,13673.28 + ,71.44 + ,13239.71 + ,76.36 + ,13557.69 + ,81.71 + ,13901.28 + ,92.6 + ,13200.58 + ,90.6 + ,13406.97 + ,92.23 + ,12538.12 + ,94.09 + ,12419.57 + ,102.79 + ,12193.88 + ,109.65 + ,12656.63 + ,124.05 + ,12812.48 + ,132.69 + ,12056.67 + ,135.81 + ,11322.38 + ,116.07 + ,11530.75 + ,101.42 + ,11114.08 + ,75.73 + ,9181.73 + ,55.48 + ,8614.55 + ,43.8 + ,8595.56 + ,45.29 + ,8396.2 + ,44.01 + ,7690.5 + ,47.48 + ,7235.47 + ,51.07 + ,7992.12 + ,57.84 + ,8398.37 + ,69.04 + ,8593 + ,65.61 + ,8679.75 + ,72.87 + ,9374.63 + ,68.41 + ,9634.97 + ,73.25 + ,9857.34 + ,77.43 + ,10238.83) + ,dim=c(2 + ,111) + ,dimnames=list(c('olieprijs' + ,'dowjones') + ,1:111)) > y <- array(NA,dim=c(2,111),dimnames=list(c('olieprijs','dowjones'),1:111)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal 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 olieprijs dowjones 1 32.68 10967.87 2 31.54 10433.56 3 32.43 10665.78 4 26.54 10666.71 5 25.85 10682.74 6 27.60 10777.22 7 25.71 10052.60 8 25.38 10213.97 9 28.57 10546.82 10 27.64 10767.20 11 25.36 10444.50 12 25.90 10314.68 13 26.29 9042.56 14 21.74 9220.75 15 19.20 9721.84 16 19.32 9978.53 17 19.82 9923.81 18 20.36 9892.56 19 24.31 10500.98 20 25.97 10179.35 21 25.61 10080.48 22 24.67 9492.44 23 25.59 8616.49 24 26.09 8685.40 25 28.37 8160.67 26 27.34 8048.10 27 24.46 8641.21 28 27.46 8526.63 29 30.23 8474.21 30 32.33 7916.13 31 29.87 7977.64 32 24.87 8334.59 33 25.48 8623.36 34 27.28 9098.03 35 28.24 9154.34 36 29.58 9284.73 37 26.95 9492.49 38 29.08 9682.35 39 28.76 9762.12 40 29.59 10124.63 41 30.70 10540.05 42 30.52 10601.61 43 32.67 10323.73 44 33.19 10418.40 45 37.13 10092.96 46 35.54 10364.91 47 37.75 10152.09 48 41.84 10032.80 49 42.94 10204.59 50 49.14 10001.60 51 44.61 10411.75 52 40.22 10673.38 53 44.23 10539.51 54 45.85 10723.78 55 53.38 10682.06 56 53.26 10283.19 57 51.80 10377.18 58 55.30 10486.64 59 57.81 10545.38 60 63.96 10554.27 61 63.77 10532.54 62 59.15 10324.31 63 56.12 10695.25 64 57.42 10827.81 65 63.52 10872.48 66 61.71 10971.19 67 63.01 11145.65 68 68.18 11234.68 69 72.03 11333.88 70 69.75 10997.97 71 74.41 11036.89 72 74.33 11257.35 73 64.24 11533.59 74 60.03 11963.12 75 59.44 12185.15 76 62.50 12377.62 77 55.04 12512.89 78 58.34 12631.48 79 61.92 12268.53 80 67.65 12754.80 81 67.68 13407.75 82 70.30 13480.21 83 75.26 13673.28 84 71.44 13239.71 85 76.36 13557.69 86 81.71 13901.28 87 92.60 13200.58 88 90.60 13406.97 89 92.23 12538.12 90 94.09 12419.57 91 102.79 12193.88 92 109.65 12656.63 93 124.05 12812.48 94 132.69 12056.67 95 135.81 11322.38 96 116.07 11530.75 97 101.42 11114.08 98 75.73 9181.73 99 55.48 8614.55 100 43.80 8595.56 101 45.29 8396.20 102 44.01 7690.50 103 47.48 7235.47 104 51.07 7992.12 105 57.84 8398.37 106 69.04 8593.00 107 65.61 8679.75 108 72.87 9374.63 109 68.41 9634.97 110 73.25 9857.34 111 77.43 10238.83 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) dowjones -55.92278 0.01027 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -27.925 -15.504 -6.383 11.520 75.466 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -55.922784 14.489554 -3.860 0.000193 *** dowjones 0.010269 0.001373 7.478 2.03e-11 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 21.51 on 109 degrees of freedom Multiple R-squared: 0.3391, Adjusted R-squared: 0.333 F-statistic: 55.93 on 1 and 109 DF, p-value: 2.028e-11 > 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,] 7.647363e-03 1.529473e-02 9.923526e-01 [2,] 1.396772e-03 2.793544e-03 9.986032e-01 [3,] 2.181033e-04 4.362066e-04 9.997819e-01 [4,] 3.328710e-05 6.657420e-05 9.999667e-01 [5,] 4.326572e-06 8.653144e-06 9.999957e-01 [6,] 6.924902e-07 1.384980e-06 9.999993e-01 [7,] 1.260882e-07 2.521764e-07 9.999999e-01 [8,] 1.645486e-08 3.290972e-08 1.000000e+00 [9,] 4.550569e-09 9.101139e-09 1.000000e+00 [10,] 9.374017e-10 1.874803e-09 1.000000e+00 [11,] 1.129026e-09 2.258052e-09 1.000000e+00 [12,] 1.158079e-09 2.316157e-09 1.000000e+00 [13,] 5.765412e-10 1.153082e-09 1.000000e+00 [14,] 1.958539e-10 3.917077e-10 1.000000e+00 [15,] 5.172298e-11 1.034460e-10 1.000000e+00 [16,] 9.982178e-12 1.996436e-11 1.000000e+00 [17,] 1.921187e-12 3.842375e-12 1.000000e+00 [18,] 4.554090e-13 9.108180e-13 1.000000e+00 [19,] 3.613284e-13 7.226568e-13 1.000000e+00 [20,] 1.430097e-13 2.860195e-13 1.000000e+00 [21,] 1.146790e-13 2.293580e-13 1.000000e+00 [22,] 3.444809e-14 6.889619e-14 1.000000e+00 [23,] 6.367349e-15 1.273470e-14 1.000000e+00 [24,] 1.535347e-15 3.070694e-15 1.000000e+00 [25,] 7.464725e-16 1.492945e-15 1.000000e+00 [26,] 6.254665e-16 1.250933e-15 1.000000e+00 [27,] 1.627854e-16 3.255709e-16 1.000000e+00 [28,] 3.405229e-17 6.810459e-17 1.000000e+00 [29,] 6.789053e-18 1.357811e-17 1.000000e+00 [30,] 1.414473e-18 2.828946e-18 1.000000e+00 [31,] 3.263867e-19 6.527734e-19 1.000000e+00 [32,] 9.859429e-20 1.971886e-19 1.000000e+00 [33,] 2.287362e-20 4.574724e-20 1.000000e+00 [34,] 7.113225e-21 1.422645e-20 1.000000e+00 [35,] 2.191291e-21 4.382582e-21 1.000000e+00 [36,] 9.104301e-22 1.820860e-21 1.000000e+00 [37,] 5.903163e-22 1.180633e-21 1.000000e+00 [38,] 3.728050e-22 7.456100e-22 1.000000e+00 [39,] 4.441163e-22 8.882326e-22 1.000000e+00 [40,] 6.199267e-22 1.239853e-21 1.000000e+00 [41,] 5.070958e-21 1.014192e-20 1.000000e+00 [42,] 1.285486e-20 2.570971e-20 1.000000e+00 [43,] 7.096192e-20 1.419238e-19 1.000000e+00 [44,] 2.061760e-18 4.123521e-18 1.000000e+00 [45,] 4.144016e-17 8.288031e-17 1.000000e+00 [46,] 6.783947e-15 1.356789e-14 1.000000e+00 [47,] 4.486679e-14 8.973358e-14 1.000000e+00 [48,] 8.383796e-14 1.676759e-13 1.000000e+00 [49,] 3.077618e-13 6.155235e-13 1.000000e+00 [50,] 1.218555e-12 2.437111e-12 1.000000e+00 [51,] 2.126146e-11 4.252293e-11 1.000000e+00 [52,] 2.205522e-10 4.411045e-10 1.000000e+00 [53,] 9.907492e-10 1.981498e-09 1.000000e+00 [54,] 5.575082e-09 1.115016e-08 1.000000e+00 [55,] 3.066705e-08 6.133410e-08 1.000000e+00 [56,] 2.906375e-07 5.812751e-07 9.999997e-01 [57,] 1.473395e-06 2.946790e-06 9.999985e-01 [58,] 3.453836e-06 6.907673e-06 9.999965e-01 [59,] 4.833698e-06 9.667396e-06 9.999952e-01 [60,] 6.497600e-06 1.299520e-05 9.999935e-01 [61,] 1.147858e-05 2.295716e-05 9.999885e-01 [62,] 1.521701e-05 3.043403e-05 9.999848e-01 [63,] 1.848031e-05 3.696061e-05 9.999815e-01 [64,] 2.589289e-05 5.178578e-05 9.999741e-01 [65,] 3.824304e-05 7.648608e-05 9.999618e-01 [66,] 5.194617e-05 1.038923e-04 9.999481e-01 [67,] 8.281609e-05 1.656322e-04 9.999172e-01 [68,] 1.002919e-04 2.005838e-04 9.998997e-01 [69,] 7.708070e-05 1.541614e-04 9.999229e-01 [70,] 6.338658e-05 1.267732e-04 9.999366e-01 [71,] 5.788108e-05 1.157622e-04 9.999421e-01 [72,] 5.083089e-05 1.016618e-04 9.999492e-01 [73,] 8.076816e-05 1.615363e-04 9.999192e-01 [74,] 1.186230e-04 2.372459e-04 9.998814e-01 [75,] 1.332512e-04 2.665024e-04 9.998667e-01 [76,] 1.432268e-04 2.864536e-04 9.998568e-01 [77,] 2.368501e-04 4.737001e-04 9.997631e-01 [78,] 4.210114e-04 8.420227e-04 9.995790e-01 [79,] 7.653328e-04 1.530666e-03 9.992347e-01 [80,] 1.928665e-03 3.857329e-03 9.980713e-01 [81,] 6.242623e-03 1.248525e-02 9.937574e-01 [82,] 3.081534e-02 6.163068e-02 9.691847e-01 [83,] 6.217538e-02 1.243508e-01 9.378246e-01 [84,] 2.037668e-01 4.075336e-01 7.962332e-01 [85,] 3.745620e-01 7.491240e-01 6.254380e-01 [86,] 6.054309e-01 7.891381e-01 3.945691e-01 [87,] 7.327073e-01 5.345854e-01 2.672927e-01 [88,] 8.737926e-01 2.524147e-01 1.262074e-01 [89,] 9.331145e-01 1.337711e-01 6.688553e-02 [90,] 9.624925e-01 7.501499e-02 3.750749e-02 [91,] 9.992447e-01 1.510549e-03 7.552745e-04 [92,] 9.996192e-01 7.615627e-04 3.807814e-04 [93,] 9.995935e-01 8.130003e-04 4.065002e-04 [94,] 9.996375e-01 7.250644e-04 3.625322e-04 [95,] 9.991312e-01 1.737682e-03 8.688412e-04 [96,] 9.997115e-01 5.769189e-04 2.884594e-04 [97,] 9.999160e-01 1.679150e-04 8.395749e-05 [98,] 9.999126e-01 1.747547e-04 8.737733e-05 [99,] 9.995983e-01 8.033063e-04 4.016532e-04 [100,] 9.994286e-01 1.142898e-03 5.714492e-04 [101,] 9.993753e-01 1.249488e-03 6.247440e-04 [102,] 9.971194e-01 5.761261e-03 2.880631e-03 > postscript(file="/var/www/html/rcomp/tmp/19wz71262197807.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/2c0zm1262197807.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/36ibh1262197807.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/4fe4q1262197807.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/5xvck1262197807.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 = 111 Frequency = 1 1 2 3 4 5 6 -24.0233048 -19.6766200 -21.1712243 -27.0707742 -27.9253820 -27.1455715 7 8 9 10 11 12 -21.5946449 -23.5817097 -23.8096563 -27.0026789 -25.9689599 -24.0958734 13 14 15 16 17 18 -10.6428175 -17.0226023 -24.7081599 -27.2240401 -26.1621352 -25.3012374 19 20 21 22 23 24 -27.5989377 -22.6362063 -21.9809370 -16.8825134 -6.9676199 -7.1752381 25 26 27 28 29 30 0.4930723 0.6190231 -8.3514629 -4.1748719 -0.8665851 6.9641874 31 32 33 34 35 36 3.8725578 -4.7928651 -7.1481661 -10.2224239 -9.8406560 -9.8395956 37 38 39 40 41 42 -14.6030269 -14.4226478 -15.5617844 -18.4543014 -21.6101370 -22.4222800 43 44 45 46 47 48 -17.4188054 -17.8709461 -10.5890908 -14.9716717 -10.5762807 -5.2613240 49 50 51 52 53 54 -5.9253890 2.3590603 -6.3826590 -13.4592667 -8.0745919 -8.3468106 55 56 57 58 59 60 -0.3883992 3.5874888 1.1623310 3.5383159 5.4451307 11.5038417 61 62 63 64 65 66 11.5369812 9.0552387 2.2161562 2.1549335 7.7962293 4.9726030 67 68 69 70 71 72 4.4811205 8.7368955 11.5682376 12.7376065 16.9979475 14.6541034 73 74 75 76 77 78 1.7274696 -6.8932577 -9.7632237 -8.6796460 -17.5286970 -15.4464656 79 80 81 82 83 84 -8.1394303 -7.4028053 -14.0777722 -12.2018443 -9.2244279 -8.5922149 85 86 87 88 89 90 -6.9374654 -5.1156982 12.9696005 8.8502374 19.4022229 22.4795808 91 92 93 94 95 96 33.4971303 35.6052758 48.4048944 64.8061027 75.4663280 53.5866328 97 98 99 100 101 102 43.2153043 37.3680835 22.9423014 11.4573046 14.9944784 20.9611208 103 104 105 106 107 108 29.1037007 24.9238666 27.5221953 36.7235925 32.4027802 32.5272456 109 110 111 25.3938846 27.9504272 28.2130097 > postscript(file="/var/www/html/rcomp/tmp/6ot421262197807.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 = 111 Frequency = 1 lag(myerror, k = 1) myerror 0 -24.0233048 NA 1 -19.6766200 -24.0233048 2 -21.1712243 -19.6766200 3 -27.0707742 -21.1712243 4 -27.9253820 -27.0707742 5 -27.1455715 -27.9253820 6 -21.5946449 -27.1455715 7 -23.5817097 -21.5946449 8 -23.8096563 -23.5817097 9 -27.0026789 -23.8096563 10 -25.9689599 -27.0026789 11 -24.0958734 -25.9689599 12 -10.6428175 -24.0958734 13 -17.0226023 -10.6428175 14 -24.7081599 -17.0226023 15 -27.2240401 -24.7081599 16 -26.1621352 -27.2240401 17 -25.3012374 -26.1621352 18 -27.5989377 -25.3012374 19 -22.6362063 -27.5989377 20 -21.9809370 -22.6362063 21 -16.8825134 -21.9809370 22 -6.9676199 -16.8825134 23 -7.1752381 -6.9676199 24 0.4930723 -7.1752381 25 0.6190231 0.4930723 26 -8.3514629 0.6190231 27 -4.1748719 -8.3514629 28 -0.8665851 -4.1748719 29 6.9641874 -0.8665851 30 3.8725578 6.9641874 31 -4.7928651 3.8725578 32 -7.1481661 -4.7928651 33 -10.2224239 -7.1481661 34 -9.8406560 -10.2224239 35 -9.8395956 -9.8406560 36 -14.6030269 -9.8395956 37 -14.4226478 -14.6030269 38 -15.5617844 -14.4226478 39 -18.4543014 -15.5617844 40 -21.6101370 -18.4543014 41 -22.4222800 -21.6101370 42 -17.4188054 -22.4222800 43 -17.8709461 -17.4188054 44 -10.5890908 -17.8709461 45 -14.9716717 -10.5890908 46 -10.5762807 -14.9716717 47 -5.2613240 -10.5762807 48 -5.9253890 -5.2613240 49 2.3590603 -5.9253890 50 -6.3826590 2.3590603 51 -13.4592667 -6.3826590 52 -8.0745919 -13.4592667 53 -8.3468106 -8.0745919 54 -0.3883992 -8.3468106 55 3.5874888 -0.3883992 56 1.1623310 3.5874888 57 3.5383159 1.1623310 58 5.4451307 3.5383159 59 11.5038417 5.4451307 60 11.5369812 11.5038417 61 9.0552387 11.5369812 62 2.2161562 9.0552387 63 2.1549335 2.2161562 64 7.7962293 2.1549335 65 4.9726030 7.7962293 66 4.4811205 4.9726030 67 8.7368955 4.4811205 68 11.5682376 8.7368955 69 12.7376065 11.5682376 70 16.9979475 12.7376065 71 14.6541034 16.9979475 72 1.7274696 14.6541034 73 -6.8932577 1.7274696 74 -9.7632237 -6.8932577 75 -8.6796460 -9.7632237 76 -17.5286970 -8.6796460 77 -15.4464656 -17.5286970 78 -8.1394303 -15.4464656 79 -7.4028053 -8.1394303 80 -14.0777722 -7.4028053 81 -12.2018443 -14.0777722 82 -9.2244279 -12.2018443 83 -8.5922149 -9.2244279 84 -6.9374654 -8.5922149 85 -5.1156982 -6.9374654 86 12.9696005 -5.1156982 87 8.8502374 12.9696005 88 19.4022229 8.8502374 89 22.4795808 19.4022229 90 33.4971303 22.4795808 91 35.6052758 33.4971303 92 48.4048944 35.6052758 93 64.8061027 48.4048944 94 75.4663280 64.8061027 95 53.5866328 75.4663280 96 43.2153043 53.5866328 97 37.3680835 43.2153043 98 22.9423014 37.3680835 99 11.4573046 22.9423014 100 14.9944784 11.4573046 101 20.9611208 14.9944784 102 29.1037007 20.9611208 103 24.9238666 29.1037007 104 27.5221953 24.9238666 105 36.7235925 27.5221953 106 32.4027802 36.7235925 107 32.5272456 32.4027802 108 25.3938846 32.5272456 109 27.9504272 25.3938846 110 28.2130097 27.9504272 111 NA 28.2130097 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -19.6766200 -24.0233048 [2,] -21.1712243 -19.6766200 [3,] -27.0707742 -21.1712243 [4,] -27.9253820 -27.0707742 [5,] -27.1455715 -27.9253820 [6,] -21.5946449 -27.1455715 [7,] -23.5817097 -21.5946449 [8,] -23.8096563 -23.5817097 [9,] -27.0026789 -23.8096563 [10,] -25.9689599 -27.0026789 [11,] -24.0958734 -25.9689599 [12,] -10.6428175 -24.0958734 [13,] -17.0226023 -10.6428175 [14,] -24.7081599 -17.0226023 [15,] -27.2240401 -24.7081599 [16,] -26.1621352 -27.2240401 [17,] -25.3012374 -26.1621352 [18,] -27.5989377 -25.3012374 [19,] -22.6362063 -27.5989377 [20,] -21.9809370 -22.6362063 [21,] -16.8825134 -21.9809370 [22,] -6.9676199 -16.8825134 [23,] -7.1752381 -6.9676199 [24,] 0.4930723 -7.1752381 [25,] 0.6190231 0.4930723 [26,] -8.3514629 0.6190231 [27,] -4.1748719 -8.3514629 [28,] -0.8665851 -4.1748719 [29,] 6.9641874 -0.8665851 [30,] 3.8725578 6.9641874 [31,] -4.7928651 3.8725578 [32,] -7.1481661 -4.7928651 [33,] -10.2224239 -7.1481661 [34,] -9.8406560 -10.2224239 [35,] -9.8395956 -9.8406560 [36,] -14.6030269 -9.8395956 [37,] -14.4226478 -14.6030269 [38,] -15.5617844 -14.4226478 [39,] -18.4543014 -15.5617844 [40,] -21.6101370 -18.4543014 [41,] -22.4222800 -21.6101370 [42,] -17.4188054 -22.4222800 [43,] -17.8709461 -17.4188054 [44,] -10.5890908 -17.8709461 [45,] -14.9716717 -10.5890908 [46,] -10.5762807 -14.9716717 [47,] -5.2613240 -10.5762807 [48,] -5.9253890 -5.2613240 [49,] 2.3590603 -5.9253890 [50,] -6.3826590 2.3590603 [51,] -13.4592667 -6.3826590 [52,] -8.0745919 -13.4592667 [53,] -8.3468106 -8.0745919 [54,] -0.3883992 -8.3468106 [55,] 3.5874888 -0.3883992 [56,] 1.1623310 3.5874888 [57,] 3.5383159 1.1623310 [58,] 5.4451307 3.5383159 [59,] 11.5038417 5.4451307 [60,] 11.5369812 11.5038417 [61,] 9.0552387 11.5369812 [62,] 2.2161562 9.0552387 [63,] 2.1549335 2.2161562 [64,] 7.7962293 2.1549335 [65,] 4.9726030 7.7962293 [66,] 4.4811205 4.9726030 [67,] 8.7368955 4.4811205 [68,] 11.5682376 8.7368955 [69,] 12.7376065 11.5682376 [70,] 16.9979475 12.7376065 [71,] 14.6541034 16.9979475 [72,] 1.7274696 14.6541034 [73,] -6.8932577 1.7274696 [74,] -9.7632237 -6.8932577 [75,] -8.6796460 -9.7632237 [76,] -17.5286970 -8.6796460 [77,] -15.4464656 -17.5286970 [78,] -8.1394303 -15.4464656 [79,] -7.4028053 -8.1394303 [80,] -14.0777722 -7.4028053 [81,] -12.2018443 -14.0777722 [82,] -9.2244279 -12.2018443 [83,] -8.5922149 -9.2244279 [84,] -6.9374654 -8.5922149 [85,] -5.1156982 -6.9374654 [86,] 12.9696005 -5.1156982 [87,] 8.8502374 12.9696005 [88,] 19.4022229 8.8502374 [89,] 22.4795808 19.4022229 [90,] 33.4971303 22.4795808 [91,] 35.6052758 33.4971303 [92,] 48.4048944 35.6052758 [93,] 64.8061027 48.4048944 [94,] 75.4663280 64.8061027 [95,] 53.5866328 75.4663280 [96,] 43.2153043 53.5866328 [97,] 37.3680835 43.2153043 [98,] 22.9423014 37.3680835 [99,] 11.4573046 22.9423014 [100,] 14.9944784 11.4573046 [101,] 20.9611208 14.9944784 [102,] 29.1037007 20.9611208 [103,] 24.9238666 29.1037007 [104,] 27.5221953 24.9238666 [105,] 36.7235925 27.5221953 [106,] 32.4027802 36.7235925 [107,] 32.5272456 32.4027802 [108,] 25.3938846 32.5272456 [109,] 27.9504272 25.3938846 [110,] 28.2130097 27.9504272 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -19.6766200 -24.0233048 2 -21.1712243 -19.6766200 3 -27.0707742 -21.1712243 4 -27.9253820 -27.0707742 5 -27.1455715 -27.9253820 6 -21.5946449 -27.1455715 7 -23.5817097 -21.5946449 8 -23.8096563 -23.5817097 9 -27.0026789 -23.8096563 10 -25.9689599 -27.0026789 11 -24.0958734 -25.9689599 12 -10.6428175 -24.0958734 13 -17.0226023 -10.6428175 14 -24.7081599 -17.0226023 15 -27.2240401 -24.7081599 16 -26.1621352 -27.2240401 17 -25.3012374 -26.1621352 18 -27.5989377 -25.3012374 19 -22.6362063 -27.5989377 20 -21.9809370 -22.6362063 21 -16.8825134 -21.9809370 22 -6.9676199 -16.8825134 23 -7.1752381 -6.9676199 24 0.4930723 -7.1752381 25 0.6190231 0.4930723 26 -8.3514629 0.6190231 27 -4.1748719 -8.3514629 28 -0.8665851 -4.1748719 29 6.9641874 -0.8665851 30 3.8725578 6.9641874 31 -4.7928651 3.8725578 32 -7.1481661 -4.7928651 33 -10.2224239 -7.1481661 34 -9.8406560 -10.2224239 35 -9.8395956 -9.8406560 36 -14.6030269 -9.8395956 37 -14.4226478 -14.6030269 38 -15.5617844 -14.4226478 39 -18.4543014 -15.5617844 40 -21.6101370 -18.4543014 41 -22.4222800 -21.6101370 42 -17.4188054 -22.4222800 43 -17.8709461 -17.4188054 44 -10.5890908 -17.8709461 45 -14.9716717 -10.5890908 46 -10.5762807 -14.9716717 47 -5.2613240 -10.5762807 48 -5.9253890 -5.2613240 49 2.3590603 -5.9253890 50 -6.3826590 2.3590603 51 -13.4592667 -6.3826590 52 -8.0745919 -13.4592667 53 -8.3468106 -8.0745919 54 -0.3883992 -8.3468106 55 3.5874888 -0.3883992 56 1.1623310 3.5874888 57 3.5383159 1.1623310 58 5.4451307 3.5383159 59 11.5038417 5.4451307 60 11.5369812 11.5038417 61 9.0552387 11.5369812 62 2.2161562 9.0552387 63 2.1549335 2.2161562 64 7.7962293 2.1549335 65 4.9726030 7.7962293 66 4.4811205 4.9726030 67 8.7368955 4.4811205 68 11.5682376 8.7368955 69 12.7376065 11.5682376 70 16.9979475 12.7376065 71 14.6541034 16.9979475 72 1.7274696 14.6541034 73 -6.8932577 1.7274696 74 -9.7632237 -6.8932577 75 -8.6796460 -9.7632237 76 -17.5286970 -8.6796460 77 -15.4464656 -17.5286970 78 -8.1394303 -15.4464656 79 -7.4028053 -8.1394303 80 -14.0777722 -7.4028053 81 -12.2018443 -14.0777722 82 -9.2244279 -12.2018443 83 -8.5922149 -9.2244279 84 -6.9374654 -8.5922149 85 -5.1156982 -6.9374654 86 12.9696005 -5.1156982 87 8.8502374 12.9696005 88 19.4022229 8.8502374 89 22.4795808 19.4022229 90 33.4971303 22.4795808 91 35.6052758 33.4971303 92 48.4048944 35.6052758 93 64.8061027 48.4048944 94 75.4663280 64.8061027 95 53.5866328 75.4663280 96 43.2153043 53.5866328 97 37.3680835 43.2153043 98 22.9423014 37.3680835 99 11.4573046 22.9423014 100 14.9944784 11.4573046 101 20.9611208 14.9944784 102 29.1037007 20.9611208 103 24.9238666 29.1037007 104 27.5221953 24.9238666 105 36.7235925 27.5221953 106 32.4027802 36.7235925 107 32.5272456 32.4027802 108 25.3938846 32.5272456 109 27.9504272 25.3938846 110 28.2130097 27.9504272 > 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/7ts091262197807.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/8fncw1262197807.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/9m1031262197807.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/10iunh1262197807.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/11fex31262197807.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/12tbj71262197807.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/13phn41262197807.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/14erpb1262197807.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/15tqt31262197807.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/163dfb1262197807.tab") + } > > try(system("convert tmp/19wz71262197807.ps tmp/19wz71262197807.png",intern=TRUE)) character(0) > try(system("convert tmp/2c0zm1262197807.ps tmp/2c0zm1262197807.png",intern=TRUE)) character(0) > try(system("convert tmp/36ibh1262197807.ps tmp/36ibh1262197807.png",intern=TRUE)) character(0) > try(system("convert tmp/4fe4q1262197807.ps tmp/4fe4q1262197807.png",intern=TRUE)) character(0) > try(system("convert tmp/5xvck1262197807.ps tmp/5xvck1262197807.png",intern=TRUE)) character(0) > try(system("convert tmp/6ot421262197807.ps tmp/6ot421262197807.png",intern=TRUE)) character(0) > try(system("convert tmp/7ts091262197807.ps tmp/7ts091262197807.png",intern=TRUE)) character(0) > try(system("convert tmp/8fncw1262197807.ps tmp/8fncw1262197807.png",intern=TRUE)) character(0) > try(system("convert tmp/9m1031262197807.ps tmp/9m1031262197807.png",intern=TRUE)) character(0) > try(system("convert tmp/10iunh1262197807.ps tmp/10iunh1262197807.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.172 1.694 5.836