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(103.8 + ,122.5 + ,80.2 + ,19 + ,103.5 + ,122.4 + ,74.8 + ,18 + ,104.1 + ,121.9 + ,77.8 + ,19 + ,101.9 + ,122.2 + ,73 + ,19 + ,102 + ,123.7 + ,72 + ,22 + ,100.7 + ,122.6 + ,75.8 + ,23 + ,99 + ,115.7 + ,72.6 + ,20 + ,96.5 + ,116.1 + ,71.9 + ,14 + ,101.8 + ,120.5 + ,74.8 + ,14 + ,100.5 + ,122.6 + ,72.9 + ,14 + ,103.3 + ,119.9 + ,72.9 + ,15 + ,102.3 + ,120.7 + ,79.9 + ,11 + ,100.4 + ,120.2 + ,74 + ,17 + ,103 + ,122.1 + ,76 + ,16 + ,99 + ,119.3 + ,69.6 + ,20 + ,104.8 + ,121.7 + ,77.3 + ,24 + ,104.5 + ,113.5 + ,75.2 + ,23 + ,104.8 + ,123.7 + ,75.8 + ,20 + ,103.8 + ,123.4 + ,77.6 + ,21 + ,106.3 + ,126.4 + ,76.7 + ,19 + ,105.2 + ,124.1 + ,77 + ,23 + ,108.2 + ,125.6 + ,77.9 + ,23 + ,106.2 + ,124.8 + ,76.7 + ,23 + ,103.9 + ,123 + ,71.9 + ,23 + ,104.9 + ,126.9 + ,73.4 + ,27 + ,106.2 + ,127.3 + ,72.5 + ,26 + ,107.9 + ,129 + ,73.7 + ,17 + ,106.9 + ,126.2 + ,69.5 + ,24 + ,110.3 + ,125.4 + ,74.7 + ,26 + ,109.8 + ,126.3 + ,72.5 + ,24 + ,108.3 + ,126.3 + ,72.1 + ,27 + ,110.9 + ,128.4 + ,70.7 + ,27 + ,109.8 + ,127.2 + ,71.4 + ,26 + ,109.3 + ,128.5 + ,69.5 + ,24 + ,109 + ,129 + ,73.5 + ,23 + ,107.9 + ,128.9 + ,72.4 + ,23 + ,108.4 + ,128.3 + ,74.5 + ,24 + ,107.2 + ,124.6 + ,72.2 + ,17 + ,109.5 + ,126.2 + ,73 + ,21 + ,109.9 + ,129.1 + ,73.3 + ,19 + ,108 + ,127.3 + ,71.3 + ,22 + ,114.7 + ,129.2 + ,73.6 + ,22 + ,115.6 + ,130.4 + ,71.3 + ,18 + ,107.6 + ,125.9 + ,71.2 + ,16 + ,115.9 + ,135.8 + ,81.4 + ,14 + ,111.8 + ,126.4 + ,76.1 + ,12 + ,110 + ,129.5 + ,71.1 + ,14 + ,109.2 + ,128.4 + ,75.7 + ,16 + ,108 + ,125.6 + ,70 + ,8 + ,105.6 + ,127.7 + ,68.5 + ,3 + ,103 + ,126.4 + ,56.7 + ,0 + ,99.6 + ,124.2 + ,57.9 + ,5 + ,97.9 + ,126.4 + ,58.8 + ,1 + ,97.6 + ,123.7 + ,59.3 + ,1 + ,96.2 + ,121.8 + ,61.3 + ,3 + ,97.9 + ,124 + ,62.9 + ,6 + ,94.5 + ,122.7 + ,61.4 + ,7 + ,95.4 + ,122.9 + ,64.5 + ,8 + ,94.4 + ,121 + ,63.8 + ,14 + ,96.3 + ,122.8 + ,61.6 + ,14 + ,95.1 + ,122.9 + ,64.7 + ,13) + ,dim=c(4 + ,61) + ,dimnames=list(c('totid' + ,'ndzcg' + ,'dzcg' + ,'indc ') + ,1:61)) > y <- array(NA,dim=c(4,61),dimnames=list(c('totid','ndzcg','dzcg','indc '),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 = '3' > #'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 dzcg totid ndzcg indc\r M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 80.2 103.8 122.5 19 1 0 0 0 0 0 0 0 0 0 0 2 74.8 103.5 122.4 18 0 1 0 0 0 0 0 0 0 0 0 3 77.8 104.1 121.9 19 0 0 1 0 0 0 0 0 0 0 0 4 73.0 101.9 122.2 19 0 0 0 1 0 0 0 0 0 0 0 5 72.0 102.0 123.7 22 0 0 0 0 1 0 0 0 0 0 0 6 75.8 100.7 122.6 23 0 0 0 0 0 1 0 0 0 0 0 7 72.6 99.0 115.7 20 0 0 0 0 0 0 1 0 0 0 0 8 71.9 96.5 116.1 14 0 0 0 0 0 0 0 1 0 0 0 9 74.8 101.8 120.5 14 0 0 0 0 0 0 0 0 1 0 0 10 72.9 100.5 122.6 14 0 0 0 0 0 0 0 0 0 1 0 11 72.9 103.3 119.9 15 0 0 0 0 0 0 0 0 0 0 1 12 79.9 102.3 120.7 11 0 0 0 0 0 0 0 0 0 0 0 13 74.0 100.4 120.2 17 1 0 0 0 0 0 0 0 0 0 0 14 76.0 103.0 122.1 16 0 1 0 0 0 0 0 0 0 0 0 15 69.6 99.0 119.3 20 0 0 1 0 0 0 0 0 0 0 0 16 77.3 104.8 121.7 24 0 0 0 1 0 0 0 0 0 0 0 17 75.2 104.5 113.5 23 0 0 0 0 1 0 0 0 0 0 0 18 75.8 104.8 123.7 20 0 0 0 0 0 1 0 0 0 0 0 19 77.6 103.8 123.4 21 0 0 0 0 0 0 1 0 0 0 0 20 76.7 106.3 126.4 19 0 0 0 0 0 0 0 1 0 0 0 21 77.0 105.2 124.1 23 0 0 0 0 0 0 0 0 1 0 0 22 77.9 108.2 125.6 23 0 0 0 0 0 0 0 0 0 1 0 23 76.7 106.2 124.8 23 0 0 0 0 0 0 0 0 0 0 1 24 71.9 103.9 123.0 23 0 0 0 0 0 0 0 0 0 0 0 25 73.4 104.9 126.9 27 1 0 0 0 0 0 0 0 0 0 0 26 72.5 106.2 127.3 26 0 1 0 0 0 0 0 0 0 0 0 27 73.7 107.9 129.0 17 0 0 1 0 0 0 0 0 0 0 0 28 69.5 106.9 126.2 24 0 0 0 1 0 0 0 0 0 0 0 29 74.7 110.3 125.4 26 0 0 0 0 1 0 0 0 0 0 0 30 72.5 109.8 126.3 24 0 0 0 0 0 1 0 0 0 0 0 31 72.1 108.3 126.3 27 0 0 0 0 0 0 1 0 0 0 0 32 70.7 110.9 128.4 27 0 0 0 0 0 0 0 1 0 0 0 33 71.4 109.8 127.2 26 0 0 0 0 0 0 0 0 1 0 0 34 69.5 109.3 128.5 24 0 0 0 0 0 0 0 0 0 1 0 35 73.5 109.0 129.0 23 0 0 0 0 0 0 0 0 0 0 1 36 72.4 107.9 128.9 23 0 0 0 0 0 0 0 0 0 0 0 37 74.5 108.4 128.3 24 1 0 0 0 0 0 0 0 0 0 0 38 72.2 107.2 124.6 17 0 1 0 0 0 0 0 0 0 0 0 39 73.0 109.5 126.2 21 0 0 1 0 0 0 0 0 0 0 0 40 73.3 109.9 129.1 19 0 0 0 1 0 0 0 0 0 0 0 41 71.3 108.0 127.3 22 0 0 0 0 1 0 0 0 0 0 0 42 73.6 114.7 129.2 22 0 0 0 0 0 1 0 0 0 0 0 43 71.3 115.6 130.4 18 0 0 0 0 0 0 1 0 0 0 0 44 71.2 107.6 125.9 16 0 0 0 0 0 0 0 1 0 0 0 45 81.4 115.9 135.8 14 0 0 0 0 0 0 0 0 1 0 0 46 76.1 111.8 126.4 12 0 0 0 0 0 0 0 0 0 1 0 47 71.1 110.0 129.5 14 0 0 0 0 0 0 0 0 0 0 1 48 75.7 109.2 128.4 16 0 0 0 0 0 0 0 0 0 0 0 49 70.0 108.0 125.6 8 1 0 0 0 0 0 0 0 0 0 0 50 68.5 105.6 127.7 3 0 1 0 0 0 0 0 0 0 0 0 51 56.7 103.0 126.4 0 0 0 1 0 0 0 0 0 0 0 0 52 57.9 99.6 124.2 5 0 0 0 1 0 0 0 0 0 0 0 53 58.8 97.9 126.4 1 0 0 0 0 1 0 0 0 0 0 0 54 59.3 97.6 123.7 1 0 0 0 0 0 1 0 0 0 0 0 55 61.3 96.2 121.8 3 0 0 0 0 0 0 1 0 0 0 0 56 62.9 97.9 124.0 6 0 0 0 0 0 0 0 1 0 0 0 57 61.4 94.5 122.7 7 0 0 0 0 0 0 0 0 1 0 0 58 64.5 95.4 122.9 8 0 0 0 0 0 0 0 0 0 1 0 59 63.8 94.4 121.0 14 0 0 0 0 0 0 0 0 0 0 1 60 61.6 96.3 122.8 14 0 0 0 0 0 0 0 0 0 0 0 61 64.7 95.1 122.9 13 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) totid ndzcg `indc\r` M1 M2 86.4486 0.8204 -0.8344 0.2700 0.4369 -0.0400 M3 M4 M5 M6 M7 M8 -2.4068 -2.9571 -4.0384 -2.0910 -3.0042 -1.7850 M9 M10 M11 0.8998 -0.3477 -1.2827 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.9100 -2.1801 -0.2320 2.3334 8.5019 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 86.44863 16.94844 5.101 6.27e-06 *** totid 0.82042 0.16820 4.878 1.32e-05 *** ndzcg -0.83444 0.20597 -4.051 0.000194 *** `indc\r` 0.27002 0.08829 3.058 0.003702 ** M1 0.43686 2.32707 0.188 0.851915 M2 -0.04000 2.44511 -0.016 0.987019 M3 -2.40677 2.44768 -0.983 0.330609 M4 -2.95707 2.43105 -1.216 0.230046 M5 -4.03836 2.45427 -1.645 0.106696 M6 -2.09098 2.43641 -0.858 0.395220 M7 -3.00420 2.45130 -1.226 0.226605 M8 -1.78501 2.43453 -0.733 0.467153 M9 0.89975 2.43718 0.369 0.713690 M10 -0.34769 2.43812 -0.143 0.887225 M11 -1.28273 2.43017 -0.528 0.600149 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.84 on 46 degrees of freedom Multiple R-squared: 0.6505, Adjusted R-squared: 0.5442 F-statistic: 6.116 on 14 and 46 DF, p-value: 1.304e-06 > 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.2300968 0.4601936 0.7699032 [2,] 0.1575753 0.3151507 0.8424247 [3,] 0.2706477 0.5412954 0.7293523 [4,] 0.1846653 0.3693305 0.8153347 [5,] 0.1288536 0.2577071 0.8711464 [6,] 0.1007260 0.2014520 0.8992740 [7,] 0.2770375 0.5540749 0.7229625 [8,] 0.2307549 0.4615098 0.7692451 [9,] 0.1674792 0.3349583 0.8325208 [10,] 0.3091459 0.6182918 0.6908541 [11,] 0.4346696 0.8693392 0.5653304 [12,] 0.3588418 0.7176836 0.6411582 [13,] 0.4412665 0.8825329 0.5587335 [14,] 0.3942774 0.7885548 0.6057226 [15,] 0.3996350 0.7992700 0.6003650 [16,] 0.4863440 0.9726880 0.5136560 [17,] 0.7331853 0.5336293 0.2668147 [18,] 0.6421658 0.7156683 0.3578342 [19,] 0.5689223 0.8621553 0.4310777 [20,] 0.4843998 0.9687996 0.5156002 [21,] 0.4195663 0.8391326 0.5804337 [22,] 0.4795949 0.9591897 0.5204051 [23,] 0.5052147 0.9895705 0.4947853 [24,] 0.4408491 0.8816982 0.5591509 [25,] 0.3168644 0.6337289 0.6831356 [26,] 0.5140807 0.9718387 0.4859193 > postscript(file="/var/www/html/rcomp/tmp/1lk2f1258746295.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/2gwxq1258746295.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/3r85a1258746295.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/4aczi1258746295.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/58hze1258746295.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 5.24371074 0.75327319 4.94054719 2.74610718 3.18695338 4.91820711 7 8 9 10 11 12 -0.92145179 1.16433137 0.70289011 2.86921182 -1.01595049 7.26938788 13 14 15 16 17 18 0.45397006 2.65319738 -1.51487898 2.89954456 -4.44545916 3.28243512 19 20 21 22 23 24 6.29572153 5.16885686 0.68724596 1.62508585 2.33341752 -3.36434406 25 26 27 28 29 30 -0.94738369 -1.83327438 4.18754566 -2.86834159 -0.58408750 -3.03021271 31 32 33 34 35 36 -2.09642838 -5.09638181 -6.90998753 -5.52751264 0.34090254 -1.22280992 37 38 39 40 41 42 -0.74056906 -2.77648748 -1.24166733 2.24039736 0.56842092 -2.99034552 43 44 45 46 47 48 -3.03407815 -1.00484442 8.50193926 0.50937752 -0.03208813 2.48358178 49 50 51 52 53 54 -2.84502849 1.20329130 -6.37154655 -5.01770751 1.27417237 -2.18008400 55 56 57 58 59 60 -0.24376320 -0.23196201 -2.98208780 0.52383744 -1.62628143 -5.16581567 61 -1.16469956 > postscript(file="/var/www/html/rcomp/tmp/6c5b91258746295.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 5.24371074 NA 1 0.75327319 5.24371074 2 4.94054719 0.75327319 3 2.74610718 4.94054719 4 3.18695338 2.74610718 5 4.91820711 3.18695338 6 -0.92145179 4.91820711 7 1.16433137 -0.92145179 8 0.70289011 1.16433137 9 2.86921182 0.70289011 10 -1.01595049 2.86921182 11 7.26938788 -1.01595049 12 0.45397006 7.26938788 13 2.65319738 0.45397006 14 -1.51487898 2.65319738 15 2.89954456 -1.51487898 16 -4.44545916 2.89954456 17 3.28243512 -4.44545916 18 6.29572153 3.28243512 19 5.16885686 6.29572153 20 0.68724596 5.16885686 21 1.62508585 0.68724596 22 2.33341752 1.62508585 23 -3.36434406 2.33341752 24 -0.94738369 -3.36434406 25 -1.83327438 -0.94738369 26 4.18754566 -1.83327438 27 -2.86834159 4.18754566 28 -0.58408750 -2.86834159 29 -3.03021271 -0.58408750 30 -2.09642838 -3.03021271 31 -5.09638181 -2.09642838 32 -6.90998753 -5.09638181 33 -5.52751264 -6.90998753 34 0.34090254 -5.52751264 35 -1.22280992 0.34090254 36 -0.74056906 -1.22280992 37 -2.77648748 -0.74056906 38 -1.24166733 -2.77648748 39 2.24039736 -1.24166733 40 0.56842092 2.24039736 41 -2.99034552 0.56842092 42 -3.03407815 -2.99034552 43 -1.00484442 -3.03407815 44 8.50193926 -1.00484442 45 0.50937752 8.50193926 46 -0.03208813 0.50937752 47 2.48358178 -0.03208813 48 -2.84502849 2.48358178 49 1.20329130 -2.84502849 50 -6.37154655 1.20329130 51 -5.01770751 -6.37154655 52 1.27417237 -5.01770751 53 -2.18008400 1.27417237 54 -0.24376320 -2.18008400 55 -0.23196201 -0.24376320 56 -2.98208780 -0.23196201 57 0.52383744 -2.98208780 58 -1.62628143 0.52383744 59 -5.16581567 -1.62628143 60 -1.16469956 -5.16581567 61 NA -1.16469956 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.75327319 5.24371074 [2,] 4.94054719 0.75327319 [3,] 2.74610718 4.94054719 [4,] 3.18695338 2.74610718 [5,] 4.91820711 3.18695338 [6,] -0.92145179 4.91820711 [7,] 1.16433137 -0.92145179 [8,] 0.70289011 1.16433137 [9,] 2.86921182 0.70289011 [10,] -1.01595049 2.86921182 [11,] 7.26938788 -1.01595049 [12,] 0.45397006 7.26938788 [13,] 2.65319738 0.45397006 [14,] -1.51487898 2.65319738 [15,] 2.89954456 -1.51487898 [16,] -4.44545916 2.89954456 [17,] 3.28243512 -4.44545916 [18,] 6.29572153 3.28243512 [19,] 5.16885686 6.29572153 [20,] 0.68724596 5.16885686 [21,] 1.62508585 0.68724596 [22,] 2.33341752 1.62508585 [23,] -3.36434406 2.33341752 [24,] -0.94738369 -3.36434406 [25,] -1.83327438 -0.94738369 [26,] 4.18754566 -1.83327438 [27,] -2.86834159 4.18754566 [28,] -0.58408750 -2.86834159 [29,] -3.03021271 -0.58408750 [30,] -2.09642838 -3.03021271 [31,] -5.09638181 -2.09642838 [32,] -6.90998753 -5.09638181 [33,] -5.52751264 -6.90998753 [34,] 0.34090254 -5.52751264 [35,] -1.22280992 0.34090254 [36,] -0.74056906 -1.22280992 [37,] -2.77648748 -0.74056906 [38,] -1.24166733 -2.77648748 [39,] 2.24039736 -1.24166733 [40,] 0.56842092 2.24039736 [41,] -2.99034552 0.56842092 [42,] -3.03407815 -2.99034552 [43,] -1.00484442 -3.03407815 [44,] 8.50193926 -1.00484442 [45,] 0.50937752 8.50193926 [46,] -0.03208813 0.50937752 [47,] 2.48358178 -0.03208813 [48,] -2.84502849 2.48358178 [49,] 1.20329130 -2.84502849 [50,] -6.37154655 1.20329130 [51,] -5.01770751 -6.37154655 [52,] 1.27417237 -5.01770751 [53,] -2.18008400 1.27417237 [54,] -0.24376320 -2.18008400 [55,] -0.23196201 -0.24376320 [56,] -2.98208780 -0.23196201 [57,] 0.52383744 -2.98208780 [58,] -1.62628143 0.52383744 [59,] -5.16581567 -1.62628143 [60,] -1.16469956 -5.16581567 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.75327319 5.24371074 2 4.94054719 0.75327319 3 2.74610718 4.94054719 4 3.18695338 2.74610718 5 4.91820711 3.18695338 6 -0.92145179 4.91820711 7 1.16433137 -0.92145179 8 0.70289011 1.16433137 9 2.86921182 0.70289011 10 -1.01595049 2.86921182 11 7.26938788 -1.01595049 12 0.45397006 7.26938788 13 2.65319738 0.45397006 14 -1.51487898 2.65319738 15 2.89954456 -1.51487898 16 -4.44545916 2.89954456 17 3.28243512 -4.44545916 18 6.29572153 3.28243512 19 5.16885686 6.29572153 20 0.68724596 5.16885686 21 1.62508585 0.68724596 22 2.33341752 1.62508585 23 -3.36434406 2.33341752 24 -0.94738369 -3.36434406 25 -1.83327438 -0.94738369 26 4.18754566 -1.83327438 27 -2.86834159 4.18754566 28 -0.58408750 -2.86834159 29 -3.03021271 -0.58408750 30 -2.09642838 -3.03021271 31 -5.09638181 -2.09642838 32 -6.90998753 -5.09638181 33 -5.52751264 -6.90998753 34 0.34090254 -5.52751264 35 -1.22280992 0.34090254 36 -0.74056906 -1.22280992 37 -2.77648748 -0.74056906 38 -1.24166733 -2.77648748 39 2.24039736 -1.24166733 40 0.56842092 2.24039736 41 -2.99034552 0.56842092 42 -3.03407815 -2.99034552 43 -1.00484442 -3.03407815 44 8.50193926 -1.00484442 45 0.50937752 8.50193926 46 -0.03208813 0.50937752 47 2.48358178 -0.03208813 48 -2.84502849 2.48358178 49 1.20329130 -2.84502849 50 -6.37154655 1.20329130 51 -5.01770751 -6.37154655 52 1.27417237 -5.01770751 53 -2.18008400 1.27417237 54 -0.24376320 -2.18008400 55 -0.23196201 -0.24376320 56 -2.98208780 -0.23196201 57 0.52383744 -2.98208780 58 -1.62628143 0.52383744 59 -5.16581567 -1.62628143 60 -1.16469956 -5.16581567 > 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/7noxo1258746295.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/8jl6h1258746295.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/9az8j1258746295.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/10yedl1258746295.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/117uli1258746295.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/123wjk1258746295.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/13ac8f1258746296.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/143pao1258746296.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/15rt3v1258746296.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/168r0m1258746296.tab") + } > > system("convert tmp/1lk2f1258746295.ps tmp/1lk2f1258746295.png") > system("convert tmp/2gwxq1258746295.ps tmp/2gwxq1258746295.png") > system("convert tmp/3r85a1258746295.ps tmp/3r85a1258746295.png") > system("convert tmp/4aczi1258746295.ps tmp/4aczi1258746295.png") > system("convert tmp/58hze1258746295.ps tmp/58hze1258746295.png") > system("convert tmp/6c5b91258746295.ps tmp/6c5b91258746295.png") > system("convert tmp/7noxo1258746295.ps tmp/7noxo1258746295.png") > system("convert tmp/8jl6h1258746295.ps tmp/8jl6h1258746295.png") > system("convert tmp/9az8j1258746295.ps tmp/9az8j1258746295.png") > system("convert tmp/10yedl1258746295.ps tmp/10yedl1258746295.png") > > > proc.time() user system elapsed 2.462 1.597 2.847