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. Natural language support but running in an English locale 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(97.06 + ,21.454 + ,631.923 + ,130.678 + ,97.73 + ,23.899 + ,654.294 + ,120.877 + ,98 + ,24.939 + ,671.833 + ,137.114 + ,97.76 + ,23.580 + ,586.840 + ,134.406 + ,97.48 + ,24.562 + ,600.969 + ,120.262 + ,97.77 + ,24.696 + ,625.568 + ,130.846 + ,97.96 + ,23.785 + ,558.110 + ,120.343 + ,98.22 + ,23.812 + ,630.577 + ,98.881 + ,98.51 + ,21.917 + ,628.654 + ,115.678 + ,98.19 + ,19.713 + ,603.184 + ,120.796 + ,98.37 + ,19.282 + ,656.255 + ,94.261 + ,98.31 + ,18.788 + ,600.730 + ,89.151 + ,98.6 + ,21.453 + ,670.326 + ,119.880 + ,98.96 + ,24.482 + ,678.423 + ,131.468 + ,99.11 + ,27.474 + ,641.502 + ,155.089 + ,99.64 + ,27.264 + ,625.311 + ,149.581 + ,100.02 + ,27.349 + ,628.177 + ,122.788 + ,99.98 + ,30.632 + ,589.767 + ,143.900 + ,100.32 + ,29.429 + ,582.471 + ,112.115 + ,100.44 + ,30.084 + ,636.248 + ,109.600 + ,100.51 + ,26.290 + ,599.885 + ,117.446 + ,101 + ,24.379 + ,621.694 + ,118.456 + ,100.88 + ,23.335 + ,637.406 + ,101.901 + ,100.55 + ,21.346 + ,595.994 + ,89.940 + ,100.82 + ,21.106 + ,696.308 + ,129.143 + ,101.5 + ,24.514 + ,674.201 + ,126.102 + ,102.15 + ,28.353 + ,648.861 + ,143.048 + ,102.39 + ,30.805 + ,649.605 + ,142.258 + ,102.54 + ,31.348 + ,672.392 + ,131.011 + ,102.85 + ,34.556 + ,598.396 + ,146.471 + ,103.47 + ,33.855 + ,613.177 + ,114.073 + ,103.56 + ,34.787 + ,638.104 + ,114.642 + ,103.69 + ,32.529 + ,615.632 + ,118.226 + ,103.49 + ,29.998 + ,634.465 + ,111.338 + ,103.47 + ,29.257 + ,638.686 + ,108.701 + ,103.45 + ,28.155 + ,604.243 + ,80.512 + ,103.48 + ,30.466 + ,706.669 + ,146.865 + ,103.93 + ,35.704 + ,677.185 + ,137.179 + ,103.89 + ,39.327 + ,644.328 + ,166.536 + ,104.4 + ,39.351 + ,664.825 + ,137.070 + ,104.79 + ,42.234 + ,605.707 + ,127.090 + ,104.77 + ,43.630 + ,600.136 + ,139.966 + ,105.13 + ,43.722 + ,612.166 + ,122.243 + ,105.26 + ,43.121 + ,599.659 + ,109.097 + ,104.96 + ,37.985 + ,634.210 + ,116.591 + ,104.75 + ,37.135 + ,618.234 + ,111.964 + ,105.01 + ,34.646 + ,613.576 + ,109.754 + ,105.15 + ,33.026 + ,627.200 + ,77.609 + ,105.2 + ,35.087 + ,668.973 + ,138.445 + ,105.77 + ,38.846 + ,651.479 + ,127.901 + ,105.78 + ,42.013 + ,619.661 + ,156.615 + ,106.26 + ,43.908 + ,644.260 + ,133.264 + ,106.13 + ,42.868 + ,579.936 + ,143.521 + ,106.12 + ,44.423 + ,601.752 + ,152.139 + ,106.57 + ,44.167 + ,595.376 + ,131.523 + ,106.44 + ,43.636 + ,588.902 + ,113.925 + ,106.54 + ,44.382 + ,634.341 + ,86.495 + ,107.1 + ,42.142 + ,594.305 + ,127.877 + ,108.1 + ,43.452 + ,606.200 + ,107.017 + ,108.4 + ,36.912 + ,610.926 + ,78.716 + ,108.84 + ,42.413 + ,633.685 + ,138.278 + ,109.62 + ,45.344 + ,639.696 + ,144.238 + ,110.42 + ,44.873 + ,659.451 + ,143.679 + ,110.67 + ,47.510 + ,593.248 + ,159.932 + ,111.66 + ,49.554 + ,606.677 + ,136.781 + ,112.28 + ,47.369 + ,599.434 + ,148.173 + ,112.87 + ,45.998 + ,569.578 + ,125.673 + ,112.18 + ,48.140 + ,629.873 + ,105.573 + ,112.36 + ,48.441 + ,613.438 + ,122.405 + ,112.16 + ,44.928 + ,604.172 + ,128.045 + ,111.49 + ,40.454 + ,658.328 + ,94.467 + ,111.25 + ,38.661 + ,612.633 + ,85.573 + ,111.36 + ,37.246 + ,707.372 + ,121.501 + ,111.74 + ,36.843 + ,739.770 + ,125.074 + ,111.1 + ,36.424 + ,777.535 + ,144.979 + ,111.33 + ,37.594 + ,685.030 + ,142.120 + ,111.25 + ,38.144 + ,730.234 + ,124.213 + ,111.04 + ,38.737 + ,714.154 + ,144.407 + ,110.97 + ,34.560 + ,630.872 + ,125.170 + ,111.31 + ,36.080 + ,719.492 + ,109.267 + ,111.02 + ,33.508 + ,677.023 + ,122.354 + ,111.07 + ,35.462 + ,679.272 + ,122.589 + ,111.36 + ,33.374 + ,718.317 + ,104.982 + ,111.54 + ,32.110 + ,645.672 + ,90.542) + ,dim=c(4 + ,84) + ,dimnames=list(c('CPI' + ,'vacatures' + ,'werklozen' + ,'inschrijvingen') + ,1:84)) > y <- array(NA,dim=c(4,84),dimnames=list(c('CPI','vacatures','werklozen','inschrijvingen'),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 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '3' > 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 werklozen CPI vacatures inschrijvingen 1 631.923 97.06 21.454 130.678 2 654.294 97.73 23.899 120.877 3 671.833 98.00 24.939 137.114 4 586.840 97.76 23.580 134.406 5 600.969 97.48 24.562 120.262 6 625.568 97.77 24.696 130.846 7 558.110 97.96 23.785 120.343 8 630.577 98.22 23.812 98.881 9 628.654 98.51 21.917 115.678 10 603.184 98.19 19.713 120.796 11 656.255 98.37 19.282 94.261 12 600.730 98.31 18.788 89.151 13 670.326 98.60 21.453 119.880 14 678.423 98.96 24.482 131.468 15 641.502 99.11 27.474 155.089 16 625.311 99.64 27.264 149.581 17 628.177 100.02 27.349 122.788 18 589.767 99.98 30.632 143.900 19 582.471 100.32 29.429 112.115 20 636.248 100.44 30.084 109.600 21 599.885 100.51 26.290 117.446 22 621.694 101.00 24.379 118.456 23 637.406 100.88 23.335 101.901 24 595.994 100.55 21.346 89.940 25 696.308 100.82 21.106 129.143 26 674.201 101.50 24.514 126.102 27 648.861 102.15 28.353 143.048 28 649.605 102.39 30.805 142.258 29 672.392 102.54 31.348 131.011 30 598.396 102.85 34.556 146.471 31 613.177 103.47 33.855 114.073 32 638.104 103.56 34.787 114.642 33 615.632 103.69 32.529 118.226 34 634.465 103.49 29.998 111.338 35 638.686 103.47 29.257 108.701 36 604.243 103.45 28.155 80.512 37 706.669 103.48 30.466 146.865 38 677.185 103.93 35.704 137.179 39 644.328 103.89 39.327 166.536 40 664.825 104.40 39.351 137.070 41 605.707 104.79 42.234 127.090 42 600.136 104.77 43.630 139.966 43 612.166 105.13 43.722 122.243 44 599.659 105.26 43.121 109.097 45 634.210 104.96 37.985 116.591 46 618.234 104.75 37.135 111.964 47 613.576 105.01 34.646 109.754 48 627.200 105.15 33.026 77.609 49 668.973 105.20 35.087 138.445 50 651.479 105.77 38.846 127.901 51 619.661 105.78 42.013 156.615 52 644.260 106.26 43.908 133.264 53 579.936 106.13 42.868 143.521 54 601.752 106.12 44.423 152.139 55 595.376 106.57 44.167 131.523 56 588.902 106.44 43.636 113.925 57 634.341 106.54 44.382 86.495 58 594.305 107.10 42.142 127.877 59 606.200 108.10 43.452 107.017 60 610.926 108.40 36.912 78.716 61 633.685 108.84 42.413 138.278 62 639.696 109.62 45.344 144.238 63 659.451 110.42 44.873 143.679 64 593.248 110.67 47.510 159.932 65 606.677 111.66 49.554 136.781 66 599.434 112.28 47.369 148.173 67 569.578 112.87 45.998 125.673 68 629.873 112.18 48.140 105.573 69 613.438 112.36 48.441 122.405 70 604.172 112.16 44.928 128.045 71 658.328 111.49 40.454 94.467 72 612.633 111.25 38.661 85.573 73 707.372 111.36 37.246 121.501 74 739.770 111.74 36.843 125.074 75 777.535 111.10 36.424 144.979 76 685.030 111.33 37.594 142.120 77 730.234 111.25 38.144 124.213 78 714.154 111.04 38.737 144.407 79 630.872 110.97 34.560 125.170 80 719.492 111.31 36.080 109.267 81 677.023 111.02 33.508 122.354 82 679.272 111.07 35.462 122.589 83 718.317 111.36 33.374 104.982 84 645.672 111.54 32.110 90.542 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) CPI vacatures inschrijvingen -229.9598 9.0872 -5.1149 0.7179 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -81.0798 -18.6587 -0.6429 23.0928 80.1316 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -229.9598 121.5184 -1.892 0.062057 . CPI 9.0872 1.2724 7.142 3.79e-10 *** vacatures -5.1149 0.7607 -6.724 2.40e-09 *** inschrijvingen 0.7179 0.1958 3.667 0.000441 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 32.59 on 80 degrees of freedom Multiple R-squared: 0.4087, Adjusted R-squared: 0.3865 F-statistic: 18.43 on 3 and 80 DF, p-value: 3.49e-09 > 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,] 0.904101303 0.191797394 0.09589870 [2,] 0.922829974 0.154340053 0.07717003 [3,] 0.868359188 0.263281624 0.13164081 [4,] 0.814819350 0.370361299 0.18518065 [5,] 0.810493892 0.379012217 0.18950611 [6,] 0.773785114 0.452429772 0.22621489 [7,] 0.769336017 0.461327967 0.23066398 [8,] 0.717578307 0.564843387 0.28242169 [9,] 0.687440323 0.625119354 0.31255968 [10,] 0.680879657 0.638240687 0.31912034 [11,] 0.615069789 0.769860423 0.38493021 [12,] 0.644545948 0.710908104 0.35545405 [13,] 0.612089565 0.775820871 0.38791044 [14,] 0.599551084 0.800897831 0.40044892 [15,] 0.587755751 0.824488498 0.41224425 [16,] 0.539504058 0.920991885 0.46049594 [17,] 0.474302601 0.948605202 0.52569740 [18,] 0.513389696 0.973220608 0.48661030 [19,] 0.536119016 0.927761967 0.46388098 [20,] 0.491258769 0.982517538 0.50874123 [21,] 0.434062292 0.868124583 0.56593771 [22,] 0.372557659 0.745115317 0.62744234 [23,] 0.375690093 0.751380186 0.62430991 [24,] 0.417403452 0.834806904 0.58259655 [25,] 0.361276028 0.722552057 0.63872397 [26,] 0.325588647 0.651177294 0.67441135 [27,] 0.297272835 0.594545671 0.70272716 [28,] 0.255506891 0.511013782 0.74449311 [29,] 0.219608397 0.439216794 0.78039160 [30,] 0.236294082 0.472588164 0.76370592 [31,] 0.246421912 0.492843825 0.75357809 [32,] 0.257407990 0.514815980 0.74259201 [33,] 0.207720317 0.415440634 0.79227968 [34,] 0.222347612 0.444695224 0.77765239 [35,] 0.177498715 0.354997430 0.82250129 [36,] 0.142643595 0.285287189 0.85735641 [37,] 0.116576941 0.233153883 0.88342306 [38,] 0.089714305 0.179428610 0.91028569 [39,] 0.067947163 0.135894327 0.93205284 [40,] 0.049479032 0.098958064 0.95052097 [41,] 0.044950775 0.089901549 0.95504923 [42,] 0.034184431 0.068368862 0.96581557 [43,] 0.023755833 0.047511667 0.97624417 [44,] 0.016967738 0.033935477 0.98303226 [45,] 0.014266423 0.028532846 0.98573358 [46,] 0.013659163 0.027318326 0.98634084 [47,] 0.023185501 0.046371002 0.97681450 [48,] 0.019463318 0.038926635 0.98053668 [49,] 0.015159241 0.030318481 0.98484076 [50,] 0.011017765 0.022035530 0.98898224 [51,] 0.026943985 0.053887970 0.97305602 [52,] 0.026138578 0.052277157 0.97386142 [53,] 0.017852233 0.035704466 0.98214777 [54,] 0.013389899 0.026779798 0.98661010 [55,] 0.009889800 0.019779600 0.99011020 [56,] 0.006145934 0.012291867 0.99385407 [57,] 0.003804358 0.007608716 0.99619564 [58,] 0.011735446 0.023470892 0.98826455 [59,] 0.009227231 0.018454463 0.99077277 [60,] 0.011979538 0.023959075 0.98802046 [61,] 0.027109898 0.054219796 0.97289010 [62,] 0.020970145 0.041940289 0.97902986 [63,] 0.012790933 0.025581866 0.98720907 [64,] 0.130602667 0.261205335 0.86939733 [65,] 0.095670033 0.191340066 0.90432997 [66,] 0.094096698 0.188193396 0.90590330 [67,] 0.075180258 0.150360516 0.92481974 [68,] 0.062633204 0.125266408 0.93736680 [69,] 0.472613381 0.945226762 0.52738662 [70,] 0.383224403 0.766448806 0.61677560 [71,] 0.257224855 0.514449710 0.74277515 > postscript(file="/var/www/html/freestat/rcomp/tmp/1inyf1292698687.ps",horizontal=F,onefile=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/2inyf1292698687.ps",horizontal=F,onefile=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/3inyf1292698687.ps",horizontal=F,onefile=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/4bwf01292698687.ps",horizontal=F,onefile=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/5bwf01292698687.ps",horizontal=F,onefile=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 -4.199515611 31.625202951 40.373489835 -47.445636307 -15.595309564 6 7 8 9 10 -0.544531968 -66.848586363 18.801578495 -7.508130087 -45.017713763 11 12 13 14 15 23.262748376 -30.575271860 27.956062948 39.955585617 0.017585319 16 17 18 19 20 -18.109518893 0.973012412 -35.437756656 -29.157930895 28.684401532 21 22 23 24 25 -33.353324628 -26.496702930 -3.149233276 -43.149098978 25.339654468 26 27 28 29 30 16.668092101 -7.108152198 4.563797277 36.839414304 -34.663874988 31 32 33 34 35 -5.843706627 22.624041128 -15.151712233 -2.502131961 0.003595199 36 37 38 39 40 -19.657181653 46.681410073 46.853659058 11.815807248 48.954962042 41 42 43 44 45 8.203924207 0.711286865 22.663944705 15.339169522 20.966214947 46 47 48 49 50 5.872620413 -12.292452506 14.850345788 23.036165396 27.158983246 51 52 53 54 55 -9.165006644 37.528731895 -38.297004382 -14.623394582 -11.597661508 56 57 58 59 60 -6.972600083 61.065598574 -25.225048105 -0.741170898 -11.875254114 61 62 63 64 65 -7.737577762 1.898448976 12.375890827 -54.279074099 -22.771264197 66 67 68 69 70 -55.002775282 -81.079821385 10.871391413 -17.743538684 -47.209733389 71 72 73 74 75 14.256533439 -32.043481964 28.665364832 52.983845401 80.131555023 76 77 78 79 80 -6.426571147 55.173168153 29.537186882 -60.663247981 44.058635179 81 82 83 84 -18.325851703 -6.705410238 31.664597602 -38.714741573 > postscript(file="/var/www/html/freestat/rcomp/tmp/6bwf01292698687.ps",horizontal=F,onefile=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 -4.199515611 NA 1 31.625202951 -4.199515611 2 40.373489835 31.625202951 3 -47.445636307 40.373489835 4 -15.595309564 -47.445636307 5 -0.544531968 -15.595309564 6 -66.848586363 -0.544531968 7 18.801578495 -66.848586363 8 -7.508130087 18.801578495 9 -45.017713763 -7.508130087 10 23.262748376 -45.017713763 11 -30.575271860 23.262748376 12 27.956062948 -30.575271860 13 39.955585617 27.956062948 14 0.017585319 39.955585617 15 -18.109518893 0.017585319 16 0.973012412 -18.109518893 17 -35.437756656 0.973012412 18 -29.157930895 -35.437756656 19 28.684401532 -29.157930895 20 -33.353324628 28.684401532 21 -26.496702930 -33.353324628 22 -3.149233276 -26.496702930 23 -43.149098978 -3.149233276 24 25.339654468 -43.149098978 25 16.668092101 25.339654468 26 -7.108152198 16.668092101 27 4.563797277 -7.108152198 28 36.839414304 4.563797277 29 -34.663874988 36.839414304 30 -5.843706627 -34.663874988 31 22.624041128 -5.843706627 32 -15.151712233 22.624041128 33 -2.502131961 -15.151712233 34 0.003595199 -2.502131961 35 -19.657181653 0.003595199 36 46.681410073 -19.657181653 37 46.853659058 46.681410073 38 11.815807248 46.853659058 39 48.954962042 11.815807248 40 8.203924207 48.954962042 41 0.711286865 8.203924207 42 22.663944705 0.711286865 43 15.339169522 22.663944705 44 20.966214947 15.339169522 45 5.872620413 20.966214947 46 -12.292452506 5.872620413 47 14.850345788 -12.292452506 48 23.036165396 14.850345788 49 27.158983246 23.036165396 50 -9.165006644 27.158983246 51 37.528731895 -9.165006644 52 -38.297004382 37.528731895 53 -14.623394582 -38.297004382 54 -11.597661508 -14.623394582 55 -6.972600083 -11.597661508 56 61.065598574 -6.972600083 57 -25.225048105 61.065598574 58 -0.741170898 -25.225048105 59 -11.875254114 -0.741170898 60 -7.737577762 -11.875254114 61 1.898448976 -7.737577762 62 12.375890827 1.898448976 63 -54.279074099 12.375890827 64 -22.771264197 -54.279074099 65 -55.002775282 -22.771264197 66 -81.079821385 -55.002775282 67 10.871391413 -81.079821385 68 -17.743538684 10.871391413 69 -47.209733389 -17.743538684 70 14.256533439 -47.209733389 71 -32.043481964 14.256533439 72 28.665364832 -32.043481964 73 52.983845401 28.665364832 74 80.131555023 52.983845401 75 -6.426571147 80.131555023 76 55.173168153 -6.426571147 77 29.537186882 55.173168153 78 -60.663247981 29.537186882 79 44.058635179 -60.663247981 80 -18.325851703 44.058635179 81 -6.705410238 -18.325851703 82 31.664597602 -6.705410238 83 -38.714741573 31.664597602 84 NA -38.714741573 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 31.625202951 -4.199515611 [2,] 40.373489835 31.625202951 [3,] -47.445636307 40.373489835 [4,] -15.595309564 -47.445636307 [5,] -0.544531968 -15.595309564 [6,] -66.848586363 -0.544531968 [7,] 18.801578495 -66.848586363 [8,] -7.508130087 18.801578495 [9,] -45.017713763 -7.508130087 [10,] 23.262748376 -45.017713763 [11,] -30.575271860 23.262748376 [12,] 27.956062948 -30.575271860 [13,] 39.955585617 27.956062948 [14,] 0.017585319 39.955585617 [15,] -18.109518893 0.017585319 [16,] 0.973012412 -18.109518893 [17,] -35.437756656 0.973012412 [18,] -29.157930895 -35.437756656 [19,] 28.684401532 -29.157930895 [20,] -33.353324628 28.684401532 [21,] -26.496702930 -33.353324628 [22,] -3.149233276 -26.496702930 [23,] -43.149098978 -3.149233276 [24,] 25.339654468 -43.149098978 [25,] 16.668092101 25.339654468 [26,] -7.108152198 16.668092101 [27,] 4.563797277 -7.108152198 [28,] 36.839414304 4.563797277 [29,] -34.663874988 36.839414304 [30,] -5.843706627 -34.663874988 [31,] 22.624041128 -5.843706627 [32,] -15.151712233 22.624041128 [33,] -2.502131961 -15.151712233 [34,] 0.003595199 -2.502131961 [35,] -19.657181653 0.003595199 [36,] 46.681410073 -19.657181653 [37,] 46.853659058 46.681410073 [38,] 11.815807248 46.853659058 [39,] 48.954962042 11.815807248 [40,] 8.203924207 48.954962042 [41,] 0.711286865 8.203924207 [42,] 22.663944705 0.711286865 [43,] 15.339169522 22.663944705 [44,] 20.966214947 15.339169522 [45,] 5.872620413 20.966214947 [46,] -12.292452506 5.872620413 [47,] 14.850345788 -12.292452506 [48,] 23.036165396 14.850345788 [49,] 27.158983246 23.036165396 [50,] -9.165006644 27.158983246 [51,] 37.528731895 -9.165006644 [52,] -38.297004382 37.528731895 [53,] -14.623394582 -38.297004382 [54,] -11.597661508 -14.623394582 [55,] -6.972600083 -11.597661508 [56,] 61.065598574 -6.972600083 [57,] -25.225048105 61.065598574 [58,] -0.741170898 -25.225048105 [59,] -11.875254114 -0.741170898 [60,] -7.737577762 -11.875254114 [61,] 1.898448976 -7.737577762 [62,] 12.375890827 1.898448976 [63,] -54.279074099 12.375890827 [64,] -22.771264197 -54.279074099 [65,] -55.002775282 -22.771264197 [66,] -81.079821385 -55.002775282 [67,] 10.871391413 -81.079821385 [68,] -17.743538684 10.871391413 [69,] -47.209733389 -17.743538684 [70,] 14.256533439 -47.209733389 [71,] -32.043481964 14.256533439 [72,] 28.665364832 -32.043481964 [73,] 52.983845401 28.665364832 [74,] 80.131555023 52.983845401 [75,] -6.426571147 80.131555023 [76,] 55.173168153 -6.426571147 [77,] 29.537186882 55.173168153 [78,] -60.663247981 29.537186882 [79,] 44.058635179 -60.663247981 [80,] -18.325851703 44.058635179 [81,] -6.705410238 -18.325851703 [82,] 31.664597602 -6.705410238 [83,] -38.714741573 31.664597602 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 31.625202951 -4.199515611 2 40.373489835 31.625202951 3 -47.445636307 40.373489835 4 -15.595309564 -47.445636307 5 -0.544531968 -15.595309564 6 -66.848586363 -0.544531968 7 18.801578495 -66.848586363 8 -7.508130087 18.801578495 9 -45.017713763 -7.508130087 10 23.262748376 -45.017713763 11 -30.575271860 23.262748376 12 27.956062948 -30.575271860 13 39.955585617 27.956062948 14 0.017585319 39.955585617 15 -18.109518893 0.017585319 16 0.973012412 -18.109518893 17 -35.437756656 0.973012412 18 -29.157930895 -35.437756656 19 28.684401532 -29.157930895 20 -33.353324628 28.684401532 21 -26.496702930 -33.353324628 22 -3.149233276 -26.496702930 23 -43.149098978 -3.149233276 24 25.339654468 -43.149098978 25 16.668092101 25.339654468 26 -7.108152198 16.668092101 27 4.563797277 -7.108152198 28 36.839414304 4.563797277 29 -34.663874988 36.839414304 30 -5.843706627 -34.663874988 31 22.624041128 -5.843706627 32 -15.151712233 22.624041128 33 -2.502131961 -15.151712233 34 0.003595199 -2.502131961 35 -19.657181653 0.003595199 36 46.681410073 -19.657181653 37 46.853659058 46.681410073 38 11.815807248 46.853659058 39 48.954962042 11.815807248 40 8.203924207 48.954962042 41 0.711286865 8.203924207 42 22.663944705 0.711286865 43 15.339169522 22.663944705 44 20.966214947 15.339169522 45 5.872620413 20.966214947 46 -12.292452506 5.872620413 47 14.850345788 -12.292452506 48 23.036165396 14.850345788 49 27.158983246 23.036165396 50 -9.165006644 27.158983246 51 37.528731895 -9.165006644 52 -38.297004382 37.528731895 53 -14.623394582 -38.297004382 54 -11.597661508 -14.623394582 55 -6.972600083 -11.597661508 56 61.065598574 -6.972600083 57 -25.225048105 61.065598574 58 -0.741170898 -25.225048105 59 -11.875254114 -0.741170898 60 -7.737577762 -11.875254114 61 1.898448976 -7.737577762 62 12.375890827 1.898448976 63 -54.279074099 12.375890827 64 -22.771264197 -54.279074099 65 -55.002775282 -22.771264197 66 -81.079821385 -55.002775282 67 10.871391413 -81.079821385 68 -17.743538684 10.871391413 69 -47.209733389 -17.743538684 70 14.256533439 -47.209733389 71 -32.043481964 14.256533439 72 28.665364832 -32.043481964 73 52.983845401 28.665364832 74 80.131555023 52.983845401 75 -6.426571147 80.131555023 76 55.173168153 -6.426571147 77 29.537186882 55.173168153 78 -60.663247981 29.537186882 79 44.058635179 -60.663247981 80 -18.325851703 44.058635179 81 -6.705410238 -18.325851703 82 31.664597602 -6.705410238 83 -38.714741573 31.664597602 > 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/74oxl1292698687.ps",horizontal=F,onefile=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/8wfwo1292698687.ps",horizontal=F,onefile=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/9wfwo1292698687.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/10wfwo1292698687.ps",horizontal=F,onefile=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/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/110xuc1292698687.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/123gbi1292698687.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/13szqt1292698687.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/1438pw1292698687.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/freestat/rcomp/tmp/15o96k1292698687.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/freestat/rcomp/tmp/16203t1292698687.tab") + } > > try(system("convert tmp/1inyf1292698687.ps tmp/1inyf1292698687.png",intern=TRUE)) character(0) > try(system("convert tmp/2inyf1292698687.ps tmp/2inyf1292698687.png",intern=TRUE)) character(0) > try(system("convert tmp/3inyf1292698687.ps tmp/3inyf1292698687.png",intern=TRUE)) character(0) > try(system("convert tmp/4bwf01292698687.ps tmp/4bwf01292698687.png",intern=TRUE)) character(0) > try(system("convert tmp/5bwf01292698687.ps tmp/5bwf01292698687.png",intern=TRUE)) character(0) > try(system("convert tmp/6bwf01292698687.ps tmp/6bwf01292698687.png",intern=TRUE)) character(0) > try(system("convert tmp/74oxl1292698687.ps tmp/74oxl1292698687.png",intern=TRUE)) character(0) > try(system("convert tmp/8wfwo1292698687.ps tmp/8wfwo1292698687.png",intern=TRUE)) character(0) > try(system("convert tmp/9wfwo1292698687.ps tmp/9wfwo1292698687.png",intern=TRUE)) character(0) > try(system("convert tmp/10wfwo1292698687.ps tmp/10wfwo1292698687.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.194 2.503 4.677