R version 2.7.0 (2008-04-22) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(90.7,0,94.3,0,104.6,0,111.1,0,110.8,0,107.2,0,99,0,99,0,91,0,96.2,0,96.9,0,96.2,0,100.1,0,99,0,115.4,0,106.9,0,107.1,0,99.3,0,99.2,0,108.3,0,105.6,0,99.5,0,107.4,0,93.1,0,88.1,0,110.7,0,113.1,0,99.6,0,93.6,0,98.6,0,99.6,0,114.3,0,107.8,0,101.2,0,112.5,0,100.5,0,93.9,0,116.2,0,112,0,106.4,0,95.7,0,96,0,95.8,0,103,0,102.2,0,98.4,0,111.4,1,86.6,1,91.3,1,107.9,1,101.8,1,104.4,1,93.4,1,100.1,1,98.5,1,112.9,1,101.4,1,107.1,1,110.8,1,90.3,1,95.5,1,111.4,1,113,1,107.5,1,95.9,1,106.3,1,105.2,1,117.2,1,106.9,1,108.2,1,113,1,97.2,1,99.9,1,108.1,1,118.1,1,109.1,1,93.3,1,112.1,1,111.8,1,112.5,1,116.3,1,110.3,1,117.1,1,103.4,1,96.2,1),dim=c(2,85),dimnames=list(c('Prodintergoed','invest'),1:85)) > y <- array(NA,dim=c(2,85),dimnames=list(c('Prodintergoed','invest'),1:85)) > 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 Prodintergoed invest 1 90.7 0 2 94.3 0 3 104.6 0 4 111.1 0 5 110.8 0 6 107.2 0 7 99.0 0 8 99.0 0 9 91.0 0 10 96.2 0 11 96.9 0 12 96.2 0 13 100.1 0 14 99.0 0 15 115.4 0 16 106.9 0 17 107.1 0 18 99.3 0 19 99.2 0 20 108.3 0 21 105.6 0 22 99.5 0 23 107.4 0 24 93.1 0 25 88.1 0 26 110.7 0 27 113.1 0 28 99.6 0 29 93.6 0 30 98.6 0 31 99.6 0 32 114.3 0 33 107.8 0 34 101.2 0 35 112.5 0 36 100.5 0 37 93.9 0 38 116.2 0 39 112.0 0 40 106.4 0 41 95.7 0 42 96.0 0 43 95.8 0 44 103.0 0 45 102.2 0 46 98.4 0 47 111.4 1 48 86.6 1 49 91.3 1 50 107.9 1 51 101.8 1 52 104.4 1 53 93.4 1 54 100.1 1 55 98.5 1 56 112.9 1 57 101.4 1 58 107.1 1 59 110.8 1 60 90.3 1 61 95.5 1 62 111.4 1 63 113.0 1 64 107.5 1 65 95.9 1 66 106.3 1 67 105.2 1 68 117.2 1 69 106.9 1 70 108.2 1 71 113.0 1 72 97.2 1 73 99.9 1 74 108.1 1 75 118.1 1 76 109.1 1 77 93.3 1 78 112.1 1 79 111.8 1 80 112.5 1 81 116.3 1 82 110.3 1 83 117.1 1 84 103.4 1 85 96.2 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) invest 102.111 3.105 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -18.61538 -5.91087 -0.01538 6.18462 14.08913 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 102.111 1.135 89.950 <2e-16 *** invest 3.105 1.676 1.852 0.0675 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 7.699 on 83 degrees of freedom Multiple R-squared: 0.0397, Adjusted R-squared: 0.02813 F-statistic: 3.432 on 1 and 83 DF, p-value: 0.06752 > 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.8810324 0.2379353 0.1189676 [2,] 0.8129681 0.3740638 0.1870319 [3,] 0.7279104 0.5441793 0.2720896 [4,] 0.6313386 0.7373229 0.3686614 [5,] 0.6986840 0.6026320 0.3013160 [6,] 0.6306045 0.7387909 0.3693955 [7,] 0.5499598 0.9000804 0.4500402 [8,] 0.4774772 0.9549544 0.5225228 [9,] 0.3833463 0.7666926 0.6166537 [10,] 0.3001103 0.6002205 0.6998897 [11,] 0.5380539 0.9238923 0.4619461 [12,] 0.4971700 0.9943400 0.5028300 [13,] 0.4561827 0.9123654 0.5438173 [14,] 0.3832784 0.7665568 0.6167216 [15,] 0.3158892 0.6317784 0.6841108 [16,] 0.2997152 0.5994303 0.7002848 [17,] 0.2508083 0.5016166 0.7491917 [18,] 0.1992099 0.3984198 0.8007901 [19,] 0.1756118 0.3512236 0.8243882 [20,] 0.1946594 0.3893189 0.8053406 [21,] 0.3237023 0.6474046 0.6762977 [22,] 0.3478929 0.6957858 0.6521071 [23,] 0.4193391 0.8386783 0.5806609 [24,] 0.3598159 0.7196318 0.6401841 [25,] 0.3714957 0.7429914 0.6285043 [26,] 0.3220456 0.6440912 0.6779544 [27,] 0.2709278 0.5418556 0.7290722 [28,] 0.3590291 0.7180582 0.6409709 [29,] 0.3304725 0.6609449 0.6695275 [30,] 0.2743071 0.5486141 0.7256929 [31,] 0.3183439 0.6366878 0.6816561 [32,] 0.2650386 0.5300772 0.7349614 [33,] 0.2721794 0.5443587 0.7278206 [34,] 0.4043404 0.8086807 0.5956596 [35,] 0.4542643 0.9085285 0.5457357 [36,] 0.4244562 0.8489124 0.5755438 [37,] 0.3931568 0.7863136 0.6068432 [38,] 0.3599993 0.7199985 0.6400007 [39,] 0.3322736 0.6645472 0.6677264 [40,] 0.2790688 0.5581376 0.7209312 [41,] 0.2309793 0.4619587 0.7690207 [42,] 0.1906655 0.3813310 0.8093345 [43,] 0.1620302 0.3240604 0.8379698 [44,] 0.3862119 0.7724239 0.6137881 [45,] 0.4642112 0.9284225 0.5357888 [46,] 0.4474194 0.8948387 0.5525806 [47,] 0.3969694 0.7939388 0.6030306 [48,] 0.3446603 0.6893206 0.6553397 [49,] 0.4037883 0.8075767 0.5962117 [50,] 0.3684953 0.7369906 0.6315047 [51,] 0.3525966 0.7051933 0.6474034 [52,] 0.3777440 0.7554880 0.6222560 [53,] 0.3351930 0.6703860 0.6648070 [54,] 0.2876211 0.5752423 0.7123789 [55,] 0.2662462 0.5324925 0.7337538 [56,] 0.4530452 0.9060903 0.5469548 [57,] 0.5264202 0.9471595 0.4735798 [58,] 0.5005584 0.9988831 0.4994416 [59,] 0.4935612 0.9871225 0.5064388 [60,] 0.4276392 0.8552783 0.5723608 [61,] 0.5053993 0.9892015 0.4946007 [62,] 0.4365016 0.8730032 0.5634984 [63,] 0.3719183 0.7438366 0.6280817 [64,] 0.4334415 0.8668830 0.5665585 [65,] 0.3579561 0.7159121 0.6420439 [66,] 0.2873655 0.5747310 0.7126345 [67,] 0.2579789 0.5159578 0.7420211 [68,] 0.3012478 0.6024956 0.6987522 [69,] 0.3051304 0.6102607 0.6948696 [70,] 0.2296701 0.4593402 0.7703299 [71,] 0.2733110 0.5466220 0.7266890 [72,] 0.1951971 0.3903943 0.8048029 [73,] 0.4512780 0.9025559 0.5487220 [74,] 0.3442522 0.6885044 0.6557478 [75,] 0.2389380 0.4778760 0.7610620 [76,] 0.1529000 0.3057999 0.8471000 > postscript(file="/var/www/html/rcomp/tmp/1bnas1227512086.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/2j7ni1227512086.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/349811227512086.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/4ryh31227512086.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/51lrf1227512086.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 = 85 Frequency = 1 1 2 3 4 5 6 -11.41086957 -7.81086957 2.48913043 8.98913043 8.68913043 5.08913043 7 8 9 10 11 12 -3.11086957 -3.11086957 -11.11086957 -5.91086957 -5.21086957 -5.91086957 13 14 15 16 17 18 -2.01086957 -3.11086957 13.28913043 4.78913043 4.98913043 -2.81086957 19 20 21 22 23 24 -2.91086957 6.18913043 3.48913043 -2.61086957 5.28913043 -9.01086957 25 26 27 28 29 30 -14.01086957 8.58913043 10.98913043 -2.51086957 -8.51086957 -3.51086957 31 32 33 34 35 36 -2.51086957 12.18913043 5.68913043 -0.91086957 10.38913043 -1.61086957 37 38 39 40 41 42 -8.21086957 14.08913043 9.88913043 4.28913043 -6.41086957 -6.11086957 43 44 45 46 47 48 -6.31086957 0.88913043 0.08913043 -3.71086957 6.18461538 -18.61538462 49 50 51 52 53 54 -13.91538462 2.68461538 -3.41538462 -0.81538462 -11.81538462 -5.11538462 55 56 57 58 59 60 -6.71538462 7.68461538 -3.81538462 1.88461538 5.58461538 -14.91538462 61 62 63 64 65 66 -9.71538462 6.18461538 7.78461538 2.28461538 -9.31538462 1.08461538 67 68 69 70 71 72 -0.01538462 11.98461538 1.68461538 2.98461538 7.78461538 -8.01538462 73 74 75 76 77 78 -5.31538462 2.88461538 12.88461538 3.88461538 -11.91538462 6.88461538 79 80 81 82 83 84 6.58461538 7.28461538 11.08461538 5.08461538 11.88461538 -1.81538462 85 -9.01538462 > postscript(file="/var/www/html/rcomp/tmp/6yto11227512086.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 = 85 Frequency = 1 lag(myerror, k = 1) myerror 0 -11.41086957 NA 1 -7.81086957 -11.41086957 2 2.48913043 -7.81086957 3 8.98913043 2.48913043 4 8.68913043 8.98913043 5 5.08913043 8.68913043 6 -3.11086957 5.08913043 7 -3.11086957 -3.11086957 8 -11.11086957 -3.11086957 9 -5.91086957 -11.11086957 10 -5.21086957 -5.91086957 11 -5.91086957 -5.21086957 12 -2.01086957 -5.91086957 13 -3.11086957 -2.01086957 14 13.28913043 -3.11086957 15 4.78913043 13.28913043 16 4.98913043 4.78913043 17 -2.81086957 4.98913043 18 -2.91086957 -2.81086957 19 6.18913043 -2.91086957 20 3.48913043 6.18913043 21 -2.61086957 3.48913043 22 5.28913043 -2.61086957 23 -9.01086957 5.28913043 24 -14.01086957 -9.01086957 25 8.58913043 -14.01086957 26 10.98913043 8.58913043 27 -2.51086957 10.98913043 28 -8.51086957 -2.51086957 29 -3.51086957 -8.51086957 30 -2.51086957 -3.51086957 31 12.18913043 -2.51086957 32 5.68913043 12.18913043 33 -0.91086957 5.68913043 34 10.38913043 -0.91086957 35 -1.61086957 10.38913043 36 -8.21086957 -1.61086957 37 14.08913043 -8.21086957 38 9.88913043 14.08913043 39 4.28913043 9.88913043 40 -6.41086957 4.28913043 41 -6.11086957 -6.41086957 42 -6.31086957 -6.11086957 43 0.88913043 -6.31086957 44 0.08913043 0.88913043 45 -3.71086957 0.08913043 46 6.18461538 -3.71086957 47 -18.61538462 6.18461538 48 -13.91538462 -18.61538462 49 2.68461538 -13.91538462 50 -3.41538462 2.68461538 51 -0.81538462 -3.41538462 52 -11.81538462 -0.81538462 53 -5.11538462 -11.81538462 54 -6.71538462 -5.11538462 55 7.68461538 -6.71538462 56 -3.81538462 7.68461538 57 1.88461538 -3.81538462 58 5.58461538 1.88461538 59 -14.91538462 5.58461538 60 -9.71538462 -14.91538462 61 6.18461538 -9.71538462 62 7.78461538 6.18461538 63 2.28461538 7.78461538 64 -9.31538462 2.28461538 65 1.08461538 -9.31538462 66 -0.01538462 1.08461538 67 11.98461538 -0.01538462 68 1.68461538 11.98461538 69 2.98461538 1.68461538 70 7.78461538 2.98461538 71 -8.01538462 7.78461538 72 -5.31538462 -8.01538462 73 2.88461538 -5.31538462 74 12.88461538 2.88461538 75 3.88461538 12.88461538 76 -11.91538462 3.88461538 77 6.88461538 -11.91538462 78 6.58461538 6.88461538 79 7.28461538 6.58461538 80 11.08461538 7.28461538 81 5.08461538 11.08461538 82 11.88461538 5.08461538 83 -1.81538462 11.88461538 84 -9.01538462 -1.81538462 85 NA -9.01538462 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -7.81086957 -11.41086957 [2,] 2.48913043 -7.81086957 [3,] 8.98913043 2.48913043 [4,] 8.68913043 8.98913043 [5,] 5.08913043 8.68913043 [6,] -3.11086957 5.08913043 [7,] -3.11086957 -3.11086957 [8,] -11.11086957 -3.11086957 [9,] -5.91086957 -11.11086957 [10,] -5.21086957 -5.91086957 [11,] -5.91086957 -5.21086957 [12,] -2.01086957 -5.91086957 [13,] -3.11086957 -2.01086957 [14,] 13.28913043 -3.11086957 [15,] 4.78913043 13.28913043 [16,] 4.98913043 4.78913043 [17,] -2.81086957 4.98913043 [18,] -2.91086957 -2.81086957 [19,] 6.18913043 -2.91086957 [20,] 3.48913043 6.18913043 [21,] -2.61086957 3.48913043 [22,] 5.28913043 -2.61086957 [23,] -9.01086957 5.28913043 [24,] -14.01086957 -9.01086957 [25,] 8.58913043 -14.01086957 [26,] 10.98913043 8.58913043 [27,] -2.51086957 10.98913043 [28,] -8.51086957 -2.51086957 [29,] -3.51086957 -8.51086957 [30,] -2.51086957 -3.51086957 [31,] 12.18913043 -2.51086957 [32,] 5.68913043 12.18913043 [33,] -0.91086957 5.68913043 [34,] 10.38913043 -0.91086957 [35,] -1.61086957 10.38913043 [36,] -8.21086957 -1.61086957 [37,] 14.08913043 -8.21086957 [38,] 9.88913043 14.08913043 [39,] 4.28913043 9.88913043 [40,] -6.41086957 4.28913043 [41,] -6.11086957 -6.41086957 [42,] -6.31086957 -6.11086957 [43,] 0.88913043 -6.31086957 [44,] 0.08913043 0.88913043 [45,] -3.71086957 0.08913043 [46,] 6.18461538 -3.71086957 [47,] -18.61538462 6.18461538 [48,] -13.91538462 -18.61538462 [49,] 2.68461538 -13.91538462 [50,] -3.41538462 2.68461538 [51,] -0.81538462 -3.41538462 [52,] -11.81538462 -0.81538462 [53,] -5.11538462 -11.81538462 [54,] -6.71538462 -5.11538462 [55,] 7.68461538 -6.71538462 [56,] -3.81538462 7.68461538 [57,] 1.88461538 -3.81538462 [58,] 5.58461538 1.88461538 [59,] -14.91538462 5.58461538 [60,] -9.71538462 -14.91538462 [61,] 6.18461538 -9.71538462 [62,] 7.78461538 6.18461538 [63,] 2.28461538 7.78461538 [64,] -9.31538462 2.28461538 [65,] 1.08461538 -9.31538462 [66,] -0.01538462 1.08461538 [67,] 11.98461538 -0.01538462 [68,] 1.68461538 11.98461538 [69,] 2.98461538 1.68461538 [70,] 7.78461538 2.98461538 [71,] -8.01538462 7.78461538 [72,] -5.31538462 -8.01538462 [73,] 2.88461538 -5.31538462 [74,] 12.88461538 2.88461538 [75,] 3.88461538 12.88461538 [76,] -11.91538462 3.88461538 [77,] 6.88461538 -11.91538462 [78,] 6.58461538 6.88461538 [79,] 7.28461538 6.58461538 [80,] 11.08461538 7.28461538 [81,] 5.08461538 11.08461538 [82,] 11.88461538 5.08461538 [83,] -1.81538462 11.88461538 [84,] -9.01538462 -1.81538462 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -7.81086957 -11.41086957 2 2.48913043 -7.81086957 3 8.98913043 2.48913043 4 8.68913043 8.98913043 5 5.08913043 8.68913043 6 -3.11086957 5.08913043 7 -3.11086957 -3.11086957 8 -11.11086957 -3.11086957 9 -5.91086957 -11.11086957 10 -5.21086957 -5.91086957 11 -5.91086957 -5.21086957 12 -2.01086957 -5.91086957 13 -3.11086957 -2.01086957 14 13.28913043 -3.11086957 15 4.78913043 13.28913043 16 4.98913043 4.78913043 17 -2.81086957 4.98913043 18 -2.91086957 -2.81086957 19 6.18913043 -2.91086957 20 3.48913043 6.18913043 21 -2.61086957 3.48913043 22 5.28913043 -2.61086957 23 -9.01086957 5.28913043 24 -14.01086957 -9.01086957 25 8.58913043 -14.01086957 26 10.98913043 8.58913043 27 -2.51086957 10.98913043 28 -8.51086957 -2.51086957 29 -3.51086957 -8.51086957 30 -2.51086957 -3.51086957 31 12.18913043 -2.51086957 32 5.68913043 12.18913043 33 -0.91086957 5.68913043 34 10.38913043 -0.91086957 35 -1.61086957 10.38913043 36 -8.21086957 -1.61086957 37 14.08913043 -8.21086957 38 9.88913043 14.08913043 39 4.28913043 9.88913043 40 -6.41086957 4.28913043 41 -6.11086957 -6.41086957 42 -6.31086957 -6.11086957 43 0.88913043 -6.31086957 44 0.08913043 0.88913043 45 -3.71086957 0.08913043 46 6.18461538 -3.71086957 47 -18.61538462 6.18461538 48 -13.91538462 -18.61538462 49 2.68461538 -13.91538462 50 -3.41538462 2.68461538 51 -0.81538462 -3.41538462 52 -11.81538462 -0.81538462 53 -5.11538462 -11.81538462 54 -6.71538462 -5.11538462 55 7.68461538 -6.71538462 56 -3.81538462 7.68461538 57 1.88461538 -3.81538462 58 5.58461538 1.88461538 59 -14.91538462 5.58461538 60 -9.71538462 -14.91538462 61 6.18461538 -9.71538462 62 7.78461538 6.18461538 63 2.28461538 7.78461538 64 -9.31538462 2.28461538 65 1.08461538 -9.31538462 66 -0.01538462 1.08461538 67 11.98461538 -0.01538462 68 1.68461538 11.98461538 69 2.98461538 1.68461538 70 7.78461538 2.98461538 71 -8.01538462 7.78461538 72 -5.31538462 -8.01538462 73 2.88461538 -5.31538462 74 12.88461538 2.88461538 75 3.88461538 12.88461538 76 -11.91538462 3.88461538 77 6.88461538 -11.91538462 78 6.58461538 6.88461538 79 7.28461538 6.58461538 80 11.08461538 7.28461538 81 5.08461538 11.08461538 82 11.88461538 5.08461538 83 -1.81538462 11.88461538 84 -9.01538462 -1.81538462 > 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/7t18c1227512086.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/8mxdr1227512086.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/90pw31227512086.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/103s9d1227512086.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/11c00p1227512086.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/12vbnl1227512087.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/134ktw1227512087.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/14esrg1227512087.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/151kzc1227512087.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/16misr1227512087.tab") + } > > system("convert tmp/1bnas1227512086.ps tmp/1bnas1227512086.png") > system("convert tmp/2j7ni1227512086.ps tmp/2j7ni1227512086.png") > system("convert tmp/349811227512086.ps tmp/349811227512086.png") > system("convert tmp/4ryh31227512086.ps tmp/4ryh31227512086.png") > system("convert tmp/51lrf1227512086.ps tmp/51lrf1227512086.png") > system("convert tmp/6yto11227512086.ps tmp/6yto11227512086.png") > system("convert tmp/7t18c1227512086.ps tmp/7t18c1227512086.png") > system("convert tmp/8mxdr1227512086.ps tmp/8mxdr1227512086.png") > system("convert tmp/90pw31227512086.ps tmp/90pw31227512086.png") > system("convert tmp/103s9d1227512086.ps tmp/103s9d1227512086.png") > > > proc.time() user system elapsed 5.469 2.781 5.876