R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(101.2,0,100.5,0,98,0,106.6,0,90.1,0,96.9,0,125.9,0,112,0,100,0,123.9,0,79.8,0,83.4,0,113.6,0,112.9,0,104,0,109.9,0,99,0,106.3,0,128.9,0,111.1,0,102.9,0,130,0,87,0,87.5,0,117.6,0,103.4,0,110.8,0,112.6,0,102.5,0,112.4,0,135.6,0,105.1,0,127.7,0,137,0,91,0,90.5,0,122.4,1,123.3,1,124.3,1,120,1,118.1,1,119,1,142.7,1,123.6,1,129.6,1,151.6,1,110.4,1,99.2,1,130.5,1,136.2,1,129.7,1,128,1,121.6,1,135.8,1,143.8,1,147.5,1,136.2,1,156.6,1,123.3,1,100.4,1),dim=c(2,60),dimnames=list(c('y','x'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('y','x'),1:60)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x y x M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 101.2 0 1 0 0 0 0 0 0 0 0 0 0 1 2 100.5 0 0 1 0 0 0 0 0 0 0 0 0 2 3 98.0 0 0 0 1 0 0 0 0 0 0 0 0 3 4 106.6 0 0 0 0 1 0 0 0 0 0 0 0 4 5 90.1 0 0 0 0 0 1 0 0 0 0 0 0 5 6 96.9 0 0 0 0 0 0 1 0 0 0 0 0 6 7 125.9 0 0 0 0 0 0 0 1 0 0 0 0 7 8 112.0 0 0 0 0 0 0 0 0 1 0 0 0 8 9 100.0 0 0 0 0 0 0 0 0 0 1 0 0 9 10 123.9 0 0 0 0 0 0 0 0 0 0 1 0 10 11 79.8 0 0 0 0 0 0 0 0 0 0 0 1 11 12 83.4 0 0 0 0 0 0 0 0 0 0 0 0 12 13 113.6 0 1 0 0 0 0 0 0 0 0 0 0 13 14 112.9 0 0 1 0 0 0 0 0 0 0 0 0 14 15 104.0 0 0 0 1 0 0 0 0 0 0 0 0 15 16 109.9 0 0 0 0 1 0 0 0 0 0 0 0 16 17 99.0 0 0 0 0 0 1 0 0 0 0 0 0 17 18 106.3 0 0 0 0 0 0 1 0 0 0 0 0 18 19 128.9 0 0 0 0 0 0 0 1 0 0 0 0 19 20 111.1 0 0 0 0 0 0 0 0 1 0 0 0 20 21 102.9 0 0 0 0 0 0 0 0 0 1 0 0 21 22 130.0 0 0 0 0 0 0 0 0 0 0 1 0 22 23 87.0 0 0 0 0 0 0 0 0 0 0 0 1 23 24 87.5 0 0 0 0 0 0 0 0 0 0 0 0 24 25 117.6 0 1 0 0 0 0 0 0 0 0 0 0 25 26 103.4 0 0 1 0 0 0 0 0 0 0 0 0 26 27 110.8 0 0 0 1 0 0 0 0 0 0 0 0 27 28 112.6 0 0 0 0 1 0 0 0 0 0 0 0 28 29 102.5 0 0 0 0 0 1 0 0 0 0 0 0 29 30 112.4 0 0 0 0 0 0 1 0 0 0 0 0 30 31 135.6 0 0 0 0 0 0 0 1 0 0 0 0 31 32 105.1 0 0 0 0 0 0 0 0 1 0 0 0 32 33 127.7 0 0 0 0 0 0 0 0 0 1 0 0 33 34 137.0 0 0 0 0 0 0 0 0 0 0 1 0 34 35 91.0 0 0 0 0 0 0 0 0 0 0 0 1 35 36 90.5 0 0 0 0 0 0 0 0 0 0 0 0 36 37 122.4 1 1 0 0 0 0 0 0 0 0 0 0 37 38 123.3 1 0 1 0 0 0 0 0 0 0 0 0 38 39 124.3 1 0 0 1 0 0 0 0 0 0 0 0 39 40 120.0 1 0 0 0 1 0 0 0 0 0 0 0 40 41 118.1 1 0 0 0 0 1 0 0 0 0 0 0 41 42 119.0 1 0 0 0 0 0 1 0 0 0 0 0 42 43 142.7 1 0 0 0 0 0 0 1 0 0 0 0 43 44 123.6 1 0 0 0 0 0 0 0 1 0 0 0 44 45 129.6 1 0 0 0 0 0 0 0 0 1 0 0 45 46 151.6 1 0 0 0 0 0 0 0 0 0 1 0 46 47 110.4 1 0 0 0 0 0 0 0 0 0 0 1 47 48 99.2 1 0 0 0 0 0 0 0 0 0 0 0 48 49 130.5 1 1 0 0 0 0 0 0 0 0 0 0 49 50 136.2 1 0 1 0 0 0 0 0 0 0 0 0 50 51 129.7 1 0 0 1 0 0 0 0 0 0 0 0 51 52 128.0 1 0 0 0 1 0 0 0 0 0 0 0 52 53 121.6 1 0 0 0 0 1 0 0 0 0 0 0 53 54 135.8 1 0 0 0 0 0 1 0 0 0 0 0 54 55 143.8 1 0 0 0 0 0 0 1 0 0 0 0 55 56 147.5 1 0 0 0 0 0 0 0 1 0 0 0 56 57 136.2 1 0 0 0 0 0 0 0 0 1 0 0 57 58 156.6 1 0 0 0 0 0 0 0 0 0 1 0 58 59 123.3 1 0 0 0 0 0 0 0 0 0 0 1 59 60 100.4 1 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x M1 M2 M3 M4 71.7922 5.8694 30.3783 28.0767 25.6750 27.2333 M5 M6 M7 M8 M9 M10 17.5717 24.8900 45.6883 29.6667 28.5850 48.6233 M11 t 6.6017 0.5017 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -12.4122 -2.6043 -0.2969 2.5607 12.0783 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 71.79222 3.12868 22.947 < 2e-16 *** x 5.86944 2.80964 2.089 0.0423 * M1 30.37833 3.48761 8.710 2.71e-11 *** M2 28.07667 3.46775 8.097 2.13e-10 *** M3 25.67500 3.44968 7.443 1.98e-09 *** M4 27.23333 3.43343 7.932 3.73e-10 *** M5 17.57167 3.41903 5.139 5.50e-06 *** M6 24.89000 3.40650 7.307 3.17e-09 *** M7 45.68833 3.39586 13.454 < 2e-16 *** M8 29.66667 3.38714 8.759 2.31e-11 *** M9 28.58500 3.38033 8.456 6.34e-11 *** M10 48.62333 3.37546 14.405 < 2e-16 *** M11 6.60167 3.37254 1.957 0.0564 . t 0.50167 0.08111 6.185 1.53e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.331 on 46 degrees of freedom Multiple R-squared: 0.9292, Adjusted R-squared: 0.9092 F-statistic: 46.43 on 13 and 46 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.19830288 0.39660576 0.8016971 [2,] 0.08905284 0.17810568 0.9109472 [3,] 0.08052589 0.16105178 0.9194741 [4,] 0.12708598 0.25417196 0.8729140 [5,] 0.09828074 0.19656149 0.9017193 [6,] 0.05149971 0.10299942 0.9485003 [7,] 0.02622371 0.05244741 0.9737763 [8,] 0.01836127 0.03672254 0.9816387 [9,] 0.01041662 0.02083324 0.9895834 [10,] 0.09925871 0.19851741 0.9007413 [11,] 0.06339998 0.12679995 0.9366000 [12,] 0.04480419 0.08960838 0.9551958 [13,] 0.02514804 0.05029608 0.9748520 [14,] 0.01560380 0.03120761 0.9843962 [15,] 0.01250962 0.02501924 0.9874904 [16,] 0.15353858 0.30707716 0.8464614 [17,] 0.57318657 0.85362685 0.4268134 [18,] 0.47175571 0.94351141 0.5282443 [19,] 0.59534102 0.80931796 0.4046590 [20,] 0.49401556 0.98803113 0.5059844 [21,] 0.38392464 0.76784928 0.6160754 [22,] 0.31682523 0.63365046 0.6831748 [23,] 0.24310442 0.48620884 0.7568956 [24,] 0.17189775 0.34379549 0.8281023 [25,] 0.13566975 0.27133950 0.8643303 [26,] 0.11190422 0.22380844 0.8880958 [27,] 0.09348133 0.18696265 0.9065187 > postscript(file="/var/www/html/rcomp/tmp/1bplc1227776368.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/2glcu1227776368.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/3knxw1227776368.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/43uzb1227776368.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/5wa811227776368.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 60 Frequency = 1 1 2 3 4 5 6 -1.4722222 -0.3722222 -0.9722222 5.5677778 -1.7722222 -2.7922222 7 8 9 10 11 12 4.9077778 6.5277778 -4.8922222 -1.5322222 -4.1122222 5.5877778 13 14 15 16 17 18 4.9077778 6.0077778 -0.9922222 2.8477778 1.1077778 0.5877778 19 20 21 22 23 24 1.8877778 -0.3922222 -8.0122222 -1.4522222 -2.9322222 3.6677778 25 26 27 28 29 30 2.8877778 -9.5122222 -0.2122222 -0.4722222 -1.4122222 0.6677778 31 32 33 34 35 36 2.5677778 -12.4122222 10.7677778 -0.4722222 -4.9522222 0.6477778 37 38 39 40 41 42 -4.2016667 -1.5016667 1.3983333 -4.9616667 2.2983333 -4.6216667 43 44 45 46 47 48 -2.2216667 -5.8016667 0.7783333 2.2383333 2.5583333 -2.5416667 49 50 51 52 53 54 -2.1216667 5.3783333 0.7783333 -2.9816667 -0.2216667 6.1583333 55 56 57 58 59 60 -7.1416667 12.0783333 1.3583333 1.2183333 9.4383333 -7.3616667 > postscript(file="/var/www/html/rcomp/tmp/68zws1227776368.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.4722222 NA 1 -0.3722222 -1.4722222 2 -0.9722222 -0.3722222 3 5.5677778 -0.9722222 4 -1.7722222 5.5677778 5 -2.7922222 -1.7722222 6 4.9077778 -2.7922222 7 6.5277778 4.9077778 8 -4.8922222 6.5277778 9 -1.5322222 -4.8922222 10 -4.1122222 -1.5322222 11 5.5877778 -4.1122222 12 4.9077778 5.5877778 13 6.0077778 4.9077778 14 -0.9922222 6.0077778 15 2.8477778 -0.9922222 16 1.1077778 2.8477778 17 0.5877778 1.1077778 18 1.8877778 0.5877778 19 -0.3922222 1.8877778 20 -8.0122222 -0.3922222 21 -1.4522222 -8.0122222 22 -2.9322222 -1.4522222 23 3.6677778 -2.9322222 24 2.8877778 3.6677778 25 -9.5122222 2.8877778 26 -0.2122222 -9.5122222 27 -0.4722222 -0.2122222 28 -1.4122222 -0.4722222 29 0.6677778 -1.4122222 30 2.5677778 0.6677778 31 -12.4122222 2.5677778 32 10.7677778 -12.4122222 33 -0.4722222 10.7677778 34 -4.9522222 -0.4722222 35 0.6477778 -4.9522222 36 -4.2016667 0.6477778 37 -1.5016667 -4.2016667 38 1.3983333 -1.5016667 39 -4.9616667 1.3983333 40 2.2983333 -4.9616667 41 -4.6216667 2.2983333 42 -2.2216667 -4.6216667 43 -5.8016667 -2.2216667 44 0.7783333 -5.8016667 45 2.2383333 0.7783333 46 2.5583333 2.2383333 47 -2.5416667 2.5583333 48 -2.1216667 -2.5416667 49 5.3783333 -2.1216667 50 0.7783333 5.3783333 51 -2.9816667 0.7783333 52 -0.2216667 -2.9816667 53 6.1583333 -0.2216667 54 -7.1416667 6.1583333 55 12.0783333 -7.1416667 56 1.3583333 12.0783333 57 1.2183333 1.3583333 58 9.4383333 1.2183333 59 -7.3616667 9.4383333 60 NA -7.3616667 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.3722222 -1.4722222 [2,] -0.9722222 -0.3722222 [3,] 5.5677778 -0.9722222 [4,] -1.7722222 5.5677778 [5,] -2.7922222 -1.7722222 [6,] 4.9077778 -2.7922222 [7,] 6.5277778 4.9077778 [8,] -4.8922222 6.5277778 [9,] -1.5322222 -4.8922222 [10,] -4.1122222 -1.5322222 [11,] 5.5877778 -4.1122222 [12,] 4.9077778 5.5877778 [13,] 6.0077778 4.9077778 [14,] -0.9922222 6.0077778 [15,] 2.8477778 -0.9922222 [16,] 1.1077778 2.8477778 [17,] 0.5877778 1.1077778 [18,] 1.8877778 0.5877778 [19,] -0.3922222 1.8877778 [20,] -8.0122222 -0.3922222 [21,] -1.4522222 -8.0122222 [22,] -2.9322222 -1.4522222 [23,] 3.6677778 -2.9322222 [24,] 2.8877778 3.6677778 [25,] -9.5122222 2.8877778 [26,] -0.2122222 -9.5122222 [27,] -0.4722222 -0.2122222 [28,] -1.4122222 -0.4722222 [29,] 0.6677778 -1.4122222 [30,] 2.5677778 0.6677778 [31,] -12.4122222 2.5677778 [32,] 10.7677778 -12.4122222 [33,] -0.4722222 10.7677778 [34,] -4.9522222 -0.4722222 [35,] 0.6477778 -4.9522222 [36,] -4.2016667 0.6477778 [37,] -1.5016667 -4.2016667 [38,] 1.3983333 -1.5016667 [39,] -4.9616667 1.3983333 [40,] 2.2983333 -4.9616667 [41,] -4.6216667 2.2983333 [42,] -2.2216667 -4.6216667 [43,] -5.8016667 -2.2216667 [44,] 0.7783333 -5.8016667 [45,] 2.2383333 0.7783333 [46,] 2.5583333 2.2383333 [47,] -2.5416667 2.5583333 [48,] -2.1216667 -2.5416667 [49,] 5.3783333 -2.1216667 [50,] 0.7783333 5.3783333 [51,] -2.9816667 0.7783333 [52,] -0.2216667 -2.9816667 [53,] 6.1583333 -0.2216667 [54,] -7.1416667 6.1583333 [55,] 12.0783333 -7.1416667 [56,] 1.3583333 12.0783333 [57,] 1.2183333 1.3583333 [58,] 9.4383333 1.2183333 [59,] -7.3616667 9.4383333 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.3722222 -1.4722222 2 -0.9722222 -0.3722222 3 5.5677778 -0.9722222 4 -1.7722222 5.5677778 5 -2.7922222 -1.7722222 6 4.9077778 -2.7922222 7 6.5277778 4.9077778 8 -4.8922222 6.5277778 9 -1.5322222 -4.8922222 10 -4.1122222 -1.5322222 11 5.5877778 -4.1122222 12 4.9077778 5.5877778 13 6.0077778 4.9077778 14 -0.9922222 6.0077778 15 2.8477778 -0.9922222 16 1.1077778 2.8477778 17 0.5877778 1.1077778 18 1.8877778 0.5877778 19 -0.3922222 1.8877778 20 -8.0122222 -0.3922222 21 -1.4522222 -8.0122222 22 -2.9322222 -1.4522222 23 3.6677778 -2.9322222 24 2.8877778 3.6677778 25 -9.5122222 2.8877778 26 -0.2122222 -9.5122222 27 -0.4722222 -0.2122222 28 -1.4122222 -0.4722222 29 0.6677778 -1.4122222 30 2.5677778 0.6677778 31 -12.4122222 2.5677778 32 10.7677778 -12.4122222 33 -0.4722222 10.7677778 34 -4.9522222 -0.4722222 35 0.6477778 -4.9522222 36 -4.2016667 0.6477778 37 -1.5016667 -4.2016667 38 1.3983333 -1.5016667 39 -4.9616667 1.3983333 40 2.2983333 -4.9616667 41 -4.6216667 2.2983333 42 -2.2216667 -4.6216667 43 -5.8016667 -2.2216667 44 0.7783333 -5.8016667 45 2.2383333 0.7783333 46 2.5583333 2.2383333 47 -2.5416667 2.5583333 48 -2.1216667 -2.5416667 49 5.3783333 -2.1216667 50 0.7783333 5.3783333 51 -2.9816667 0.7783333 52 -0.2216667 -2.9816667 53 6.1583333 -0.2216667 54 -7.1416667 6.1583333 55 12.0783333 -7.1416667 56 1.3583333 12.0783333 57 1.2183333 1.3583333 58 9.4383333 1.2183333 59 -7.3616667 9.4383333 > 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/73x7u1227776368.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/83fhn1227776368.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/99dzj1227776368.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/1008vk1227776368.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/116a5y1227776368.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/12w9nx1227776368.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/13gztw1227776368.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/14nv1v1227776368.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/15np0n1227776369.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/16tmes1227776369.tab") + } > > system("convert tmp/1bplc1227776368.ps tmp/1bplc1227776368.png") > system("convert tmp/2glcu1227776368.ps tmp/2glcu1227776368.png") > system("convert tmp/3knxw1227776368.ps tmp/3knxw1227776368.png") > system("convert tmp/43uzb1227776368.ps tmp/43uzb1227776368.png") > system("convert tmp/5wa811227776368.ps tmp/5wa811227776368.png") > system("convert tmp/68zws1227776368.ps tmp/68zws1227776368.png") > system("convert tmp/73x7u1227776368.ps tmp/73x7u1227776368.png") > system("convert tmp/83fhn1227776368.ps tmp/83fhn1227776368.png") > system("convert tmp/99dzj1227776368.ps tmp/99dzj1227776368.png") > system("convert tmp/1008vk1227776368.ps tmp/1008vk1227776368.png") > > > proc.time() user system elapsed 2.628 1.710 3.297