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(8.2,267722,8,266003,7.9,262971,7.6,265521,7.6,264676,8.3,270223,8.4,269508,8.4,268457,8.4,265814,8.4,266680,8.6,263018,8.9,269285,8.8,269829,8.3,270911,7.5,266844,7.2,271244,7.4,269907,8.8,271296,9.3,270157,9.3,271322,8.7,267179,8.2,264101,8.3,265518,8.5,269419,8.6,268714,8.5,272482,8.2,268351,8.1,268175,7.9,270674,8.6,272764,8.7,272599,8.7,270333,8.5,270846,8.4,270491,8.5,269160,8.7,274027,8.7,273784,8.6,276663,8.5,274525,8.3,271344,8,271115,8.2,270798,8.1,273911,8.1,273985,8,271917,7.9,273338,7.9,270601,8,273547,8,275363,7.9,281229,8,277793,7.7,279913,7.2,282500,7.5,280041,7.3,282166,7,290304,7,283519,7,287816,7.2,285226,7.3,287595),dim=c(2,60),dimnames=list(c('wkh','los'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('wkh','los'),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 wkh los M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 8.2 267722 1 0 0 0 0 0 0 0 0 0 0 1 2 8.0 266003 0 1 0 0 0 0 0 0 0 0 0 2 3 7.9 262971 0 0 1 0 0 0 0 0 0 0 0 3 4 7.6 265521 0 0 0 1 0 0 0 0 0 0 0 4 5 7.6 264676 0 0 0 0 1 0 0 0 0 0 0 5 6 8.3 270223 0 0 0 0 0 1 0 0 0 0 0 6 7 8.4 269508 0 0 0 0 0 0 1 0 0 0 0 7 8 8.4 268457 0 0 0 0 0 0 0 1 0 0 0 8 9 8.4 265814 0 0 0 0 0 0 0 0 1 0 0 9 10 8.4 266680 0 0 0 0 0 0 0 0 0 1 0 10 11 8.6 263018 0 0 0 0 0 0 0 0 0 0 1 11 12 8.9 269285 0 0 0 0 0 0 0 0 0 0 0 12 13 8.8 269829 1 0 0 0 0 0 0 0 0 0 0 13 14 8.3 270911 0 1 0 0 0 0 0 0 0 0 0 14 15 7.5 266844 0 0 1 0 0 0 0 0 0 0 0 15 16 7.2 271244 0 0 0 1 0 0 0 0 0 0 0 16 17 7.4 269907 0 0 0 0 1 0 0 0 0 0 0 17 18 8.8 271296 0 0 0 0 0 1 0 0 0 0 0 18 19 9.3 270157 0 0 0 0 0 0 1 0 0 0 0 19 20 9.3 271322 0 0 0 0 0 0 0 1 0 0 0 20 21 8.7 267179 0 0 0 0 0 0 0 0 1 0 0 21 22 8.2 264101 0 0 0 0 0 0 0 0 0 1 0 22 23 8.3 265518 0 0 0 0 0 0 0 0 0 0 1 23 24 8.5 269419 0 0 0 0 0 0 0 0 0 0 0 24 25 8.6 268714 1 0 0 0 0 0 0 0 0 0 0 25 26 8.5 272482 0 1 0 0 0 0 0 0 0 0 0 26 27 8.2 268351 0 0 1 0 0 0 0 0 0 0 0 27 28 8.1 268175 0 0 0 1 0 0 0 0 0 0 0 28 29 7.9 270674 0 0 0 0 1 0 0 0 0 0 0 29 30 8.6 272764 0 0 0 0 0 1 0 0 0 0 0 30 31 8.7 272599 0 0 0 0 0 0 1 0 0 0 0 31 32 8.7 270333 0 0 0 0 0 0 0 1 0 0 0 32 33 8.5 270846 0 0 0 0 0 0 0 0 1 0 0 33 34 8.4 270491 0 0 0 0 0 0 0 0 0 1 0 34 35 8.5 269160 0 0 0 0 0 0 0 0 0 0 1 35 36 8.7 274027 0 0 0 0 0 0 0 0 0 0 0 36 37 8.7 273784 1 0 0 0 0 0 0 0 0 0 0 37 38 8.6 276663 0 1 0 0 0 0 0 0 0 0 0 38 39 8.5 274525 0 0 1 0 0 0 0 0 0 0 0 39 40 8.3 271344 0 0 0 1 0 0 0 0 0 0 0 40 41 8.0 271115 0 0 0 0 1 0 0 0 0 0 0 41 42 8.2 270798 0 0 0 0 0 1 0 0 0 0 0 42 43 8.1 273911 0 0 0 0 0 0 1 0 0 0 0 43 44 8.1 273985 0 0 0 0 0 0 0 1 0 0 0 44 45 8.0 271917 0 0 0 0 0 0 0 0 1 0 0 45 46 7.9 273338 0 0 0 0 0 0 0 0 0 1 0 46 47 7.9 270601 0 0 0 0 0 0 0 0 0 0 1 47 48 8.0 273547 0 0 0 0 0 0 0 0 0 0 0 48 49 8.0 275363 1 0 0 0 0 0 0 0 0 0 0 49 50 7.9 281229 0 1 0 0 0 0 0 0 0 0 0 50 51 8.0 277793 0 0 1 0 0 0 0 0 0 0 0 51 52 7.7 279913 0 0 0 1 0 0 0 0 0 0 0 52 53 7.2 282500 0 0 0 0 1 0 0 0 0 0 0 53 54 7.5 280041 0 0 0 0 0 1 0 0 0 0 0 54 55 7.3 282166 0 0 0 0 0 0 1 0 0 0 0 55 56 7.0 290304 0 0 0 0 0 0 0 1 0 0 0 56 57 7.0 283519 0 0 0 0 0 0 0 0 1 0 0 57 58 7.0 287816 0 0 0 0 0 0 0 0 0 1 0 58 59 7.2 285226 0 0 0 0 0 0 0 0 0 0 1 59 60 7.3 287595 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) los M1 M2 M3 M4 29.0258358 -0.0000766 -0.0102477 -0.0367149 -0.5425832 -0.7034726 M5 M6 M7 M8 M9 M10 -0.8309067 -0.0835689 0.0373316 0.0617585 -0.3584015 -0.4585429 M11 t -0.4833614 0.0084173 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.6682 -0.3207 0.0089 0.2863 0.8284 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 29.0258358 4.4926249 6.461 5.88e-08 *** los -0.0000766 0.0000170 -4.505 4.53e-05 *** M1 -0.0102477 0.2607325 -0.039 0.9688 M2 -0.0367149 0.2618747 -0.140 0.8891 M3 -0.5425832 0.2620410 -2.071 0.0440 * M4 -0.7034726 0.2602944 -2.703 0.0096 ** M5 -0.8309067 0.2597562 -3.199 0.0025 ** M6 -0.0835689 0.2590790 -0.323 0.7485 M7 0.0373316 0.2589628 0.144 0.8860 M8 0.0617584 0.2596667 0.238 0.8131 M9 -0.3584015 0.2608298 -1.374 0.1761 M10 -0.4585429 0.2600633 -1.763 0.0845 . M11 -0.4833614 0.2662479 -1.815 0.0760 . t 0.0084173 0.0060037 1.402 0.1676 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4086 on 46 degrees of freedom Multiple R-squared: 0.5773, Adjusted R-squared: 0.4578 F-statistic: 4.832 on 13 and 46 DF, p-value: 3.197e-05 > 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.5359533 9.280935e-01 4.640467e-01 [2,] 0.3689086 7.378171e-01 6.310914e-01 [3,] 0.2928301 5.856601e-01 7.071699e-01 [4,] 0.4954732 9.909465e-01 5.045268e-01 [5,] 0.4566453 9.132907e-01 5.433547e-01 [6,] 0.8746213 2.507573e-01 1.253787e-01 [7,] 0.8889202 2.221597e-01 1.110798e-01 [8,] 0.9183397 1.633206e-01 8.166032e-02 [9,] 0.9023246 1.953508e-01 9.767539e-02 [10,] 0.8974801 2.050397e-01 1.025199e-01 [11,] 0.9799267 4.014658e-02 2.007329e-02 [12,] 0.9994304 1.139295e-03 5.696476e-04 [13,] 0.9999992 1.652251e-06 8.261256e-07 [14,] 0.9999987 2.570256e-06 1.285128e-06 [15,] 0.9999970 5.948593e-06 2.974296e-06 [16,] 0.9999937 1.255389e-05 6.276945e-06 [17,] 0.9999790 4.198092e-05 2.099046e-05 [18,] 0.9999436 1.127684e-04 5.638418e-05 [19,] 0.9998450 3.099829e-04 1.549914e-04 [20,] 0.9995475 9.050233e-04 4.525117e-04 [21,] 0.9990607 1.878639e-03 9.393197e-04 [22,] 0.9978057 4.388511e-03 2.194256e-03 [23,] 0.9948267 1.034657e-02 5.173285e-03 [24,] 0.9903596 1.928078e-02 9.640390e-03 [25,] 0.9720790 5.584201e-02 2.792101e-02 [26,] 0.9473682 1.052636e-01 5.263180e-02 [27,] 0.8970774 2.058452e-01 1.029226e-01 > postscript(file="/var/www/html/rcomp/tmp/1xxlm1258703708.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/2dp0y1258703708.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/38h1p1258703708.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/4fexg1258703708.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/535521258703708.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 -0.315405994 -0.629038448 -0.463851024 -0.416038432 -0.361752072 0.007415690 7 8 9 10 11 12 -0.076673943 -0.190028992 0.019249090 0.177312333 0.113189404 0.401488583 13 14 15 16 17 18 0.344991627 -0.054072778 -0.668170585 -0.478640431 -0.262043282 0.488604686 19 20 21 22 23 24 0.772034919 0.828434527 0.322806479 -0.321256797 -0.096307568 -0.089253659 25 26 27 28 29 30 -0.041429120 0.165265053 0.046264585 0.085254435 0.195704863 0.300052296 31 32 33 34 35 36 0.258094910 0.051665895 0.302706476 0.267236129 0.281677327 0.362730784 37 38 39 40 41 42 0.345946412 0.484539551 0.718211029 0.427005598 0.228480075 -0.351558530 43 44 45 46 47 48 -0.342407718 -0.369583169 -0.216257737 -0.115679224 -0.308943373 -0.475046367 49 50 51 52 53 54 -0.334102925 0.033306623 0.367545995 0.382418830 0.199610417 -0.444514142 55 56 57 58 59 60 -0.611048168 -0.320488261 -0.428504308 -0.007612441 0.010384211 -0.199919341 > postscript(file="/var/www/html/rcomp/tmp/6rh3o1258703708.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 -0.315405994 NA 1 -0.629038448 -0.315405994 2 -0.463851024 -0.629038448 3 -0.416038432 -0.463851024 4 -0.361752072 -0.416038432 5 0.007415690 -0.361752072 6 -0.076673943 0.007415690 7 -0.190028992 -0.076673943 8 0.019249090 -0.190028992 9 0.177312333 0.019249090 10 0.113189404 0.177312333 11 0.401488583 0.113189404 12 0.344991627 0.401488583 13 -0.054072778 0.344991627 14 -0.668170585 -0.054072778 15 -0.478640431 -0.668170585 16 -0.262043282 -0.478640431 17 0.488604686 -0.262043282 18 0.772034919 0.488604686 19 0.828434527 0.772034919 20 0.322806479 0.828434527 21 -0.321256797 0.322806479 22 -0.096307568 -0.321256797 23 -0.089253659 -0.096307568 24 -0.041429120 -0.089253659 25 0.165265053 -0.041429120 26 0.046264585 0.165265053 27 0.085254435 0.046264585 28 0.195704863 0.085254435 29 0.300052296 0.195704863 30 0.258094910 0.300052296 31 0.051665895 0.258094910 32 0.302706476 0.051665895 33 0.267236129 0.302706476 34 0.281677327 0.267236129 35 0.362730784 0.281677327 36 0.345946412 0.362730784 37 0.484539551 0.345946412 38 0.718211029 0.484539551 39 0.427005598 0.718211029 40 0.228480075 0.427005598 41 -0.351558530 0.228480075 42 -0.342407718 -0.351558530 43 -0.369583169 -0.342407718 44 -0.216257737 -0.369583169 45 -0.115679224 -0.216257737 46 -0.308943373 -0.115679224 47 -0.475046367 -0.308943373 48 -0.334102925 -0.475046367 49 0.033306623 -0.334102925 50 0.367545995 0.033306623 51 0.382418830 0.367545995 52 0.199610417 0.382418830 53 -0.444514142 0.199610417 54 -0.611048168 -0.444514142 55 -0.320488261 -0.611048168 56 -0.428504308 -0.320488261 57 -0.007612441 -0.428504308 58 0.010384211 -0.007612441 59 -0.199919341 0.010384211 60 NA -0.199919341 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.629038448 -0.315405994 [2,] -0.463851024 -0.629038448 [3,] -0.416038432 -0.463851024 [4,] -0.361752072 -0.416038432 [5,] 0.007415690 -0.361752072 [6,] -0.076673943 0.007415690 [7,] -0.190028992 -0.076673943 [8,] 0.019249090 -0.190028992 [9,] 0.177312333 0.019249090 [10,] 0.113189404 0.177312333 [11,] 0.401488583 0.113189404 [12,] 0.344991627 0.401488583 [13,] -0.054072778 0.344991627 [14,] -0.668170585 -0.054072778 [15,] -0.478640431 -0.668170585 [16,] -0.262043282 -0.478640431 [17,] 0.488604686 -0.262043282 [18,] 0.772034919 0.488604686 [19,] 0.828434527 0.772034919 [20,] 0.322806479 0.828434527 [21,] -0.321256797 0.322806479 [22,] -0.096307568 -0.321256797 [23,] -0.089253659 -0.096307568 [24,] -0.041429120 -0.089253659 [25,] 0.165265053 -0.041429120 [26,] 0.046264585 0.165265053 [27,] 0.085254435 0.046264585 [28,] 0.195704863 0.085254435 [29,] 0.300052296 0.195704863 [30,] 0.258094910 0.300052296 [31,] 0.051665895 0.258094910 [32,] 0.302706476 0.051665895 [33,] 0.267236129 0.302706476 [34,] 0.281677327 0.267236129 [35,] 0.362730784 0.281677327 [36,] 0.345946412 0.362730784 [37,] 0.484539551 0.345946412 [38,] 0.718211029 0.484539551 [39,] 0.427005598 0.718211029 [40,] 0.228480075 0.427005598 [41,] -0.351558530 0.228480075 [42,] -0.342407718 -0.351558530 [43,] -0.369583169 -0.342407718 [44,] -0.216257737 -0.369583169 [45,] -0.115679224 -0.216257737 [46,] -0.308943373 -0.115679224 [47,] -0.475046367 -0.308943373 [48,] -0.334102925 -0.475046367 [49,] 0.033306623 -0.334102925 [50,] 0.367545995 0.033306623 [51,] 0.382418830 0.367545995 [52,] 0.199610417 0.382418830 [53,] -0.444514142 0.199610417 [54,] -0.611048168 -0.444514142 [55,] -0.320488261 -0.611048168 [56,] -0.428504308 -0.320488261 [57,] -0.007612441 -0.428504308 [58,] 0.010384211 -0.007612441 [59,] -0.199919341 0.010384211 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.629038448 -0.315405994 2 -0.463851024 -0.629038448 3 -0.416038432 -0.463851024 4 -0.361752072 -0.416038432 5 0.007415690 -0.361752072 6 -0.076673943 0.007415690 7 -0.190028992 -0.076673943 8 0.019249090 -0.190028992 9 0.177312333 0.019249090 10 0.113189404 0.177312333 11 0.401488583 0.113189404 12 0.344991627 0.401488583 13 -0.054072778 0.344991627 14 -0.668170585 -0.054072778 15 -0.478640431 -0.668170585 16 -0.262043282 -0.478640431 17 0.488604686 -0.262043282 18 0.772034919 0.488604686 19 0.828434527 0.772034919 20 0.322806479 0.828434527 21 -0.321256797 0.322806479 22 -0.096307568 -0.321256797 23 -0.089253659 -0.096307568 24 -0.041429120 -0.089253659 25 0.165265053 -0.041429120 26 0.046264585 0.165265053 27 0.085254435 0.046264585 28 0.195704863 0.085254435 29 0.300052296 0.195704863 30 0.258094910 0.300052296 31 0.051665895 0.258094910 32 0.302706476 0.051665895 33 0.267236129 0.302706476 34 0.281677327 0.267236129 35 0.362730784 0.281677327 36 0.345946412 0.362730784 37 0.484539551 0.345946412 38 0.718211029 0.484539551 39 0.427005598 0.718211029 40 0.228480075 0.427005598 41 -0.351558530 0.228480075 42 -0.342407718 -0.351558530 43 -0.369583169 -0.342407718 44 -0.216257737 -0.369583169 45 -0.115679224 -0.216257737 46 -0.308943373 -0.115679224 47 -0.475046367 -0.308943373 48 -0.334102925 -0.475046367 49 0.033306623 -0.334102925 50 0.367545995 0.033306623 51 0.382418830 0.367545995 52 0.199610417 0.382418830 53 -0.444514142 0.199610417 54 -0.611048168 -0.444514142 55 -0.320488261 -0.611048168 56 -0.428504308 -0.320488261 57 -0.007612441 -0.428504308 58 0.010384211 -0.007612441 59 -0.199919341 0.010384211 > 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/7klf41258703708.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/8oq331258703708.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/97zkn1258703708.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/10wp9i1258703708.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/11wpsy1258703708.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/12rruq1258703708.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/13gt0d1258703708.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/14twq31258703708.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/1577p51258703708.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/1628yo1258703708.tab") + } > > system("convert tmp/1xxlm1258703708.ps tmp/1xxlm1258703708.png") > system("convert tmp/2dp0y1258703708.ps tmp/2dp0y1258703708.png") > system("convert tmp/38h1p1258703708.ps tmp/38h1p1258703708.png") > system("convert tmp/4fexg1258703708.ps tmp/4fexg1258703708.png") > system("convert tmp/535521258703708.ps tmp/535521258703708.png") > system("convert tmp/6rh3o1258703708.ps tmp/6rh3o1258703708.png") > system("convert tmp/7klf41258703708.ps tmp/7klf41258703708.png") > system("convert tmp/8oq331258703708.ps tmp/8oq331258703708.png") > system("convert tmp/97zkn1258703708.ps tmp/97zkn1258703708.png") > system("convert tmp/10wp9i1258703708.ps tmp/10wp9i1258703708.png") > > > proc.time() user system elapsed 2.380 1.548 3.460