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(6539,2605,6699,2682,6962,2755,6981,2760,7024,2735,6940,2659,6774,2654,6671,2670,6965,2785,6969,2845,6822,2723,6878,2746,6691,2767,6837,2940,7018,2977,7167,2993,7076,2892,7171,2824,7093,2771,6971,2686,7142,2738,7047,2723,6999,2731,6650,2632,6475,2606,6437,2605,6639,2646,6422,2627,6272,2535,6232,2456,6003,2404,5673,2319,6050,2519,5977,2504,5796,2382,5752,2394,5609,2381,5839,2501,6069,2532,6006,2515,5809,2429,5797,2389,5502,2261,5568,2272,5864,2439,5764,2373,5615,2327,5615,2364,5681,2388,5915,2553,6334,2663,6494,2694,6620,2679,6578,2611,6495,2580,6538,2627,6737,2732,6651,2707,6530,2633,6563,2683),dim=c(2,60),dimnames=list(c('Voeding-Mannen','Landbouw-Mannen'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Voeding-Mannen','Landbouw-Mannen'),1:60)) > 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 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Voeding-Mannen Landbouw-Mannen M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 6539 2605 1 0 0 0 0 0 0 0 0 0 0 2 6699 2682 0 1 0 0 0 0 0 0 0 0 0 3 6962 2755 0 0 1 0 0 0 0 0 0 0 0 4 6981 2760 0 0 0 1 0 0 0 0 0 0 0 5 7024 2735 0 0 0 0 1 0 0 0 0 0 0 6 6940 2659 0 0 0 0 0 1 0 0 0 0 0 7 6774 2654 0 0 0 0 0 0 1 0 0 0 0 8 6671 2670 0 0 0 0 0 0 0 1 0 0 0 9 6965 2785 0 0 0 0 0 0 0 0 1 0 0 10 6969 2845 0 0 0 0 0 0 0 0 0 1 0 11 6822 2723 0 0 0 0 0 0 0 0 0 0 1 12 6878 2746 0 0 0 0 0 0 0 0 0 0 0 13 6691 2767 1 0 0 0 0 0 0 0 0 0 0 14 6837 2940 0 1 0 0 0 0 0 0 0 0 0 15 7018 2977 0 0 1 0 0 0 0 0 0 0 0 16 7167 2993 0 0 0 1 0 0 0 0 0 0 0 17 7076 2892 0 0 0 0 1 0 0 0 0 0 0 18 7171 2824 0 0 0 0 0 1 0 0 0 0 0 19 7093 2771 0 0 0 0 0 0 1 0 0 0 0 20 6971 2686 0 0 0 0 0 0 0 1 0 0 0 21 7142 2738 0 0 0 0 0 0 0 0 1 0 0 22 7047 2723 0 0 0 0 0 0 0 0 0 1 0 23 6999 2731 0 0 0 0 0 0 0 0 0 0 1 24 6650 2632 0 0 0 0 0 0 0 0 0 0 0 25 6475 2606 1 0 0 0 0 0 0 0 0 0 0 26 6437 2605 0 1 0 0 0 0 0 0 0 0 0 27 6639 2646 0 0 1 0 0 0 0 0 0 0 0 28 6422 2627 0 0 0 1 0 0 0 0 0 0 0 29 6272 2535 0 0 0 0 1 0 0 0 0 0 0 30 6232 2456 0 0 0 0 0 1 0 0 0 0 0 31 6003 2404 0 0 0 0 0 0 1 0 0 0 0 32 5673 2319 0 0 0 0 0 0 0 1 0 0 0 33 6050 2519 0 0 0 0 0 0 0 0 1 0 0 34 5977 2504 0 0 0 0 0 0 0 0 0 1 0 35 5796 2382 0 0 0 0 0 0 0 0 0 0 1 36 5752 2394 0 0 0 0 0 0 0 0 0 0 0 37 5609 2381 1 0 0 0 0 0 0 0 0 0 0 38 5839 2501 0 1 0 0 0 0 0 0 0 0 0 39 6069 2532 0 0 1 0 0 0 0 0 0 0 0 40 6006 2515 0 0 0 1 0 0 0 0 0 0 0 41 5809 2429 0 0 0 0 1 0 0 0 0 0 0 42 5797 2389 0 0 0 0 0 1 0 0 0 0 0 43 5502 2261 0 0 0 0 0 0 1 0 0 0 0 44 5568 2272 0 0 0 0 0 0 0 1 0 0 0 45 5864 2439 0 0 0 0 0 0 0 0 1 0 0 46 5764 2373 0 0 0 0 0 0 0 0 0 1 0 47 5615 2327 0 0 0 0 0 0 0 0 0 0 1 48 5615 2364 0 0 0 0 0 0 0 0 0 0 0 49 5681 2388 1 0 0 0 0 0 0 0 0 0 0 50 5915 2553 0 1 0 0 0 0 0 0 0 0 0 51 6334 2663 0 0 1 0 0 0 0 0 0 0 0 52 6494 2694 0 0 0 1 0 0 0 0 0 0 0 53 6620 2679 0 0 0 0 1 0 0 0 0 0 0 54 6578 2611 0 0 0 0 0 1 0 0 0 0 0 55 6495 2580 0 0 0 0 0 0 1 0 0 0 0 56 6538 2627 0 0 0 0 0 0 0 1 0 0 0 57 6737 2732 0 0 0 0 0 0 0 0 1 0 0 58 6651 2707 0 0 0 0 0 0 0 0 0 1 0 59 6530 2633 0 0 0 0 0 0 0 0 0 0 1 60 6563 2683 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `Landbouw-Mannen` M1 M2 -1163.161 2.908 -50.729 -214.871 M3 M4 M5 M6 -125.681 -125.386 6.325 182.215 M7 M8 M9 M10 168.449 135.077 30.873 -3.653 M11 74.175 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -349.38 -82.10 -35.02 71.73 313.01 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1163.161 348.946 -3.333 0.00168 ** `Landbouw-Mannen` 2.908 0.133 21.860 < 2e-16 *** M1 -50.729 104.562 -0.485 0.62982 M2 -214.871 105.264 -2.041 0.04686 * M3 -125.681 106.451 -1.181 0.24368 M4 -125.386 106.532 -1.177 0.24513 M5 6.325 105.231 0.060 0.95232 M6 182.215 104.593 1.742 0.08803 . M7 168.450 104.620 1.610 0.11407 M8 135.077 104.747 1.290 0.20352 M9 30.873 105.069 0.294 0.77017 M10 -3.653 104.919 -0.035 0.97237 M11 74.175 104.546 0.709 0.48152 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 165.3 on 47 degrees of freedom Multiple R-squared: 0.9169, Adjusted R-squared: 0.8956 F-statistic: 43.2 on 12 and 47 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.04767020 9.534040e-02 9.523298e-01 [2,] 0.01918873 3.837747e-02 9.808113e-01 [3,] 0.03613029 7.226058e-02 9.638697e-01 [4,] 0.15756326 3.151265e-01 8.424367e-01 [5,] 0.35899678 7.179936e-01 6.410032e-01 [6,] 0.54608000 9.078400e-01 4.539200e-01 [7,] 0.66128614 6.774277e-01 3.387139e-01 [8,] 0.67384969 6.523006e-01 3.261503e-01 [9,] 0.72187745 5.562451e-01 2.781225e-01 [10,] 0.70625036 5.874993e-01 2.937496e-01 [11,] 0.90808551 1.838290e-01 9.191449e-02 [12,] 0.98902047 2.195906e-02 1.097953e-02 [13,] 0.99865939 2.681221e-03 1.340610e-03 [14,] 0.99979440 4.112028e-04 2.056014e-04 [15,] 0.99998671 2.657710e-05 1.328855e-05 [16,] 0.99999010 1.979893e-05 9.899465e-06 [17,] 0.99999034 1.932619e-05 9.663095e-06 [18,] 0.99999248 1.504435e-05 7.522177e-06 [19,] 0.99999701 5.984232e-06 2.992116e-06 [20,] 0.99999057 1.885890e-05 9.429450e-06 [21,] 0.99997465 5.070966e-05 2.535483e-05 [22,] 0.99993050 1.389980e-04 6.949898e-05 [23,] 0.99983610 3.277987e-04 1.638994e-04 [24,] 0.99979827 4.034626e-04 2.017313e-04 [25,] 0.99928408 1.431835e-03 7.159177e-04 [26,] 0.99822215 3.555701e-03 1.777851e-03 [27,] 0.99889192 2.216161e-03 1.108080e-03 [28,] 0.99757094 4.858111e-03 2.429055e-03 [29,] 0.99014391 1.971219e-02 9.856093e-03 > postscript(file="/var/www/html/rcomp/tmp/17uq81258725322.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/2uizp1258725322.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/33ngk1258725322.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/4v2971258725322.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/5w12z1258725322.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 = 60 Frequency = 1 1 2 3 4 5 6 178.3318892 278.5813443 240.1289267 244.2950670 228.2763134 189.3717717 7 8 9 10 11 12 51.6760198 -64.4750144 -0.6564565 -136.5923846 -6.6812330 56.6170901 13 14 15 16 17 18 -140.7154841 -333.6052132 -349.3804367 -247.1989946 -176.2325607 -59.3987010 19 20 21 22 23 24 30.4751391 189.0017882 313.0054357 296.1469953 147.0571683 160.0948712 25 26 27 28 29 30 111.4241893 240.4742316 234.0682087 72.0191450 57.8162804 71.6348383 31 32 33 34 35 36 7.6009786 -41.8723723 -142.2083004 -137.0667408 -41.1555892 -45.8725680 37 38 39 40 41 42 -100.3433478 -55.1249856 -4.4540101 -18.3184734 -96.9675371 -168.5492728 43 44 45 46 47 48 -77.5979450 -10.2104800 -95.5923136 30.8419375 -62.2320983 -95.6415730 49 50 51 52 53 54 -48.6972466 -130.3253770 -120.3626885 -50.7967439 -12.8924959 -33.0586362 55 56 57 58 59 60 -12.1541924 -72.4439215 -74.5483653 -53.3298074 -36.9882478 -75.1978203 > postscript(file="/var/www/html/rcomp/tmp/6df1o1258725322.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 178.3318892 NA 1 278.5813443 178.3318892 2 240.1289267 278.5813443 3 244.2950670 240.1289267 4 228.2763134 244.2950670 5 189.3717717 228.2763134 6 51.6760198 189.3717717 7 -64.4750144 51.6760198 8 -0.6564565 -64.4750144 9 -136.5923846 -0.6564565 10 -6.6812330 -136.5923846 11 56.6170901 -6.6812330 12 -140.7154841 56.6170901 13 -333.6052132 -140.7154841 14 -349.3804367 -333.6052132 15 -247.1989946 -349.3804367 16 -176.2325607 -247.1989946 17 -59.3987010 -176.2325607 18 30.4751391 -59.3987010 19 189.0017882 30.4751391 20 313.0054357 189.0017882 21 296.1469953 313.0054357 22 147.0571683 296.1469953 23 160.0948712 147.0571683 24 111.4241893 160.0948712 25 240.4742316 111.4241893 26 234.0682087 240.4742316 27 72.0191450 234.0682087 28 57.8162804 72.0191450 29 71.6348383 57.8162804 30 7.6009786 71.6348383 31 -41.8723723 7.6009786 32 -142.2083004 -41.8723723 33 -137.0667408 -142.2083004 34 -41.1555892 -137.0667408 35 -45.8725680 -41.1555892 36 -100.3433478 -45.8725680 37 -55.1249856 -100.3433478 38 -4.4540101 -55.1249856 39 -18.3184734 -4.4540101 40 -96.9675371 -18.3184734 41 -168.5492728 -96.9675371 42 -77.5979450 -168.5492728 43 -10.2104800 -77.5979450 44 -95.5923136 -10.2104800 45 30.8419375 -95.5923136 46 -62.2320983 30.8419375 47 -95.6415730 -62.2320983 48 -48.6972466 -95.6415730 49 -130.3253770 -48.6972466 50 -120.3626885 -130.3253770 51 -50.7967439 -120.3626885 52 -12.8924959 -50.7967439 53 -33.0586362 -12.8924959 54 -12.1541924 -33.0586362 55 -72.4439215 -12.1541924 56 -74.5483653 -72.4439215 57 -53.3298074 -74.5483653 58 -36.9882478 -53.3298074 59 -75.1978203 -36.9882478 60 NA -75.1978203 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 278.5813443 178.3318892 [2,] 240.1289267 278.5813443 [3,] 244.2950670 240.1289267 [4,] 228.2763134 244.2950670 [5,] 189.3717717 228.2763134 [6,] 51.6760198 189.3717717 [7,] -64.4750144 51.6760198 [8,] -0.6564565 -64.4750144 [9,] -136.5923846 -0.6564565 [10,] -6.6812330 -136.5923846 [11,] 56.6170901 -6.6812330 [12,] -140.7154841 56.6170901 [13,] -333.6052132 -140.7154841 [14,] -349.3804367 -333.6052132 [15,] -247.1989946 -349.3804367 [16,] -176.2325607 -247.1989946 [17,] -59.3987010 -176.2325607 [18,] 30.4751391 -59.3987010 [19,] 189.0017882 30.4751391 [20,] 313.0054357 189.0017882 [21,] 296.1469953 313.0054357 [22,] 147.0571683 296.1469953 [23,] 160.0948712 147.0571683 [24,] 111.4241893 160.0948712 [25,] 240.4742316 111.4241893 [26,] 234.0682087 240.4742316 [27,] 72.0191450 234.0682087 [28,] 57.8162804 72.0191450 [29,] 71.6348383 57.8162804 [30,] 7.6009786 71.6348383 [31,] -41.8723723 7.6009786 [32,] -142.2083004 -41.8723723 [33,] -137.0667408 -142.2083004 [34,] -41.1555892 -137.0667408 [35,] -45.8725680 -41.1555892 [36,] -100.3433478 -45.8725680 [37,] -55.1249856 -100.3433478 [38,] -4.4540101 -55.1249856 [39,] -18.3184734 -4.4540101 [40,] -96.9675371 -18.3184734 [41,] -168.5492728 -96.9675371 [42,] -77.5979450 -168.5492728 [43,] -10.2104800 -77.5979450 [44,] -95.5923136 -10.2104800 [45,] 30.8419375 -95.5923136 [46,] -62.2320983 30.8419375 [47,] -95.6415730 -62.2320983 [48,] -48.6972466 -95.6415730 [49,] -130.3253770 -48.6972466 [50,] -120.3626885 -130.3253770 [51,] -50.7967439 -120.3626885 [52,] -12.8924959 -50.7967439 [53,] -33.0586362 -12.8924959 [54,] -12.1541924 -33.0586362 [55,] -72.4439215 -12.1541924 [56,] -74.5483653 -72.4439215 [57,] -53.3298074 -74.5483653 [58,] -36.9882478 -53.3298074 [59,] -75.1978203 -36.9882478 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 278.5813443 178.3318892 2 240.1289267 278.5813443 3 244.2950670 240.1289267 4 228.2763134 244.2950670 5 189.3717717 228.2763134 6 51.6760198 189.3717717 7 -64.4750144 51.6760198 8 -0.6564565 -64.4750144 9 -136.5923846 -0.6564565 10 -6.6812330 -136.5923846 11 56.6170901 -6.6812330 12 -140.7154841 56.6170901 13 -333.6052132 -140.7154841 14 -349.3804367 -333.6052132 15 -247.1989946 -349.3804367 16 -176.2325607 -247.1989946 17 -59.3987010 -176.2325607 18 30.4751391 -59.3987010 19 189.0017882 30.4751391 20 313.0054357 189.0017882 21 296.1469953 313.0054357 22 147.0571683 296.1469953 23 160.0948712 147.0571683 24 111.4241893 160.0948712 25 240.4742316 111.4241893 26 234.0682087 240.4742316 27 72.0191450 234.0682087 28 57.8162804 72.0191450 29 71.6348383 57.8162804 30 7.6009786 71.6348383 31 -41.8723723 7.6009786 32 -142.2083004 -41.8723723 33 -137.0667408 -142.2083004 34 -41.1555892 -137.0667408 35 -45.8725680 -41.1555892 36 -100.3433478 -45.8725680 37 -55.1249856 -100.3433478 38 -4.4540101 -55.1249856 39 -18.3184734 -4.4540101 40 -96.9675371 -18.3184734 41 -168.5492728 -96.9675371 42 -77.5979450 -168.5492728 43 -10.2104800 -77.5979450 44 -95.5923136 -10.2104800 45 30.8419375 -95.5923136 46 -62.2320983 30.8419375 47 -95.6415730 -62.2320983 48 -48.6972466 -95.6415730 49 -130.3253770 -48.6972466 50 -120.3626885 -130.3253770 51 -50.7967439 -120.3626885 52 -12.8924959 -50.7967439 53 -33.0586362 -12.8924959 54 -12.1541924 -33.0586362 55 -72.4439215 -12.1541924 56 -74.5483653 -72.4439215 57 -53.3298074 -74.5483653 58 -36.9882478 -53.3298074 59 -75.1978203 -36.9882478 > 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/7qzk71258725322.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/8f0351258725322.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/9y1to1258725322.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/102gpx1258725322.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/11ak2z1258725322.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/12ewhg1258725322.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/13o9381258725322.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/14cb3u1258725322.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/15f5ta1258725322.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/164fcl1258725322.tab") + } > > system("convert tmp/17uq81258725322.ps tmp/17uq81258725322.png") > system("convert tmp/2uizp1258725322.ps tmp/2uizp1258725322.png") > system("convert tmp/33ngk1258725322.ps tmp/33ngk1258725322.png") > system("convert tmp/4v2971258725322.ps tmp/4v2971258725322.png") > system("convert tmp/5w12z1258725322.ps tmp/5w12z1258725322.png") > system("convert tmp/6df1o1258725322.ps tmp/6df1o1258725322.png") > system("convert tmp/7qzk71258725322.ps tmp/7qzk71258725322.png") > system("convert tmp/8f0351258725322.ps tmp/8f0351258725322.png") > system("convert tmp/9y1to1258725322.ps tmp/9y1to1258725322.png") > system("convert tmp/102gpx1258725322.ps tmp/102gpx1258725322.png") > > > proc.time() user system elapsed 2.425 1.577 2.820