R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(2.00 + ,4.50 + ,1000.00 + ,6600.00 + ,42.00 + ,3.00 + ,1.00 + ,3.00 + ,1.80 + ,69.00 + ,2547000.00 + ,4603000.00 + ,624.00 + ,3.00 + ,5.00 + ,4.00 + ,0.70 + ,27.00 + ,10550.00 + ,179500.00 + ,180.00 + ,4.00 + ,4.00 + ,4.00 + ,3.90 + ,19.00 + ,23.00 + ,300.00 + ,35.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,30.40 + ,160000.00 + ,169000.00 + ,392.00 + ,4.00 + ,5.00 + ,4.00 + ,3.60 + ,28.00 + ,3300.00 + ,25600.00 + ,63.00 + ,1.00 + ,2.00 + ,1.00 + ,1.40 + ,50.00 + ,52160.00 + ,440000.00 + ,230.00 + ,1.00 + ,1.00 + ,1.00 + ,1.50 + ,7.00 + ,425.00 + ,6400.00 + ,112.00 + ,5.00 + ,4.00 + ,4.00 + ,0.70 + ,30.00 + ,465000.00 + ,423000.00 + ,281.00 + ,5.00 + ,5.00 + ,5.00 + ,2.10 + ,3.50 + ,75.00 + ,1200.00 + ,42.00 + ,1.00 + ,1.00 + ,1.00 + ,0.00 + ,50.00 + ,3000.00 + ,25000.00 + ,28.00 + ,2.00 + ,2.00 + ,2.00 + ,4.10 + ,6.00 + ,785.00 + ,3500.00 + ,42.00 + ,2.00 + ,2.00 + ,2.00 + ,1.20 + ,10.40 + ,200.00 + ,5000.00 + ,120.00 + ,2.00 + ,2.00 + ,2.00 + ,0.50 + ,20.00 + ,27660.00 + ,115000.00 + ,148.00 + ,5.00 + ,5.00 + ,5.00 + ,3.40 + ,3.90 + ,120.00 + ,1000.00 + ,16.00 + ,3.00 + ,1.00 + ,2.00 + ,1.50 + ,41.00 + ,85000.00 + ,325000.00 + ,310.00 + ,1.00 + ,3.00 + ,1.00 + ,3.40 + ,9.00 + ,101.00 + ,4000.00 + ,28.00 + ,5.00 + ,1.00 + ,3.00 + ,0.80 + ,7.60 + ,1040.00 + ,5500.00 + ,68.00 + ,5.00 + ,3.00 + ,4.00 + ,0.80 + ,46.00 + ,521000.00 + ,655000.00 + ,336.00 + ,5.00 + ,5.00 + ,5.00 + ,1.40 + ,2.60 + ,5.00 + ,140.00 + ,21.50 + ,5.00 + ,2.00 + ,4.00 + ,2.00 + ,24.00 + ,10.00 + ,250.00 + ,50.00 + ,1.00 + ,1.00 + ,1.00 + ,1.90 + ,100.00 + ,62000.00 + ,1320000.00 + ,267.00 + ,1.00 + ,1.00 + ,1.00 + ,1.30 + ,3.20 + ,23.00 + ,400.00 + ,19.00 + ,4.00 + ,1.00 + ,3.00 + ,2.00 + ,2.00 + ,48.00 + ,330.00 + ,30.00 + ,4.00 + ,1.00 + ,3.00 + ,5.60 + ,5.00 + ,1700.00 + ,6300.00 + ,12.00 + ,2.00 + ,1.00 + ,1.00 + ,3.10 + ,6.50 + ,3500.00 + ,10800.00 + ,120.00 + ,2.00 + ,1.00 + ,1.00 + ,1.80 + ,12.00 + ,480.00 + ,15500.00 + ,140.00 + ,2.00 + ,2.00 + ,2.00 + ,0.90 + ,20.20 + ,10000.00 + ,115000.00 + ,170.00 + ,4.00 + ,4.00 + ,4.00 + ,1.80 + ,13.00 + ,1620.00 + ,11400.00 + ,17.00 + ,2.00 + ,1.00 + ,2.00 + ,1.90 + ,27.00 + ,192000.00 + ,180000.00 + ,115.00 + ,4.00 + ,4.00 + ,4.00 + ,0.90 + ,18.00 + ,2500.00 + ,12100.00 + ,31.00 + ,5.00 + ,5.00 + ,5.00 + ,2.60 + ,4.70 + ,280.00 + ,1900.00 + ,21.00 + ,3.00 + ,1.00 + ,3.00 + ,2.40 + ,9.80 + ,4235.00 + ,50400.00 + ,52.00 + ,1.00 + ,1.00 + ,1.00 + ,1.20 + ,29.00 + ,6800.00 + ,179000.00 + ,164.00 + ,2.00 + ,3.00 + ,2.00 + ,0.90 + ,7.00 + ,750.00 + ,12300.00 + ,225.00 + ,2.00 + ,2.00 + ,2.00 + ,0.50 + ,6.00 + ,3600.00 + ,21000.00 + ,225.00 + ,3.00 + ,2.00 + ,3.00 + ,0.60 + ,20.00 + ,55500.00 + ,175000.00 + ,151.00 + ,5.00 + ,5.00 + ,5.00 + ,2.30 + ,4.50 + ,900.00 + ,2600.00 + ,60.00 + ,2.00 + ,1.00 + ,2.00 + ,0.50 + ,7.50 + ,2000.00 + ,12300.00 + ,200.00 + ,3.00 + ,1.00 + ,3.00 + ,2.60 + ,2.30 + ,104.00 + ,2500.00 + ,46.00 + ,3.00 + ,2.00 + ,2.00 + ,0.60 + ,24.00 + ,4190.00 + ,58000.00 + ,210.00 + ,4.00 + ,3.00 + ,4.00 + ,6.60 + ,3.00 + ,3500.00 + ,3900.00 + ,14.00 + ,2.00 + ,1.00 + ,1.00) + ,dim=c(8 + ,42) + ,dimnames=list(c('PS' + ,'L' + ,'Wb' + ,'Wbr' + ,'Tg' + ,'P' + ,'S' + ,'D') + ,1:42)) > y <- array(NA,dim=c(8,42),dimnames=list(c('PS','L','Wb','Wbr','Tg','P','S','D'),1:42)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo > 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 PS L Wb Wbr Tg P S D 1 2.0 4.5 1000 6600 42.0 3 1 3 2 1.8 69.0 2547000 4603000 624.0 3 5 4 3 0.7 27.0 10550 179500 180.0 4 4 4 4 3.9 19.0 23 300 35.0 1 1 1 5 1.0 30.4 160000 169000 392.0 4 5 4 6 3.6 28.0 3300 25600 63.0 1 2 1 7 1.4 50.0 52160 440000 230.0 1 1 1 8 1.5 7.0 425 6400 112.0 5 4 4 9 0.7 30.0 465000 423000 281.0 5 5 5 10 2.1 3.5 75 1200 42.0 1 1 1 11 0.0 50.0 3000 25000 28.0 2 2 2 12 4.1 6.0 785 3500 42.0 2 2 2 13 1.2 10.4 200 5000 120.0 2 2 2 14 0.5 20.0 27660 115000 148.0 5 5 5 15 3.4 3.9 120 1000 16.0 3 1 2 16 1.5 41.0 85000 325000 310.0 1 3 1 17 3.4 9.0 101 4000 28.0 5 1 3 18 0.8 7.6 1040 5500 68.0 5 3 4 19 0.8 46.0 521000 655000 336.0 5 5 5 20 1.4 2.6 5 140 21.5 5 2 4 21 2.0 24.0 10 250 50.0 1 1 1 22 1.9 100.0 62000 1320000 267.0 1 1 1 23 1.3 3.2 23 400 19.0 4 1 3 24 2.0 2.0 48 330 30.0 4 1 3 25 5.6 5.0 1700 6300 12.0 2 1 1 26 3.1 6.5 3500 10800 120.0 2 1 1 27 1.8 12.0 480 15500 140.0 2 2 2 28 0.9 20.2 10000 115000 170.0 4 4 4 29 1.8 13.0 1620 11400 17.0 2 1 2 30 1.9 27.0 192000 180000 115.0 4 4 4 31 0.9 18.0 2500 12100 31.0 5 5 5 32 2.6 4.7 280 1900 21.0 3 1 3 33 2.4 9.8 4235 50400 52.0 1 1 1 34 1.2 29.0 6800 179000 164.0 2 3 2 35 0.9 7.0 750 12300 225.0 2 2 2 36 0.5 6.0 3600 21000 225.0 3 2 3 37 0.6 20.0 55500 175000 151.0 5 5 5 38 2.3 4.5 900 2600 60.0 2 1 2 39 0.5 7.5 2000 12300 200.0 3 1 3 40 2.6 2.3 104 2500 46.0 3 2 2 41 0.6 24.0 4190 58000 210.0 4 3 4 42 6.6 3.0 3500 3900 14.0 2 1 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) L Wb Wbr Tg P 3.778e+00 -1.339e-02 1.370e-06 2.961e-07 -5.007e-03 9.004e-01 S D 3.600e-01 -1.738e+00 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.02306 -0.59238 -0.06292 0.57529 2.50441 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.778e+00 4.133e-01 9.141 1.10e-10 *** L -1.339e-02 1.431e-02 -0.936 0.355869 Wb 1.370e-06 1.831e-06 0.748 0.459434 Wbr 2.961e-07 1.099e-06 0.269 0.789227 Tg -5.007e-03 2.158e-03 -2.320 0.026497 * P 9.004e-01 3.379e-01 2.665 0.011704 * S 3.600e-01 2.117e-01 1.701 0.098147 . D -1.738e+00 4.196e-01 -4.143 0.000214 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.9396 on 34 degrees of freedom Multiple R-squared: 0.6204, Adjusted R-squared: 0.5422 F-statistic: 7.938 on 7 and 34 DF, p-value: 1.066e-05 > 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.8677923 0.2644154 0.13220768 [2,] 0.8743541 0.2512918 0.12564588 [3,] 0.9136695 0.1726610 0.08633052 [4,] 0.8511537 0.2976927 0.14884635 [5,] 0.7863531 0.4272937 0.21364686 [6,] 0.7115912 0.5768176 0.28840880 [7,] 0.6409433 0.7181133 0.35905665 [8,] 0.6473278 0.7053444 0.35267219 [9,] 0.5731301 0.8537397 0.42686987 [10,] 0.4910234 0.9820468 0.50897662 [11,] 0.4228144 0.8456287 0.57718563 [12,] 0.4386158 0.8772316 0.56138420 [13,] 0.5092970 0.9814060 0.49070301 [14,] 0.5638430 0.8723140 0.43615699 [15,] 0.6389035 0.7221930 0.36109648 [16,] 0.5924903 0.8150194 0.40750971 [17,] 0.4819251 0.9638501 0.51807493 [18,] 0.3672351 0.7344702 0.63276489 [19,] 0.3148464 0.6296927 0.68515364 [20,] 0.3465897 0.6931793 0.65341033 [21,] 0.2249404 0.4498809 0.77505957 > postscript(file="/var/www/rcomp/tmp/1x70v1292273020.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/2pyzy1292273020.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/3pyzy1292273020.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/4pyzy1292273020.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/5iqh11292273020.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 42 Frequency = 1 1 2 3 4 5 6 0.64387758 -0.32960842 0.02997877 1.03006718 0.87530424 0.61881458 7 8 9 10 11 12 -0.27997008 -0.61362575 0.35910296 -0.94284340 -2.02305677 1.56706499 13 14 15 16 17 18 -0.88309234 0.04971839 0.17006453 -0.63095279 0.23533556 -1.16645245 19 20 21 22 23 24 0.80337016 -0.50322678 -0.72782012 0.80096496 -1.08588399 -0.34689428 25 26 27 28 29 30 1.52294005 -0.42000870 -0.16501303 0.10867649 -0.40780797 0.65573142 31 32 33 34 35 36 -0.09794443 1.14378761 -0.52865474 -0.83422816 -0.70581372 -0.28759404 37 38 39 40 41 42 0.10882252 0.19722912 -0.02788694 -0.86160047 0.44471996 2.50440830 > postscript(file="/var/www/rcomp/tmp/6iqh11292273020.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 42 Frequency = 1 lag(myerror, k = 1) myerror 0 0.64387758 NA 1 -0.32960842 0.64387758 2 0.02997877 -0.32960842 3 1.03006718 0.02997877 4 0.87530424 1.03006718 5 0.61881458 0.87530424 6 -0.27997008 0.61881458 7 -0.61362575 -0.27997008 8 0.35910296 -0.61362575 9 -0.94284340 0.35910296 10 -2.02305677 -0.94284340 11 1.56706499 -2.02305677 12 -0.88309234 1.56706499 13 0.04971839 -0.88309234 14 0.17006453 0.04971839 15 -0.63095279 0.17006453 16 0.23533556 -0.63095279 17 -1.16645245 0.23533556 18 0.80337016 -1.16645245 19 -0.50322678 0.80337016 20 -0.72782012 -0.50322678 21 0.80096496 -0.72782012 22 -1.08588399 0.80096496 23 -0.34689428 -1.08588399 24 1.52294005 -0.34689428 25 -0.42000870 1.52294005 26 -0.16501303 -0.42000870 27 0.10867649 -0.16501303 28 -0.40780797 0.10867649 29 0.65573142 -0.40780797 30 -0.09794443 0.65573142 31 1.14378761 -0.09794443 32 -0.52865474 1.14378761 33 -0.83422816 -0.52865474 34 -0.70581372 -0.83422816 35 -0.28759404 -0.70581372 36 0.10882252 -0.28759404 37 0.19722912 0.10882252 38 -0.02788694 0.19722912 39 -0.86160047 -0.02788694 40 0.44471996 -0.86160047 41 2.50440830 0.44471996 42 NA 2.50440830 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.32960842 0.64387758 [2,] 0.02997877 -0.32960842 [3,] 1.03006718 0.02997877 [4,] 0.87530424 1.03006718 [5,] 0.61881458 0.87530424 [6,] -0.27997008 0.61881458 [7,] -0.61362575 -0.27997008 [8,] 0.35910296 -0.61362575 [9,] -0.94284340 0.35910296 [10,] -2.02305677 -0.94284340 [11,] 1.56706499 -2.02305677 [12,] -0.88309234 1.56706499 [13,] 0.04971839 -0.88309234 [14,] 0.17006453 0.04971839 [15,] -0.63095279 0.17006453 [16,] 0.23533556 -0.63095279 [17,] -1.16645245 0.23533556 [18,] 0.80337016 -1.16645245 [19,] -0.50322678 0.80337016 [20,] -0.72782012 -0.50322678 [21,] 0.80096496 -0.72782012 [22,] -1.08588399 0.80096496 [23,] -0.34689428 -1.08588399 [24,] 1.52294005 -0.34689428 [25,] -0.42000870 1.52294005 [26,] -0.16501303 -0.42000870 [27,] 0.10867649 -0.16501303 [28,] -0.40780797 0.10867649 [29,] 0.65573142 -0.40780797 [30,] -0.09794443 0.65573142 [31,] 1.14378761 -0.09794443 [32,] -0.52865474 1.14378761 [33,] -0.83422816 -0.52865474 [34,] -0.70581372 -0.83422816 [35,] -0.28759404 -0.70581372 [36,] 0.10882252 -0.28759404 [37,] 0.19722912 0.10882252 [38,] -0.02788694 0.19722912 [39,] -0.86160047 -0.02788694 [40,] 0.44471996 -0.86160047 [41,] 2.50440830 0.44471996 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.32960842 0.64387758 2 0.02997877 -0.32960842 3 1.03006718 0.02997877 4 0.87530424 1.03006718 5 0.61881458 0.87530424 6 -0.27997008 0.61881458 7 -0.61362575 -0.27997008 8 0.35910296 -0.61362575 9 -0.94284340 0.35910296 10 -2.02305677 -0.94284340 11 1.56706499 -2.02305677 12 -0.88309234 1.56706499 13 0.04971839 -0.88309234 14 0.17006453 0.04971839 15 -0.63095279 0.17006453 16 0.23533556 -0.63095279 17 -1.16645245 0.23533556 18 0.80337016 -1.16645245 19 -0.50322678 0.80337016 20 -0.72782012 -0.50322678 21 0.80096496 -0.72782012 22 -1.08588399 0.80096496 23 -0.34689428 -1.08588399 24 1.52294005 -0.34689428 25 -0.42000870 1.52294005 26 -0.16501303 -0.42000870 27 0.10867649 -0.16501303 28 -0.40780797 0.10867649 29 0.65573142 -0.40780797 30 -0.09794443 0.65573142 31 1.14378761 -0.09794443 32 -0.52865474 1.14378761 33 -0.83422816 -0.52865474 34 -0.70581372 -0.83422816 35 -0.28759404 -0.70581372 36 0.10882252 -0.28759404 37 0.19722912 0.10882252 38 -0.02788694 0.19722912 39 -0.86160047 -0.02788694 40 0.44471996 -0.86160047 41 2.50440830 0.44471996 > 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/rcomp/tmp/7shg41292273020.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/8shg41292273020.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/93qx71292273020.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') Warning messages: 1: In sqrt(crit * p * (1 - hh)/hh) : NaNs produced 2: In sqrt(crit * p * (1 - hh)/hh) : NaNs produced > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/rcomp/tmp/103qx71292273020.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/11prwd1292273020.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/rcomp/tmp/12srcj1292273020.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/rcomp/tmp/13hs9u1292273020.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/rcomp/tmp/14r18x1292273020.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/rcomp/tmp/15ncay1292273021.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/rcomp/tmp/16j4p71292273021.tab") + } > > try(system("convert tmp/1x70v1292273020.ps tmp/1x70v1292273020.png",intern=TRUE)) character(0) > try(system("convert tmp/2pyzy1292273020.ps tmp/2pyzy1292273020.png",intern=TRUE)) character(0) > try(system("convert tmp/3pyzy1292273020.ps tmp/3pyzy1292273020.png",intern=TRUE)) character(0) > try(system("convert tmp/4pyzy1292273020.ps tmp/4pyzy1292273020.png",intern=TRUE)) character(0) > try(system("convert tmp/5iqh11292273020.ps tmp/5iqh11292273020.png",intern=TRUE)) character(0) > try(system("convert tmp/6iqh11292273020.ps tmp/6iqh11292273020.png",intern=TRUE)) character(0) > try(system("convert tmp/7shg41292273020.ps tmp/7shg41292273020.png",intern=TRUE)) character(0) > try(system("convert tmp/8shg41292273020.ps tmp/8shg41292273020.png",intern=TRUE)) character(0) > try(system("convert tmp/93qx71292273020.ps tmp/93qx71292273020.png",intern=TRUE)) character(0) > try(system("convert tmp/103qx71292273020.ps tmp/103qx71292273020.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.930 1.680 4.593