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(14.1,14.8,16.8,15.4,15.2,16.9,14.1,14.7,16.5,15.2,17.6,18,16.9,16.7,19.7,15.9,17.4,17.7,15.2,15.7,17.2,17.7,17.9,16.2,17.5,16.8,19.1,16.7,18.2,18.5,17.8,16.4,18,20.3,19.5,18,20.2,19,20.2,21.5,19.7,21.1,20.2,18.2,21.3,20.4,17.2,15.8,15.1,14.5,15.8,14.3,13.9,15.5,14.3,13.6,16.3,16.8,16,16.8,16),dim=c(1,61),dimnames=list(c('HPC'),1:61)) > y <- array(NA,dim=c(1,61),dimnames=list(c('HPC'),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 = '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 HPC M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 14.1 1 0 0 0 0 0 0 0 0 0 0 1 2 14.8 0 1 0 0 0 0 0 0 0 0 0 2 3 16.8 0 0 1 0 0 0 0 0 0 0 0 3 4 15.4 0 0 0 1 0 0 0 0 0 0 0 4 5 15.2 0 0 0 0 1 0 0 0 0 0 0 5 6 16.9 0 0 0 0 0 1 0 0 0 0 0 6 7 14.1 0 0 0 0 0 0 1 0 0 0 0 7 8 14.7 0 0 0 0 0 0 0 1 0 0 0 8 9 16.5 0 0 0 0 0 0 0 0 1 0 0 9 10 15.2 0 0 0 0 0 0 0 0 0 1 0 10 11 17.6 0 0 0 0 0 0 0 0 0 0 1 11 12 18.0 0 0 0 0 0 0 0 0 0 0 0 12 13 16.9 1 0 0 0 0 0 0 0 0 0 0 13 14 16.7 0 1 0 0 0 0 0 0 0 0 0 14 15 19.7 0 0 1 0 0 0 0 0 0 0 0 15 16 15.9 0 0 0 1 0 0 0 0 0 0 0 16 17 17.4 0 0 0 0 1 0 0 0 0 0 0 17 18 17.7 0 0 0 0 0 1 0 0 0 0 0 18 19 15.2 0 0 0 0 0 0 1 0 0 0 0 19 20 15.7 0 0 0 0 0 0 0 1 0 0 0 20 21 17.2 0 0 0 0 0 0 0 0 1 0 0 21 22 17.7 0 0 0 0 0 0 0 0 0 1 0 22 23 17.9 0 0 0 0 0 0 0 0 0 0 1 23 24 16.2 0 0 0 0 0 0 0 0 0 0 0 24 25 17.5 1 0 0 0 0 0 0 0 0 0 0 25 26 16.8 0 1 0 0 0 0 0 0 0 0 0 26 27 19.1 0 0 1 0 0 0 0 0 0 0 0 27 28 16.7 0 0 0 1 0 0 0 0 0 0 0 28 29 18.2 0 0 0 0 1 0 0 0 0 0 0 29 30 18.5 0 0 0 0 0 1 0 0 0 0 0 30 31 17.8 0 0 0 0 0 0 1 0 0 0 0 31 32 16.4 0 0 0 0 0 0 0 1 0 0 0 32 33 18.0 0 0 0 0 0 0 0 0 1 0 0 33 34 20.3 0 0 0 0 0 0 0 0 0 1 0 34 35 19.5 0 0 0 0 0 0 0 0 0 0 1 35 36 18.0 0 0 0 0 0 0 0 0 0 0 0 36 37 20.2 1 0 0 0 0 0 0 0 0 0 0 37 38 19.0 0 1 0 0 0 0 0 0 0 0 0 38 39 20.2 0 0 1 0 0 0 0 0 0 0 0 39 40 21.5 0 0 0 1 0 0 0 0 0 0 0 40 41 19.7 0 0 0 0 1 0 0 0 0 0 0 41 42 21.1 0 0 0 0 0 1 0 0 0 0 0 42 43 20.2 0 0 0 0 0 0 1 0 0 0 0 43 44 18.2 0 0 0 0 0 0 0 1 0 0 0 44 45 21.3 0 0 0 0 0 0 0 0 1 0 0 45 46 20.4 0 0 0 0 0 0 0 0 0 1 0 46 47 17.2 0 0 0 0 0 0 0 0 0 0 1 47 48 15.8 0 0 0 0 0 0 0 0 0 0 0 48 49 15.1 1 0 0 0 0 0 0 0 0 0 0 49 50 14.5 0 1 0 0 0 0 0 0 0 0 0 50 51 15.8 0 0 1 0 0 0 0 0 0 0 0 51 52 14.3 0 0 0 1 0 0 0 0 0 0 0 52 53 13.9 0 0 0 0 1 0 0 0 0 0 0 53 54 15.5 0 0 0 0 0 1 0 0 0 0 0 54 55 14.3 0 0 0 0 0 0 1 0 0 0 0 55 56 13.6 0 0 0 0 0 0 0 1 0 0 0 56 57 16.3 0 0 0 0 0 0 0 0 1 0 0 57 58 16.8 0 0 0 0 0 0 0 0 0 1 0 58 59 16.0 0 0 0 0 0 0 0 0 0 0 1 59 60 16.8 0 0 0 0 0 0 0 0 0 0 0 60 61 16.0 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) M1 M2 M3 M4 M5 16.585882 -0.274706 -0.496078 1.453529 -0.116863 -0.007255 M6 M7 M8 M9 M10 M11 1.042353 -0.588039 -1.198431 0.931176 1.140784 0.690392 t 0.010392 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3.2294 -1.3106 -0.1153 1.2894 4.6153 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 16.585882 1.077422 15.394 <2e-16 *** M1 -0.274706 1.256527 -0.219 0.828 M2 -0.496078 1.318858 -0.376 0.708 M3 1.453529 1.317174 1.104 0.275 M4 -0.116863 1.315665 -0.089 0.930 M5 -0.007255 1.314333 -0.006 0.996 M6 1.042353 1.313177 0.794 0.431 M7 -0.588039 1.312198 -0.448 0.656 M8 -1.198431 1.311396 -0.914 0.365 M9 0.931176 1.310772 0.710 0.481 M10 1.140784 1.310327 0.871 0.388 M11 0.690392 1.310059 0.527 0.601 t 0.010392 0.015286 0.680 0.500 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.071 on 48 degrees of freedom Multiple R-squared: 0.1613, Adjusted R-squared: -0.04833 F-statistic: 0.7695 on 12 and 48 DF, p-value: 0.6777 > 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,] 6.064083e-02 0.1212816597 0.9393592 [2,] 1.771742e-02 0.0354348407 0.9822826 [3,] 9.590647e-03 0.0191812934 0.9904094 [4,] 4.073683e-03 0.0081473665 0.9959263 [5,] 1.542864e-03 0.0030857277 0.9984571 [6,] 7.865850e-04 0.0015731701 0.9992134 [7,] 4.559585e-04 0.0009119169 0.9995440 [8,] 3.324387e-04 0.0006648774 0.9996676 [9,] 3.998828e-03 0.0079976563 0.9960012 [10,] 1.957546e-03 0.0039150920 0.9980425 [11,] 1.096302e-03 0.0021926045 0.9989037 [12,] 5.638542e-04 0.0011277083 0.9994361 [13,] 4.252640e-04 0.0008505281 0.9995747 [14,] 1.786357e-04 0.0003572714 0.9998214 [15,] 1.001243e-04 0.0002002487 0.9998999 [16,] 1.328829e-04 0.0002657657 0.9998671 [17,] 9.370317e-05 0.0001874063 0.9999063 [18,] 2.123104e-04 0.0004246207 0.9997877 [19,] 7.281577e-04 0.0014563155 0.9992718 [20,] 4.148292e-04 0.0008296583 0.9995852 [21,] 7.737585e-04 0.0015475170 0.9992262 [22,] 8.169341e-04 0.0016338683 0.9991831 [23,] 3.661268e-04 0.0007322536 0.9996339 [24,] 1.801621e-04 0.0003603243 0.9998198 [25,] 2.191287e-03 0.0043825742 0.9978087 [26,] 1.945538e-03 0.0038910757 0.9980545 [27,] 2.173966e-03 0.0043479324 0.9978260 [28,] 7.510176e-03 0.0150203512 0.9924898 [29,] 1.001553e-02 0.0200310536 0.9899845 [30,] 6.911075e-02 0.1382215059 0.9308892 > postscript(file="/var/www/html/rcomp/tmp/1vsqc1292589029.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/html/rcomp/tmp/2vsqc1292589029.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/html/rcomp/tmp/3n1pf1292589029.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/html/rcomp/tmp/4n1pf1292589029.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/html/rcomp/tmp/5n1pf1292589029.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 = 61 Frequency = 1 1 2 3 4 5 6 7 -2.2215686 -1.3105882 -1.2705882 -1.1105882 -1.4305882 -0.7905882 -1.9705882 8 9 10 11 12 13 14 -0.7705882 -1.1105882 -2.6305882 0.2094118 1.2894118 0.4537255 0.4647059 15 16 17 18 19 20 21 1.5047059 -0.7352941 0.6447059 -0.1152941 -0.9952941 0.1047059 -0.5352941 22 23 24 25 26 27 28 -0.2552941 0.3847059 -0.6352941 0.9290196 0.4400000 0.7800000 -0.0600000 29 30 31 32 33 34 35 1.3200000 0.5600000 1.4800000 0.6800000 0.1400000 2.2200000 1.8600000 36 37 38 39 40 41 42 1.0400000 3.5043137 2.5152941 1.7552941 4.6152941 2.6952941 3.0352941 43 44 45 46 47 48 49 3.7552941 2.3552941 3.3152941 2.1952941 -0.5647059 -1.2847059 -1.7203922 50 51 52 53 54 55 56 -2.1094118 -2.7694118 -2.7094118 -3.2294118 -2.6894118 -2.2694118 -2.3694118 57 58 59 60 61 -1.8094118 -1.5294118 -1.8894118 -0.4094118 -0.9450980 > postscript(file="/var/www/html/rcomp/tmp/6gsoi1292589029.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 -2.2215686 NA 1 -1.3105882 -2.2215686 2 -1.2705882 -1.3105882 3 -1.1105882 -1.2705882 4 -1.4305882 -1.1105882 5 -0.7905882 -1.4305882 6 -1.9705882 -0.7905882 7 -0.7705882 -1.9705882 8 -1.1105882 -0.7705882 9 -2.6305882 -1.1105882 10 0.2094118 -2.6305882 11 1.2894118 0.2094118 12 0.4537255 1.2894118 13 0.4647059 0.4537255 14 1.5047059 0.4647059 15 -0.7352941 1.5047059 16 0.6447059 -0.7352941 17 -0.1152941 0.6447059 18 -0.9952941 -0.1152941 19 0.1047059 -0.9952941 20 -0.5352941 0.1047059 21 -0.2552941 -0.5352941 22 0.3847059 -0.2552941 23 -0.6352941 0.3847059 24 0.9290196 -0.6352941 25 0.4400000 0.9290196 26 0.7800000 0.4400000 27 -0.0600000 0.7800000 28 1.3200000 -0.0600000 29 0.5600000 1.3200000 30 1.4800000 0.5600000 31 0.6800000 1.4800000 32 0.1400000 0.6800000 33 2.2200000 0.1400000 34 1.8600000 2.2200000 35 1.0400000 1.8600000 36 3.5043137 1.0400000 37 2.5152941 3.5043137 38 1.7552941 2.5152941 39 4.6152941 1.7552941 40 2.6952941 4.6152941 41 3.0352941 2.6952941 42 3.7552941 3.0352941 43 2.3552941 3.7552941 44 3.3152941 2.3552941 45 2.1952941 3.3152941 46 -0.5647059 2.1952941 47 -1.2847059 -0.5647059 48 -1.7203922 -1.2847059 49 -2.1094118 -1.7203922 50 -2.7694118 -2.1094118 51 -2.7094118 -2.7694118 52 -3.2294118 -2.7094118 53 -2.6894118 -3.2294118 54 -2.2694118 -2.6894118 55 -2.3694118 -2.2694118 56 -1.8094118 -2.3694118 57 -1.5294118 -1.8094118 58 -1.8894118 -1.5294118 59 -0.4094118 -1.8894118 60 -0.9450980 -0.4094118 61 NA -0.9450980 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.3105882 -2.2215686 [2,] -1.2705882 -1.3105882 [3,] -1.1105882 -1.2705882 [4,] -1.4305882 -1.1105882 [5,] -0.7905882 -1.4305882 [6,] -1.9705882 -0.7905882 [7,] -0.7705882 -1.9705882 [8,] -1.1105882 -0.7705882 [9,] -2.6305882 -1.1105882 [10,] 0.2094118 -2.6305882 [11,] 1.2894118 0.2094118 [12,] 0.4537255 1.2894118 [13,] 0.4647059 0.4537255 [14,] 1.5047059 0.4647059 [15,] -0.7352941 1.5047059 [16,] 0.6447059 -0.7352941 [17,] -0.1152941 0.6447059 [18,] -0.9952941 -0.1152941 [19,] 0.1047059 -0.9952941 [20,] -0.5352941 0.1047059 [21,] -0.2552941 -0.5352941 [22,] 0.3847059 -0.2552941 [23,] -0.6352941 0.3847059 [24,] 0.9290196 -0.6352941 [25,] 0.4400000 0.9290196 [26,] 0.7800000 0.4400000 [27,] -0.0600000 0.7800000 [28,] 1.3200000 -0.0600000 [29,] 0.5600000 1.3200000 [30,] 1.4800000 0.5600000 [31,] 0.6800000 1.4800000 [32,] 0.1400000 0.6800000 [33,] 2.2200000 0.1400000 [34,] 1.8600000 2.2200000 [35,] 1.0400000 1.8600000 [36,] 3.5043137 1.0400000 [37,] 2.5152941 3.5043137 [38,] 1.7552941 2.5152941 [39,] 4.6152941 1.7552941 [40,] 2.6952941 4.6152941 [41,] 3.0352941 2.6952941 [42,] 3.7552941 3.0352941 [43,] 2.3552941 3.7552941 [44,] 3.3152941 2.3552941 [45,] 2.1952941 3.3152941 [46,] -0.5647059 2.1952941 [47,] -1.2847059 -0.5647059 [48,] -1.7203922 -1.2847059 [49,] -2.1094118 -1.7203922 [50,] -2.7694118 -2.1094118 [51,] -2.7094118 -2.7694118 [52,] -3.2294118 -2.7094118 [53,] -2.6894118 -3.2294118 [54,] -2.2694118 -2.6894118 [55,] -2.3694118 -2.2694118 [56,] -1.8094118 -2.3694118 [57,] -1.5294118 -1.8094118 [58,] -1.8894118 -1.5294118 [59,] -0.4094118 -1.8894118 [60,] -0.9450980 -0.4094118 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.3105882 -2.2215686 2 -1.2705882 -1.3105882 3 -1.1105882 -1.2705882 4 -1.4305882 -1.1105882 5 -0.7905882 -1.4305882 6 -1.9705882 -0.7905882 7 -0.7705882 -1.9705882 8 -1.1105882 -0.7705882 9 -2.6305882 -1.1105882 10 0.2094118 -2.6305882 11 1.2894118 0.2094118 12 0.4537255 1.2894118 13 0.4647059 0.4537255 14 1.5047059 0.4647059 15 -0.7352941 1.5047059 16 0.6447059 -0.7352941 17 -0.1152941 0.6447059 18 -0.9952941 -0.1152941 19 0.1047059 -0.9952941 20 -0.5352941 0.1047059 21 -0.2552941 -0.5352941 22 0.3847059 -0.2552941 23 -0.6352941 0.3847059 24 0.9290196 -0.6352941 25 0.4400000 0.9290196 26 0.7800000 0.4400000 27 -0.0600000 0.7800000 28 1.3200000 -0.0600000 29 0.5600000 1.3200000 30 1.4800000 0.5600000 31 0.6800000 1.4800000 32 0.1400000 0.6800000 33 2.2200000 0.1400000 34 1.8600000 2.2200000 35 1.0400000 1.8600000 36 3.5043137 1.0400000 37 2.5152941 3.5043137 38 1.7552941 2.5152941 39 4.6152941 1.7552941 40 2.6952941 4.6152941 41 3.0352941 2.6952941 42 3.7552941 3.0352941 43 2.3552941 3.7552941 44 3.3152941 2.3552941 45 2.1952941 3.3152941 46 -0.5647059 2.1952941 47 -1.2847059 -0.5647059 48 -1.7203922 -1.2847059 49 -2.1094118 -1.7203922 50 -2.7694118 -2.1094118 51 -2.7094118 -2.7694118 52 -3.2294118 -2.7094118 53 -2.6894118 -3.2294118 54 -2.2694118 -2.6894118 55 -2.3694118 -2.2694118 56 -1.8094118 -2.3694118 57 -1.5294118 -1.8094118 58 -1.8894118 -1.5294118 59 -0.4094118 -1.8894118 60 -0.9450980 -0.4094118 > 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/7rk631292589029.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/html/rcomp/tmp/8rk631292589029.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/html/rcomp/tmp/9rk631292589029.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') > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10jt5n1292589029.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/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/115bmt1292589029.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/12qc2h1292589029.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/13xvhb1292589029.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/14q4ge1292589029.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/15b5f21292589029.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/16pfdb1292589029.tab") + } > try(system("convert tmp/1vsqc1292589029.ps tmp/1vsqc1292589029.png",intern=TRUE)) character(0) > try(system("convert tmp/2vsqc1292589029.ps tmp/2vsqc1292589029.png",intern=TRUE)) character(0) > try(system("convert tmp/3n1pf1292589029.ps tmp/3n1pf1292589029.png",intern=TRUE)) character(0) > try(system("convert tmp/4n1pf1292589029.ps tmp/4n1pf1292589029.png",intern=TRUE)) character(0) > try(system("convert tmp/5n1pf1292589029.ps tmp/5n1pf1292589029.png",intern=TRUE)) character(0) > try(system("convert tmp/6gsoi1292589029.ps tmp/6gsoi1292589029.png",intern=TRUE)) character(0) > try(system("convert tmp/7rk631292589029.ps tmp/7rk631292589029.png",intern=TRUE)) character(0) > try(system("convert tmp/8rk631292589029.ps tmp/8rk631292589029.png",intern=TRUE)) character(0) > try(system("convert tmp/9rk631292589029.ps tmp/9rk631292589029.png",intern=TRUE)) character(0) > try(system("convert tmp/10jt5n1292589029.ps tmp/10jt5n1292589029.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.513 1.656 13.536