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(3.48,4143,3.6,4429,3.66,5219,3.45,4929,3.3,5761,3.14,5592,3.21,4163,3.12,4962,3.14,5208,3.4,4755,3.42,4491,3.29,5732,3.49,5731,3.52,5040,3.81,6102,4.03,4904,3.98,5369,4.1,5578,3.96,4619,3.83,4731,3.72,5011,3.82,5299,3.76,4146,3.98,4625,4.14,4736,4,4219,4.13,5116,4.28,4205,4.46,4121,4.63,5103,4.49,4300,4.41,4578,4.5,3809,4.39,5657,4.33,4248,4.45,3830,4.17,4736,4.13,4839,4.33,4411,4.47,4570,4.63,4104,4.9,4801,4.77,3953,4.51,3828,4.63,4440,4.36,4026,3.95,4109,3.74,4785,4.15,3224,4.14,3552,3.97,3940,3.81,3913,4.07,3681,3.84,4309,3.63,3830,3.55,4143,3.6,4087,3.63,3818,3.55,3380,3.69,3430,3.53,3458,3.43,3970,3.4,5260,3.41,5024,3.09,5634,3.35,6549,3.22,4676),dim=c(2,67),dimnames=list(c('leningen','nieuwbouw'),1:67)) > y <- array(NA,dim=c(2,67),dimnames=list(c('leningen','nieuwbouw'),1:67)) > 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 leningen nieuwbouw 1 3.48 4143 2 3.60 4429 3 3.66 5219 4 3.45 4929 5 3.30 5761 6 3.14 5592 7 3.21 4163 8 3.12 4962 9 3.14 5208 10 3.40 4755 11 3.42 4491 12 3.29 5732 13 3.49 5731 14 3.52 5040 15 3.81 6102 16 4.03 4904 17 3.98 5369 18 4.10 5578 19 3.96 4619 20 3.83 4731 21 3.72 5011 22 3.82 5299 23 3.76 4146 24 3.98 4625 25 4.14 4736 26 4.00 4219 27 4.13 5116 28 4.28 4205 29 4.46 4121 30 4.63 5103 31 4.49 4300 32 4.41 4578 33 4.50 3809 34 4.39 5657 35 4.33 4248 36 4.45 3830 37 4.17 4736 38 4.13 4839 39 4.33 4411 40 4.47 4570 41 4.63 4104 42 4.90 4801 43 4.77 3953 44 4.51 3828 45 4.63 4440 46 4.36 4026 47 3.95 4109 48 3.74 4785 49 4.15 3224 50 4.14 3552 51 3.97 3940 52 3.81 3913 53 4.07 3681 54 3.84 4309 55 3.63 3830 56 3.55 4143 57 3.60 4087 58 3.63 3818 59 3.55 3380 60 3.69 3430 61 3.53 3458 62 3.43 3970 63 3.40 5260 64 3.41 5024 65 3.09 5634 66 3.35 6549 67 3.22 4676 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) nieuwbouw 4.7859381 -0.0001974 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.75419 -0.38172 -0.02485 0.36134 1.06174 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.786e+00 3.573e-01 13.393 <2e-16 *** nieuwbouw -1.974e-04 7.709e-05 -2.561 0.0128 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4463 on 65 degrees of freedom Multiple R-squared: 0.09163, Adjusted R-squared: 0.07766 F-statistic: 6.557 on 1 and 65 DF, p-value: 0.01278 > 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.042519063 0.0850381256 9.574809e-01 [2,] 0.037479509 0.0749590190 9.625205e-01 [3,] 0.047784060 0.0955681195 9.522159e-01 [4,] 0.043035577 0.0860711531 9.569644e-01 [5,] 0.029905738 0.0598114752 9.700943e-01 [6,] 0.014510566 0.0290211326 9.854894e-01 [7,] 0.006881734 0.0137634688 9.931183e-01 [8,] 0.003155106 0.0063102113 9.968449e-01 [9,] 0.002174029 0.0043480581 9.978260e-01 [10,] 0.001297001 0.0025940027 9.987030e-01 [11,] 0.003963800 0.0079275993 9.960362e-01 [12,] 0.021914889 0.0438297775 9.780851e-01 [13,] 0.038092951 0.0761859016 9.619070e-01 [14,] 0.068411376 0.1368227529 9.315886e-01 [15,] 0.079303835 0.1586076706 9.206962e-01 [16,] 0.066532137 0.1330642741 9.334679e-01 [17,] 0.048318370 0.0966367398 9.516816e-01 [18,] 0.036817856 0.0736357123 9.631821e-01 [19,] 0.027662898 0.0553257968 9.723371e-01 [20,] 0.026291619 0.0525832372 9.737084e-01 [21,] 0.033293696 0.0665873920 9.667063e-01 [22,] 0.027747185 0.0554943697 9.722528e-01 [23,] 0.031050979 0.0621019577 9.689490e-01 [24,] 0.038003582 0.0760071646 9.619964e-01 [25,] 0.057951349 0.1159026976 9.420487e-01 [26,] 0.159507182 0.3190143644 8.404928e-01 [27,] 0.195539263 0.3910785252 8.044607e-01 [28,] 0.217420825 0.4348416507 7.825792e-01 [29,] 0.218924877 0.4378497547 7.810751e-01 [30,] 0.305532200 0.6110643993 6.944678e-01 [31,] 0.284878674 0.5697573485 7.151213e-01 [32,] 0.270860733 0.5417214651 7.291393e-01 [33,] 0.239591893 0.4791837851 7.604081e-01 [34,] 0.208507157 0.4170143145 7.914928e-01 [35,] 0.198328803 0.3966576053 8.016712e-01 [36,] 0.235712564 0.4714251277 7.642874e-01 [37,] 0.302805082 0.6056101647 6.971949e-01 [38,] 0.701741871 0.5965162584 2.982581e-01 [39,] 0.865950651 0.2680986976 1.340493e-01 [40,] 0.912633522 0.1747329550 8.736648e-02 [41,] 0.991473981 0.0170520389 8.526019e-03 [42,] 0.998037171 0.0039256580 1.962829e-03 [43,] 0.997689757 0.0046204864 2.310243e-03 [44,] 0.996799233 0.0064015340 3.200767e-03 [45,] 0.996896551 0.0062068987 3.103449e-03 [46,] 0.998263237 0.0034735250 1.736763e-03 [47,] 0.998746564 0.0025068718 1.253436e-03 [48,] 0.998226114 0.0035477719 1.773886e-03 [49,] 0.999717368 0.0005652649 2.826325e-04 [50,] 0.999941837 0.0001163255 5.816274e-05 [51,] 0.999861193 0.0002776144 1.388072e-04 [52,] 0.999611067 0.0007778661 3.889331e-04 [53,] 0.999109625 0.0017807491 8.903745e-04 [54,] 0.998094999 0.0038100019 1.905001e-03 [55,] 0.994341778 0.0113164433 5.658222e-03 [56,] 0.991830513 0.0163389732 8.169487e-03 [57,] 0.978975637 0.0420487265 2.102436e-02 [58,] 0.943475339 0.1130493216 5.652466e-02 > postscript(file="/var/www/html/rcomp/tmp/1ida01293204952.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/2ida01293204952.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/3ida01293204952.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/4bm9l1293204952.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/5bm9l1293204952.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 = 67 Frequency = 1 1 2 3 4 5 -0.4881409511 -0.3116866969 -0.0957466238 -0.3629904481 -0.3487598902 6 7 8 9 10 -0.5421192223 -0.7541931012 -0.6864764957 -0.6179179413 -0.4473367427 11 12 13 14 15 -0.4794483620 -0.3644842726 -0.1646816651 -0.2710798809 0.2285509515 16 17 18 19 20 0.2120747395 0.2538622508 0.4151172828 0.0858178777 -0.0220741626 21 22 23 24 25 -0.0768042633 0.0800447760 -0.2075487737 0.1070022327 0.2889127999 26 27 28 29 30 0.0468608787 0.3539219489 0.3240973837 0.4875164139 0.8513558465 31 32 33 34 35 0.5528496710 0.5277247853 0.4659299547 0.7207112901 0.3825852611 36 37 38 39 40 0.4200751971 0.3189127999 0.2992442271 0.4147602382 0.5861456453 41 42 43 44 45 0.6541607415 1.0617433122 0.7643544743 0.4796804121 0.7204846206 46 47 48 49 50 0.3687641266 -0.0248522961 -0.1014149677 0.0004553436 0.0552000828 51 52 53 54 55 -0.0382116281 -0.2035412256 0.0106637150 -0.0953737966 -0.3999248029 56 57 58 59 60 -0.4181409511 -0.3791949310 -0.4022935128 -0.5687514267 -0.4188818019 61 62 63 64 65 -0.5733548119 -0.5722898532 -0.3476535314 -0.3842381608 -0.5838287374 66 67 -0.1432146022 -0.6429307500 > postscript(file="/var/www/html/rcomp/tmp/6bm9l1293204952.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 = 67 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.4881409511 NA 1 -0.3116866969 -0.4881409511 2 -0.0957466238 -0.3116866969 3 -0.3629904481 -0.0957466238 4 -0.3487598902 -0.3629904481 5 -0.5421192223 -0.3487598902 6 -0.7541931012 -0.5421192223 7 -0.6864764957 -0.7541931012 8 -0.6179179413 -0.6864764957 9 -0.4473367427 -0.6179179413 10 -0.4794483620 -0.4473367427 11 -0.3644842726 -0.4794483620 12 -0.1646816651 -0.3644842726 13 -0.2710798809 -0.1646816651 14 0.2285509515 -0.2710798809 15 0.2120747395 0.2285509515 16 0.2538622508 0.2120747395 17 0.4151172828 0.2538622508 18 0.0858178777 0.4151172828 19 -0.0220741626 0.0858178777 20 -0.0768042633 -0.0220741626 21 0.0800447760 -0.0768042633 22 -0.2075487737 0.0800447760 23 0.1070022327 -0.2075487737 24 0.2889127999 0.1070022327 25 0.0468608787 0.2889127999 26 0.3539219489 0.0468608787 27 0.3240973837 0.3539219489 28 0.4875164139 0.3240973837 29 0.8513558465 0.4875164139 30 0.5528496710 0.8513558465 31 0.5277247853 0.5528496710 32 0.4659299547 0.5277247853 33 0.7207112901 0.4659299547 34 0.3825852611 0.7207112901 35 0.4200751971 0.3825852611 36 0.3189127999 0.4200751971 37 0.2992442271 0.3189127999 38 0.4147602382 0.2992442271 39 0.5861456453 0.4147602382 40 0.6541607415 0.5861456453 41 1.0617433122 0.6541607415 42 0.7643544743 1.0617433122 43 0.4796804121 0.7643544743 44 0.7204846206 0.4796804121 45 0.3687641266 0.7204846206 46 -0.0248522961 0.3687641266 47 -0.1014149677 -0.0248522961 48 0.0004553436 -0.1014149677 49 0.0552000828 0.0004553436 50 -0.0382116281 0.0552000828 51 -0.2035412256 -0.0382116281 52 0.0106637150 -0.2035412256 53 -0.0953737966 0.0106637150 54 -0.3999248029 -0.0953737966 55 -0.4181409511 -0.3999248029 56 -0.3791949310 -0.4181409511 57 -0.4022935128 -0.3791949310 58 -0.5687514267 -0.4022935128 59 -0.4188818019 -0.5687514267 60 -0.5733548119 -0.4188818019 61 -0.5722898532 -0.5733548119 62 -0.3476535314 -0.5722898532 63 -0.3842381608 -0.3476535314 64 -0.5838287374 -0.3842381608 65 -0.1432146022 -0.5838287374 66 -0.6429307500 -0.1432146022 67 NA -0.6429307500 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.3116866969 -0.4881409511 [2,] -0.0957466238 -0.3116866969 [3,] -0.3629904481 -0.0957466238 [4,] -0.3487598902 -0.3629904481 [5,] -0.5421192223 -0.3487598902 [6,] -0.7541931012 -0.5421192223 [7,] -0.6864764957 -0.7541931012 [8,] -0.6179179413 -0.6864764957 [9,] -0.4473367427 -0.6179179413 [10,] -0.4794483620 -0.4473367427 [11,] -0.3644842726 -0.4794483620 [12,] -0.1646816651 -0.3644842726 [13,] -0.2710798809 -0.1646816651 [14,] 0.2285509515 -0.2710798809 [15,] 0.2120747395 0.2285509515 [16,] 0.2538622508 0.2120747395 [17,] 0.4151172828 0.2538622508 [18,] 0.0858178777 0.4151172828 [19,] -0.0220741626 0.0858178777 [20,] -0.0768042633 -0.0220741626 [21,] 0.0800447760 -0.0768042633 [22,] -0.2075487737 0.0800447760 [23,] 0.1070022327 -0.2075487737 [24,] 0.2889127999 0.1070022327 [25,] 0.0468608787 0.2889127999 [26,] 0.3539219489 0.0468608787 [27,] 0.3240973837 0.3539219489 [28,] 0.4875164139 0.3240973837 [29,] 0.8513558465 0.4875164139 [30,] 0.5528496710 0.8513558465 [31,] 0.5277247853 0.5528496710 [32,] 0.4659299547 0.5277247853 [33,] 0.7207112901 0.4659299547 [34,] 0.3825852611 0.7207112901 [35,] 0.4200751971 0.3825852611 [36,] 0.3189127999 0.4200751971 [37,] 0.2992442271 0.3189127999 [38,] 0.4147602382 0.2992442271 [39,] 0.5861456453 0.4147602382 [40,] 0.6541607415 0.5861456453 [41,] 1.0617433122 0.6541607415 [42,] 0.7643544743 1.0617433122 [43,] 0.4796804121 0.7643544743 [44,] 0.7204846206 0.4796804121 [45,] 0.3687641266 0.7204846206 [46,] -0.0248522961 0.3687641266 [47,] -0.1014149677 -0.0248522961 [48,] 0.0004553436 -0.1014149677 [49,] 0.0552000828 0.0004553436 [50,] -0.0382116281 0.0552000828 [51,] -0.2035412256 -0.0382116281 [52,] 0.0106637150 -0.2035412256 [53,] -0.0953737966 0.0106637150 [54,] -0.3999248029 -0.0953737966 [55,] -0.4181409511 -0.3999248029 [56,] -0.3791949310 -0.4181409511 [57,] -0.4022935128 -0.3791949310 [58,] -0.5687514267 -0.4022935128 [59,] -0.4188818019 -0.5687514267 [60,] -0.5733548119 -0.4188818019 [61,] -0.5722898532 -0.5733548119 [62,] -0.3476535314 -0.5722898532 [63,] -0.3842381608 -0.3476535314 [64,] -0.5838287374 -0.3842381608 [65,] -0.1432146022 -0.5838287374 [66,] -0.6429307500 -0.1432146022 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.3116866969 -0.4881409511 2 -0.0957466238 -0.3116866969 3 -0.3629904481 -0.0957466238 4 -0.3487598902 -0.3629904481 5 -0.5421192223 -0.3487598902 6 -0.7541931012 -0.5421192223 7 -0.6864764957 -0.7541931012 8 -0.6179179413 -0.6864764957 9 -0.4473367427 -0.6179179413 10 -0.4794483620 -0.4473367427 11 -0.3644842726 -0.4794483620 12 -0.1646816651 -0.3644842726 13 -0.2710798809 -0.1646816651 14 0.2285509515 -0.2710798809 15 0.2120747395 0.2285509515 16 0.2538622508 0.2120747395 17 0.4151172828 0.2538622508 18 0.0858178777 0.4151172828 19 -0.0220741626 0.0858178777 20 -0.0768042633 -0.0220741626 21 0.0800447760 -0.0768042633 22 -0.2075487737 0.0800447760 23 0.1070022327 -0.2075487737 24 0.2889127999 0.1070022327 25 0.0468608787 0.2889127999 26 0.3539219489 0.0468608787 27 0.3240973837 0.3539219489 28 0.4875164139 0.3240973837 29 0.8513558465 0.4875164139 30 0.5528496710 0.8513558465 31 0.5277247853 0.5528496710 32 0.4659299547 0.5277247853 33 0.7207112901 0.4659299547 34 0.3825852611 0.7207112901 35 0.4200751971 0.3825852611 36 0.3189127999 0.4200751971 37 0.2992442271 0.3189127999 38 0.4147602382 0.2992442271 39 0.5861456453 0.4147602382 40 0.6541607415 0.5861456453 41 1.0617433122 0.6541607415 42 0.7643544743 1.0617433122 43 0.4796804121 0.7643544743 44 0.7204846206 0.4796804121 45 0.3687641266 0.7204846206 46 -0.0248522961 0.3687641266 47 -0.1014149677 -0.0248522961 48 0.0004553436 -0.1014149677 49 0.0552000828 0.0004553436 50 -0.0382116281 0.0552000828 51 -0.2035412256 -0.0382116281 52 0.0106637150 -0.2035412256 53 -0.0953737966 0.0106637150 54 -0.3999248029 -0.0953737966 55 -0.4181409511 -0.3999248029 56 -0.3791949310 -0.4181409511 57 -0.4022935128 -0.3791949310 58 -0.5687514267 -0.4022935128 59 -0.4188818019 -0.5687514267 60 -0.5733548119 -0.4188818019 61 -0.5722898532 -0.5733548119 62 -0.3476535314 -0.5722898532 63 -0.3842381608 -0.3476535314 64 -0.5838287374 -0.3842381608 65 -0.1432146022 -0.5838287374 66 -0.6429307500 -0.1432146022 > 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/7md8o1293204952.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/8e4q91293204952.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/9e4q91293204952.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/10e4q91293204952.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/11ten01293204952.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/12wf461293204952.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/13sp2x1293204952.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/14v7ik1293204952.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/15z7h81293204952.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/16k8fe1293204952.tab") + } > > try(system("convert tmp/1ida01293204952.ps tmp/1ida01293204952.png",intern=TRUE)) character(0) > try(system("convert tmp/2ida01293204952.ps tmp/2ida01293204952.png",intern=TRUE)) character(0) > try(system("convert tmp/3ida01293204952.ps tmp/3ida01293204952.png",intern=TRUE)) character(0) > try(system("convert tmp/4bm9l1293204952.ps tmp/4bm9l1293204952.png",intern=TRUE)) character(0) > try(system("convert tmp/5bm9l1293204952.ps tmp/5bm9l1293204952.png",intern=TRUE)) character(0) > try(system("convert tmp/6bm9l1293204952.ps tmp/6bm9l1293204952.png",intern=TRUE)) character(0) > try(system("convert tmp/7md8o1293204952.ps tmp/7md8o1293204952.png",intern=TRUE)) character(0) > try(system("convert tmp/8e4q91293204952.ps tmp/8e4q91293204952.png",intern=TRUE)) character(0) > try(system("convert tmp/9e4q91293204952.ps tmp/9e4q91293204952.png",intern=TRUE)) character(0) > try(system("convert tmp/10e4q91293204952.ps tmp/10e4q91293204952.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.572 1.622 10.879