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(286602,0,283042,0,276687,0,277915,0,277128,0,277103,0,275037,0,270150,0,267140,0,264993,0,287259,0,291186,0,292300,0,288186,0,281477,0,282656,0,280190,0,280408,0,276836,0,275216,0,274352,0,271311,0,289802,0,290726,0,292300,0,278506,0,269826,0,265861,0,269034,0,264176,0,255198,0,253353,0,246057,0,235372,0,258556,0,260993,0,254663,0,250643,0,243422,0,247105,0,248541,0,245039,0,237080,0,237085,0,225554,0,226839,1,247934,1,248333,1,246969,1,245098,1,246263,1,255765,1,264319,1,268347,1,273046,1,273963,1,267430,1,271993,1,292710,1,295881,1),dim=c(2,60),dimnames=list(c('nwwmb','dummy_variable'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('nwwmb','dummy_variable'),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 nwwmb dummy_variable M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 286602 0 1 0 0 0 0 0 0 0 0 0 0 1 2 283042 0 0 1 0 0 0 0 0 0 0 0 0 2 3 276687 0 0 0 1 0 0 0 0 0 0 0 0 3 4 277915 0 0 0 0 1 0 0 0 0 0 0 0 4 5 277128 0 0 0 0 0 1 0 0 0 0 0 0 5 6 277103 0 0 0 0 0 0 1 0 0 0 0 0 6 7 275037 0 0 0 0 0 0 0 1 0 0 0 0 7 8 270150 0 0 0 0 0 0 0 0 1 0 0 0 8 9 267140 0 0 0 0 0 0 0 0 0 1 0 0 9 10 264993 0 0 0 0 0 0 0 0 0 0 1 0 10 11 287259 0 0 0 0 0 0 0 0 0 0 0 1 11 12 291186 0 0 0 0 0 0 0 0 0 0 0 0 12 13 292300 0 1 0 0 0 0 0 0 0 0 0 0 13 14 288186 0 0 1 0 0 0 0 0 0 0 0 0 14 15 281477 0 0 0 1 0 0 0 0 0 0 0 0 15 16 282656 0 0 0 0 1 0 0 0 0 0 0 0 16 17 280190 0 0 0 0 0 1 0 0 0 0 0 0 17 18 280408 0 0 0 0 0 0 1 0 0 0 0 0 18 19 276836 0 0 0 0 0 0 0 1 0 0 0 0 19 20 275216 0 0 0 0 0 0 0 0 1 0 0 0 20 21 274352 0 0 0 0 0 0 0 0 0 1 0 0 21 22 271311 0 0 0 0 0 0 0 0 0 0 1 0 22 23 289802 0 0 0 0 0 0 0 0 0 0 0 1 23 24 290726 0 0 0 0 0 0 0 0 0 0 0 0 24 25 292300 0 1 0 0 0 0 0 0 0 0 0 0 25 26 278506 0 0 1 0 0 0 0 0 0 0 0 0 26 27 269826 0 0 0 1 0 0 0 0 0 0 0 0 27 28 265861 0 0 0 0 1 0 0 0 0 0 0 0 28 29 269034 0 0 0 0 0 1 0 0 0 0 0 0 29 30 264176 0 0 0 0 0 0 1 0 0 0 0 0 30 31 255198 0 0 0 0 0 0 0 1 0 0 0 0 31 32 253353 0 0 0 0 0 0 0 0 1 0 0 0 32 33 246057 0 0 0 0 0 0 0 0 0 1 0 0 33 34 235372 0 0 0 0 0 0 0 0 0 0 1 0 34 35 258556 0 0 0 0 0 0 0 0 0 0 0 1 35 36 260993 0 0 0 0 0 0 0 0 0 0 0 0 36 37 254663 0 1 0 0 0 0 0 0 0 0 0 0 37 38 250643 0 0 1 0 0 0 0 0 0 0 0 0 38 39 243422 0 0 0 1 0 0 0 0 0 0 0 0 39 40 247105 0 0 0 0 1 0 0 0 0 0 0 0 40 41 248541 0 0 0 0 0 1 0 0 0 0 0 0 41 42 245039 0 0 0 0 0 0 1 0 0 0 0 0 42 43 237080 0 0 0 0 0 0 0 1 0 0 0 0 43 44 237085 0 0 0 0 0 0 0 0 1 0 0 0 44 45 225554 0 0 0 0 0 0 0 0 0 1 0 0 45 46 226839 1 0 0 0 0 0 0 0 0 0 1 0 46 47 247934 1 0 0 0 0 0 0 0 0 0 0 1 47 48 248333 1 0 0 0 0 0 0 0 0 0 0 0 48 49 246969 1 1 0 0 0 0 0 0 0 0 0 0 49 50 245098 1 0 1 0 0 0 0 0 0 0 0 0 50 51 246263 1 0 0 1 0 0 0 0 0 0 0 0 51 52 255765 1 0 0 0 1 0 0 0 0 0 0 0 52 53 264319 1 0 0 0 0 1 0 0 0 0 0 0 53 54 268347 1 0 0 0 0 0 1 0 0 0 0 0 54 55 273046 1 0 0 0 0 0 0 1 0 0 0 0 55 56 273963 1 0 0 0 0 0 0 0 1 0 0 0 56 57 267430 1 0 0 0 0 0 0 0 0 1 0 0 57 58 271993 1 0 0 0 0 0 0 0 0 0 1 0 58 59 292710 1 0 0 0 0 0 0 0 0 0 0 1 59 60 295881 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) dummy_variable M1 M2 M3 300922.9 18529.6 -8596.1 -13209.2 -17910.6 M4 M5 M6 M7 M8 -14726.6 -11885.9 -11855.1 -14571.7 -15199.0 M9 M10 M11 t -20187.2 -25039.5 -3030.2 -858.6 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -29905 -7014 -3352 10251 27947 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 300922.9 7984.9 37.686 < 2e-16 *** dummy_variable 18529.6 6809.6 2.721 0.00916 ** M1 -8596.1 9443.3 -0.910 0.36742 M2 -13209.2 9429.5 -1.401 0.16797 M3 -17910.6 9418.7 -1.902 0.06350 . M4 -14726.6 9411.0 -1.565 0.12448 M5 -11885.9 9406.4 -1.264 0.21274 M6 -11855.1 9404.9 -1.261 0.21384 M7 -14571.7 9406.4 -1.549 0.12821 M8 -15199.0 9411.0 -1.615 0.11315 M9 -20187.2 9418.7 -2.143 0.03741 * M10 -25039.5 9367.8 -2.673 0.01037 * M11 -3030.2 9363.2 -0.324 0.74768 t -858.6 170.2 -5.044 7.59e-06 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 14800 on 46 degrees of freedom Multiple R-squared: 0.4715, Adjusted R-squared: 0.3221 F-statistic: 3.157 on 13 and 46 DF, p-value: 0.001977 > 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,] 1.361087e-04 2.722175e-04 0.999863891 [2,] 9.824008e-06 1.964802e-05 0.999990176 [3,] 2.418653e-06 4.837307e-06 0.999997581 [4,] 1.507601e-07 3.015203e-07 0.999999849 [5,] 4.273719e-08 8.547437e-08 0.999999957 [6,] 4.610359e-09 9.220718e-09 0.999999995 [7,] 6.357887e-10 1.271577e-09 0.999999999 [8,] 8.762449e-10 1.752490e-09 0.999999999 [9,] 4.981622e-10 9.963244e-10 1.000000000 [10,] 2.424283e-07 4.848565e-07 0.999999758 [11,] 2.888504e-06 5.777008e-06 0.999997111 [12,] 3.185508e-05 6.371016e-05 0.999968145 [13,] 4.172252e-05 8.344504e-05 0.999958277 [14,] 1.128143e-04 2.256286e-04 0.999887186 [15,] 5.573028e-04 1.114606e-03 0.999442697 [16,] 1.442998e-03 2.885997e-03 0.998557002 [17,] 1.285208e-02 2.570416e-02 0.987147922 [18,] 4.174051e-02 8.348101e-02 0.958259495 [19,] 8.242884e-02 1.648577e-01 0.917571164 [20,] 1.881639e-01 3.763278e-01 0.811836099 [21,] 3.428504e-01 6.857008e-01 0.657149595 [22,] 5.640787e-01 8.718425e-01 0.435921273 [23,] 7.361205e-01 5.277591e-01 0.263879546 [24,] 8.748366e-01 2.503269e-01 0.125163443 [25,] 9.602690e-01 7.946197e-02 0.039730987 [26,] 9.978147e-01 4.370659e-03 0.002185329 [27,] 9.927583e-01 1.448349e-02 0.007241745 > postscript(file="/var/www/html/rcomp/tmp/1fucy1258743334.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/2rg8f1258743334.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/3ga5h1258743334.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/4ecv71258743334.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/5ssrj1258743334.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 -4866.1608 -2954.3608 -3749.3608 -4846.7608 -7615.7608 -6812.9608 7 8 9 10 11 12 -5303.7608 -8704.7608 -5867.9608 -2304.0455 -1188.6455 566.7545 13 14 15 16 17 18 11135.4772 12493.2772 11344.2772 10197.8772 5749.8772 6795.6772 19 20 21 22 23 24 6798.8772 6664.8772 11647.6772 14317.5926 11657.9926 10410.3926 25 26 27 28 29 30 21439.1153 13116.9153 9996.9153 3706.5153 4897.5153 867.3153 31 32 33 34 35 36 -4535.4847 -4894.4847 -6343.6847 -11317.7693 -9284.3693 -9018.9693 37 38 39 40 41 42 -5894.2466 -4442.4466 -6103.4466 -4745.8466 -5291.8466 -7966.0466 43 44 45 46 47 48 -12349.8466 -10858.8466 -16543.0466 -28076.7079 -28132.3079 -29904.9079 49 50 51 52 53 54 -21814.1852 -18213.3852 -11488.3852 -4311.7852 2260.2148 7116.0148 55 56 57 58 59 60 15390.2148 17793.2148 17107.0148 27380.9302 26947.3302 27946.7302 > postscript(file="/var/www/html/rcomp/tmp/6tgo11258743334.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 -4866.1608 NA 1 -2954.3608 -4866.1608 2 -3749.3608 -2954.3608 3 -4846.7608 -3749.3608 4 -7615.7608 -4846.7608 5 -6812.9608 -7615.7608 6 -5303.7608 -6812.9608 7 -8704.7608 -5303.7608 8 -5867.9608 -8704.7608 9 -2304.0455 -5867.9608 10 -1188.6455 -2304.0455 11 566.7545 -1188.6455 12 11135.4772 566.7545 13 12493.2772 11135.4772 14 11344.2772 12493.2772 15 10197.8772 11344.2772 16 5749.8772 10197.8772 17 6795.6772 5749.8772 18 6798.8772 6795.6772 19 6664.8772 6798.8772 20 11647.6772 6664.8772 21 14317.5926 11647.6772 22 11657.9926 14317.5926 23 10410.3926 11657.9926 24 21439.1153 10410.3926 25 13116.9153 21439.1153 26 9996.9153 13116.9153 27 3706.5153 9996.9153 28 4897.5153 3706.5153 29 867.3153 4897.5153 30 -4535.4847 867.3153 31 -4894.4847 -4535.4847 32 -6343.6847 -4894.4847 33 -11317.7693 -6343.6847 34 -9284.3693 -11317.7693 35 -9018.9693 -9284.3693 36 -5894.2466 -9018.9693 37 -4442.4466 -5894.2466 38 -6103.4466 -4442.4466 39 -4745.8466 -6103.4466 40 -5291.8466 -4745.8466 41 -7966.0466 -5291.8466 42 -12349.8466 -7966.0466 43 -10858.8466 -12349.8466 44 -16543.0466 -10858.8466 45 -28076.7079 -16543.0466 46 -28132.3079 -28076.7079 47 -29904.9079 -28132.3079 48 -21814.1852 -29904.9079 49 -18213.3852 -21814.1852 50 -11488.3852 -18213.3852 51 -4311.7852 -11488.3852 52 2260.2148 -4311.7852 53 7116.0148 2260.2148 54 15390.2148 7116.0148 55 17793.2148 15390.2148 56 17107.0148 17793.2148 57 27380.9302 17107.0148 58 26947.3302 27380.9302 59 27946.7302 26947.3302 60 NA 27946.7302 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2954.3608 -4866.1608 [2,] -3749.3608 -2954.3608 [3,] -4846.7608 -3749.3608 [4,] -7615.7608 -4846.7608 [5,] -6812.9608 -7615.7608 [6,] -5303.7608 -6812.9608 [7,] -8704.7608 -5303.7608 [8,] -5867.9608 -8704.7608 [9,] -2304.0455 -5867.9608 [10,] -1188.6455 -2304.0455 [11,] 566.7545 -1188.6455 [12,] 11135.4772 566.7545 [13,] 12493.2772 11135.4772 [14,] 11344.2772 12493.2772 [15,] 10197.8772 11344.2772 [16,] 5749.8772 10197.8772 [17,] 6795.6772 5749.8772 [18,] 6798.8772 6795.6772 [19,] 6664.8772 6798.8772 [20,] 11647.6772 6664.8772 [21,] 14317.5926 11647.6772 [22,] 11657.9926 14317.5926 [23,] 10410.3926 11657.9926 [24,] 21439.1153 10410.3926 [25,] 13116.9153 21439.1153 [26,] 9996.9153 13116.9153 [27,] 3706.5153 9996.9153 [28,] 4897.5153 3706.5153 [29,] 867.3153 4897.5153 [30,] -4535.4847 867.3153 [31,] -4894.4847 -4535.4847 [32,] -6343.6847 -4894.4847 [33,] -11317.7693 -6343.6847 [34,] -9284.3693 -11317.7693 [35,] -9018.9693 -9284.3693 [36,] -5894.2466 -9018.9693 [37,] -4442.4466 -5894.2466 [38,] -6103.4466 -4442.4466 [39,] -4745.8466 -6103.4466 [40,] -5291.8466 -4745.8466 [41,] -7966.0466 -5291.8466 [42,] -12349.8466 -7966.0466 [43,] -10858.8466 -12349.8466 [44,] -16543.0466 -10858.8466 [45,] -28076.7079 -16543.0466 [46,] -28132.3079 -28076.7079 [47,] -29904.9079 -28132.3079 [48,] -21814.1852 -29904.9079 [49,] -18213.3852 -21814.1852 [50,] -11488.3852 -18213.3852 [51,] -4311.7852 -11488.3852 [52,] 2260.2148 -4311.7852 [53,] 7116.0148 2260.2148 [54,] 15390.2148 7116.0148 [55,] 17793.2148 15390.2148 [56,] 17107.0148 17793.2148 [57,] 27380.9302 17107.0148 [58,] 26947.3302 27380.9302 [59,] 27946.7302 26947.3302 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2954.3608 -4866.1608 2 -3749.3608 -2954.3608 3 -4846.7608 -3749.3608 4 -7615.7608 -4846.7608 5 -6812.9608 -7615.7608 6 -5303.7608 -6812.9608 7 -8704.7608 -5303.7608 8 -5867.9608 -8704.7608 9 -2304.0455 -5867.9608 10 -1188.6455 -2304.0455 11 566.7545 -1188.6455 12 11135.4772 566.7545 13 12493.2772 11135.4772 14 11344.2772 12493.2772 15 10197.8772 11344.2772 16 5749.8772 10197.8772 17 6795.6772 5749.8772 18 6798.8772 6795.6772 19 6664.8772 6798.8772 20 11647.6772 6664.8772 21 14317.5926 11647.6772 22 11657.9926 14317.5926 23 10410.3926 11657.9926 24 21439.1153 10410.3926 25 13116.9153 21439.1153 26 9996.9153 13116.9153 27 3706.5153 9996.9153 28 4897.5153 3706.5153 29 867.3153 4897.5153 30 -4535.4847 867.3153 31 -4894.4847 -4535.4847 32 -6343.6847 -4894.4847 33 -11317.7693 -6343.6847 34 -9284.3693 -11317.7693 35 -9018.9693 -9284.3693 36 -5894.2466 -9018.9693 37 -4442.4466 -5894.2466 38 -6103.4466 -4442.4466 39 -4745.8466 -6103.4466 40 -5291.8466 -4745.8466 41 -7966.0466 -5291.8466 42 -12349.8466 -7966.0466 43 -10858.8466 -12349.8466 44 -16543.0466 -10858.8466 45 -28076.7079 -16543.0466 46 -28132.3079 -28076.7079 47 -29904.9079 -28132.3079 48 -21814.1852 -29904.9079 49 -18213.3852 -21814.1852 50 -11488.3852 -18213.3852 51 -4311.7852 -11488.3852 52 2260.2148 -4311.7852 53 7116.0148 2260.2148 54 15390.2148 7116.0148 55 17793.2148 15390.2148 56 17107.0148 17793.2148 57 27380.9302 17107.0148 58 26947.3302 27380.9302 59 27946.7302 26947.3302 > 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/7vi7j1258743334.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/8qni21258743334.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/9m5391258743334.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/10ihq81258743334.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/11isyw1258743334.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/12ftqp1258743334.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/13653c1258743334.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/14qac91258743334.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/15h6001258743334.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/16w5gw1258743334.tab") + } > > system("convert tmp/1fucy1258743334.ps tmp/1fucy1258743334.png") > system("convert tmp/2rg8f1258743334.ps tmp/2rg8f1258743334.png") > system("convert tmp/3ga5h1258743334.ps tmp/3ga5h1258743334.png") > system("convert tmp/4ecv71258743334.ps tmp/4ecv71258743334.png") > system("convert tmp/5ssrj1258743334.ps tmp/5ssrj1258743334.png") > system("convert tmp/6tgo11258743334.ps tmp/6tgo11258743334.png") > system("convert tmp/7vi7j1258743334.ps tmp/7vi7j1258743334.png") > system("convert tmp/8qni21258743334.ps tmp/8qni21258743334.png") > system("convert tmp/9m5391258743334.ps tmp/9m5391258743334.png") > system("convert tmp/10ihq81258743334.ps tmp/10ihq81258743334.png") > > > proc.time() user system elapsed 2.373 1.562 2.797