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(631.923 + ,21.454 + ,97.06 + ,130.678 + ,654.294 + ,23.899 + ,97.73 + ,120.877 + ,671.833 + ,24.939 + ,98 + ,137.114 + ,586.840 + ,23.580 + ,97.76 + ,134.406 + ,600.969 + ,24.562 + ,97.48 + ,120.262 + ,625.568 + ,24.696 + ,97.77 + ,130.846 + ,558.110 + ,23.785 + ,97.96 + ,120.343 + ,630.577 + ,23.812 + ,98.22 + ,98.881 + ,628.654 + ,21.917 + ,98.51 + ,115.678 + ,603.184 + ,19.713 + ,98.19 + ,120.796 + ,656.255 + ,19.282 + ,98.37 + ,94.261 + ,600.730 + ,18.788 + ,98.31 + ,89.151 + ,670.326 + ,21.453 + ,98.6 + ,119.880 + ,678.423 + ,24.482 + ,98.96 + ,131.468 + ,641.502 + ,27.474 + ,99.11 + ,155.089 + ,625.311 + ,27.264 + ,99.64 + ,149.581 + ,628.177 + ,27.349 + ,100.02 + ,122.788 + ,589.767 + ,30.632 + ,99.98 + ,143.900 + ,582.471 + ,29.429 + ,100.32 + ,112.115 + ,636.248 + ,30.084 + ,100.44 + ,109.600 + ,599.885 + ,26.290 + ,100.51 + ,117.446 + ,621.694 + ,24.379 + ,101 + ,118.456 + ,637.406 + ,23.335 + ,100.88 + ,101.901 + ,595.994 + ,21.346 + ,100.55 + ,89.940 + ,696.308 + ,21.106 + ,100.82 + ,129.143 + ,674.201 + ,24.514 + ,101.5 + ,126.102 + ,648.861 + ,28.353 + ,102.15 + ,143.048 + ,649.605 + ,30.805 + ,102.39 + ,142.258 + ,672.392 + ,31.348 + ,102.54 + ,131.011 + ,598.396 + ,34.556 + ,102.85 + ,146.471 + ,613.177 + ,33.855 + ,103.47 + ,114.073 + ,638.104 + ,34.787 + ,103.56 + ,114.642 + ,615.632 + ,32.529 + ,103.69 + ,118.226 + ,634.465 + ,29.998 + ,103.49 + ,111.338 + ,638.686 + ,29.257 + ,103.47 + ,108.701 + ,604.243 + ,28.155 + ,103.45 + ,80.512 + ,706.669 + ,30.466 + ,103.48 + ,146.865 + ,677.185 + ,35.704 + ,103.93 + ,137.179 + ,644.328 + ,39.327 + ,103.89 + ,166.536 + ,664.825 + ,39.351 + ,104.4 + ,137.070 + ,605.707 + ,42.234 + ,104.79 + ,127.090 + ,600.136 + ,43.630 + ,104.77 + ,139.966 + ,612.166 + ,43.722 + ,105.13 + ,122.243 + ,599.659 + ,43.121 + ,105.26 + ,109.097 + ,634.210 + ,37.985 + ,104.96 + ,116.591 + ,618.234 + ,37.135 + ,104.75 + ,111.964 + ,613.576 + ,34.646 + ,105.01 + ,109.754 + ,627.200 + ,33.026 + ,105.15 + ,77.609 + ,668.973 + ,35.087 + ,105.2 + ,138.445 + ,651.479 + ,38.846 + ,105.77 + ,127.901 + ,619.661 + ,42.013 + ,105.78 + ,156.615 + ,644.260 + ,43.908 + ,106.26 + ,133.264 + ,579.936 + ,42.868 + ,106.13 + ,143.521 + ,601.752 + ,44.423 + ,106.12 + ,152.139 + ,595.376 + ,44.167 + ,106.57 + ,131.523 + ,588.902 + ,43.636 + ,106.44 + ,113.925 + ,634.341 + ,44.382 + ,106.54 + ,86.495 + ,594.305 + ,42.142 + ,107.1 + ,127.877 + ,606.200 + ,43.452 + ,108.1 + ,107.017 + ,610.926 + ,36.912 + ,108.4 + ,78.716 + ,633.685 + ,42.413 + ,108.84 + ,138.278 + ,639.696 + ,45.344 + ,109.62 + ,144.238 + ,659.451 + ,44.873 + ,110.42 + ,143.679 + ,593.248 + ,47.510 + ,110.67 + ,159.932 + ,606.677 + ,49.554 + ,111.66 + ,136.781 + ,599.434 + ,47.369 + ,112.28 + ,148.173 + ,569.578 + ,45.998 + ,112.87 + ,125.673 + ,629.873 + ,48.140 + ,112.18 + ,105.573 + ,613.438 + ,48.441 + ,112.36 + ,122.405 + ,604.172 + ,44.928 + ,112.16 + ,128.045 + ,658.328 + ,40.454 + ,111.49 + ,94.467 + ,612.633 + ,38.661 + ,111.25 + ,85.573 + ,707.372 + ,37.246 + ,111.36 + ,121.501 + ,739.770 + ,36.843 + ,111.74 + ,125.074 + ,777.535 + ,36.424 + ,111.1 + ,144.979 + ,685.030 + ,37.594 + ,111.33 + ,142.120 + ,730.234 + ,38.144 + ,111.25 + ,124.213 + ,714.154 + ,38.737 + ,111.04 + ,144.407 + ,630.872 + ,34.560 + ,110.97 + ,125.170 + ,719.492 + ,36.080 + ,111.31 + ,109.267 + ,677.023 + ,33.508 + ,111.02 + ,122.354 + ,679.272 + ,35.462 + ,111.07 + ,122.589 + ,718.317 + ,33.374 + ,111.36 + ,104.982 + ,645.672 + ,32.110 + ,111.54 + ,90.542) + ,dim=c(4 + ,84) + ,dimnames=list(c('WERKL' + ,'VAC' + ,'CPI' + ,'INSCHR') + ,1:84)) > y <- array(NA,dim=c(4,84),dimnames=list(c('WERKL','VAC','CPI','INSCHR'),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 = '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 WERKL VAC CPI INSCHR 1 631.923 21.454 97.06 130.678 2 654.294 23.899 97.73 120.877 3 671.833 24.939 98.00 137.114 4 586.840 23.580 97.76 134.406 5 600.969 24.562 97.48 120.262 6 625.568 24.696 97.77 130.846 7 558.110 23.785 97.96 120.343 8 630.577 23.812 98.22 98.881 9 628.654 21.917 98.51 115.678 10 603.184 19.713 98.19 120.796 11 656.255 19.282 98.37 94.261 12 600.730 18.788 98.31 89.151 13 670.326 21.453 98.60 119.880 14 678.423 24.482 98.96 131.468 15 641.502 27.474 99.11 155.089 16 625.311 27.264 99.64 149.581 17 628.177 27.349 100.02 122.788 18 589.767 30.632 99.98 143.900 19 582.471 29.429 100.32 112.115 20 636.248 30.084 100.44 109.600 21 599.885 26.290 100.51 117.446 22 621.694 24.379 101.00 118.456 23 637.406 23.335 100.88 101.901 24 595.994 21.346 100.55 89.940 25 696.308 21.106 100.82 129.143 26 674.201 24.514 101.50 126.102 27 648.861 28.353 102.15 143.048 28 649.605 30.805 102.39 142.258 29 672.392 31.348 102.54 131.011 30 598.396 34.556 102.85 146.471 31 613.177 33.855 103.47 114.073 32 638.104 34.787 103.56 114.642 33 615.632 32.529 103.69 118.226 34 634.465 29.998 103.49 111.338 35 638.686 29.257 103.47 108.701 36 604.243 28.155 103.45 80.512 37 706.669 30.466 103.48 146.865 38 677.185 35.704 103.93 137.179 39 644.328 39.327 103.89 166.536 40 664.825 39.351 104.40 137.070 41 605.707 42.234 104.79 127.090 42 600.136 43.630 104.77 139.966 43 612.166 43.722 105.13 122.243 44 599.659 43.121 105.26 109.097 45 634.210 37.985 104.96 116.591 46 618.234 37.135 104.75 111.964 47 613.576 34.646 105.01 109.754 48 627.200 33.026 105.15 77.609 49 668.973 35.087 105.20 138.445 50 651.479 38.846 105.77 127.901 51 619.661 42.013 105.78 156.615 52 644.260 43.908 106.26 133.264 53 579.936 42.868 106.13 143.521 54 601.752 44.423 106.12 152.139 55 595.376 44.167 106.57 131.523 56 588.902 43.636 106.44 113.925 57 634.341 44.382 106.54 86.495 58 594.305 42.142 107.10 127.877 59 606.200 43.452 108.10 107.017 60 610.926 36.912 108.40 78.716 61 633.685 42.413 108.84 138.278 62 639.696 45.344 109.62 144.238 63 659.451 44.873 110.42 143.679 64 593.248 47.510 110.67 159.932 65 606.677 49.554 111.66 136.781 66 599.434 47.369 112.28 148.173 67 569.578 45.998 112.87 125.673 68 629.873 48.140 112.18 105.573 69 613.438 48.441 112.36 122.405 70 604.172 44.928 112.16 128.045 71 658.328 40.454 111.49 94.467 72 612.633 38.661 111.25 85.573 73 707.372 37.246 111.36 121.501 74 739.770 36.843 111.74 125.074 75 777.535 36.424 111.10 144.979 76 685.030 37.594 111.33 142.120 77 730.234 38.144 111.25 124.213 78 714.154 38.737 111.04 144.407 79 630.872 34.560 110.97 125.170 80 719.492 36.080 111.31 109.267 81 677.023 33.508 111.02 122.354 82 679.272 35.462 111.07 122.589 83 718.317 33.374 111.36 104.982 84 645.672 32.110 111.54 90.542 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) VAC CPI INSCHR -229.9598 -5.1149 9.0872 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 . VAC -5.1149 0.7607 -6.724 2.40e-09 *** CPI 9.0872 1.2724 7.142 3.79e-10 *** INSCHR 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/rcomp/tmp/13y8j1292760492.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/rcomp/tmp/2ep741292760492.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/rcomp/tmp/3ep741292760492.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/rcomp/tmp/4ep741292760492.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/rcomp/tmp/5pgop1292760492.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/rcomp/tmp/6pgop1292760492.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/rcomp/tmp/7hq5a1292760492.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/rcomp/tmp/8hq5a1292760492.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/rcomp/tmp/9shnv1292760492.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/rcomp/tmp/10shnv1292760492.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/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/11wz311292760492.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/12zi2p1292760492.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/13dszg1292760492.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/14ysg31292760492.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/152bwr1292760492.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/165tdf1292760492.tab") + } > > try(system("convert tmp/13y8j1292760492.ps tmp/13y8j1292760492.png",intern=TRUE)) character(0) > try(system("convert tmp/2ep741292760492.ps tmp/2ep741292760492.png",intern=TRUE)) character(0) > try(system("convert tmp/3ep741292760492.ps tmp/3ep741292760492.png",intern=TRUE)) character(0) > try(system("convert tmp/4ep741292760492.ps tmp/4ep741292760492.png",intern=TRUE)) character(0) > try(system("convert tmp/5pgop1292760492.ps tmp/5pgop1292760492.png",intern=TRUE)) character(0) > try(system("convert tmp/6pgop1292760492.ps tmp/6pgop1292760492.png",intern=TRUE)) character(0) > try(system("convert tmp/7hq5a1292760492.ps tmp/7hq5a1292760492.png",intern=TRUE)) character(0) > try(system("convert tmp/8hq5a1292760492.ps tmp/8hq5a1292760492.png",intern=TRUE)) character(0) > try(system("convert tmp/9shnv1292760492.ps tmp/9shnv1292760492.png",intern=TRUE)) character(0) > try(system("convert tmp/10shnv1292760492.ps tmp/10shnv1292760492.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.869 1.677 6.451