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(68.848 + ,73.159 + ,72.616 + ,60.106 + ,63.152 + ,77.056 + ,68.848 + ,73.159 + ,72.616 + ,60.106 + ,62.246 + ,77.056 + ,68.848 + ,73.159 + ,72.616 + ,60.777 + ,62.246 + ,77.056 + ,68.848 + ,73.159 + ,64.513 + ,60.777 + ,62.246 + ,77.056 + ,68.848 + ,58.353 + ,64.513 + ,60.777 + ,62.246 + ,77.056 + ,56.511 + ,58.353 + ,64.513 + ,60.777 + ,62.246 + ,44.554 + ,56.511 + ,58.353 + ,64.513 + ,60.777 + ,71.414 + ,44.554 + ,56.511 + ,58.353 + ,64.513 + ,65.719 + ,71.414 + ,44.554 + ,56.511 + ,58.353 + ,80.997 + ,65.719 + ,71.414 + ,44.554 + ,56.511 + ,69.826 + ,80.997 + ,65.719 + ,71.414 + ,44.554 + ,65.386 + ,69.826 + ,80.997 + ,65.719 + ,71.414 + ,75.589 + ,65.386 + ,69.826 + ,80.997 + ,65.719 + ,65.520 + ,75.589 + ,65.386 + ,69.826 + ,80.997 + ,59.003 + ,65.520 + ,75.589 + ,65.386 + ,69.826 + ,63.961 + ,59.003 + ,65.520 + ,75.589 + ,65.386 + ,59.716 + ,63.961 + ,59.003 + ,65.520 + ,75.589 + ,57.520 + ,59.716 + ,63.961 + ,59.003 + ,65.520 + ,42.886 + ,57.520 + ,59.716 + ,63.961 + ,59.003 + ,69.805 + ,42.886 + ,57.520 + ,59.716 + ,63.961 + ,64.656 + ,69.805 + ,42.886 + ,57.520 + ,59.716 + ,80.353 + ,64.656 + ,69.805 + ,42.886 + ,57.520 + ,71.321 + ,80.353 + ,64.656 + ,69.805 + ,42.886 + ,76.577 + ,71.321 + ,80.353 + ,64.656 + ,69.805 + ,81.580 + ,76.577 + ,71.321 + ,80.353 + ,64.656 + ,71.127 + ,81.580 + ,76.577 + ,71.321 + ,80.353 + ,63.478 + ,71.127 + ,81.580 + ,76.577 + ,71.321 + ,48.152 + ,63.478 + ,71.127 + ,81.580 + ,76.577 + ,69.236 + ,48.152 + ,63.478 + ,71.127 + ,81.580 + ,57.038 + ,69.236 + ,48.152 + ,63.478 + ,71.127 + ,43.621 + ,57.038 + ,69.236 + ,48.152 + ,63.478 + ,69.551 + ,43.621 + ,57.038 + ,69.236 + ,48.152 + ,72.009 + ,69.551 + ,43.621 + ,57.038 + ,69.236 + ,72.140 + ,72.009 + ,69.551 + ,43.621 + ,57.038 + ,81.519 + ,72.140 + ,72.009 + ,69.551 + ,43.621 + ,73.310 + ,81.519 + ,72.140 + ,72.009 + ,69.551 + ,80.406 + ,73.310 + ,81.519 + ,72.140 + ,72.009 + ,70.697 + ,80.406 + ,73.310 + ,81.519 + ,72.140 + ,59.328 + ,70.697 + ,80.406 + ,73.310 + ,81.519 + ,68.281 + ,59.328 + ,70.697 + ,80.406 + ,73.310 + ,70.041 + ,68.281 + ,59.328 + ,70.697 + ,80.406 + ,51.244 + ,70.041 + ,68.281 + ,59.328 + ,70.697 + ,46.538 + ,51.244 + ,70.041 + ,68.281 + ,59.328 + ,61.443 + ,46.538 + ,51.244 + ,70.041 + ,68.281 + ,62.256 + ,61.443 + ,46.538 + ,51.244 + ,70.041 + ,73.117 + ,62.256 + ,61.443 + ,46.538 + ,51.244 + ,74.155 + ,73.117 + ,62.256 + ,61.443 + ,46.538 + ,65.191 + ,74.155 + ,73.117 + ,62.256 + ,61.443 + ,77.889 + ,65.191 + ,74.155 + ,73.117 + ,62.256 + ,68.688 + ,77.889 + ,65.191 + ,74.155 + ,73.117 + ,59.983 + ,68.688 + ,77.889 + ,65.191 + ,74.155 + ,65.470 + ,59.983 + ,68.688 + ,77.889 + ,65.191 + ,65.089 + ,65.470 + ,59.983 + ,68.688 + ,77.889 + ,54.795 + ,65.089 + ,65.470 + ,59.983 + ,68.688 + ,47.123 + ,54.795 + ,65.089 + ,65.470 + ,59.983) + ,dim=c(5 + ,56) + ,dimnames=list(c('Yt' + ,'Yt-1' + ,'Yt-2' + ,'Yt-3' + ,'Yt-4') + ,1:56)) > y <- array(NA,dim=c(5,56),dimnames=list(c('Yt','Yt-1','Yt-2','Yt-3','Yt-4'),1:56)) > 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 = '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 Yt Yt-1 Yt-2 Yt-3 Yt-4 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 68.848 73.159 72.616 60.106 63.152 1 0 0 0 0 0 0 0 0 0 0 2 77.056 68.848 73.159 72.616 60.106 0 1 0 0 0 0 0 0 0 0 0 3 62.246 77.056 68.848 73.159 72.616 0 0 1 0 0 0 0 0 0 0 0 4 60.777 62.246 77.056 68.848 73.159 0 0 0 1 0 0 0 0 0 0 0 5 64.513 60.777 62.246 77.056 68.848 0 0 0 0 1 0 0 0 0 0 0 6 58.353 64.513 60.777 62.246 77.056 0 0 0 0 0 1 0 0 0 0 0 7 56.511 58.353 64.513 60.777 62.246 0 0 0 0 0 0 1 0 0 0 0 8 44.554 56.511 58.353 64.513 60.777 0 0 0 0 0 0 0 1 0 0 0 9 71.414 44.554 56.511 58.353 64.513 0 0 0 0 0 0 0 0 1 0 0 10 65.719 71.414 44.554 56.511 58.353 0 0 0 0 0 0 0 0 0 1 0 11 80.997 65.719 71.414 44.554 56.511 0 0 0 0 0 0 0 0 0 0 1 12 69.826 80.997 65.719 71.414 44.554 0 0 0 0 0 0 0 0 0 0 0 13 65.386 69.826 80.997 65.719 71.414 1 0 0 0 0 0 0 0 0 0 0 14 75.589 65.386 69.826 80.997 65.719 0 1 0 0 0 0 0 0 0 0 0 15 65.520 75.589 65.386 69.826 80.997 0 0 1 0 0 0 0 0 0 0 0 16 59.003 65.520 75.589 65.386 69.826 0 0 0 1 0 0 0 0 0 0 0 17 63.961 59.003 65.520 75.589 65.386 0 0 0 0 1 0 0 0 0 0 0 18 59.716 63.961 59.003 65.520 75.589 0 0 0 0 0 1 0 0 0 0 0 19 57.520 59.716 63.961 59.003 65.520 0 0 0 0 0 0 1 0 0 0 0 20 42.886 57.520 59.716 63.961 59.003 0 0 0 0 0 0 0 1 0 0 0 21 69.805 42.886 57.520 59.716 63.961 0 0 0 0 0 0 0 0 1 0 0 22 64.656 69.805 42.886 57.520 59.716 0 0 0 0 0 0 0 0 0 1 0 23 80.353 64.656 69.805 42.886 57.520 0 0 0 0 0 0 0 0 0 0 1 24 71.321 80.353 64.656 69.805 42.886 0 0 0 0 0 0 0 0 0 0 0 25 76.577 71.321 80.353 64.656 69.805 1 0 0 0 0 0 0 0 0 0 0 26 81.580 76.577 71.321 80.353 64.656 0 1 0 0 0 0 0 0 0 0 0 27 71.127 81.580 76.577 71.321 80.353 0 0 1 0 0 0 0 0 0 0 0 28 63.478 71.127 81.580 76.577 71.321 0 0 0 1 0 0 0 0 0 0 0 29 48.152 63.478 71.127 81.580 76.577 0 0 0 0 1 0 0 0 0 0 0 30 69.236 48.152 63.478 71.127 81.580 0 0 0 0 0 1 0 0 0 0 0 31 57.038 69.236 48.152 63.478 71.127 0 0 0 0 0 0 1 0 0 0 0 32 43.621 57.038 69.236 48.152 63.478 0 0 0 0 0 0 0 1 0 0 0 33 69.551 43.621 57.038 69.236 48.152 0 0 0 0 0 0 0 0 1 0 0 34 72.009 69.551 43.621 57.038 69.236 0 0 0 0 0 0 0 0 0 1 0 35 72.140 72.009 69.551 43.621 57.038 0 0 0 0 0 0 0 0 0 0 1 36 81.519 72.140 72.009 69.551 43.621 0 0 0 0 0 0 0 0 0 0 0 37 73.310 81.519 72.140 72.009 69.551 1 0 0 0 0 0 0 0 0 0 0 38 80.406 73.310 81.519 72.140 72.009 0 1 0 0 0 0 0 0 0 0 0 39 70.697 80.406 73.310 81.519 72.140 0 0 1 0 0 0 0 0 0 0 0 40 59.328 70.697 80.406 73.310 81.519 0 0 0 1 0 0 0 0 0 0 0 41 68.281 59.328 70.697 80.406 73.310 0 0 0 0 1 0 0 0 0 0 0 42 70.041 68.281 59.328 70.697 80.406 0 0 0 0 0 1 0 0 0 0 0 43 51.244 70.041 68.281 59.328 70.697 0 0 0 0 0 0 1 0 0 0 0 44 46.538 51.244 70.041 68.281 59.328 0 0 0 0 0 0 0 1 0 0 0 45 61.443 46.538 51.244 70.041 68.281 0 0 0 0 0 0 0 0 1 0 0 46 62.256 61.443 46.538 51.244 70.041 0 0 0 0 0 0 0 0 0 1 0 47 73.117 62.256 61.443 46.538 51.244 0 0 0 0 0 0 0 0 0 0 1 48 74.155 73.117 62.256 61.443 46.538 0 0 0 0 0 0 0 0 0 0 0 49 65.191 74.155 73.117 62.256 61.443 1 0 0 0 0 0 0 0 0 0 0 50 77.889 65.191 74.155 73.117 62.256 0 1 0 0 0 0 0 0 0 0 0 51 68.688 77.889 65.191 74.155 73.117 0 0 1 0 0 0 0 0 0 0 0 52 59.983 68.688 77.889 65.191 74.155 0 0 0 1 0 0 0 0 0 0 0 53 65.470 59.983 68.688 77.889 65.191 0 0 0 0 1 0 0 0 0 0 0 54 65.089 65.470 59.983 68.688 77.889 0 0 0 0 0 1 0 0 0 0 0 55 54.795 65.089 65.470 59.983 68.688 0 0 0 0 0 0 1 0 0 0 0 56 47.123 54.795 65.089 65.470 59.983 0 0 0 0 0 0 0 1 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `Yt-1` `Yt-2` `Yt-3` `Yt-4` M1 64.69877 -0.13265 0.16944 0.15321 -0.04421 -4.85820 M2 M3 M4 M5 M6 M7 1.78511 -6.45173 -15.94517 -14.99948 -9.12650 -17.52196 M8 M9 M10 M11 -30.16525 -7.32382 -2.70607 4.85220 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -14.2929 -1.7561 0.1705 2.4811 6.1962 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 64.69877 19.51058 3.316 0.00195 ** `Yt-1` -0.13265 0.15822 -0.838 0.40680 `Yt-2` 0.16944 0.15691 1.080 0.28667 `Yt-3` 0.15321 0.15276 1.003 0.32190 `Yt-4` -0.04421 0.15392 -0.287 0.77544 M1 -4.85820 4.65662 -1.043 0.30308 M2 1.78511 4.84632 0.368 0.71456 M3 -6.45173 5.73676 -1.125 0.26745 M4 -15.94517 5.81441 -2.742 0.00908 ** M5 -14.99948 6.20078 -2.419 0.02021 * M6 -9.12650 6.97684 -1.308 0.19830 M7 -17.52196 5.41410 -3.236 0.00243 ** M8 -30.16525 5.39063 -5.596 1.75e-06 *** M9 -7.32382 7.26976 -1.007 0.31978 M10 -2.70607 6.50074 -0.416 0.67944 M11 4.85220 5.12808 0.946 0.34973 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.477 on 40 degrees of freedom Multiple R-squared: 0.8531, Adjusted R-squared: 0.798 F-statistic: 15.48 on 15 and 40 DF, p-value: 3.781e-12 > 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,] 2.177549e-02 0.0435509859 0.97822451 [2,] 5.002049e-03 0.0100040989 0.99499795 [3,] 1.593765e-03 0.0031875304 0.99840623 [4,] 6.233863e-04 0.0012467725 0.99937661 [5,] 3.042103e-04 0.0006084205 0.99969579 [6,] 9.552867e-05 0.0001910573 0.99990447 [7,] 5.566593e-02 0.1113318671 0.94433407 [8,] 2.780233e-02 0.0556046662 0.97219767 [9,] 1.816132e-02 0.0363226381 0.98183868 [10,] 8.159172e-03 0.0163183437 0.99184083 [11,] 8.829269e-01 0.2341462943 0.11707315 [12,] 9.713585e-01 0.0572830100 0.02864150 [13,] 9.491717e-01 0.1016566453 0.05082832 [14,] 9.524056e-01 0.0951888678 0.04759443 [15,] 9.398911e-01 0.1202177024 0.06010885 [16,] 9.234744e-01 0.1530512570 0.07652563 [17,] 8.693217e-01 0.2613565112 0.13067826 [18,] 8.890059e-01 0.2219881999 0.11099410 [19,] 8.128676e-01 0.3742648648 0.18713243 > postscript(file="/var/www/html/rcomp/tmp/1ec7p1290960676.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/2ec7p1290960676.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/3pl6a1290960676.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/4pl6a1290960676.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/5pl6a1290960676.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 = 56 Frequency = 1 1 2 3 4 5 -0.009661804 -1.160173293 -5.444278027 -0.090596858 3.566129341 6 7 8 9 10 -5.090447825 -0.416750194 0.431619299 4.285188635 -0.428764035 11 12 13 14 15 3.734904900 -4.236235044 -5.828606211 -3.557595029 -0.897111160 16 17 18 19 20 -0.798659447 2.295784319 -4.066550993 1.283111123 -1.327337310 21 22 23 24 25 2.050736717 -1.516903223 3.522695674 -2.473760941 5.761557339 26 27 28 29 30 3.716217307 3.350839239 1.756452863 -14.292858674 2.003966644 31 32 33 34 35 4.304838293 0.350617742 -0.181548321 6.172561810 -3.805834360 36 37 38 39 40 5.460320640 4.101103358 1.964291711 1.393140339 -1.300294992 41 42 43 44 45 5.393965888 6.196174636 -4.176232770 -0.904818296 -6.154377031 46 47 48 49 50 -4.226894551 -3.451766215 1.249675345 -4.024392682 -0.962740696 51 52 53 54 55 1.597409610 0.433098434 3.036979126 0.956857537 -0.994966453 56 1.449918565 > postscript(file="/var/www/html/rcomp/tmp/60c5v1290960676.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 = 56 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.009661804 NA 1 -1.160173293 -0.009661804 2 -5.444278027 -1.160173293 3 -0.090596858 -5.444278027 4 3.566129341 -0.090596858 5 -5.090447825 3.566129341 6 -0.416750194 -5.090447825 7 0.431619299 -0.416750194 8 4.285188635 0.431619299 9 -0.428764035 4.285188635 10 3.734904900 -0.428764035 11 -4.236235044 3.734904900 12 -5.828606211 -4.236235044 13 -3.557595029 -5.828606211 14 -0.897111160 -3.557595029 15 -0.798659447 -0.897111160 16 2.295784319 -0.798659447 17 -4.066550993 2.295784319 18 1.283111123 -4.066550993 19 -1.327337310 1.283111123 20 2.050736717 -1.327337310 21 -1.516903223 2.050736717 22 3.522695674 -1.516903223 23 -2.473760941 3.522695674 24 5.761557339 -2.473760941 25 3.716217307 5.761557339 26 3.350839239 3.716217307 27 1.756452863 3.350839239 28 -14.292858674 1.756452863 29 2.003966644 -14.292858674 30 4.304838293 2.003966644 31 0.350617742 4.304838293 32 -0.181548321 0.350617742 33 6.172561810 -0.181548321 34 -3.805834360 6.172561810 35 5.460320640 -3.805834360 36 4.101103358 5.460320640 37 1.964291711 4.101103358 38 1.393140339 1.964291711 39 -1.300294992 1.393140339 40 5.393965888 -1.300294992 41 6.196174636 5.393965888 42 -4.176232770 6.196174636 43 -0.904818296 -4.176232770 44 -6.154377031 -0.904818296 45 -4.226894551 -6.154377031 46 -3.451766215 -4.226894551 47 1.249675345 -3.451766215 48 -4.024392682 1.249675345 49 -0.962740696 -4.024392682 50 1.597409610 -0.962740696 51 0.433098434 1.597409610 52 3.036979126 0.433098434 53 0.956857537 3.036979126 54 -0.994966453 0.956857537 55 1.449918565 -0.994966453 56 NA 1.449918565 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.16017329 -0.009661804 [2,] -5.44427803 -1.160173293 [3,] -0.09059686 -5.444278027 [4,] 3.56612934 -0.090596858 [5,] -5.09044783 3.566129341 [6,] -0.41675019 -5.090447825 [7,] 0.43161930 -0.416750194 [8,] 4.28518864 0.431619299 [9,] -0.42876403 4.285188635 [10,] 3.73490490 -0.428764035 [11,] -4.23623504 3.734904900 [12,] -5.82860621 -4.236235044 [13,] -3.55759503 -5.828606211 [14,] -0.89711116 -3.557595029 [15,] -0.79865945 -0.897111160 [16,] 2.29578432 -0.798659447 [17,] -4.06655099 2.295784319 [18,] 1.28311112 -4.066550993 [19,] -1.32733731 1.283111123 [20,] 2.05073672 -1.327337310 [21,] -1.51690322 2.050736717 [22,] 3.52269567 -1.516903223 [23,] -2.47376094 3.522695674 [24,] 5.76155734 -2.473760941 [25,] 3.71621731 5.761557339 [26,] 3.35083924 3.716217307 [27,] 1.75645286 3.350839239 [28,] -14.29285867 1.756452863 [29,] 2.00396664 -14.292858674 [30,] 4.30483829 2.003966644 [31,] 0.35061774 4.304838293 [32,] -0.18154832 0.350617742 [33,] 6.17256181 -0.181548321 [34,] -3.80583436 6.172561810 [35,] 5.46032064 -3.805834360 [36,] 4.10110336 5.460320640 [37,] 1.96429171 4.101103358 [38,] 1.39314034 1.964291711 [39,] -1.30029499 1.393140339 [40,] 5.39396589 -1.300294992 [41,] 6.19617464 5.393965888 [42,] -4.17623277 6.196174636 [43,] -0.90481830 -4.176232770 [44,] -6.15437703 -0.904818296 [45,] -4.22689455 -6.154377031 [46,] -3.45176621 -4.226894551 [47,] 1.24967535 -3.451766215 [48,] -4.02439268 1.249675345 [49,] -0.96274070 -4.024392682 [50,] 1.59740961 -0.962740696 [51,] 0.43309843 1.597409610 [52,] 3.03697913 0.433098434 [53,] 0.95685754 3.036979126 [54,] -0.99496645 0.956857537 [55,] 1.44991856 -0.994966453 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.16017329 -0.009661804 2 -5.44427803 -1.160173293 3 -0.09059686 -5.444278027 4 3.56612934 -0.090596858 5 -5.09044783 3.566129341 6 -0.41675019 -5.090447825 7 0.43161930 -0.416750194 8 4.28518864 0.431619299 9 -0.42876403 4.285188635 10 3.73490490 -0.428764035 11 -4.23623504 3.734904900 12 -5.82860621 -4.236235044 13 -3.55759503 -5.828606211 14 -0.89711116 -3.557595029 15 -0.79865945 -0.897111160 16 2.29578432 -0.798659447 17 -4.06655099 2.295784319 18 1.28311112 -4.066550993 19 -1.32733731 1.283111123 20 2.05073672 -1.327337310 21 -1.51690322 2.050736717 22 3.52269567 -1.516903223 23 -2.47376094 3.522695674 24 5.76155734 -2.473760941 25 3.71621731 5.761557339 26 3.35083924 3.716217307 27 1.75645286 3.350839239 28 -14.29285867 1.756452863 29 2.00396664 -14.292858674 30 4.30483829 2.003966644 31 0.35061774 4.304838293 32 -0.18154832 0.350617742 33 6.17256181 -0.181548321 34 -3.80583436 6.172561810 35 5.46032064 -3.805834360 36 4.10110336 5.460320640 37 1.96429171 4.101103358 38 1.39314034 1.964291711 39 -1.30029499 1.393140339 40 5.39396589 -1.300294992 41 6.19617464 5.393965888 42 -4.17623277 6.196174636 43 -0.90481830 -4.176232770 44 -6.15437703 -0.904818296 45 -4.22689455 -6.154377031 46 -3.45176621 -4.226894551 47 1.24967535 -3.451766215 48 -4.02439268 1.249675345 49 -0.96274070 -4.024392682 50 1.59740961 -0.962740696 51 0.43309843 1.597409610 52 3.03697913 0.433098434 53 0.95685754 3.036979126 54 -0.99496645 0.956857537 55 1.44991856 -0.994966453 > 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/7a4ng1290960676.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/8a4ng1290960676.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/9a4ng1290960676.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/10ld4j1290960676.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/117v371290960676.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/12sw1v1290960676.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/13oohl1290960676.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/14roxr1290960676.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/15dpex1290960676.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/16ryuo1290960676.tab") + } > try(system("convert tmp/1ec7p1290960676.ps tmp/1ec7p1290960676.png",intern=TRUE)) character(0) > try(system("convert tmp/2ec7p1290960676.ps tmp/2ec7p1290960676.png",intern=TRUE)) character(0) > try(system("convert tmp/3pl6a1290960676.ps tmp/3pl6a1290960676.png",intern=TRUE)) character(0) > try(system("convert tmp/4pl6a1290960676.ps tmp/4pl6a1290960676.png",intern=TRUE)) character(0) > try(system("convert tmp/5pl6a1290960676.ps tmp/5pl6a1290960676.png",intern=TRUE)) character(0) > try(system("convert tmp/60c5v1290960676.ps tmp/60c5v1290960676.png",intern=TRUE)) character(0) > try(system("convert tmp/7a4ng1290960676.ps tmp/7a4ng1290960676.png",intern=TRUE)) character(0) > try(system("convert tmp/8a4ng1290960676.ps tmp/8a4ng1290960676.png",intern=TRUE)) character(0) > try(system("convert tmp/9a4ng1290960676.ps tmp/9a4ng1290960676.png",intern=TRUE)) character(0) > try(system("convert tmp/10ld4j1290960676.ps tmp/10ld4j1290960676.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.339 1.565 5.213