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(100.4 + ,120.2 + ,17 + ,74 + ,79.9 + ,72.9 + ,72.9 + ,103 + ,122.1 + ,16 + ,76 + ,74 + ,79.9 + ,72.9 + ,99 + ,119.3 + ,20 + ,69.6 + ,76 + ,74 + ,79.9 + ,104.8 + ,121.7 + ,24 + ,77.3 + ,69.6 + ,76 + ,74 + ,104.5 + ,113.5 + ,23 + ,75.2 + ,77.3 + ,69.6 + ,76 + ,104.8 + ,123.7 + ,20 + ,75.8 + ,75.2 + ,77.3 + ,69.6 + ,103.8 + ,123.4 + ,21 + ,77.6 + ,75.8 + ,75.2 + ,77.3 + ,106.3 + ,126.4 + ,19 + ,76.7 + ,77.6 + ,75.8 + ,75.2 + ,105.2 + ,124.1 + ,23 + ,77 + ,76.7 + ,77.6 + ,75.8 + ,108.2 + ,125.6 + ,23 + ,77.9 + ,77 + ,76.7 + ,77.6 + ,106.2 + ,124.8 + ,23 + ,76.7 + ,77.9 + ,77 + ,76.7 + ,103.9 + ,123 + ,23 + ,71.9 + ,76.7 + ,77.9 + ,77 + ,104.9 + ,126.9 + ,27 + ,73.4 + ,71.9 + ,76.7 + ,77.9 + ,106.2 + ,127.3 + ,26 + ,72.5 + ,73.4 + ,71.9 + ,76.7 + ,107.9 + ,129 + ,17 + ,73.7 + ,72.5 + ,73.4 + ,71.9 + ,106.9 + ,126.2 + ,24 + ,69.5 + ,73.7 + ,72.5 + ,73.4 + ,110.3 + ,125.4 + ,26 + ,74.7 + ,69.5 + ,73.7 + ,72.5 + ,109.8 + ,126.3 + ,24 + ,72.5 + ,74.7 + ,69.5 + ,73.7 + ,108.3 + ,126.3 + ,27 + ,72.1 + ,72.5 + ,74.7 + ,69.5 + ,110.9 + ,128.4 + ,27 + ,70.7 + ,72.1 + ,72.5 + ,74.7 + ,109.8 + ,127.2 + ,26 + ,71.4 + ,70.7 + ,72.1 + ,72.5 + ,109.3 + ,128.5 + ,24 + ,69.5 + ,71.4 + ,70.7 + ,72.1 + ,109 + ,129 + ,23 + ,73.5 + ,69.5 + ,71.4 + ,70.7 + ,107.9 + ,128.9 + ,23 + ,72.4 + ,73.5 + ,69.5 + ,71.4 + ,108.4 + ,128.3 + ,24 + ,74.5 + ,72.4 + ,73.5 + ,69.5 + ,107.2 + ,124.6 + ,17 + ,72.2 + ,74.5 + ,72.4 + ,73.5 + ,109.5 + ,126.2 + ,21 + ,73 + ,72.2 + ,74.5 + ,72.4 + ,109.9 + ,129.1 + ,19 + ,73.3 + ,73 + ,72.2 + ,74.5 + ,108 + ,127.3 + ,22 + ,71.3 + ,73.3 + ,73 + ,72.2 + ,114.7 + ,129.2 + ,22 + ,73.6 + ,71.3 + ,73.3 + ,73 + ,115.6 + ,130.4 + ,18 + ,71.3 + ,73.6 + ,71.3 + ,73.3 + ,107.6 + ,125.9 + ,16 + ,71.2 + ,71.3 + ,73.6 + ,71.3 + ,115.9 + ,135.8 + ,14 + ,81.4 + ,71.2 + ,71.3 + ,73.6 + ,111.8 + ,126.4 + ,12 + ,76.1 + ,81.4 + ,71.2 + ,71.3 + ,110 + ,129.5 + ,14 + ,71.1 + ,76.1 + ,81.4 + ,71.2 + ,109.2 + ,128.4 + ,16 + ,75.7 + ,71.1 + ,76.1 + ,81.4 + ,108 + ,125.6 + ,8 + ,70 + ,75.7 + ,71.1 + ,76.1 + ,105.6 + ,127.7 + ,3 + ,68.5 + ,70 + ,75.7 + ,71.1 + ,103 + ,126.4 + ,0 + ,56.7 + ,68.5 + ,70 + ,75.7 + ,99.6 + ,124.2 + ,5 + ,57.9 + ,56.7 + ,68.5 + ,70 + ,97.9 + ,126.4 + ,1 + ,58.8 + ,57.9 + ,56.7 + ,68.5 + ,97.6 + ,123.7 + ,1 + ,59.3 + ,58.8 + ,57.9 + ,56.7 + ,96.2 + ,121.8 + ,3 + ,61.3 + ,59.3 + ,58.8 + ,57.9 + ,97.9 + ,124 + ,6 + ,62.9 + ,61.3 + ,59.3 + ,58.8 + ,94.5 + ,122.7 + ,7 + ,61.4 + ,62.9 + ,61.3 + ,59.3 + ,95.4 + ,122.9 + ,8 + ,64.5 + ,61.4 + ,62.9 + ,61.3 + ,94.4 + ,121 + ,14 + ,63.8 + ,64.5 + ,61.4 + ,62.9 + ,96.3 + ,122.8 + ,14 + ,61.6 + ,63.8 + ,64.5 + ,61.4 + ,95.1 + ,122.9 + ,13 + ,64.7 + ,61.6 + ,63.8 + ,64.5) + ,dim=c(7 + ,49) + ,dimnames=list(c('totid' + ,'ndzcg' + ,'indc' + ,'Y' + ,'y1' + ,'y2' + ,'y3 ') + ,1:49)) > y <- array(NA,dim=c(7,49),dimnames=list(c('totid','ndzcg','indc','Y','y1','y2','y3 '),1:49)) > 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 = '4' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Y totid ndzcg indc y1 y2 y3\r M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 74.0 100.4 120.2 17 79.9 72.9 72.9 1 0 0 0 0 0 0 0 0 0 0 1 2 76.0 103.0 122.1 16 74.0 79.9 72.9 0 1 0 0 0 0 0 0 0 0 0 2 3 69.6 99.0 119.3 20 76.0 74.0 79.9 0 0 1 0 0 0 0 0 0 0 0 3 4 77.3 104.8 121.7 24 69.6 76.0 74.0 0 0 0 1 0 0 0 0 0 0 0 4 5 75.2 104.5 113.5 23 77.3 69.6 76.0 0 0 0 0 1 0 0 0 0 0 0 5 6 75.8 104.8 123.7 20 75.2 77.3 69.6 0 0 0 0 0 1 0 0 0 0 0 6 7 77.6 103.8 123.4 21 75.8 75.2 77.3 0 0 0 0 0 0 1 0 0 0 0 7 8 76.7 106.3 126.4 19 77.6 75.8 75.2 0 0 0 0 0 0 0 1 0 0 0 8 9 77.0 105.2 124.1 23 76.7 77.6 75.8 0 0 0 0 0 0 0 0 1 0 0 9 10 77.9 108.2 125.6 23 77.0 76.7 77.6 0 0 0 0 0 0 0 0 0 1 0 10 11 76.7 106.2 124.8 23 77.9 77.0 76.7 0 0 0 0 0 0 0 0 0 0 1 11 12 71.9 103.9 123.0 23 76.7 77.9 77.0 0 0 0 0 0 0 0 0 0 0 0 12 13 73.4 104.9 126.9 27 71.9 76.7 77.9 1 0 0 0 0 0 0 0 0 0 0 13 14 72.5 106.2 127.3 26 73.4 71.9 76.7 0 1 0 0 0 0 0 0 0 0 0 14 15 73.7 107.9 129.0 17 72.5 73.4 71.9 0 0 1 0 0 0 0 0 0 0 0 15 16 69.5 106.9 126.2 24 73.7 72.5 73.4 0 0 0 1 0 0 0 0 0 0 0 16 17 74.7 110.3 125.4 26 69.5 73.7 72.5 0 0 0 0 1 0 0 0 0 0 0 17 18 72.5 109.8 126.3 24 74.7 69.5 73.7 0 0 0 0 0 1 0 0 0 0 0 18 19 72.1 108.3 126.3 27 72.5 74.7 69.5 0 0 0 0 0 0 1 0 0 0 0 19 20 70.7 110.9 128.4 27 72.1 72.5 74.7 0 0 0 0 0 0 0 1 0 0 0 20 21 71.4 109.8 127.2 26 70.7 72.1 72.5 0 0 0 0 0 0 0 0 1 0 0 21 22 69.5 109.3 128.5 24 71.4 70.7 72.1 0 0 0 0 0 0 0 0 0 1 0 22 23 73.5 109.0 129.0 23 69.5 71.4 70.7 0 0 0 0 0 0 0 0 0 0 1 23 24 72.4 107.9 128.9 23 73.5 69.5 71.4 0 0 0 0 0 0 0 0 0 0 0 24 25 74.5 108.4 128.3 24 72.4 73.5 69.5 1 0 0 0 0 0 0 0 0 0 0 25 26 72.2 107.2 124.6 17 74.5 72.4 73.5 0 1 0 0 0 0 0 0 0 0 0 26 27 73.0 109.5 126.2 21 72.2 74.5 72.4 0 0 1 0 0 0 0 0 0 0 0 27 28 73.3 109.9 129.1 19 73.0 72.2 74.5 0 0 0 1 0 0 0 0 0 0 0 28 29 71.3 108.0 127.3 22 73.3 73.0 72.2 0 0 0 0 1 0 0 0 0 0 0 29 30 73.6 114.7 129.2 22 71.3 73.3 73.0 0 0 0 0 0 1 0 0 0 0 0 30 31 71.3 115.6 130.4 18 73.6 71.3 73.3 0 0 0 0 0 0 1 0 0 0 0 31 32 71.2 107.6 125.9 16 71.3 73.6 71.3 0 0 0 0 0 0 0 1 0 0 0 32 33 81.4 115.9 135.8 14 71.2 71.3 73.6 0 0 0 0 0 0 0 0 1 0 0 33 34 76.1 111.8 126.4 12 81.4 71.2 71.3 0 0 0 0 0 0 0 0 0 1 0 34 35 71.1 110.0 129.5 14 76.1 81.4 71.2 0 0 0 0 0 0 0 0 0 0 1 35 36 75.7 109.2 128.4 16 71.1 76.1 81.4 0 0 0 0 0 0 0 0 0 0 0 36 37 70.0 108.0 125.6 8 75.7 71.1 76.1 1 0 0 0 0 0 0 0 0 0 0 37 38 68.5 105.6 127.7 3 70.0 75.7 71.1 0 1 0 0 0 0 0 0 0 0 0 38 39 56.7 103.0 126.4 0 68.5 70.0 75.7 0 0 1 0 0 0 0 0 0 0 0 39 40 57.9 99.6 124.2 5 56.7 68.5 70.0 0 0 0 1 0 0 0 0 0 0 0 40 41 58.8 97.9 126.4 1 57.9 56.7 68.5 0 0 0 0 1 0 0 0 0 0 0 41 42 59.3 97.6 123.7 1 58.8 57.9 56.7 0 0 0 0 0 1 0 0 0 0 0 42 43 61.3 96.2 121.8 3 59.3 58.8 57.9 0 0 0 0 0 0 1 0 0 0 0 43 44 62.9 97.9 124.0 6 61.3 59.3 58.8 0 0 0 0 0 0 0 1 0 0 0 44 45 61.4 94.5 122.7 7 62.9 61.3 59.3 0 0 0 0 0 0 0 0 1 0 0 45 46 64.5 95.4 122.9 8 61.4 62.9 61.3 0 0 0 0 0 0 0 0 0 1 0 46 47 63.8 94.4 121.0 14 64.5 61.4 62.9 0 0 0 0 0 0 0 0 0 0 1 47 48 61.6 96.3 122.8 14 63.8 64.5 61.4 0 0 0 0 0 0 0 0 0 0 0 48 49 64.7 95.1 122.9 13 61.6 63.8 64.5 1 0 0 0 0 0 0 0 0 0 0 49 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) totid ndzcg indc y1 y2 20.25132 0.42534 -0.04554 0.04368 0.18834 0.16357 `y3\r` M1 M2 M3 M4 M5 -0.13097 0.29651 -0.83584 -3.76745 -2.08061 -1.12031 M6 M7 M8 M9 M10 M11 -1.97032 -1.21767 -1.11621 1.25634 0.26910 -0.08551 t -0.16644 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -5.7830 -1.1662 0.1615 1.2789 6.2280 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 20.25132 23.26808 0.870 0.3910 totid 0.42534 0.24450 1.740 0.0922 . ndzcg -0.04554 0.26858 -0.170 0.8665 indc 0.04368 0.10458 0.418 0.6792 y1 0.18834 0.18955 0.994 0.3283 y2 0.16357 0.16883 0.969 0.3404 `y3\r` -0.13097 0.16344 -0.801 0.4292 M1 0.29651 2.12716 0.139 0.8901 M2 -0.83584 2.41593 -0.346 0.7318 M3 -3.76745 2.40512 -1.566 0.1277 M4 -2.08061 2.52678 -0.823 0.4168 M5 -1.12031 2.68075 -0.418 0.6790 M6 -1.97032 2.71805 -0.725 0.4741 M7 -1.21767 2.51746 -0.484 0.6321 M8 -1.11621 2.40973 -0.463 0.6466 M9 1.25634 2.38567 0.527 0.6023 M10 0.26910 2.36299 0.114 0.9101 M11 -0.08551 2.25996 -0.038 0.9701 t -0.16644 0.07748 -2.148 0.0399 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.108 on 30 degrees of freedom Multiple R-squared: 0.8277, Adjusted R-squared: 0.7243 F-statistic: 8.004 on 18 and 30 DF, p-value: 4.226e-07 > 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.07163750 0.14327499 0.9283625 [2,] 0.04892777 0.09785553 0.9510722 [3,] 0.04091235 0.08182471 0.9590876 [4,] 0.27685878 0.55371757 0.7231412 [5,] 0.41717679 0.83435359 0.5828232 [6,] 0.30660265 0.61320530 0.6933974 > postscript(file="/var/www/html/rcomp/tmp/1ycms1258661103.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/2wbni1258661103.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/38xem1258661103.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/4c5di1258661103.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/501921258661103.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 = 49 Frequency = 1 1 2 3 4 5 6 -1.77902536 0.51035512 0.11266870 3.86543387 0.62790281 1.01021204 7 8 9 10 11 12 3.83094350 1.44436888 -0.31966265 0.85276065 0.65160867 -3.05306124 13 14 15 16 17 18 -0.88736542 -0.63417074 2.70687135 -2.90382430 0.40925027 -0.56852201 19 20 21 22 23 24 -2.03401001 -3.26305960 -4.27127879 -4.61358999 0.16151897 -0.74514943 25 26 27 28 29 30 0.24517130 0.19989337 2.96345376 2.29292126 -0.39439470 0.59119432 31 32 33 34 35 36 -2.51520748 0.52996455 6.22804576 1.27888651 -3.06387829 4.96436648 37 38 39 40 41 42 -0.87605299 -0.07607776 -5.78299381 -3.25453083 -0.64275838 -1.03288435 43 44 45 46 47 48 0.71827399 1.28872617 -1.63710432 2.48194283 2.25075065 -1.16615581 49 3.29727246 > postscript(file="/var/www/html/rcomp/tmp/6ecu61258661103.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 = 49 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.77902536 NA 1 0.51035512 -1.77902536 2 0.11266870 0.51035512 3 3.86543387 0.11266870 4 0.62790281 3.86543387 5 1.01021204 0.62790281 6 3.83094350 1.01021204 7 1.44436888 3.83094350 8 -0.31966265 1.44436888 9 0.85276065 -0.31966265 10 0.65160867 0.85276065 11 -3.05306124 0.65160867 12 -0.88736542 -3.05306124 13 -0.63417074 -0.88736542 14 2.70687135 -0.63417074 15 -2.90382430 2.70687135 16 0.40925027 -2.90382430 17 -0.56852201 0.40925027 18 -2.03401001 -0.56852201 19 -3.26305960 -2.03401001 20 -4.27127879 -3.26305960 21 -4.61358999 -4.27127879 22 0.16151897 -4.61358999 23 -0.74514943 0.16151897 24 0.24517130 -0.74514943 25 0.19989337 0.24517130 26 2.96345376 0.19989337 27 2.29292126 2.96345376 28 -0.39439470 2.29292126 29 0.59119432 -0.39439470 30 -2.51520748 0.59119432 31 0.52996455 -2.51520748 32 6.22804576 0.52996455 33 1.27888651 6.22804576 34 -3.06387829 1.27888651 35 4.96436648 -3.06387829 36 -0.87605299 4.96436648 37 -0.07607776 -0.87605299 38 -5.78299381 -0.07607776 39 -3.25453083 -5.78299381 40 -0.64275838 -3.25453083 41 -1.03288435 -0.64275838 42 0.71827399 -1.03288435 43 1.28872617 0.71827399 44 -1.63710432 1.28872617 45 2.48194283 -1.63710432 46 2.25075065 2.48194283 47 -1.16615581 2.25075065 48 3.29727246 -1.16615581 49 NA 3.29727246 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.51035512 -1.77902536 [2,] 0.11266870 0.51035512 [3,] 3.86543387 0.11266870 [4,] 0.62790281 3.86543387 [5,] 1.01021204 0.62790281 [6,] 3.83094350 1.01021204 [7,] 1.44436888 3.83094350 [8,] -0.31966265 1.44436888 [9,] 0.85276065 -0.31966265 [10,] 0.65160867 0.85276065 [11,] -3.05306124 0.65160867 [12,] -0.88736542 -3.05306124 [13,] -0.63417074 -0.88736542 [14,] 2.70687135 -0.63417074 [15,] -2.90382430 2.70687135 [16,] 0.40925027 -2.90382430 [17,] -0.56852201 0.40925027 [18,] -2.03401001 -0.56852201 [19,] -3.26305960 -2.03401001 [20,] -4.27127879 -3.26305960 [21,] -4.61358999 -4.27127879 [22,] 0.16151897 -4.61358999 [23,] -0.74514943 0.16151897 [24,] 0.24517130 -0.74514943 [25,] 0.19989337 0.24517130 [26,] 2.96345376 0.19989337 [27,] 2.29292126 2.96345376 [28,] -0.39439470 2.29292126 [29,] 0.59119432 -0.39439470 [30,] -2.51520748 0.59119432 [31,] 0.52996455 -2.51520748 [32,] 6.22804576 0.52996455 [33,] 1.27888651 6.22804576 [34,] -3.06387829 1.27888651 [35,] 4.96436648 -3.06387829 [36,] -0.87605299 4.96436648 [37,] -0.07607776 -0.87605299 [38,] -5.78299381 -0.07607776 [39,] -3.25453083 -5.78299381 [40,] -0.64275838 -3.25453083 [41,] -1.03288435 -0.64275838 [42,] 0.71827399 -1.03288435 [43,] 1.28872617 0.71827399 [44,] -1.63710432 1.28872617 [45,] 2.48194283 -1.63710432 [46,] 2.25075065 2.48194283 [47,] -1.16615581 2.25075065 [48,] 3.29727246 -1.16615581 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.51035512 -1.77902536 2 0.11266870 0.51035512 3 3.86543387 0.11266870 4 0.62790281 3.86543387 5 1.01021204 0.62790281 6 3.83094350 1.01021204 7 1.44436888 3.83094350 8 -0.31966265 1.44436888 9 0.85276065 -0.31966265 10 0.65160867 0.85276065 11 -3.05306124 0.65160867 12 -0.88736542 -3.05306124 13 -0.63417074 -0.88736542 14 2.70687135 -0.63417074 15 -2.90382430 2.70687135 16 0.40925027 -2.90382430 17 -0.56852201 0.40925027 18 -2.03401001 -0.56852201 19 -3.26305960 -2.03401001 20 -4.27127879 -3.26305960 21 -4.61358999 -4.27127879 22 0.16151897 -4.61358999 23 -0.74514943 0.16151897 24 0.24517130 -0.74514943 25 0.19989337 0.24517130 26 2.96345376 0.19989337 27 2.29292126 2.96345376 28 -0.39439470 2.29292126 29 0.59119432 -0.39439470 30 -2.51520748 0.59119432 31 0.52996455 -2.51520748 32 6.22804576 0.52996455 33 1.27888651 6.22804576 34 -3.06387829 1.27888651 35 4.96436648 -3.06387829 36 -0.87605299 4.96436648 37 -0.07607776 -0.87605299 38 -5.78299381 -0.07607776 39 -3.25453083 -5.78299381 40 -0.64275838 -3.25453083 41 -1.03288435 -0.64275838 42 0.71827399 -1.03288435 43 1.28872617 0.71827399 44 -1.63710432 1.28872617 45 2.48194283 -1.63710432 46 2.25075065 2.48194283 47 -1.16615581 2.25075065 48 3.29727246 -1.16615581 > 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/7uky91258661103.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/8p1yo1258661103.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/9mibd1258661103.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/107ohf1258661103.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/11optn1258661103.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/12ev8d1258661103.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/133ckh1258661103.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/14o8b81258661103.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/155iup1258661103.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/16t8321258661103.tab") + } > > system("convert tmp/1ycms1258661103.ps tmp/1ycms1258661103.png") > system("convert tmp/2wbni1258661103.ps tmp/2wbni1258661103.png") > system("convert tmp/38xem1258661103.ps tmp/38xem1258661103.png") > system("convert tmp/4c5di1258661103.ps tmp/4c5di1258661103.png") > system("convert tmp/501921258661103.ps tmp/501921258661103.png") > system("convert tmp/6ecu61258661103.ps tmp/6ecu61258661103.png") > system("convert tmp/7uky91258661103.ps tmp/7uky91258661103.png") > system("convert tmp/8p1yo1258661103.ps tmp/8p1yo1258661103.png") > system("convert tmp/9mibd1258661103.ps tmp/9mibd1258661103.png") > system("convert tmp/107ohf1258661103.ps tmp/107ohf1258661103.png") > > > proc.time() user system elapsed 2.292 1.608 2.915