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(135,0,139,149,130,0,135,139,127,0,130,135,122,0,127,130,117,0,122,127,112,0,117,122,113,0,112,117,149,0,113,112,157,0,149,113,157,0,157,149,147,0,157,157,137,0,147,157,132,0,137,147,125,0,132,137,123,0,125,132,117,0,123,125,114,0,117,123,111,0,114,117,112,0,111,114,144,0,112,111,150,0,144,112,149,0,150,144,134,0,149,150,123,0,134,149,116,0,123,134,117,0,116,123,111,0,117,116,105,0,111,117,102,0,105,111,95,0,102,105,93,0,95,102,124,0,93,95,130,0,124,93,124,0,130,124,115,0,124,130,106,0,115,124,105,0,106,115,105,0,105,106,101,0,105,105,95,0,101,105,93,0,95,101,84,0,93,95,87,0,84,93,116,0,87,84,120,0,116,87,117,1,120,116,109,1,117,120,105,1,109,117,107,1,105,109,109,1,107,105,109,1,109,107,108,1,109,109,107,1,108,109,99,1,107,108,103,1,99,107,131,1,103,99,137,1,131,103,135,1,137,131),dim=c(4,58),dimnames=list(c('WLH','X','Y(t-1)','Y(t-2)'),1:58)) > y <- array(NA,dim=c(4,58),dimnames=list(c('WLH','X','Y(t-1)','Y(t-2)'),1:58)) > 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 WLH X Y(t-1) Y(t-2) M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 135 0 139 149 1 0 0 0 0 0 0 0 0 0 0 1 2 130 0 135 139 0 1 0 0 0 0 0 0 0 0 0 2 3 127 0 130 135 0 0 1 0 0 0 0 0 0 0 0 3 4 122 0 127 130 0 0 0 1 0 0 0 0 0 0 0 4 5 117 0 122 127 0 0 0 0 1 0 0 0 0 0 0 5 6 112 0 117 122 0 0 0 0 0 1 0 0 0 0 0 6 7 113 0 112 117 0 0 0 0 0 0 1 0 0 0 0 7 8 149 0 113 112 0 0 0 0 0 0 0 1 0 0 0 8 9 157 0 149 113 0 0 0 0 0 0 0 0 1 0 0 9 10 157 0 157 149 0 0 0 0 0 0 0 0 0 1 0 10 11 147 0 157 157 0 0 0 0 0 0 0 0 0 0 1 11 12 137 0 147 157 0 0 0 0 0 0 0 0 0 0 0 12 13 132 0 137 147 1 0 0 0 0 0 0 0 0 0 0 13 14 125 0 132 137 0 1 0 0 0 0 0 0 0 0 0 14 15 123 0 125 132 0 0 1 0 0 0 0 0 0 0 0 15 16 117 0 123 125 0 0 0 1 0 0 0 0 0 0 0 16 17 114 0 117 123 0 0 0 0 1 0 0 0 0 0 0 17 18 111 0 114 117 0 0 0 0 0 1 0 0 0 0 0 18 19 112 0 111 114 0 0 0 0 0 0 1 0 0 0 0 19 20 144 0 112 111 0 0 0 0 0 0 0 1 0 0 0 20 21 150 0 144 112 0 0 0 0 0 0 0 0 1 0 0 21 22 149 0 150 144 0 0 0 0 0 0 0 0 0 1 0 22 23 134 0 149 150 0 0 0 0 0 0 0 0 0 0 1 23 24 123 0 134 149 0 0 0 0 0 0 0 0 0 0 0 24 25 116 0 123 134 1 0 0 0 0 0 0 0 0 0 0 25 26 117 0 116 123 0 1 0 0 0 0 0 0 0 0 0 26 27 111 0 117 116 0 0 1 0 0 0 0 0 0 0 0 27 28 105 0 111 117 0 0 0 1 0 0 0 0 0 0 0 28 29 102 0 105 111 0 0 0 0 1 0 0 0 0 0 0 29 30 95 0 102 105 0 0 0 0 0 1 0 0 0 0 0 30 31 93 0 95 102 0 0 0 0 0 0 1 0 0 0 0 31 32 124 0 93 95 0 0 0 0 0 0 0 1 0 0 0 32 33 130 0 124 93 0 0 0 0 0 0 0 0 1 0 0 33 34 124 0 130 124 0 0 0 0 0 0 0 0 0 1 0 34 35 115 0 124 130 0 0 0 0 0 0 0 0 0 0 1 35 36 106 0 115 124 0 0 0 0 0 0 0 0 0 0 0 36 37 105 0 106 115 1 0 0 0 0 0 0 0 0 0 0 37 38 105 0 105 106 0 1 0 0 0 0 0 0 0 0 0 38 39 101 0 105 105 0 0 1 0 0 0 0 0 0 0 0 39 40 95 0 101 105 0 0 0 1 0 0 0 0 0 0 0 40 41 93 0 95 101 0 0 0 0 1 0 0 0 0 0 0 41 42 84 0 93 95 0 0 0 0 0 1 0 0 0 0 0 42 43 87 0 84 93 0 0 0 0 0 0 1 0 0 0 0 43 44 116 0 87 84 0 0 0 0 0 0 0 1 0 0 0 44 45 120 0 116 87 0 0 0 0 0 0 0 0 1 0 0 45 46 117 1 120 116 0 0 0 0 0 0 0 0 0 1 0 46 47 109 1 117 120 0 0 0 0 0 0 0 0 0 0 1 47 48 105 1 109 117 0 0 0 0 0 0 0 0 0 0 0 48 49 107 1 105 109 1 0 0 0 0 0 0 0 0 0 0 49 50 109 1 107 105 0 1 0 0 0 0 0 0 0 0 0 50 51 109 1 109 107 0 0 1 0 0 0 0 0 0 0 0 51 52 108 1 109 109 0 0 0 1 0 0 0 0 0 0 0 52 53 107 1 108 109 0 0 0 0 1 0 0 0 0 0 0 53 54 99 1 107 108 0 0 0 0 0 1 0 0 0 0 0 54 55 103 1 99 107 0 0 0 0 0 0 1 0 0 0 0 55 56 131 1 103 99 0 0 0 0 0 0 0 1 0 0 0 56 57 137 1 131 103 0 0 0 0 0 0 0 0 1 0 0 57 58 135 1 137 131 0 0 0 0 0 0 0 0 0 1 0 58 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X `Y(t-1)` `Y(t-2)` M1 M2 12.3068 4.3301 1.0187 -0.1490 4.2634 4.3378 M3 M4 M5 M6 M7 M8 2.8537 0.9708 2.7428 -1.3907 6.2410 35.1906 M9 M10 M11 t 9.7455 5.1444 -1.9530 -0.1292 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3.8929 -1.2099 -0.1176 1.5217 4.1096 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 12.30683 8.19304 1.502 0.14055 X 4.33015 1.34071 3.230 0.00241 ** `Y(t-1)` 1.01869 0.14445 7.052 1.23e-08 *** `Y(t-2)` -0.14897 0.14104 -1.056 0.29690 M1 4.26344 1.68134 2.536 0.01503 * M2 4.33778 2.02861 2.138 0.03835 * M3 2.85372 2.14441 1.331 0.19045 M4 0.97084 2.08789 0.465 0.64434 M5 2.74284 2.05206 1.337 0.18854 M6 -1.39069 2.24537 -0.619 0.53903 M7 6.24100 2.18492 2.856 0.00663 ** M8 35.19065 2.70429 13.013 2.50e-16 *** M9 9.74545 6.07991 1.603 0.11645 M10 5.14442 2.81462 1.828 0.07470 . M11 -1.95299 2.05956 -0.948 0.34843 t -0.12922 0.05141 -2.513 0.01588 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.388 on 42 degrees of freedom Multiple R-squared: 0.9861, Adjusted R-squared: 0.9811 F-statistic: 198 on 15 and 42 DF, p-value: < 2.2e-16 > 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.19283014 0.38566029 0.80716986 [2,] 0.14057581 0.28115161 0.85942419 [3,] 0.07171627 0.14343254 0.92828373 [4,] 0.20885123 0.41770247 0.79114877 [5,] 0.56289032 0.87421936 0.43710968 [6,] 0.44876986 0.89753973 0.55123014 [7,] 0.52226363 0.95547274 0.47773637 [8,] 0.88698099 0.22603801 0.11301901 [9,] 0.89323302 0.21353396 0.10676698 [10,] 0.85145444 0.29709113 0.14854556 [11,] 0.78467828 0.43064344 0.21532172 [12,] 0.78627483 0.42745034 0.21372517 [13,] 0.90647891 0.18704219 0.09352109 [14,] 0.94554095 0.10891811 0.05445905 [15,] 0.96153490 0.07693020 0.03846510 [16,] 0.94773855 0.10452290 0.05226145 [17,] 0.98067172 0.03865656 0.01932828 [18,] 0.95888520 0.08222960 0.04111480 [19,] 0.94206818 0.11586364 0.05793182 [20,] 0.96386400 0.07227201 0.03613600 [21,] 0.98872178 0.02255645 0.01127822 > postscript(file="/var/www/html/rcomp/tmp/1z6b21258620691.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/2a3p81258620691.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/3euwh1258620691.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/4njiz1258620691.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/58bg61258620691.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 = 58 Frequency = 1 1 2 3 4 5 6 -0.84161433 -3.20169435 -0.09087303 -0.76757994 -2.76384292 0.84747006 7 8 9 10 11 12 -1.30642504 4.10960826 1.16033155 3.10405159 1.52244685 -0.11446842 13 14 15 16 17 18 -0.55155177 -3.89294672 2.10627384 -0.88705995 0.28433304 3.70930497 19 20 21 22 23 24 -0.18401846 1.52995666 0.65542023 3.04062679 -2.82023470 -0.51269551 25 26 27 28 29 30 -2.67594833 3.87105596 -2.57714588 -0.30397212 0.27153724 -0.30349083 31 32 33 34 35 36 -3.12207397 0.05207273 -0.25069134 -3.01445569 2.21810818 -0.33131761 37 38 39 40 41 42 2.36188487 2.09472055 -0.44097077 -0.35413806 1.51931312 -2.07440003 43 44 45 46 47 48 2.29335788 -1.92386259 -1.44440198 -3.79888716 -0.92032033 0.95848154 49 50 51 52 53 54 1.70722957 1.12886457 1.00271583 2.31275007 0.68865952 -2.17888416 55 56 57 58 2.31915959 -3.76777505 -0.12065846 0.66866447 > postscript(file="/var/www/html/rcomp/tmp/68xwq1258620691.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 = 58 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.84161433 NA 1 -3.20169435 -0.84161433 2 -0.09087303 -3.20169435 3 -0.76757994 -0.09087303 4 -2.76384292 -0.76757994 5 0.84747006 -2.76384292 6 -1.30642504 0.84747006 7 4.10960826 -1.30642504 8 1.16033155 4.10960826 9 3.10405159 1.16033155 10 1.52244685 3.10405159 11 -0.11446842 1.52244685 12 -0.55155177 -0.11446842 13 -3.89294672 -0.55155177 14 2.10627384 -3.89294672 15 -0.88705995 2.10627384 16 0.28433304 -0.88705995 17 3.70930497 0.28433304 18 -0.18401846 3.70930497 19 1.52995666 -0.18401846 20 0.65542023 1.52995666 21 3.04062679 0.65542023 22 -2.82023470 3.04062679 23 -0.51269551 -2.82023470 24 -2.67594833 -0.51269551 25 3.87105596 -2.67594833 26 -2.57714588 3.87105596 27 -0.30397212 -2.57714588 28 0.27153724 -0.30397212 29 -0.30349083 0.27153724 30 -3.12207397 -0.30349083 31 0.05207273 -3.12207397 32 -0.25069134 0.05207273 33 -3.01445569 -0.25069134 34 2.21810818 -3.01445569 35 -0.33131761 2.21810818 36 2.36188487 -0.33131761 37 2.09472055 2.36188487 38 -0.44097077 2.09472055 39 -0.35413806 -0.44097077 40 1.51931312 -0.35413806 41 -2.07440003 1.51931312 42 2.29335788 -2.07440003 43 -1.92386259 2.29335788 44 -1.44440198 -1.92386259 45 -3.79888716 -1.44440198 46 -0.92032033 -3.79888716 47 0.95848154 -0.92032033 48 1.70722957 0.95848154 49 1.12886457 1.70722957 50 1.00271583 1.12886457 51 2.31275007 1.00271583 52 0.68865952 2.31275007 53 -2.17888416 0.68865952 54 2.31915959 -2.17888416 55 -3.76777505 2.31915959 56 -0.12065846 -3.76777505 57 0.66866447 -0.12065846 58 NA 0.66866447 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -3.20169435 -0.84161433 [2,] -0.09087303 -3.20169435 [3,] -0.76757994 -0.09087303 [4,] -2.76384292 -0.76757994 [5,] 0.84747006 -2.76384292 [6,] -1.30642504 0.84747006 [7,] 4.10960826 -1.30642504 [8,] 1.16033155 4.10960826 [9,] 3.10405159 1.16033155 [10,] 1.52244685 3.10405159 [11,] -0.11446842 1.52244685 [12,] -0.55155177 -0.11446842 [13,] -3.89294672 -0.55155177 [14,] 2.10627384 -3.89294672 [15,] -0.88705995 2.10627384 [16,] 0.28433304 -0.88705995 [17,] 3.70930497 0.28433304 [18,] -0.18401846 3.70930497 [19,] 1.52995666 -0.18401846 [20,] 0.65542023 1.52995666 [21,] 3.04062679 0.65542023 [22,] -2.82023470 3.04062679 [23,] -0.51269551 -2.82023470 [24,] -2.67594833 -0.51269551 [25,] 3.87105596 -2.67594833 [26,] -2.57714588 3.87105596 [27,] -0.30397212 -2.57714588 [28,] 0.27153724 -0.30397212 [29,] -0.30349083 0.27153724 [30,] -3.12207397 -0.30349083 [31,] 0.05207273 -3.12207397 [32,] -0.25069134 0.05207273 [33,] -3.01445569 -0.25069134 [34,] 2.21810818 -3.01445569 [35,] -0.33131761 2.21810818 [36,] 2.36188487 -0.33131761 [37,] 2.09472055 2.36188487 [38,] -0.44097077 2.09472055 [39,] -0.35413806 -0.44097077 [40,] 1.51931312 -0.35413806 [41,] -2.07440003 1.51931312 [42,] 2.29335788 -2.07440003 [43,] -1.92386259 2.29335788 [44,] -1.44440198 -1.92386259 [45,] -3.79888716 -1.44440198 [46,] -0.92032033 -3.79888716 [47,] 0.95848154 -0.92032033 [48,] 1.70722957 0.95848154 [49,] 1.12886457 1.70722957 [50,] 1.00271583 1.12886457 [51,] 2.31275007 1.00271583 [52,] 0.68865952 2.31275007 [53,] -2.17888416 0.68865952 [54,] 2.31915959 -2.17888416 [55,] -3.76777505 2.31915959 [56,] -0.12065846 -3.76777505 [57,] 0.66866447 -0.12065846 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -3.20169435 -0.84161433 2 -0.09087303 -3.20169435 3 -0.76757994 -0.09087303 4 -2.76384292 -0.76757994 5 0.84747006 -2.76384292 6 -1.30642504 0.84747006 7 4.10960826 -1.30642504 8 1.16033155 4.10960826 9 3.10405159 1.16033155 10 1.52244685 3.10405159 11 -0.11446842 1.52244685 12 -0.55155177 -0.11446842 13 -3.89294672 -0.55155177 14 2.10627384 -3.89294672 15 -0.88705995 2.10627384 16 0.28433304 -0.88705995 17 3.70930497 0.28433304 18 -0.18401846 3.70930497 19 1.52995666 -0.18401846 20 0.65542023 1.52995666 21 3.04062679 0.65542023 22 -2.82023470 3.04062679 23 -0.51269551 -2.82023470 24 -2.67594833 -0.51269551 25 3.87105596 -2.67594833 26 -2.57714588 3.87105596 27 -0.30397212 -2.57714588 28 0.27153724 -0.30397212 29 -0.30349083 0.27153724 30 -3.12207397 -0.30349083 31 0.05207273 -3.12207397 32 -0.25069134 0.05207273 33 -3.01445569 -0.25069134 34 2.21810818 -3.01445569 35 -0.33131761 2.21810818 36 2.36188487 -0.33131761 37 2.09472055 2.36188487 38 -0.44097077 2.09472055 39 -0.35413806 -0.44097077 40 1.51931312 -0.35413806 41 -2.07440003 1.51931312 42 2.29335788 -2.07440003 43 -1.92386259 2.29335788 44 -1.44440198 -1.92386259 45 -3.79888716 -1.44440198 46 -0.92032033 -3.79888716 47 0.95848154 -0.92032033 48 1.70722957 0.95848154 49 1.12886457 1.70722957 50 1.00271583 1.12886457 51 2.31275007 1.00271583 52 0.68865952 2.31275007 53 -2.17888416 0.68865952 54 2.31915959 -2.17888416 55 -3.76777505 2.31915959 56 -0.12065846 -3.76777505 57 0.66866447 -0.12065846 > 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/7wjgd1258620691.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/8qdmk1258620691.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/9ixx21258620691.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/109hsb1258620691.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/11ti3n1258620691.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/127gek1258620691.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/13hpad1258620691.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/14pn6p1258620691.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/158r6q1258620691.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/164vzj1258620691.tab") + } > > system("convert tmp/1z6b21258620691.ps tmp/1z6b21258620691.png") > system("convert tmp/2a3p81258620691.ps tmp/2a3p81258620691.png") > system("convert tmp/3euwh1258620691.ps tmp/3euwh1258620691.png") > system("convert tmp/4njiz1258620691.ps tmp/4njiz1258620691.png") > system("convert tmp/58bg61258620691.ps tmp/58bg61258620691.png") > system("convert tmp/68xwq1258620691.ps tmp/68xwq1258620691.png") > system("convert tmp/7wjgd1258620691.ps tmp/7wjgd1258620691.png") > system("convert tmp/8qdmk1258620691.ps tmp/8qdmk1258620691.png") > system("convert tmp/9ixx21258620691.ps tmp/9ixx21258620691.png") > system("convert tmp/109hsb1258620691.ps tmp/109hsb1258620691.png") > > > proc.time() user system elapsed 2.319 1.547 2.774