R version 2.7.0 (2008-04-22) Copyright (C) 2008 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(11554.5 + ,180144 + ,13182.1 + ,173666 + ,14800.1 + ,165688 + ,12150.7 + ,161570 + ,14478.2 + ,156145 + ,13253.9 + ,153730 + ,12036.8 + ,182698 + ,12653.2 + ,200765 + ,14035.4 + ,176512 + ,14571.4 + ,166618 + ,15400.9 + ,158644 + ,14283.2 + ,159585 + ,14485.3 + ,163095 + ,14196.3 + ,159044 + ,15559.1 + ,155511 + ,13767.4 + ,153745 + ,14634 + ,150569 + ,14381.1 + ,150605 + ,12509.9 + ,179612 + ,12122.3 + ,194690 + ,13122.3 + ,189917 + ,13908.7 + ,184128 + ,13456.5 + ,175335 + ,12441.6 + ,179566 + ,12953 + ,181140 + ,13057.2 + ,177876 + ,14350.1 + ,175041 + ,13830.2 + ,169292 + ,13755.5 + ,166070 + ,13574.4 + ,166972 + ,12802.6 + ,206348 + ,11737.3 + ,215706 + ,13850.2 + ,202108 + ,15081.8 + ,195411 + ,13653.3 + ,193111 + ,14019.1 + ,195198 + ,13962 + ,198770 + ,13768.7 + ,194163 + ,14747.1 + ,190420 + ,13858.1 + ,189733 + ,13188 + ,186029 + ,13693.1 + ,191531 + ,12970 + ,232571 + ,11392.8 + ,243477 + ,13985.2 + ,227247 + ,14994.7 + ,217859 + ,13584.7 + ,208679 + ,14257.8 + ,213188 + ,13553.4 + ,216234 + ,14007.3 + ,213586 + ,16535.8 + ,209465 + ,14721.4 + ,204045 + ,13664.6 + ,200237 + ,16805.9 + ,203666 + ,13829.4 + ,241476 + ,13735.6 + ,260307 + ,15870.5 + ,243324 + ,15962.4 + ,244460 + ,15744.1 + ,233575 + ,16083.7 + ,237217 + ,14863.9 + ,235243 + ,15533.1 + ,230354 + ,17473.1 + ,227184 + ,15925.5 + ,221678 + ,15573.7 + ,217142 + ,17495 + ,219452 + ,14155.8 + ,256446 + ,14913.9 + ,265845 + ,17250.4 + ,248624 + ,15879.8 + ,241114 + ,17647.8 + ,229245 + ,17749.9 + ,231805 + ,17111.8 + ,219277 + ,16934.8 + ,219313 + ,20280 + ,212610 + ,16238.2 + ,214771 + ,17896.1 + ,211142 + ,18089.3 + ,211457 + ,15660 + ,240048 + ,16162.4 + ,240636 + ,17850.1 + ,230580 + ,18520.4 + ,208795 + ,18524.7 + ,197922 + ,16843.7 + ,194596) + ,dim=c(2 + ,84) + ,dimnames=list(c('invoer' + ,'werkloosheid') + ,1:84)) > y <- array(NA,dim=c(2,84),dimnames=list(c('invoer','werkloosheid'),1:84)) > 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 invoer werkloosheid M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 11554.5 180144 1 0 0 0 0 0 0 0 0 0 0 1 2 13182.1 173666 0 1 0 0 0 0 0 0 0 0 0 2 3 14800.1 165688 0 0 1 0 0 0 0 0 0 0 0 3 4 12150.7 161570 0 0 0 1 0 0 0 0 0 0 0 4 5 14478.2 156145 0 0 0 0 1 0 0 0 0 0 0 5 6 13253.9 153730 0 0 0 0 0 1 0 0 0 0 0 6 7 12036.8 182698 0 0 0 0 0 0 1 0 0 0 0 7 8 12653.2 200765 0 0 0 0 0 0 0 1 0 0 0 8 9 14035.4 176512 0 0 0 0 0 0 0 0 1 0 0 9 10 14571.4 166618 0 0 0 0 0 0 0 0 0 1 0 10 11 15400.9 158644 0 0 0 0 0 0 0 0 0 0 1 11 12 14283.2 159585 0 0 0 0 0 0 0 0 0 0 0 12 13 14485.3 163095 1 0 0 0 0 0 0 0 0 0 0 13 14 14196.3 159044 0 1 0 0 0 0 0 0 0 0 0 14 15 15559.1 155511 0 0 1 0 0 0 0 0 0 0 0 15 16 13767.4 153745 0 0 0 1 0 0 0 0 0 0 0 16 17 14634.0 150569 0 0 0 0 1 0 0 0 0 0 0 17 18 14381.1 150605 0 0 0 0 0 1 0 0 0 0 0 18 19 12509.9 179612 0 0 0 0 0 0 1 0 0 0 0 19 20 12122.3 194690 0 0 0 0 0 0 0 1 0 0 0 20 21 13122.3 189917 0 0 0 0 0 0 0 0 1 0 0 21 22 13908.7 184128 0 0 0 0 0 0 0 0 0 1 0 22 23 13456.5 175335 0 0 0 0 0 0 0 0 0 0 1 23 24 12441.6 179566 0 0 0 0 0 0 0 0 0 0 0 24 25 12953.0 181140 1 0 0 0 0 0 0 0 0 0 0 25 26 13057.2 177876 0 1 0 0 0 0 0 0 0 0 0 26 27 14350.1 175041 0 0 1 0 0 0 0 0 0 0 0 27 28 13830.2 169292 0 0 0 1 0 0 0 0 0 0 0 28 29 13755.5 166070 0 0 0 0 1 0 0 0 0 0 0 29 30 13574.4 166972 0 0 0 0 0 1 0 0 0 0 0 30 31 12802.6 206348 0 0 0 0 0 0 1 0 0 0 0 31 32 11737.3 215706 0 0 0 0 0 0 0 1 0 0 0 32 33 13850.2 202108 0 0 0 0 0 0 0 0 1 0 0 33 34 15081.8 195411 0 0 0 0 0 0 0 0 0 1 0 34 35 13653.3 193111 0 0 0 0 0 0 0 0 0 0 1 35 36 14019.1 195198 0 0 0 0 0 0 0 0 0 0 0 36 37 13962.0 198770 1 0 0 0 0 0 0 0 0 0 0 37 38 13768.7 194163 0 1 0 0 0 0 0 0 0 0 0 38 39 14747.1 190420 0 0 1 0 0 0 0 0 0 0 0 39 40 13858.1 189733 0 0 0 1 0 0 0 0 0 0 0 40 41 13188.0 186029 0 0 0 0 1 0 0 0 0 0 0 41 42 13693.1 191531 0 0 0 0 0 1 0 0 0 0 0 42 43 12970.0 232571 0 0 0 0 0 0 1 0 0 0 0 43 44 11392.8 243477 0 0 0 0 0 0 0 1 0 0 0 44 45 13985.2 227247 0 0 0 0 0 0 0 0 1 0 0 45 46 14994.7 217859 0 0 0 0 0 0 0 0 0 1 0 46 47 13584.7 208679 0 0 0 0 0 0 0 0 0 0 1 47 48 14257.8 213188 0 0 0 0 0 0 0 0 0 0 0 48 49 13553.4 216234 1 0 0 0 0 0 0 0 0 0 0 49 50 14007.3 213586 0 1 0 0 0 0 0 0 0 0 0 50 51 16535.8 209465 0 0 1 0 0 0 0 0 0 0 0 51 52 14721.4 204045 0 0 0 1 0 0 0 0 0 0 0 52 53 13664.6 200237 0 0 0 0 1 0 0 0 0 0 0 53 54 16805.9 203666 0 0 0 0 0 1 0 0 0 0 0 54 55 13829.4 241476 0 0 0 0 0 0 1 0 0 0 0 55 56 13735.6 260307 0 0 0 0 0 0 0 1 0 0 0 56 57 15870.5 243324 0 0 0 0 0 0 0 0 1 0 0 57 58 15962.4 244460 0 0 0 0 0 0 0 0 0 1 0 58 59 15744.1 233575 0 0 0 0 0 0 0 0 0 0 1 59 60 16083.7 237217 0 0 0 0 0 0 0 0 0 0 0 60 61 14863.9 235243 1 0 0 0 0 0 0 0 0 0 0 61 62 15533.1 230354 0 1 0 0 0 0 0 0 0 0 0 62 63 17473.1 227184 0 0 1 0 0 0 0 0 0 0 0 63 64 15925.5 221678 0 0 0 1 0 0 0 0 0 0 0 64 65 15573.7 217142 0 0 0 0 1 0 0 0 0 0 0 65 66 17495.0 219452 0 0 0 0 0 1 0 0 0 0 0 66 67 14155.8 256446 0 0 0 0 0 0 1 0 0 0 0 67 68 14913.9 265845 0 0 0 0 0 0 0 1 0 0 0 68 69 17250.4 248624 0 0 0 0 0 0 0 0 1 0 0 69 70 15879.8 241114 0 0 0 0 0 0 0 0 0 1 0 70 71 17647.8 229245 0 0 0 0 0 0 0 0 0 0 1 71 72 17749.9 231805 0 0 0 0 0 0 0 0 0 0 0 72 73 17111.8 219277 1 0 0 0 0 0 0 0 0 0 0 73 74 16934.8 219313 0 1 0 0 0 0 0 0 0 0 0 74 75 20280.0 212610 0 0 1 0 0 0 0 0 0 0 0 75 76 16238.2 214771 0 0 0 1 0 0 0 0 0 0 0 76 77 17896.1 211142 0 0 0 0 1 0 0 0 0 0 0 77 78 18089.3 211457 0 0 0 0 0 1 0 0 0 0 0 78 79 15660.0 240048 0 0 0 0 0 0 1 0 0 0 0 79 80 16162.4 240636 0 0 0 0 0 0 0 1 0 0 0 80 81 17850.1 230580 0 0 0 0 0 0 0 0 1 0 0 81 82 18520.4 208795 0 0 0 0 0 0 0 0 0 1 0 82 83 18524.7 197922 0 0 0 0 0 0 0 0 0 0 1 83 84 16843.7 194596 0 0 0 0 0 0 0 0 0 0 0 84 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) werkloosheid M1 M2 M3 1.662e+04 -2.642e-02 -2.215e+02 -8.482e+01 1.581e+03 M4 M5 M6 M7 M8 -4.708e+02 -2.683e+02 2.766e+02 -7.942e+02 -7.412e+02 M9 M10 M11 t 6.828e+02 7.996e+02 3.572e+02 7.922e+01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1603.15 -642.37 -51.82 617.36 1855.51 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.662e+04 1.340e+03 12.399 < 2e-16 *** werkloosheid -2.642e-02 8.124e-03 -3.252 0.00177 ** M1 -2.215e+02 5.073e+02 -0.437 0.66371 M2 -8.482e+01 5.036e+02 -0.168 0.86674 M3 1.581e+03 5.030e+02 3.144 0.00245 ** M4 -4.708e+02 5.050e+02 -0.932 0.35442 M5 -2.683e+02 5.103e+02 -0.526 0.60073 M6 2.766e+02 5.093e+02 0.543 0.58875 M7 -7.942e+02 5.351e+02 -1.484 0.14227 M8 -7.412e+02 5.715e+02 -1.297 0.19892 M9 6.828e+02 5.225e+02 1.307 0.19552 M10 7.996e+02 5.061e+02 1.580 0.11866 M11 3.572e+02 5.013e+02 0.713 0.47844 t 7.922e+01 8.651e+00 9.158 1.36e-13 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 937.7 on 70 degrees of freedom Multiple R-squared: 0.7779, Adjusted R-squared: 0.7366 F-statistic: 18.86 on 13 and 70 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.41409553 0.8281911 0.5859045 [2,] 0.36670069 0.7334014 0.6332993 [3,] 0.24468570 0.4893714 0.7553143 [4,] 0.36045359 0.7209072 0.6395464 [5,] 0.27633936 0.5526787 0.7236606 [6,] 0.23195158 0.4639032 0.7680484 [7,] 0.20289435 0.4057887 0.7971056 [8,] 0.13696945 0.2739389 0.8630305 [9,] 0.10570939 0.2114188 0.8942906 [10,] 0.06745232 0.1349046 0.9325477 [11,] 0.04146660 0.0829332 0.9585334 [12,] 0.12077891 0.2415578 0.8792211 [13,] 0.10316717 0.2063343 0.8968328 [14,] 0.07890956 0.1578191 0.9210904 [15,] 0.28615464 0.5723093 0.7138454 [16,] 0.22474356 0.4494871 0.7752564 [17,] 0.22238702 0.4447740 0.7776130 [18,] 0.39928007 0.7985601 0.6007199 [19,] 0.32980014 0.6596003 0.6701999 [20,] 0.42421968 0.8484394 0.5757803 [21,] 0.54799803 0.9040039 0.4520020 [22,] 0.53936167 0.9212767 0.4606383 [23,] 0.48012622 0.9602524 0.5198738 [24,] 0.51329639 0.9734072 0.4867036 [25,] 0.48859851 0.9771970 0.5114015 [26,] 0.48732092 0.9746418 0.5126791 [27,] 0.59684326 0.8063135 0.4031567 [28,] 0.56851064 0.8629787 0.4314894 [29,] 0.53107644 0.9378471 0.4689236 [30,] 0.55012874 0.8997425 0.4498713 [31,] 0.56015030 0.8796994 0.4398497 [32,] 0.52478713 0.9504257 0.4752129 [33,] 0.46756700 0.9351340 0.5324330 [34,] 0.40831030 0.8166206 0.5916897 [35,] 0.47197169 0.9439434 0.5280283 [36,] 0.45994051 0.9198810 0.5400595 [37,] 0.53319816 0.9336037 0.4668018 [38,] 0.73569499 0.5286100 0.2643050 [39,] 0.73006146 0.5398771 0.2699385 [40,] 0.70600517 0.5879897 0.2939948 [41,] 0.69910415 0.6017917 0.3008959 [42,] 0.67168315 0.6566337 0.3283169 [43,] 0.61557598 0.7688480 0.3844240 [44,] 0.61387244 0.7722551 0.3861276 [45,] 0.57059269 0.8588146 0.4294073 [46,] 0.47590599 0.9518120 0.5240940 [47,] 0.55663135 0.8867373 0.4433687 [48,] 0.53990275 0.9201945 0.4600973 [49,] 0.47763082 0.9552616 0.5223692 [50,] 0.42315792 0.8463158 0.5768421 [51,] 0.27263364 0.5452673 0.7273664 > postscript(file="/var/www/html/rcomp/tmp/1s2rn1229262814.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/24p731229262814.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/34mmg1229262814.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/4cviv1229262814.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/5j6e21229262814.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 = 84 Frequency = 1 1 2 3 4 5 6 -164.06676 1076.49345 738.27243 -46.94099 1855.51357 -56.70590 7 8 9 10 11 12 483.00452 1444.51035 682.78495 761.41394 1743.36842 928.54817 13 14 15 16 17 18 1365.65367 753.72793 277.73047 412.34982 913.31622 37.24481 19 20 21 22 23 24 -76.11451 -197.56909 -826.89137 -389.42059 -710.80164 -1335.90996 25 26 27 28 29 30 -640.64778 -838.58333 -1366.04173 -64.84128 -506.39007 -1287.78436 31 32 33 34 35 36 -27.82582 -978.08563 -727.63792 131.04622 -995.10925 -296.15562 37 38 39 40 41 42 -116.61227 -647.52586 -1513.47089 -447.64760 -1497.32938 -1471.00547 43 44 45 46 47 48 -118.38906 -1539.65535 -879.23718 -313.74118 -1603.14560 -532.91000 49 50 51 52 53 54 -1014.56199 -846.52468 -172.35534 -156.96369 -1596.09284 1011.66862 55 56 57 58 59 60 25.55814 297.04655 480.07272 405.98121 263.23581 977.06787 61 62 63 64 65 66 -152.59745 171.53937 282.33128 562.25106 -191.10967 1167.09118 67 68 69 70 71 72 -203.27558 670.94772 1049.28664 -715.70624 1101.85403 1549.60290 73 74 75 76 77 78 722.83258 330.87312 1753.53378 -258.20732 1022.09217 599.49111 79 80 81 82 83 84 -82.95768 302.80544 221.62216 120.42663 200.59823 -1290.24335 > postscript(file="/var/www/html/rcomp/tmp/6nfno1229262814.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 = 84 Frequency = 1 lag(myerror, k = 1) myerror 0 -164.06676 NA 1 1076.49345 -164.06676 2 738.27243 1076.49345 3 -46.94099 738.27243 4 1855.51357 -46.94099 5 -56.70590 1855.51357 6 483.00452 -56.70590 7 1444.51035 483.00452 8 682.78495 1444.51035 9 761.41394 682.78495 10 1743.36842 761.41394 11 928.54817 1743.36842 12 1365.65367 928.54817 13 753.72793 1365.65367 14 277.73047 753.72793 15 412.34982 277.73047 16 913.31622 412.34982 17 37.24481 913.31622 18 -76.11451 37.24481 19 -197.56909 -76.11451 20 -826.89137 -197.56909 21 -389.42059 -826.89137 22 -710.80164 -389.42059 23 -1335.90996 -710.80164 24 -640.64778 -1335.90996 25 -838.58333 -640.64778 26 -1366.04173 -838.58333 27 -64.84128 -1366.04173 28 -506.39007 -64.84128 29 -1287.78436 -506.39007 30 -27.82582 -1287.78436 31 -978.08563 -27.82582 32 -727.63792 -978.08563 33 131.04622 -727.63792 34 -995.10925 131.04622 35 -296.15562 -995.10925 36 -116.61227 -296.15562 37 -647.52586 -116.61227 38 -1513.47089 -647.52586 39 -447.64760 -1513.47089 40 -1497.32938 -447.64760 41 -1471.00547 -1497.32938 42 -118.38906 -1471.00547 43 -1539.65535 -118.38906 44 -879.23718 -1539.65535 45 -313.74118 -879.23718 46 -1603.14560 -313.74118 47 -532.91000 -1603.14560 48 -1014.56199 -532.91000 49 -846.52468 -1014.56199 50 -172.35534 -846.52468 51 -156.96369 -172.35534 52 -1596.09284 -156.96369 53 1011.66862 -1596.09284 54 25.55814 1011.66862 55 297.04655 25.55814 56 480.07272 297.04655 57 405.98121 480.07272 58 263.23581 405.98121 59 977.06787 263.23581 60 -152.59745 977.06787 61 171.53937 -152.59745 62 282.33128 171.53937 63 562.25106 282.33128 64 -191.10967 562.25106 65 1167.09118 -191.10967 66 -203.27558 1167.09118 67 670.94772 -203.27558 68 1049.28664 670.94772 69 -715.70624 1049.28664 70 1101.85403 -715.70624 71 1549.60290 1101.85403 72 722.83258 1549.60290 73 330.87312 722.83258 74 1753.53378 330.87312 75 -258.20732 1753.53378 76 1022.09217 -258.20732 77 599.49111 1022.09217 78 -82.95768 599.49111 79 302.80544 -82.95768 80 221.62216 302.80544 81 120.42663 221.62216 82 200.59823 120.42663 83 -1290.24335 200.59823 84 NA -1290.24335 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1076.49345 -164.06676 [2,] 738.27243 1076.49345 [3,] -46.94099 738.27243 [4,] 1855.51357 -46.94099 [5,] -56.70590 1855.51357 [6,] 483.00452 -56.70590 [7,] 1444.51035 483.00452 [8,] 682.78495 1444.51035 [9,] 761.41394 682.78495 [10,] 1743.36842 761.41394 [11,] 928.54817 1743.36842 [12,] 1365.65367 928.54817 [13,] 753.72793 1365.65367 [14,] 277.73047 753.72793 [15,] 412.34982 277.73047 [16,] 913.31622 412.34982 [17,] 37.24481 913.31622 [18,] -76.11451 37.24481 [19,] -197.56909 -76.11451 [20,] -826.89137 -197.56909 [21,] -389.42059 -826.89137 [22,] -710.80164 -389.42059 [23,] -1335.90996 -710.80164 [24,] -640.64778 -1335.90996 [25,] -838.58333 -640.64778 [26,] -1366.04173 -838.58333 [27,] -64.84128 -1366.04173 [28,] -506.39007 -64.84128 [29,] -1287.78436 -506.39007 [30,] -27.82582 -1287.78436 [31,] -978.08563 -27.82582 [32,] -727.63792 -978.08563 [33,] 131.04622 -727.63792 [34,] -995.10925 131.04622 [35,] -296.15562 -995.10925 [36,] -116.61227 -296.15562 [37,] -647.52586 -116.61227 [38,] -1513.47089 -647.52586 [39,] -447.64760 -1513.47089 [40,] -1497.32938 -447.64760 [41,] -1471.00547 -1497.32938 [42,] -118.38906 -1471.00547 [43,] -1539.65535 -118.38906 [44,] -879.23718 -1539.65535 [45,] -313.74118 -879.23718 [46,] -1603.14560 -313.74118 [47,] -532.91000 -1603.14560 [48,] -1014.56199 -532.91000 [49,] -846.52468 -1014.56199 [50,] -172.35534 -846.52468 [51,] -156.96369 -172.35534 [52,] -1596.09284 -156.96369 [53,] 1011.66862 -1596.09284 [54,] 25.55814 1011.66862 [55,] 297.04655 25.55814 [56,] 480.07272 297.04655 [57,] 405.98121 480.07272 [58,] 263.23581 405.98121 [59,] 977.06787 263.23581 [60,] -152.59745 977.06787 [61,] 171.53937 -152.59745 [62,] 282.33128 171.53937 [63,] 562.25106 282.33128 [64,] -191.10967 562.25106 [65,] 1167.09118 -191.10967 [66,] -203.27558 1167.09118 [67,] 670.94772 -203.27558 [68,] 1049.28664 670.94772 [69,] -715.70624 1049.28664 [70,] 1101.85403 -715.70624 [71,] 1549.60290 1101.85403 [72,] 722.83258 1549.60290 [73,] 330.87312 722.83258 [74,] 1753.53378 330.87312 [75,] -258.20732 1753.53378 [76,] 1022.09217 -258.20732 [77,] 599.49111 1022.09217 [78,] -82.95768 599.49111 [79,] 302.80544 -82.95768 [80,] 221.62216 302.80544 [81,] 120.42663 221.62216 [82,] 200.59823 120.42663 [83,] -1290.24335 200.59823 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1076.49345 -164.06676 2 738.27243 1076.49345 3 -46.94099 738.27243 4 1855.51357 -46.94099 5 -56.70590 1855.51357 6 483.00452 -56.70590 7 1444.51035 483.00452 8 682.78495 1444.51035 9 761.41394 682.78495 10 1743.36842 761.41394 11 928.54817 1743.36842 12 1365.65367 928.54817 13 753.72793 1365.65367 14 277.73047 753.72793 15 412.34982 277.73047 16 913.31622 412.34982 17 37.24481 913.31622 18 -76.11451 37.24481 19 -197.56909 -76.11451 20 -826.89137 -197.56909 21 -389.42059 -826.89137 22 -710.80164 -389.42059 23 -1335.90996 -710.80164 24 -640.64778 -1335.90996 25 -838.58333 -640.64778 26 -1366.04173 -838.58333 27 -64.84128 -1366.04173 28 -506.39007 -64.84128 29 -1287.78436 -506.39007 30 -27.82582 -1287.78436 31 -978.08563 -27.82582 32 -727.63792 -978.08563 33 131.04622 -727.63792 34 -995.10925 131.04622 35 -296.15562 -995.10925 36 -116.61227 -296.15562 37 -647.52586 -116.61227 38 -1513.47089 -647.52586 39 -447.64760 -1513.47089 40 -1497.32938 -447.64760 41 -1471.00547 -1497.32938 42 -118.38906 -1471.00547 43 -1539.65535 -118.38906 44 -879.23718 -1539.65535 45 -313.74118 -879.23718 46 -1603.14560 -313.74118 47 -532.91000 -1603.14560 48 -1014.56199 -532.91000 49 -846.52468 -1014.56199 50 -172.35534 -846.52468 51 -156.96369 -172.35534 52 -1596.09284 -156.96369 53 1011.66862 -1596.09284 54 25.55814 1011.66862 55 297.04655 25.55814 56 480.07272 297.04655 57 405.98121 480.07272 58 263.23581 405.98121 59 977.06787 263.23581 60 -152.59745 977.06787 61 171.53937 -152.59745 62 282.33128 171.53937 63 562.25106 282.33128 64 -191.10967 562.25106 65 1167.09118 -191.10967 66 -203.27558 1167.09118 67 670.94772 -203.27558 68 1049.28664 670.94772 69 -715.70624 1049.28664 70 1101.85403 -715.70624 71 1549.60290 1101.85403 72 722.83258 1549.60290 73 330.87312 722.83258 74 1753.53378 330.87312 75 -258.20732 1753.53378 76 1022.09217 -258.20732 77 599.49111 1022.09217 78 -82.95768 599.49111 79 302.80544 -82.95768 80 221.62216 302.80544 81 120.42663 221.62216 82 200.59823 120.42663 83 -1290.24335 200.59823 > 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/7l8el1229262814.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/8hsar1229262814.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/92sgi1229262814.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/10emq21229262814.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/11mo291229262814.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/12naof1229262814.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/13g18x1229262814.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/143efl1229262814.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/15nld31229262814.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/16ixym1229262815.tab") + } > > system("convert tmp/1s2rn1229262814.ps tmp/1s2rn1229262814.png") > system("convert tmp/24p731229262814.ps tmp/24p731229262814.png") > system("convert tmp/34mmg1229262814.ps tmp/34mmg1229262814.png") > system("convert tmp/4cviv1229262814.ps tmp/4cviv1229262814.png") > system("convert tmp/5j6e21229262814.ps tmp/5j6e21229262814.png") > system("convert tmp/6nfno1229262814.ps tmp/6nfno1229262814.png") > system("convert tmp/7l8el1229262814.ps tmp/7l8el1229262814.png") > system("convert tmp/8hsar1229262814.ps tmp/8hsar1229262814.png") > system("convert tmp/92sgi1229262814.ps tmp/92sgi1229262814.png") > system("convert tmp/10emq21229262814.ps tmp/10emq21229262814.png") > > > proc.time() user system elapsed 5.561 2.818 5.946