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(10414.9 + ,10723.8 + ,12476.8 + ,13938.9 + ,12384.6 + ,13979.8 + ,12266.7 + ,13807.4 + ,12919.9 + ,12973.9 + ,11497.3 + ,12509.8 + ,12142 + ,12934.1 + ,13919.4 + ,14908.3 + ,12656.8 + ,13772.1 + ,12034.1 + ,13012.6 + ,13199.7 + ,14049.9 + ,10881.3 + ,11816.5 + ,11301.2 + ,11593.2 + ,13643.9 + ,14466.2 + ,12517 + ,13615.9 + ,13981.1 + ,14733.9 + ,14275.7 + ,13880.7 + ,13435 + ,13527.5 + ,13565.7 + ,13584 + ,16216.3 + ,16170.2 + ,12970 + ,13260.6 + ,14079.9 + ,14741.9 + ,14235 + ,15486.5 + ,12213.4 + ,13154.5 + ,12581 + ,12621.2 + ,14130.4 + ,15031.6 + ,14210.8 + ,15452.4 + ,14378.5 + ,15428 + ,13142.8 + ,13105.9 + ,13714.7 + ,14716.8 + ,13621.9 + ,14180 + ,15379.8 + ,16202.2 + ,13306.3 + ,14392.4 + ,14391.2 + ,15140.6 + ,14909.9 + ,15960.1 + ,14025.4 + ,14351.3 + ,12951.2 + ,13230.2 + ,14344.3 + ,15202.1 + ,16093.4 + ,17056 + ,15413.6 + ,16077.7 + ,14705.7 + ,13348.2 + ,15972.8 + ,16402.4 + ,16241.4 + ,16559.1 + ,16626.4 + ,16579 + ,17136.2 + ,17561.2 + ,15622.9 + ,16129.6 + ,18003.9 + ,18484.3 + ,16136.1 + ,16402.6 + ,14423.7 + ,14032.3 + ,16789.4 + ,17109.1 + ,16782.2 + ,17157.2 + ,14133.8 + ,13879.8 + ,12607 + ,12362.4 + ,12004.5 + ,12683.5 + ,12175.4 + ,12608.8 + ,13268 + ,13583.7 + ,12299.3 + ,12846.3 + ,11800.6 + ,12347.1 + ,13873.3 + ,13967 + ,12269.6 + ,13114.3) + ,dim=c(2 + ,60) + ,dimnames=list(c('In_IEU' + ,'Uit_IEU') + ,1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('In_IEU','Uit_IEU'),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 In_IEU Uit_IEU M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 10414.9 10723.8 1 0 0 0 0 0 0 0 0 0 0 1 2 12476.8 13938.9 0 1 0 0 0 0 0 0 0 0 0 2 3 12384.6 13979.8 0 0 1 0 0 0 0 0 0 0 0 3 4 12266.7 13807.4 0 0 0 1 0 0 0 0 0 0 0 4 5 12919.9 12973.9 0 0 0 0 1 0 0 0 0 0 0 5 6 11497.3 12509.8 0 0 0 0 0 1 0 0 0 0 0 6 7 12142.0 12934.1 0 0 0 0 0 0 1 0 0 0 0 7 8 13919.4 14908.3 0 0 0 0 0 0 0 1 0 0 0 8 9 12656.8 13772.1 0 0 0 0 0 0 0 0 1 0 0 9 10 12034.1 13012.6 0 0 0 0 0 0 0 0 0 1 0 10 11 13199.7 14049.9 0 0 0 0 0 0 0 0 0 0 1 11 12 10881.3 11816.5 0 0 0 0 0 0 0 0 0 0 0 12 13 11301.2 11593.2 1 0 0 0 0 0 0 0 0 0 0 13 14 13643.9 14466.2 0 1 0 0 0 0 0 0 0 0 0 14 15 12517.0 13615.9 0 0 1 0 0 0 0 0 0 0 0 15 16 13981.1 14733.9 0 0 0 1 0 0 0 0 0 0 0 16 17 14275.7 13880.7 0 0 0 0 1 0 0 0 0 0 0 17 18 13435.0 13527.5 0 0 0 0 0 1 0 0 0 0 0 18 19 13565.7 13584.0 0 0 0 0 0 0 1 0 0 0 0 19 20 16216.3 16170.2 0 0 0 0 0 0 0 1 0 0 0 20 21 12970.0 13260.6 0 0 0 0 0 0 0 0 1 0 0 21 22 14079.9 14741.9 0 0 0 0 0 0 0 0 0 1 0 22 23 14235.0 15486.5 0 0 0 0 0 0 0 0 0 0 1 23 24 12213.4 13154.5 0 0 0 0 0 0 0 0 0 0 0 24 25 12581.0 12621.2 1 0 0 0 0 0 0 0 0 0 0 25 26 14130.4 15031.6 0 1 0 0 0 0 0 0 0 0 0 26 27 14210.8 15452.4 0 0 1 0 0 0 0 0 0 0 0 27 28 14378.5 15428.0 0 0 0 1 0 0 0 0 0 0 0 28 29 13142.8 13105.9 0 0 0 0 1 0 0 0 0 0 0 29 30 13714.7 14716.8 0 0 0 0 0 1 0 0 0 0 0 30 31 13621.9 14180.0 0 0 0 0 0 0 1 0 0 0 0 31 32 15379.8 16202.2 0 0 0 0 0 0 0 1 0 0 0 32 33 13306.3 14392.4 0 0 0 0 0 0 0 0 1 0 0 33 34 14391.2 15140.6 0 0 0 0 0 0 0 0 0 1 0 34 35 14909.9 15960.1 0 0 0 0 0 0 0 0 0 0 1 35 36 14025.4 14351.3 0 0 0 0 0 0 0 0 0 0 0 36 37 12951.2 13230.2 1 0 0 0 0 0 0 0 0 0 0 37 38 14344.3 15202.1 0 1 0 0 0 0 0 0 0 0 0 38 39 16093.4 17056.0 0 0 1 0 0 0 0 0 0 0 0 39 40 15413.6 16077.7 0 0 0 1 0 0 0 0 0 0 0 40 41 14705.7 13348.2 0 0 0 0 1 0 0 0 0 0 0 41 42 15972.8 16402.4 0 0 0 0 0 1 0 0 0 0 0 42 43 16241.4 16559.1 0 0 0 0 0 0 1 0 0 0 0 43 44 16626.4 16579.0 0 0 0 0 0 0 0 1 0 0 0 44 45 17136.2 17561.2 0 0 0 0 0 0 0 0 1 0 0 45 46 15622.9 16129.6 0 0 0 0 0 0 0 0 0 1 0 46 47 18003.9 18484.3 0 0 0 0 0 0 0 0 0 0 1 47 48 16136.1 16402.6 0 0 0 0 0 0 0 0 0 0 0 48 49 14423.7 14032.3 1 0 0 0 0 0 0 0 0 0 0 49 50 16789.4 17109.1 0 1 0 0 0 0 0 0 0 0 0 50 51 16782.2 17157.2 0 0 1 0 0 0 0 0 0 0 0 51 52 14133.8 13879.8 0 0 0 1 0 0 0 0 0 0 0 52 53 12607.0 12362.4 0 0 0 0 1 0 0 0 0 0 0 53 54 12004.5 12683.5 0 0 0 0 0 1 0 0 0 0 0 54 55 12175.4 12608.8 0 0 0 0 0 0 1 0 0 0 0 55 56 13268.0 13583.7 0 0 0 0 0 0 0 1 0 0 0 56 57 12299.3 12846.3 0 0 0 0 0 0 0 0 1 0 0 57 58 11800.6 12347.1 0 0 0 0 0 0 0 0 0 1 0 58 59 13873.3 13967.0 0 0 0 0 0 0 0 0 0 0 1 59 60 12269.6 13114.3 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) Uit_IEU M1 M2 M3 M4 -1635.225 1.039 740.557 -145.111 -351.021 -32.611 M5 M6 M7 M8 M9 M10 1167.195 83.240 290.322 235.842 -17.934 -22.052 M11 t -142.434 11.932 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -465.14 -207.58 -37.63 151.02 809.87 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.635e+03 5.041e+02 -3.244 0.002201 ** Uit_IEU 1.039e+00 3.671e-02 28.315 < 2e-16 *** M1 7.406e+02 2.272e+02 3.260 0.002101 ** M2 -1.451e+02 2.318e+02 -0.626 0.534373 M3 -3.510e+02 2.343e+02 -1.498 0.141004 M4 -3.261e+01 2.277e+02 -0.143 0.886729 M5 1.167e+03 2.235e+02 5.223 4.14e-06 *** M6 8.324e+01 2.231e+02 0.373 0.710736 M7 2.903e+02 2.228e+02 1.303 0.199112 M8 2.358e+02 2.323e+02 1.015 0.315232 M9 -1.793e+01 2.236e+02 -0.080 0.936428 M10 -2.205e+01 2.231e+02 -0.099 0.921692 M11 -1.424e+02 2.322e+02 -0.613 0.542694 t 1.193e+01 2.853e+00 4.182 0.000128 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 351.1 on 46 degrees of freedom Multiple R-squared: 0.9656, Adjusted R-squared: 0.9558 F-statistic: 99.25 on 13 and 46 DF, p-value: < 2.2e-16 > 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.1956574 0.39131477 0.80434262 [2,] 0.1940637 0.38812731 0.80593635 [3,] 0.1388209 0.27764181 0.86117910 [4,] 0.1341194 0.26823875 0.86588063 [5,] 0.1599715 0.31994299 0.84002851 [6,] 0.1435904 0.28718077 0.85640962 [7,] 0.3830847 0.76616939 0.61691531 [8,] 0.3412487 0.68249734 0.65875133 [9,] 0.3303001 0.66060015 0.66969993 [10,] 0.3284624 0.65692477 0.67153761 [11,] 0.2777006 0.55540113 0.72229944 [12,] 0.2806985 0.56139700 0.71930150 [13,] 0.3850202 0.77004034 0.61497983 [14,] 0.4455917 0.89118334 0.55440833 [15,] 0.4083334 0.81666682 0.59166659 [16,] 0.4325669 0.86513377 0.56743311 [17,] 0.4077031 0.81540630 0.59229685 [18,] 0.3114666 0.62293320 0.68853340 [19,] 0.2815292 0.56305842 0.71847079 [20,] 0.2886040 0.57720799 0.71139601 [21,] 0.2382245 0.47644901 0.76177549 [22,] 0.1767884 0.35357673 0.82321164 [23,] 0.2420913 0.48418270 0.75790865 [24,] 0.9785361 0.04292771 0.02146385 [25,] 0.9637396 0.07252082 0.03626041 [26,] 0.9111595 0.17768101 0.08884051 [27,] 0.7992613 0.40147740 0.20073870 > postscript(file="/var/www/html/rcomp/tmp/1nen51258899186.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/269bv1258899186.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/3hlf41258899186.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/4qszc1258899186.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/5vqil1258899186.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 150.904094 -255.358412 -196.094184 -465.136555 -157.303106 -25.476578 7 8 9 10 11 12 -40.825281 -272.936541 -112.682824 46.256110 242.096088 90.812158 13 14 15 16 17 18 -9.670848 220.458580 171.370460 143.036560 112.746949 711.199741 19 20 21 22 23 24 564.156542 569.108879 589.002952 151.367943 -359.048410 -111.043697 25 26 27 28 29 30 58.399253 -23.927038 -186.945521 -324.224801 -357.983100 -388.491600 31 32 33 34 35 36 -142.335896 -443.840207 -394.320670 -94.943265 -319.613567 313.769173 37 38 39 40 41 42 -347.605886 -130.438365 -114.376260 -107.635090 809.873884 -25.656301 43 44 45 46 47 48 -138.951244 267.912289 -1.380655 -34.435060 7.448549 149.081788 49 50 51 52 53 54 147.973387 189.265235 326.045505 753.959887 -407.334627 -271.575262 55 56 57 58 59 60 -242.044121 -120.244420 -80.618803 -68.245729 429.117340 -442.619421 > postscript(file="/var/www/html/rcomp/tmp/6a5mi1258899186.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 150.904094 NA 1 -255.358412 150.904094 2 -196.094184 -255.358412 3 -465.136555 -196.094184 4 -157.303106 -465.136555 5 -25.476578 -157.303106 6 -40.825281 -25.476578 7 -272.936541 -40.825281 8 -112.682824 -272.936541 9 46.256110 -112.682824 10 242.096088 46.256110 11 90.812158 242.096088 12 -9.670848 90.812158 13 220.458580 -9.670848 14 171.370460 220.458580 15 143.036560 171.370460 16 112.746949 143.036560 17 711.199741 112.746949 18 564.156542 711.199741 19 569.108879 564.156542 20 589.002952 569.108879 21 151.367943 589.002952 22 -359.048410 151.367943 23 -111.043697 -359.048410 24 58.399253 -111.043697 25 -23.927038 58.399253 26 -186.945521 -23.927038 27 -324.224801 -186.945521 28 -357.983100 -324.224801 29 -388.491600 -357.983100 30 -142.335896 -388.491600 31 -443.840207 -142.335896 32 -394.320670 -443.840207 33 -94.943265 -394.320670 34 -319.613567 -94.943265 35 313.769173 -319.613567 36 -347.605886 313.769173 37 -130.438365 -347.605886 38 -114.376260 -130.438365 39 -107.635090 -114.376260 40 809.873884 -107.635090 41 -25.656301 809.873884 42 -138.951244 -25.656301 43 267.912289 -138.951244 44 -1.380655 267.912289 45 -34.435060 -1.380655 46 7.448549 -34.435060 47 149.081788 7.448549 48 147.973387 149.081788 49 189.265235 147.973387 50 326.045505 189.265235 51 753.959887 326.045505 52 -407.334627 753.959887 53 -271.575262 -407.334627 54 -242.044121 -271.575262 55 -120.244420 -242.044121 56 -80.618803 -120.244420 57 -68.245729 -80.618803 58 429.117340 -68.245729 59 -442.619421 429.117340 60 NA -442.619421 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -255.358412 150.904094 [2,] -196.094184 -255.358412 [3,] -465.136555 -196.094184 [4,] -157.303106 -465.136555 [5,] -25.476578 -157.303106 [6,] -40.825281 -25.476578 [7,] -272.936541 -40.825281 [8,] -112.682824 -272.936541 [9,] 46.256110 -112.682824 [10,] 242.096088 46.256110 [11,] 90.812158 242.096088 [12,] -9.670848 90.812158 [13,] 220.458580 -9.670848 [14,] 171.370460 220.458580 [15,] 143.036560 171.370460 [16,] 112.746949 143.036560 [17,] 711.199741 112.746949 [18,] 564.156542 711.199741 [19,] 569.108879 564.156542 [20,] 589.002952 569.108879 [21,] 151.367943 589.002952 [22,] -359.048410 151.367943 [23,] -111.043697 -359.048410 [24,] 58.399253 -111.043697 [25,] -23.927038 58.399253 [26,] -186.945521 -23.927038 [27,] -324.224801 -186.945521 [28,] -357.983100 -324.224801 [29,] -388.491600 -357.983100 [30,] -142.335896 -388.491600 [31,] -443.840207 -142.335896 [32,] -394.320670 -443.840207 [33,] -94.943265 -394.320670 [34,] -319.613567 -94.943265 [35,] 313.769173 -319.613567 [36,] -347.605886 313.769173 [37,] -130.438365 -347.605886 [38,] -114.376260 -130.438365 [39,] -107.635090 -114.376260 [40,] 809.873884 -107.635090 [41,] -25.656301 809.873884 [42,] -138.951244 -25.656301 [43,] 267.912289 -138.951244 [44,] -1.380655 267.912289 [45,] -34.435060 -1.380655 [46,] 7.448549 -34.435060 [47,] 149.081788 7.448549 [48,] 147.973387 149.081788 [49,] 189.265235 147.973387 [50,] 326.045505 189.265235 [51,] 753.959887 326.045505 [52,] -407.334627 753.959887 [53,] -271.575262 -407.334627 [54,] -242.044121 -271.575262 [55,] -120.244420 -242.044121 [56,] -80.618803 -120.244420 [57,] -68.245729 -80.618803 [58,] 429.117340 -68.245729 [59,] -442.619421 429.117340 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -255.358412 150.904094 2 -196.094184 -255.358412 3 -465.136555 -196.094184 4 -157.303106 -465.136555 5 -25.476578 -157.303106 6 -40.825281 -25.476578 7 -272.936541 -40.825281 8 -112.682824 -272.936541 9 46.256110 -112.682824 10 242.096088 46.256110 11 90.812158 242.096088 12 -9.670848 90.812158 13 220.458580 -9.670848 14 171.370460 220.458580 15 143.036560 171.370460 16 112.746949 143.036560 17 711.199741 112.746949 18 564.156542 711.199741 19 569.108879 564.156542 20 589.002952 569.108879 21 151.367943 589.002952 22 -359.048410 151.367943 23 -111.043697 -359.048410 24 58.399253 -111.043697 25 -23.927038 58.399253 26 -186.945521 -23.927038 27 -324.224801 -186.945521 28 -357.983100 -324.224801 29 -388.491600 -357.983100 30 -142.335896 -388.491600 31 -443.840207 -142.335896 32 -394.320670 -443.840207 33 -94.943265 -394.320670 34 -319.613567 -94.943265 35 313.769173 -319.613567 36 -347.605886 313.769173 37 -130.438365 -347.605886 38 -114.376260 -130.438365 39 -107.635090 -114.376260 40 809.873884 -107.635090 41 -25.656301 809.873884 42 -138.951244 -25.656301 43 267.912289 -138.951244 44 -1.380655 267.912289 45 -34.435060 -1.380655 46 7.448549 -34.435060 47 149.081788 7.448549 48 147.973387 149.081788 49 189.265235 147.973387 50 326.045505 189.265235 51 753.959887 326.045505 52 -407.334627 753.959887 53 -271.575262 -407.334627 54 -242.044121 -271.575262 55 -120.244420 -242.044121 56 -80.618803 -120.244420 57 -68.245729 -80.618803 58 429.117340 -68.245729 59 -442.619421 429.117340 > 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/765h71258899186.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/8scdj1258899186.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/9bmhq1258899186.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/10m7nd1258899186.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/11yq9v1258899186.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/1227xb1258899186.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/13cqty1258899186.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/14yqzc1258899186.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/15p30h1258899186.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/16j7b41258899186.tab") + } > > system("convert tmp/1nen51258899186.ps tmp/1nen51258899186.png") > system("convert tmp/269bv1258899186.ps tmp/269bv1258899186.png") > system("convert tmp/3hlf41258899186.ps tmp/3hlf41258899186.png") > system("convert tmp/4qszc1258899186.ps tmp/4qszc1258899186.png") > system("convert tmp/5vqil1258899186.ps tmp/5vqil1258899186.png") > system("convert tmp/6a5mi1258899186.ps tmp/6a5mi1258899186.png") > system("convert tmp/765h71258899186.ps tmp/765h71258899186.png") > system("convert tmp/8scdj1258899186.ps tmp/8scdj1258899186.png") > system("convert tmp/9bmhq1258899186.ps tmp/9bmhq1258899186.png") > system("convert tmp/10m7nd1258899186.ps tmp/10m7nd1258899186.png") > > > proc.time() user system elapsed 2.407 1.587 3.286