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(101.3,0,106.3,0,94,0,102.8,0,102,0,105.1,1,92.4,0,81.4,0,105.8,0,120.3,1,100.7,0,88.8,0,94.3,0,99.9,0,103.4,0,103.3,0,98.8,0,104.2,0,91.2,0,74.7,0,108.5,0,114.5,0,96.9,0,89.6,0,97.1,0,100.3,0,122.6,0,115.4,1,109,0,129.1,1,102.8,1,96.2,0,127.7,1,128.9,1,126.5,1,119.8,1,113.2,1,114.1,1,134.1,1,130,1,121.8,1,132.1,1,105.3,1,103,1,117.1,1,126.3,1,138.1,1,119.5,1,138,1,135.5,1,178.6,1,162.2,1,176.9,1,204.9,1,132.2,1,142.5,1,164.3,1,174.9,1,175.4,1,143,1),dim=c(2,60),dimnames=list(c('Omzet','Uitvoer'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Omzet','Uitvoer'),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 = '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 Omzet Uitvoer M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 101.3 0 1 0 0 0 0 0 0 0 0 0 0 1 2 106.3 0 0 1 0 0 0 0 0 0 0 0 0 2 3 94.0 0 0 0 1 0 0 0 0 0 0 0 0 3 4 102.8 0 0 0 0 1 0 0 0 0 0 0 0 4 5 102.0 0 0 0 0 0 1 0 0 0 0 0 0 5 6 105.1 1 0 0 0 0 0 1 0 0 0 0 0 6 7 92.4 0 0 0 0 0 0 0 1 0 0 0 0 7 8 81.4 0 0 0 0 0 0 0 0 1 0 0 0 8 9 105.8 0 0 0 0 0 0 0 0 0 1 0 0 9 10 120.3 1 0 0 0 0 0 0 0 0 0 1 0 10 11 100.7 0 0 0 0 0 0 0 0 0 0 0 1 11 12 88.8 0 0 0 0 0 0 0 0 0 0 0 0 12 13 94.3 0 1 0 0 0 0 0 0 0 0 0 0 13 14 99.9 0 0 1 0 0 0 0 0 0 0 0 0 14 15 103.4 0 0 0 1 0 0 0 0 0 0 0 0 15 16 103.3 0 0 0 0 1 0 0 0 0 0 0 0 16 17 98.8 0 0 0 0 0 1 0 0 0 0 0 0 17 18 104.2 0 0 0 0 0 0 1 0 0 0 0 0 18 19 91.2 0 0 0 0 0 0 0 1 0 0 0 0 19 20 74.7 0 0 0 0 0 0 0 0 1 0 0 0 20 21 108.5 0 0 0 0 0 0 0 0 0 1 0 0 21 22 114.5 0 0 0 0 0 0 0 0 0 0 1 0 22 23 96.9 0 0 0 0 0 0 0 0 0 0 0 1 23 24 89.6 0 0 0 0 0 0 0 0 0 0 0 0 24 25 97.1 0 1 0 0 0 0 0 0 0 0 0 0 25 26 100.3 0 0 1 0 0 0 0 0 0 0 0 0 26 27 122.6 0 0 0 1 0 0 0 0 0 0 0 0 27 28 115.4 1 0 0 0 1 0 0 0 0 0 0 0 28 29 109.0 0 0 0 0 0 1 0 0 0 0 0 0 29 30 129.1 1 0 0 0 0 0 1 0 0 0 0 0 30 31 102.8 1 0 0 0 0 0 0 1 0 0 0 0 31 32 96.2 0 0 0 0 0 0 0 0 1 0 0 0 32 33 127.7 1 0 0 0 0 0 0 0 0 1 0 0 33 34 128.9 1 0 0 0 0 0 0 0 0 0 1 0 34 35 126.5 1 0 0 0 0 0 0 0 0 0 0 1 35 36 119.8 1 0 0 0 0 0 0 0 0 0 0 0 36 37 113.2 1 1 0 0 0 0 0 0 0 0 0 0 37 38 114.1 1 0 1 0 0 0 0 0 0 0 0 0 38 39 134.1 1 0 0 1 0 0 0 0 0 0 0 0 39 40 130.0 1 0 0 0 1 0 0 0 0 0 0 0 40 41 121.8 1 0 0 0 0 1 0 0 0 0 0 0 41 42 132.1 1 0 0 0 0 0 1 0 0 0 0 0 42 43 105.3 1 0 0 0 0 0 0 1 0 0 0 0 43 44 103.0 1 0 0 0 0 0 0 0 1 0 0 0 44 45 117.1 1 0 0 0 0 0 0 0 0 1 0 0 45 46 126.3 1 0 0 0 0 0 0 0 0 0 1 0 46 47 138.1 1 0 0 0 0 0 0 0 0 0 0 1 47 48 119.5 1 0 0 0 0 0 0 0 0 0 0 0 48 49 138.0 1 1 0 0 0 0 0 0 0 0 0 0 49 50 135.5 1 0 1 0 0 0 0 0 0 0 0 0 50 51 178.6 1 0 0 1 0 0 0 0 0 0 0 0 51 52 162.2 1 0 0 0 1 0 0 0 0 0 0 0 52 53 176.9 1 0 0 0 0 1 0 0 0 0 0 0 53 54 204.9 1 0 0 0 0 0 1 0 0 0 0 0 54 55 132.2 1 0 0 0 0 0 0 1 0 0 0 0 55 56 142.5 1 0 0 0 0 0 0 0 1 0 0 0 56 57 164.3 1 0 0 0 0 0 0 0 0 1 0 0 57 58 174.9 1 0 0 0 0 0 0 0 0 0 1 0 58 59 175.4 1 0 0 0 0 0 0 0 0 0 0 1 59 60 143.0 1 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Uitvoer M1 M2 M3 M4 69.426 2.717 9.737 11.036 25.214 19.730 M5 M6 M7 M8 M9 M10 18.092 29.244 -1.654 -7.472 15.964 22.579 M11 t 16.521 1.141 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -22.361 -8.376 -2.732 8.852 41.887 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 69.4259 7.6561 9.068 8.31e-12 *** Uitvoer 2.7171 6.3949 0.425 0.67290 M1 9.7368 9.1876 1.060 0.29478 M2 11.0356 9.1706 1.203 0.23499 M3 25.2144 9.1571 2.754 0.00841 ** M4 19.7297 9.2163 2.141 0.03763 * M5 18.0919 9.1405 1.979 0.05378 . M6 29.2439 9.3732 3.120 0.00312 ** M7 -1.6539 9.1480 -0.181 0.85732 M8 -7.4717 9.1421 -0.817 0.41798 M9 15.9637 9.1198 1.750 0.08671 . M10 22.5790 9.2397 2.444 0.01843 * M11 16.5212 9.1057 1.814 0.07614 . t 1.1412 0.1794 6.361 8.31e-08 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 14.39 on 46 degrees of freedom Multiple R-squared: 0.7712, Adjusted R-squared: 0.7066 F-statistic: 11.93 on 13 and 46 DF, p-value: 1.041e-10 > 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,] 9.548595e-02 1.909719e-01 0.9045140 [2,] 3.366195e-02 6.732389e-02 0.9663381 [3,] 1.132123e-02 2.264245e-02 0.9886788 [4,] 4.565023e-03 9.130046e-03 0.9954350 [5,] 1.845661e-03 3.691322e-03 0.9981543 [6,] 6.743160e-04 1.348632e-03 0.9993257 [7,] 1.979483e-04 3.958967e-04 0.9998021 [8,] 5.520068e-05 1.104014e-04 0.9999448 [9,] 1.355943e-05 2.711886e-05 0.9999864 [10,] 3.208132e-06 6.416264e-06 0.9999968 [11,] 1.667470e-03 3.334941e-03 0.9983325 [12,] 7.342682e-04 1.468536e-03 0.9992657 [13,] 3.706971e-04 7.413942e-04 0.9996293 [14,] 7.110718e-04 1.422144e-03 0.9992889 [15,] 4.913059e-04 9.826117e-04 0.9995087 [16,] 4.633873e-04 9.267746e-04 0.9995366 [17,] 5.809259e-04 1.161852e-03 0.9994191 [18,] 5.099591e-04 1.019918e-03 0.9994900 [19,] 6.174024e-04 1.234805e-03 0.9993826 [20,] 2.216266e-02 4.432533e-02 0.9778373 [21,] 2.069106e-02 4.138212e-02 0.9793089 [22,] 3.324341e-02 6.648682e-02 0.9667566 [23,] 2.017485e-02 4.034971e-02 0.9798251 [24,] 1.469742e-02 2.939484e-02 0.9853026 [25,] 1.010341e-02 2.020681e-02 0.9898966 [26,] 2.113156e-01 4.226311e-01 0.7886844 [27,] 2.132798e-01 4.265596e-01 0.7867202 > postscript(file="/var/www/html/rcomp/tmp/1v0x71259316715.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/2qiip1259316715.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/3bjg21259316715.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/4stwo1259316715.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/5vgky1259316715.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 20.9960526 23.5560526 -4.0639474 9.0794737 8.7760526 -3.1342105 7 8 9 10 11 12 16.6394737 10.3160526 10.1394737 14.1657895 2.1994737 5.6794737 13 14 15 16 17 18 0.3014474 3.4614474 -8.3585526 -4.1151316 -8.1185526 -15.0117105 19 20 21 22 23 24 1.7448684 -10.0785526 -0.8551316 -2.6117105 -15.2951316 -7.2151316 25 26 27 28 29 30 -10.5931579 -9.8331579 -2.8531579 -8.4268421 -11.6131579 -6.5234211 31 32 33 34 35 36 -3.0668421 -2.2731579 1.9331579 -4.6234211 -2.1068421 6.5731579 37 38 39 40 41 42 -10.9048684 -12.4448684 -7.7648684 -7.5214474 -15.2248684 -17.2180263 43 44 45 46 47 48 -14.2614474 -11.8848684 -22.3614474 -20.9180263 -4.2014474 -7.4214474 49 50 51 52 53 54 0.2005263 -4.7394737 23.0405263 10.9839474 26.1805263 41.8873684 55 56 57 58 59 60 -1.0560526 13.9205263 11.1439474 13.9873684 19.4039474 2.3839474 > postscript(file="/var/www/html/rcomp/tmp/6ocyn1259316715.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 20.9960526 NA 1 23.5560526 20.9960526 2 -4.0639474 23.5560526 3 9.0794737 -4.0639474 4 8.7760526 9.0794737 5 -3.1342105 8.7760526 6 16.6394737 -3.1342105 7 10.3160526 16.6394737 8 10.1394737 10.3160526 9 14.1657895 10.1394737 10 2.1994737 14.1657895 11 5.6794737 2.1994737 12 0.3014474 5.6794737 13 3.4614474 0.3014474 14 -8.3585526 3.4614474 15 -4.1151316 -8.3585526 16 -8.1185526 -4.1151316 17 -15.0117105 -8.1185526 18 1.7448684 -15.0117105 19 -10.0785526 1.7448684 20 -0.8551316 -10.0785526 21 -2.6117105 -0.8551316 22 -15.2951316 -2.6117105 23 -7.2151316 -15.2951316 24 -10.5931579 -7.2151316 25 -9.8331579 -10.5931579 26 -2.8531579 -9.8331579 27 -8.4268421 -2.8531579 28 -11.6131579 -8.4268421 29 -6.5234211 -11.6131579 30 -3.0668421 -6.5234211 31 -2.2731579 -3.0668421 32 1.9331579 -2.2731579 33 -4.6234211 1.9331579 34 -2.1068421 -4.6234211 35 6.5731579 -2.1068421 36 -10.9048684 6.5731579 37 -12.4448684 -10.9048684 38 -7.7648684 -12.4448684 39 -7.5214474 -7.7648684 40 -15.2248684 -7.5214474 41 -17.2180263 -15.2248684 42 -14.2614474 -17.2180263 43 -11.8848684 -14.2614474 44 -22.3614474 -11.8848684 45 -20.9180263 -22.3614474 46 -4.2014474 -20.9180263 47 -7.4214474 -4.2014474 48 0.2005263 -7.4214474 49 -4.7394737 0.2005263 50 23.0405263 -4.7394737 51 10.9839474 23.0405263 52 26.1805263 10.9839474 53 41.8873684 26.1805263 54 -1.0560526 41.8873684 55 13.9205263 -1.0560526 56 11.1439474 13.9205263 57 13.9873684 11.1439474 58 19.4039474 13.9873684 59 2.3839474 19.4039474 60 NA 2.3839474 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 23.5560526 20.9960526 [2,] -4.0639474 23.5560526 [3,] 9.0794737 -4.0639474 [4,] 8.7760526 9.0794737 [5,] -3.1342105 8.7760526 [6,] 16.6394737 -3.1342105 [7,] 10.3160526 16.6394737 [8,] 10.1394737 10.3160526 [9,] 14.1657895 10.1394737 [10,] 2.1994737 14.1657895 [11,] 5.6794737 2.1994737 [12,] 0.3014474 5.6794737 [13,] 3.4614474 0.3014474 [14,] -8.3585526 3.4614474 [15,] -4.1151316 -8.3585526 [16,] -8.1185526 -4.1151316 [17,] -15.0117105 -8.1185526 [18,] 1.7448684 -15.0117105 [19,] -10.0785526 1.7448684 [20,] -0.8551316 -10.0785526 [21,] -2.6117105 -0.8551316 [22,] -15.2951316 -2.6117105 [23,] -7.2151316 -15.2951316 [24,] -10.5931579 -7.2151316 [25,] -9.8331579 -10.5931579 [26,] -2.8531579 -9.8331579 [27,] -8.4268421 -2.8531579 [28,] -11.6131579 -8.4268421 [29,] -6.5234211 -11.6131579 [30,] -3.0668421 -6.5234211 [31,] -2.2731579 -3.0668421 [32,] 1.9331579 -2.2731579 [33,] -4.6234211 1.9331579 [34,] -2.1068421 -4.6234211 [35,] 6.5731579 -2.1068421 [36,] -10.9048684 6.5731579 [37,] -12.4448684 -10.9048684 [38,] -7.7648684 -12.4448684 [39,] -7.5214474 -7.7648684 [40,] -15.2248684 -7.5214474 [41,] -17.2180263 -15.2248684 [42,] -14.2614474 -17.2180263 [43,] -11.8848684 -14.2614474 [44,] -22.3614474 -11.8848684 [45,] -20.9180263 -22.3614474 [46,] -4.2014474 -20.9180263 [47,] -7.4214474 -4.2014474 [48,] 0.2005263 -7.4214474 [49,] -4.7394737 0.2005263 [50,] 23.0405263 -4.7394737 [51,] 10.9839474 23.0405263 [52,] 26.1805263 10.9839474 [53,] 41.8873684 26.1805263 [54,] -1.0560526 41.8873684 [55,] 13.9205263 -1.0560526 [56,] 11.1439474 13.9205263 [57,] 13.9873684 11.1439474 [58,] 19.4039474 13.9873684 [59,] 2.3839474 19.4039474 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 23.5560526 20.9960526 2 -4.0639474 23.5560526 3 9.0794737 -4.0639474 4 8.7760526 9.0794737 5 -3.1342105 8.7760526 6 16.6394737 -3.1342105 7 10.3160526 16.6394737 8 10.1394737 10.3160526 9 14.1657895 10.1394737 10 2.1994737 14.1657895 11 5.6794737 2.1994737 12 0.3014474 5.6794737 13 3.4614474 0.3014474 14 -8.3585526 3.4614474 15 -4.1151316 -8.3585526 16 -8.1185526 -4.1151316 17 -15.0117105 -8.1185526 18 1.7448684 -15.0117105 19 -10.0785526 1.7448684 20 -0.8551316 -10.0785526 21 -2.6117105 -0.8551316 22 -15.2951316 -2.6117105 23 -7.2151316 -15.2951316 24 -10.5931579 -7.2151316 25 -9.8331579 -10.5931579 26 -2.8531579 -9.8331579 27 -8.4268421 -2.8531579 28 -11.6131579 -8.4268421 29 -6.5234211 -11.6131579 30 -3.0668421 -6.5234211 31 -2.2731579 -3.0668421 32 1.9331579 -2.2731579 33 -4.6234211 1.9331579 34 -2.1068421 -4.6234211 35 6.5731579 -2.1068421 36 -10.9048684 6.5731579 37 -12.4448684 -10.9048684 38 -7.7648684 -12.4448684 39 -7.5214474 -7.7648684 40 -15.2248684 -7.5214474 41 -17.2180263 -15.2248684 42 -14.2614474 -17.2180263 43 -11.8848684 -14.2614474 44 -22.3614474 -11.8848684 45 -20.9180263 -22.3614474 46 -4.2014474 -20.9180263 47 -7.4214474 -4.2014474 48 0.2005263 -7.4214474 49 -4.7394737 0.2005263 50 23.0405263 -4.7394737 51 10.9839474 23.0405263 52 26.1805263 10.9839474 53 41.8873684 26.1805263 54 -1.0560526 41.8873684 55 13.9205263 -1.0560526 56 11.1439474 13.9205263 57 13.9873684 11.1439474 58 19.4039474 13.9873684 59 2.3839474 19.4039474 > 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/7i8nh1259316715.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/8ad9e1259316715.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/9zh9v1259316715.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/10ast61259316715.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/113f451259316715.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/12eu1f1259316715.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/138v5d1259316715.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/148aqm1259316715.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/15n88c1259316715.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/16xzk71259316715.tab") + } > > system("convert tmp/1v0x71259316715.ps tmp/1v0x71259316715.png") > system("convert tmp/2qiip1259316715.ps tmp/2qiip1259316715.png") > system("convert tmp/3bjg21259316715.ps tmp/3bjg21259316715.png") > system("convert tmp/4stwo1259316715.ps tmp/4stwo1259316715.png") > system("convert tmp/5vgky1259316715.ps tmp/5vgky1259316715.png") > system("convert tmp/6ocyn1259316715.ps tmp/6ocyn1259316715.png") > system("convert tmp/7i8nh1259316715.ps tmp/7i8nh1259316715.png") > system("convert tmp/8ad9e1259316715.ps tmp/8ad9e1259316715.png") > system("convert tmp/9zh9v1259316715.ps tmp/9zh9v1259316715.png") > system("convert tmp/10ast61259316715.ps tmp/10ast61259316715.png") > > > proc.time() user system elapsed 2.355 1.544 3.142