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(13132.1 + ,12002.4 + ,17665.9 + ,15525.5 + ,16913 + ,14247.9 + ,17318.8 + ,15000.7 + ,16224.2 + ,14931.4 + ,15469.6 + ,13333.7 + ,16557.5 + ,14711.2 + ,19414.8 + ,17197.3 + ,17335 + ,14985.2 + ,16525.2 + ,14734.4 + ,18160.4 + ,15937.8 + ,15553.8 + ,13028.1 + ,15262.2 + ,13836.8 + ,18581 + ,16677.5 + ,17564.1 + ,15130 + ,18948.6 + ,17504 + ,17187.8 + ,16979.9 + ,17564.8 + ,16012.5 + ,17668.4 + ,16247.7 + ,20811.7 + ,19268.2 + ,17257.8 + ,15533 + ,18984.2 + ,16803.3 + ,20532.6 + ,17396.1 + ,17082.3 + ,15155.4 + ,16894.9 + ,15692.4 + ,20274.9 + ,18063.7 + ,20078.6 + ,17568.6 + ,19900.9 + ,18154.3 + ,17012.2 + ,15467.4 + ,19642.9 + ,16956.1 + ,19024 + ,16854 + ,21691 + ,19396.4 + ,18835.9 + ,16457.6 + ,19873.4 + ,17284.5 + ,21468.2 + ,18395.3 + ,19406.8 + ,16938.7 + ,18385.3 + ,16414.3 + ,20739.3 + ,18173.4 + ,22268.3 + ,19919.7 + ,21569 + ,19623.8 + ,17514.8 + ,17228.1 + ,21124.7 + ,18730.3 + ,21251 + ,19039.1 + ,21393 + ,19413.3 + ,22145.2 + ,20013.6 + ,20310.5 + ,17917.2 + ,23466.9 + ,21270.3 + ,21264.6 + ,18766.1 + ,18388.1 + ,16790.8 + ,22635.4 + ,19960.6 + ,22014.3 + ,19586.7 + ,18422.7 + ,17179 + ,16120.2 + ,14964.9 + ,16037.7 + ,13918.5 + ,16410.7 + ,14401.3 + ,17749.8 + ,15994.6 + ,16349.8 + ,14521.1 + ,15662.3 + ,13746.5 + ,17782.3 + ,15956 + ,16398.9 + ,14332.2) + ,dim=c(2 + ,60) + ,dimnames=list(c('Uitvoer' + ,'Invoer') + ,1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Uitvoer','Invoer'),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 Uitvoer Invoer M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 13132.1 12002.4 1 0 0 0 0 0 0 0 0 0 0 1 2 17665.9 15525.5 0 1 0 0 0 0 0 0 0 0 0 2 3 16913.0 14247.9 0 0 1 0 0 0 0 0 0 0 0 3 4 17318.8 15000.7 0 0 0 1 0 0 0 0 0 0 0 4 5 16224.2 14931.4 0 0 0 0 1 0 0 0 0 0 0 5 6 15469.6 13333.7 0 0 0 0 0 1 0 0 0 0 0 6 7 16557.5 14711.2 0 0 0 0 0 0 1 0 0 0 0 7 8 19414.8 17197.3 0 0 0 0 0 0 0 1 0 0 0 8 9 17335.0 14985.2 0 0 0 0 0 0 0 0 1 0 0 9 10 16525.2 14734.4 0 0 0 0 0 0 0 0 0 1 0 10 11 18160.4 15937.8 0 0 0 0 0 0 0 0 0 0 1 11 12 15553.8 13028.1 0 0 0 0 0 0 0 0 0 0 0 12 13 15262.2 13836.8 1 0 0 0 0 0 0 0 0 0 0 13 14 18581.0 16677.5 0 1 0 0 0 0 0 0 0 0 0 14 15 17564.1 15130.0 0 0 1 0 0 0 0 0 0 0 0 15 16 18948.6 17504.0 0 0 0 1 0 0 0 0 0 0 0 16 17 17187.8 16979.9 0 0 0 0 1 0 0 0 0 0 0 17 18 17564.8 16012.5 0 0 0 0 0 1 0 0 0 0 0 18 19 17668.4 16247.7 0 0 0 0 0 0 1 0 0 0 0 19 20 20811.7 19268.2 0 0 0 0 0 0 0 1 0 0 0 20 21 17257.8 15533.0 0 0 0 0 0 0 0 0 1 0 0 21 22 18984.2 16803.3 0 0 0 0 0 0 0 0 0 1 0 22 23 20532.6 17396.1 0 0 0 0 0 0 0 0 0 0 1 23 24 17082.3 15155.4 0 0 0 0 0 0 0 0 0 0 0 24 25 16894.9 15692.4 1 0 0 0 0 0 0 0 0 0 0 25 26 20274.9 18063.7 0 1 0 0 0 0 0 0 0 0 0 26 27 20078.6 17568.6 0 0 1 0 0 0 0 0 0 0 0 27 28 19900.9 18154.3 0 0 0 1 0 0 0 0 0 0 0 28 29 17012.2 15467.4 0 0 0 0 1 0 0 0 0 0 0 29 30 19642.9 16956.1 0 0 0 0 0 1 0 0 0 0 0 30 31 19024.0 16854.0 0 0 0 0 0 0 1 0 0 0 0 31 32 21691.0 19396.4 0 0 0 0 0 0 0 1 0 0 0 32 33 18835.9 16457.6 0 0 0 0 0 0 0 0 1 0 0 33 34 19873.4 17284.5 0 0 0 0 0 0 0 0 0 1 0 34 35 21468.2 18395.3 0 0 0 0 0 0 0 0 0 0 1 35 36 19406.8 16938.7 0 0 0 0 0 0 0 0 0 0 0 36 37 18385.3 16414.3 1 0 0 0 0 0 0 0 0 0 0 37 38 20739.3 18173.4 0 1 0 0 0 0 0 0 0 0 0 38 39 22268.3 19919.7 0 0 1 0 0 0 0 0 0 0 0 39 40 21569.0 19623.8 0 0 0 1 0 0 0 0 0 0 0 40 41 17514.8 17228.1 0 0 0 0 1 0 0 0 0 0 0 41 42 21124.7 18730.3 0 0 0 0 0 1 0 0 0 0 0 42 43 21251.0 19039.1 0 0 0 0 0 0 1 0 0 0 0 43 44 21393.0 19413.3 0 0 0 0 0 0 0 1 0 0 0 44 45 22145.2 20013.6 0 0 0 0 0 0 0 0 1 0 0 45 46 20310.5 17917.2 0 0 0 0 0 0 0 0 0 1 0 46 47 23466.9 21270.3 0 0 0 0 0 0 0 0 0 0 1 47 48 21264.6 18766.1 0 0 0 0 0 0 0 0 0 0 0 48 49 18388.1 16790.8 1 0 0 0 0 0 0 0 0 0 0 49 50 22635.4 19960.6 0 1 0 0 0 0 0 0 0 0 0 50 51 22014.3 19586.7 0 0 1 0 0 0 0 0 0 0 0 51 52 18422.7 17179.0 0 0 0 1 0 0 0 0 0 0 0 52 53 16120.2 14964.9 0 0 0 0 1 0 0 0 0 0 0 53 54 16037.7 13918.5 0 0 0 0 0 1 0 0 0 0 0 54 55 16410.7 14401.3 0 0 0 0 0 0 1 0 0 0 0 55 56 17749.8 15994.6 0 0 0 0 0 0 0 1 0 0 0 56 57 16349.8 14521.1 0 0 0 0 0 0 0 0 1 0 0 57 58 15662.3 13746.5 0 0 0 0 0 0 0 0 0 1 0 58 59 17782.3 15956.0 0 0 0 0 0 0 0 0 0 0 1 59 60 16398.9 14332.2 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) Invoer M1 M2 M3 M4 1759.896 1.038 -823.379 -91.870 102.518 -640.979 M5 M6 M7 M8 M9 M10 -1421.378 -134.801 -396.771 -445.014 -244.493 -143.757 M11 t 110.385 -1.629 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -749.740 -243.260 4.822 265.495 664.325 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.760e+03 4.844e+02 3.633 0.000702 *** Invoer 1.038e+00 3.119e-02 33.286 < 2e-16 *** M1 -8.234e+02 2.464e+02 -3.342 0.001660 ** M2 -9.187e+01 2.576e+02 -0.357 0.723016 M3 1.025e+02 2.536e+02 0.404 0.687911 M4 -6.410e+02 2.546e+02 -2.518 0.015364 * M5 -1.421e+03 2.457e+02 -5.786 6.05e-07 *** M6 -1.348e+02 2.451e+02 -0.550 0.585002 M7 -3.968e+02 2.459e+02 -1.613 0.113501 M8 -4.450e+02 2.594e+02 -1.716 0.092923 . M9 -2.445e+02 2.455e+02 -0.996 0.324581 M10 -1.438e+02 2.448e+02 -0.587 0.559908 M11 1.104e+02 2.535e+02 0.435 0.665325 t -1.629e+00 3.224e+00 -0.505 0.615721 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 386 on 46 degrees of freedom Multiple R-squared: 0.9767, Adjusted R-squared: 0.9701 F-statistic: 148.5 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.5776481 0.844703793 0.422351897 [2,] 0.4846041 0.969208172 0.515395914 [3,] 0.3947134 0.789426850 0.605286575 [4,] 0.3211306 0.642261164 0.678869418 [5,] 0.3373747 0.674749480 0.662625260 [6,] 0.5690227 0.861954511 0.430977256 [7,] 0.8579105 0.284179041 0.142089521 [8,] 0.8502170 0.299565987 0.149782994 [9,] 0.9003132 0.199373630 0.099686815 [10,] 0.9360208 0.127958458 0.063979229 [11,] 0.9152265 0.169547071 0.084773536 [12,] 0.8792270 0.241545990 0.120772995 [13,] 0.8699439 0.260112168 0.130056084 [14,] 0.9154049 0.169190243 0.084595121 [15,] 0.8954010 0.209198066 0.104599033 [16,] 0.8408903 0.318219435 0.159109718 [17,] 0.7685656 0.462868787 0.231434393 [18,] 0.7014965 0.597006986 0.298503493 [19,] 0.8587473 0.282505324 0.141252662 [20,] 0.8065164 0.386967271 0.193483635 [21,] 0.8080927 0.383814620 0.191907310 [22,] 0.7318607 0.536278549 0.268139275 [23,] 0.6298349 0.740330156 0.370165078 [24,] 0.8979785 0.204043006 0.102021503 [25,] 0.9989360 0.002127973 0.001063986 [26,] 0.9950705 0.009858983 0.004929491 [27,] 0.9875329 0.024934113 0.012467057 > postscript(file="/var/www/html/rcomp/tmp/1lfgy1258579289.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/2k4zc1258579289.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/3fw791258579289.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/4xig71258579289.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/5bc211258579289.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 -262.397054 -115.782053 264.826168 634.276093 393.644228 12.657500 7 8 9 10 11 12 -65.816184 260.552453 278.225809 -370.326478 -236.881037 289.072592 13 14 15 16 17 18 -17.025573 -377.015822 19.773736 -315.032920 -749.740030 -653.436856 19 20 21 22 23 24 -530.396760 -472.785091 -348.092091 -39.487836 641.017270 -371.213404 25 26 27 28 29 30 -291.061666 -102.571000 22.329348 -18.255365 664.325343 464.667983 31 32 33 34 35 36 215.356892 292.980886 289.736519 369.731267 558.904132 121.604636 37 38 39 40 41 42 469.488420 267.499699 -209.081890 143.916298 -641.295713 124.232671 43 44 45 46 47 48 193.569113 -3.013372 -72.873131 169.579260 -407.364097 101.942769 49 50 51 52 53 54 100.995873 327.869176 -97.847362 -444.904106 333.066172 51.878702 55 56 57 58 59 60 187.286940 -77.734877 -146.997106 -129.496213 -555.676268 -141.406593 > postscript(file="/var/www/html/rcomp/tmp/6qzgz1258579289.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 -262.397054 NA 1 -115.782053 -262.397054 2 264.826168 -115.782053 3 634.276093 264.826168 4 393.644228 634.276093 5 12.657500 393.644228 6 -65.816184 12.657500 7 260.552453 -65.816184 8 278.225809 260.552453 9 -370.326478 278.225809 10 -236.881037 -370.326478 11 289.072592 -236.881037 12 -17.025573 289.072592 13 -377.015822 -17.025573 14 19.773736 -377.015822 15 -315.032920 19.773736 16 -749.740030 -315.032920 17 -653.436856 -749.740030 18 -530.396760 -653.436856 19 -472.785091 -530.396760 20 -348.092091 -472.785091 21 -39.487836 -348.092091 22 641.017270 -39.487836 23 -371.213404 641.017270 24 -291.061666 -371.213404 25 -102.571000 -291.061666 26 22.329348 -102.571000 27 -18.255365 22.329348 28 664.325343 -18.255365 29 464.667983 664.325343 30 215.356892 464.667983 31 292.980886 215.356892 32 289.736519 292.980886 33 369.731267 289.736519 34 558.904132 369.731267 35 121.604636 558.904132 36 469.488420 121.604636 37 267.499699 469.488420 38 -209.081890 267.499699 39 143.916298 -209.081890 40 -641.295713 143.916298 41 124.232671 -641.295713 42 193.569113 124.232671 43 -3.013372 193.569113 44 -72.873131 -3.013372 45 169.579260 -72.873131 46 -407.364097 169.579260 47 101.942769 -407.364097 48 100.995873 101.942769 49 327.869176 100.995873 50 -97.847362 327.869176 51 -444.904106 -97.847362 52 333.066172 -444.904106 53 51.878702 333.066172 54 187.286940 51.878702 55 -77.734877 187.286940 56 -146.997106 -77.734877 57 -129.496213 -146.997106 58 -555.676268 -129.496213 59 -141.406593 -555.676268 60 NA -141.406593 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -115.782053 -262.397054 [2,] 264.826168 -115.782053 [3,] 634.276093 264.826168 [4,] 393.644228 634.276093 [5,] 12.657500 393.644228 [6,] -65.816184 12.657500 [7,] 260.552453 -65.816184 [8,] 278.225809 260.552453 [9,] -370.326478 278.225809 [10,] -236.881037 -370.326478 [11,] 289.072592 -236.881037 [12,] -17.025573 289.072592 [13,] -377.015822 -17.025573 [14,] 19.773736 -377.015822 [15,] -315.032920 19.773736 [16,] -749.740030 -315.032920 [17,] -653.436856 -749.740030 [18,] -530.396760 -653.436856 [19,] -472.785091 -530.396760 [20,] -348.092091 -472.785091 [21,] -39.487836 -348.092091 [22,] 641.017270 -39.487836 [23,] -371.213404 641.017270 [24,] -291.061666 -371.213404 [25,] -102.571000 -291.061666 [26,] 22.329348 -102.571000 [27,] -18.255365 22.329348 [28,] 664.325343 -18.255365 [29,] 464.667983 664.325343 [30,] 215.356892 464.667983 [31,] 292.980886 215.356892 [32,] 289.736519 292.980886 [33,] 369.731267 289.736519 [34,] 558.904132 369.731267 [35,] 121.604636 558.904132 [36,] 469.488420 121.604636 [37,] 267.499699 469.488420 [38,] -209.081890 267.499699 [39,] 143.916298 -209.081890 [40,] -641.295713 143.916298 [41,] 124.232671 -641.295713 [42,] 193.569113 124.232671 [43,] -3.013372 193.569113 [44,] -72.873131 -3.013372 [45,] 169.579260 -72.873131 [46,] -407.364097 169.579260 [47,] 101.942769 -407.364097 [48,] 100.995873 101.942769 [49,] 327.869176 100.995873 [50,] -97.847362 327.869176 [51,] -444.904106 -97.847362 [52,] 333.066172 -444.904106 [53,] 51.878702 333.066172 [54,] 187.286940 51.878702 [55,] -77.734877 187.286940 [56,] -146.997106 -77.734877 [57,] -129.496213 -146.997106 [58,] -555.676268 -129.496213 [59,] -141.406593 -555.676268 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -115.782053 -262.397054 2 264.826168 -115.782053 3 634.276093 264.826168 4 393.644228 634.276093 5 12.657500 393.644228 6 -65.816184 12.657500 7 260.552453 -65.816184 8 278.225809 260.552453 9 -370.326478 278.225809 10 -236.881037 -370.326478 11 289.072592 -236.881037 12 -17.025573 289.072592 13 -377.015822 -17.025573 14 19.773736 -377.015822 15 -315.032920 19.773736 16 -749.740030 -315.032920 17 -653.436856 -749.740030 18 -530.396760 -653.436856 19 -472.785091 -530.396760 20 -348.092091 -472.785091 21 -39.487836 -348.092091 22 641.017270 -39.487836 23 -371.213404 641.017270 24 -291.061666 -371.213404 25 -102.571000 -291.061666 26 22.329348 -102.571000 27 -18.255365 22.329348 28 664.325343 -18.255365 29 464.667983 664.325343 30 215.356892 464.667983 31 292.980886 215.356892 32 289.736519 292.980886 33 369.731267 289.736519 34 558.904132 369.731267 35 121.604636 558.904132 36 469.488420 121.604636 37 267.499699 469.488420 38 -209.081890 267.499699 39 143.916298 -209.081890 40 -641.295713 143.916298 41 124.232671 -641.295713 42 193.569113 124.232671 43 -3.013372 193.569113 44 -72.873131 -3.013372 45 169.579260 -72.873131 46 -407.364097 169.579260 47 101.942769 -407.364097 48 100.995873 101.942769 49 327.869176 100.995873 50 -97.847362 327.869176 51 -444.904106 -97.847362 52 333.066172 -444.904106 53 51.878702 333.066172 54 187.286940 51.878702 55 -77.734877 187.286940 56 -146.997106 -77.734877 57 -129.496213 -146.997106 58 -555.676268 -129.496213 59 -141.406593 -555.676268 > 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/744gh1258579289.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/8yhwl1258579289.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/91m871258579289.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/10vaf61258579289.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/11f2r21258579289.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/12grd81258579289.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/13wu5s1258579289.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/14f4mf1258579289.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/15h3lx1258579289.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/162obs1258579289.tab") + } > > system("convert tmp/1lfgy1258579289.ps tmp/1lfgy1258579289.png") > system("convert tmp/2k4zc1258579289.ps tmp/2k4zc1258579289.png") > system("convert tmp/3fw791258579289.ps tmp/3fw791258579289.png") > system("convert tmp/4xig71258579289.ps tmp/4xig71258579289.png") > system("convert tmp/5bc211258579289.ps tmp/5bc211258579289.png") > system("convert tmp/6qzgz1258579289.ps tmp/6qzgz1258579289.png") > system("convert tmp/744gh1258579289.ps tmp/744gh1258579289.png") > system("convert tmp/8yhwl1258579289.ps tmp/8yhwl1258579289.png") > system("convert tmp/91m871258579289.ps tmp/91m871258579289.png") > system("convert tmp/10vaf61258579289.ps tmp/10vaf61258579289.png") > > > proc.time() user system elapsed 2.432 1.613 2.893