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(95.1,136,97,133,112.7,126,102.9,120,97.4,114,111.4,116,87.4,153,96.8,162,114.1,161,110.3,149,103.9,139,101.6,135,94.6,130,95.9,127,104.7,122,102.8,117,98.1,112,113.9,113,80.9,149,95.7,157,113.2,157,105.9,147,108.8,137,102.3,132,99,125,100.7,123,115.5,117,100.7,114,109.9,111,114.6,112,85.4,144,100.5,150,114.8,149,116.5,134,112.9,123,102,116,106,117,105.3,111,118.8,105,106.1,102,109.3,95,117.2,93,92.5,124,104.2,130,112.5,124,122.4,115,113.3,106,100,105,110.7,105,112.8,101,109.8,95,117.3,93,109.1,84,115.9,87,96,116,99.8,120,116.8,117,115.7,109,99.4,105,94.3,107,91,109),dim=c(2,61),dimnames=list(c('tip','wrk'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('tip','wrk'),1:61)) > 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 tip wrk M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 95.1 136 1 0 0 0 0 0 0 0 0 0 0 2 97.0 133 0 1 0 0 0 0 0 0 0 0 0 3 112.7 126 0 0 1 0 0 0 0 0 0 0 0 4 102.9 120 0 0 0 1 0 0 0 0 0 0 0 5 97.4 114 0 0 0 0 1 0 0 0 0 0 0 6 111.4 116 0 0 0 0 0 1 0 0 0 0 0 7 87.4 153 0 0 0 0 0 0 1 0 0 0 0 8 96.8 162 0 0 0 0 0 0 0 1 0 0 0 9 114.1 161 0 0 0 0 0 0 0 0 1 0 0 10 110.3 149 0 0 0 0 0 0 0 0 0 1 0 11 103.9 139 0 0 0 0 0 0 0 0 0 0 1 12 101.6 135 0 0 0 0 0 0 0 0 0 0 0 13 94.6 130 1 0 0 0 0 0 0 0 0 0 0 14 95.9 127 0 1 0 0 0 0 0 0 0 0 0 15 104.7 122 0 0 1 0 0 0 0 0 0 0 0 16 102.8 117 0 0 0 1 0 0 0 0 0 0 0 17 98.1 112 0 0 0 0 1 0 0 0 0 0 0 18 113.9 113 0 0 0 0 0 1 0 0 0 0 0 19 80.9 149 0 0 0 0 0 0 1 0 0 0 0 20 95.7 157 0 0 0 0 0 0 0 1 0 0 0 21 113.2 157 0 0 0 0 0 0 0 0 1 0 0 22 105.9 147 0 0 0 0 0 0 0 0 0 1 0 23 108.8 137 0 0 0 0 0 0 0 0 0 0 1 24 102.3 132 0 0 0 0 0 0 0 0 0 0 0 25 99.0 125 1 0 0 0 0 0 0 0 0 0 0 26 100.7 123 0 1 0 0 0 0 0 0 0 0 0 27 115.5 117 0 0 1 0 0 0 0 0 0 0 0 28 100.7 114 0 0 0 1 0 0 0 0 0 0 0 29 109.9 111 0 0 0 0 1 0 0 0 0 0 0 30 114.6 112 0 0 0 0 0 1 0 0 0 0 0 31 85.4 144 0 0 0 0 0 0 1 0 0 0 0 32 100.5 150 0 0 0 0 0 0 0 1 0 0 0 33 114.8 149 0 0 0 0 0 0 0 0 1 0 0 34 116.5 134 0 0 0 0 0 0 0 0 0 1 0 35 112.9 123 0 0 0 0 0 0 0 0 0 0 1 36 102.0 116 0 0 0 0 0 0 0 0 0 0 0 37 106.0 117 1 0 0 0 0 0 0 0 0 0 0 38 105.3 111 0 1 0 0 0 0 0 0 0 0 0 39 118.8 105 0 0 1 0 0 0 0 0 0 0 0 40 106.1 102 0 0 0 1 0 0 0 0 0 0 0 41 109.3 95 0 0 0 0 1 0 0 0 0 0 0 42 117.2 93 0 0 0 0 0 1 0 0 0 0 0 43 92.5 124 0 0 0 0 0 0 1 0 0 0 0 44 104.2 130 0 0 0 0 0 0 0 1 0 0 0 45 112.5 124 0 0 0 0 0 0 0 0 1 0 0 46 122.4 115 0 0 0 0 0 0 0 0 0 1 0 47 113.3 106 0 0 0 0 0 0 0 0 0 0 1 48 100.0 105 0 0 0 0 0 0 0 0 0 0 0 49 110.7 105 1 0 0 0 0 0 0 0 0 0 0 50 112.8 101 0 1 0 0 0 0 0 0 0 0 0 51 109.8 95 0 0 1 0 0 0 0 0 0 0 0 52 117.3 93 0 0 0 1 0 0 0 0 0 0 0 53 109.1 84 0 0 0 0 1 0 0 0 0 0 0 54 115.9 87 0 0 0 0 0 1 0 0 0 0 0 55 96.0 116 0 0 0 0 0 0 1 0 0 0 0 56 99.8 120 0 0 0 0 0 0 0 1 0 0 0 57 116.8 117 0 0 0 0 0 0 0 0 1 0 0 58 115.7 109 0 0 0 0 0 0 0 0 0 1 0 59 99.4 105 0 0 0 0 0 0 0 0 0 0 1 60 94.3 107 0 0 0 0 0 0 0 0 0 0 0 61 91.0 109 1 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) wrk M1 M2 M3 M4 121.3948 -0.1795 -0.4007 2.3000 11.1833 4.1614 M5 M6 M7 M8 M9 M10 1.8847 11.9041 -8.3340 3.8104 18.2956 16.2375 M11 8.1584 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -11.3107 -2.5523 0.5901 2.9142 8.5484 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 121.39482 5.92024 20.505 < 2e-16 *** wrk -0.17945 0.04627 -3.879 0.000319 *** M1 -0.40073 2.94741 -0.136 0.892421 M2 2.30000 3.07779 0.747 0.458535 M3 11.18329 3.09029 3.619 0.000710 *** M4 4.16137 3.11101 1.338 0.187322 M5 1.88465 3.16342 0.596 0.554131 M6 11.90411 3.15305 3.775 0.000440 *** M7 -8.33397 3.19090 -2.612 0.011986 * M8 3.81042 3.28472 1.160 0.251769 M9 18.29562 3.25056 5.628 9.22e-07 *** M10 16.23754 3.12584 5.195 4.14e-06 *** M11 8.15836 3.08092 2.648 0.010923 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.866 on 48 degrees of freedom Multiple R-squared: 0.7719, Adjusted R-squared: 0.7149 F-statistic: 13.53 on 12 and 48 DF, p-value: 1.362e-11 > 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.1558077422 0.3116154844 0.8441923 [2,] 0.0768466260 0.1536932519 0.9231534 [3,] 0.0474884736 0.0949769471 0.9525115 [4,] 0.0477199698 0.0954399396 0.9522800 [5,] 0.0219261381 0.0438522763 0.9780739 [6,] 0.0090807352 0.0181614704 0.9909193 [7,] 0.0078687700 0.0157375401 0.9921312 [8,] 0.0095581292 0.0191162584 0.9904419 [9,] 0.0051398591 0.0102797183 0.9948601 [10,] 0.0076127015 0.0152254030 0.9923873 [11,] 0.0075653231 0.0151306461 0.9924347 [12,] 0.0093121472 0.0186242944 0.9906879 [13,] 0.0092491813 0.0184983626 0.9907508 [14,] 0.0526308169 0.1052616339 0.9473692 [15,] 0.0315075174 0.0630150348 0.9684925 [16,] 0.0255704308 0.0511408616 0.9744296 [17,] 0.0149995939 0.0299991878 0.9850004 [18,] 0.0081272411 0.0162544822 0.9918728 [19,] 0.0061144886 0.0122289772 0.9938855 [20,] 0.0037862582 0.0075725163 0.9962137 [21,] 0.0035809188 0.0071618376 0.9964191 [22,] 0.0040277806 0.0080555612 0.9959722 [23,] 0.0025094536 0.0050189071 0.9974905 [24,] 0.0027891725 0.0055783450 0.9972108 [25,] 0.0027148640 0.0054297281 0.9972851 [26,] 0.0011893771 0.0023787543 0.9988106 [27,] 0.0005913908 0.0011827816 0.9994086 [28,] 0.0002181016 0.0004362033 0.9997819 [29,] 0.0001420874 0.0002841748 0.9998579 [30,] 0.0002300496 0.0004600993 0.9997700 > postscript(file="/var/www/html/rcomp/tmp/15vjs1260971632.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/2t06m1260971632.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/32all1260971632.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/4wp421260971632.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/5xyij1260971632.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 = 61 Frequency = 1 1 2 3 4 5 6 -1.4885815 -2.8276686 2.7328792 -1.1219158 -5.4219158 -1.0824635 7 8 9 10 11 12 1.7953455 0.6660309 3.3013735 -0.5939691 -0.7093118 4.4312359 13 14 15 16 17 18 -3.0652950 -5.0043820 -5.9849298 -1.7602725 -5.0808202 0.8791798 19 20 21 22 23 24 -5.4224635 -1.3312304 1.6835646 -5.3528736 3.8317837 4.5928792 25 26 27 28 29 30 0.4374438 -0.9221910 3.9178090 -4.3986292 6.5397275 1.3997275 31 32 33 34 35 36 -1.8197247 2.2126039 1.8479466 2.9142472 5.4194522 1.4216433 37 38 39 40 41 42 6.0018259 1.5243820 5.0643820 -1.1520562 3.0684916 0.5901349 43 44 45 46 47 48 1.6912304 2.3235590 -4.9383595 5.4046545 2.7687641 -2.5523314 49 50 51 52 53 54 8.5483989 7.2298596 -5.7301404 8.4328736 0.8945169 -1.7865786 55 56 57 58 59 60 3.7556124 -3.8709634 -1.8945252 -2.3720589 -11.3106882 -7.8934269 61 -10.4337921 > postscript(file="/var/www/html/rcomp/tmp/61cfr1260971632.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.4885815 NA 1 -2.8276686 -1.4885815 2 2.7328792 -2.8276686 3 -1.1219158 2.7328792 4 -5.4219158 -1.1219158 5 -1.0824635 -5.4219158 6 1.7953455 -1.0824635 7 0.6660309 1.7953455 8 3.3013735 0.6660309 9 -0.5939691 3.3013735 10 -0.7093118 -0.5939691 11 4.4312359 -0.7093118 12 -3.0652950 4.4312359 13 -5.0043820 -3.0652950 14 -5.9849298 -5.0043820 15 -1.7602725 -5.9849298 16 -5.0808202 -1.7602725 17 0.8791798 -5.0808202 18 -5.4224635 0.8791798 19 -1.3312304 -5.4224635 20 1.6835646 -1.3312304 21 -5.3528736 1.6835646 22 3.8317837 -5.3528736 23 4.5928792 3.8317837 24 0.4374438 4.5928792 25 -0.9221910 0.4374438 26 3.9178090 -0.9221910 27 -4.3986292 3.9178090 28 6.5397275 -4.3986292 29 1.3997275 6.5397275 30 -1.8197247 1.3997275 31 2.2126039 -1.8197247 32 1.8479466 2.2126039 33 2.9142472 1.8479466 34 5.4194522 2.9142472 35 1.4216433 5.4194522 36 6.0018259 1.4216433 37 1.5243820 6.0018259 38 5.0643820 1.5243820 39 -1.1520562 5.0643820 40 3.0684916 -1.1520562 41 0.5901349 3.0684916 42 1.6912304 0.5901349 43 2.3235590 1.6912304 44 -4.9383595 2.3235590 45 5.4046545 -4.9383595 46 2.7687641 5.4046545 47 -2.5523314 2.7687641 48 8.5483989 -2.5523314 49 7.2298596 8.5483989 50 -5.7301404 7.2298596 51 8.4328736 -5.7301404 52 0.8945169 8.4328736 53 -1.7865786 0.8945169 54 3.7556124 -1.7865786 55 -3.8709634 3.7556124 56 -1.8945252 -3.8709634 57 -2.3720589 -1.8945252 58 -11.3106882 -2.3720589 59 -7.8934269 -11.3106882 60 -10.4337921 -7.8934269 61 NA -10.4337921 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.8276686 -1.4885815 [2,] 2.7328792 -2.8276686 [3,] -1.1219158 2.7328792 [4,] -5.4219158 -1.1219158 [5,] -1.0824635 -5.4219158 [6,] 1.7953455 -1.0824635 [7,] 0.6660309 1.7953455 [8,] 3.3013735 0.6660309 [9,] -0.5939691 3.3013735 [10,] -0.7093118 -0.5939691 [11,] 4.4312359 -0.7093118 [12,] -3.0652950 4.4312359 [13,] -5.0043820 -3.0652950 [14,] -5.9849298 -5.0043820 [15,] -1.7602725 -5.9849298 [16,] -5.0808202 -1.7602725 [17,] 0.8791798 -5.0808202 [18,] -5.4224635 0.8791798 [19,] -1.3312304 -5.4224635 [20,] 1.6835646 -1.3312304 [21,] -5.3528736 1.6835646 [22,] 3.8317837 -5.3528736 [23,] 4.5928792 3.8317837 [24,] 0.4374438 4.5928792 [25,] -0.9221910 0.4374438 [26,] 3.9178090 -0.9221910 [27,] -4.3986292 3.9178090 [28,] 6.5397275 -4.3986292 [29,] 1.3997275 6.5397275 [30,] -1.8197247 1.3997275 [31,] 2.2126039 -1.8197247 [32,] 1.8479466 2.2126039 [33,] 2.9142472 1.8479466 [34,] 5.4194522 2.9142472 [35,] 1.4216433 5.4194522 [36,] 6.0018259 1.4216433 [37,] 1.5243820 6.0018259 [38,] 5.0643820 1.5243820 [39,] -1.1520562 5.0643820 [40,] 3.0684916 -1.1520562 [41,] 0.5901349 3.0684916 [42,] 1.6912304 0.5901349 [43,] 2.3235590 1.6912304 [44,] -4.9383595 2.3235590 [45,] 5.4046545 -4.9383595 [46,] 2.7687641 5.4046545 [47,] -2.5523314 2.7687641 [48,] 8.5483989 -2.5523314 [49,] 7.2298596 8.5483989 [50,] -5.7301404 7.2298596 [51,] 8.4328736 -5.7301404 [52,] 0.8945169 8.4328736 [53,] -1.7865786 0.8945169 [54,] 3.7556124 -1.7865786 [55,] -3.8709634 3.7556124 [56,] -1.8945252 -3.8709634 [57,] -2.3720589 -1.8945252 [58,] -11.3106882 -2.3720589 [59,] -7.8934269 -11.3106882 [60,] -10.4337921 -7.8934269 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.8276686 -1.4885815 2 2.7328792 -2.8276686 3 -1.1219158 2.7328792 4 -5.4219158 -1.1219158 5 -1.0824635 -5.4219158 6 1.7953455 -1.0824635 7 0.6660309 1.7953455 8 3.3013735 0.6660309 9 -0.5939691 3.3013735 10 -0.7093118 -0.5939691 11 4.4312359 -0.7093118 12 -3.0652950 4.4312359 13 -5.0043820 -3.0652950 14 -5.9849298 -5.0043820 15 -1.7602725 -5.9849298 16 -5.0808202 -1.7602725 17 0.8791798 -5.0808202 18 -5.4224635 0.8791798 19 -1.3312304 -5.4224635 20 1.6835646 -1.3312304 21 -5.3528736 1.6835646 22 3.8317837 -5.3528736 23 4.5928792 3.8317837 24 0.4374438 4.5928792 25 -0.9221910 0.4374438 26 3.9178090 -0.9221910 27 -4.3986292 3.9178090 28 6.5397275 -4.3986292 29 1.3997275 6.5397275 30 -1.8197247 1.3997275 31 2.2126039 -1.8197247 32 1.8479466 2.2126039 33 2.9142472 1.8479466 34 5.4194522 2.9142472 35 1.4216433 5.4194522 36 6.0018259 1.4216433 37 1.5243820 6.0018259 38 5.0643820 1.5243820 39 -1.1520562 5.0643820 40 3.0684916 -1.1520562 41 0.5901349 3.0684916 42 1.6912304 0.5901349 43 2.3235590 1.6912304 44 -4.9383595 2.3235590 45 5.4046545 -4.9383595 46 2.7687641 5.4046545 47 -2.5523314 2.7687641 48 8.5483989 -2.5523314 49 7.2298596 8.5483989 50 -5.7301404 7.2298596 51 8.4328736 -5.7301404 52 0.8945169 8.4328736 53 -1.7865786 0.8945169 54 3.7556124 -1.7865786 55 -3.8709634 3.7556124 56 -1.8945252 -3.8709634 57 -2.3720589 -1.8945252 58 -11.3106882 -2.3720589 59 -7.8934269 -11.3106882 60 -10.4337921 -7.8934269 > 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/741851260971632.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/8597p1260971632.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/9bn2e1260971632.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/10khg91260971632.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/11qq0b1260971632.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/1238wn1260971632.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/1304od1260971632.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/14yuun1260971632.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/15i9t71260971632.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/16syts1260971632.tab") + } > try(system("convert tmp/15vjs1260971632.ps tmp/15vjs1260971632.png",intern=TRUE)) character(0) > try(system("convert tmp/2t06m1260971632.ps tmp/2t06m1260971632.png",intern=TRUE)) character(0) > try(system("convert tmp/32all1260971632.ps tmp/32all1260971632.png",intern=TRUE)) character(0) > try(system("convert tmp/4wp421260971632.ps tmp/4wp421260971632.png",intern=TRUE)) character(0) > try(system("convert tmp/5xyij1260971632.ps tmp/5xyij1260971632.png",intern=TRUE)) character(0) > try(system("convert tmp/61cfr1260971632.ps tmp/61cfr1260971632.png",intern=TRUE)) character(0) > try(system("convert tmp/741851260971632.ps tmp/741851260971632.png",intern=TRUE)) character(0) > try(system("convert tmp/8597p1260971632.ps tmp/8597p1260971632.png",intern=TRUE)) character(0) > try(system("convert tmp/9bn2e1260971632.ps tmp/9bn2e1260971632.png",intern=TRUE)) character(0) > try(system("convert tmp/10khg91260971632.ps tmp/10khg91260971632.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.395 1.557 2.991