R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(31/01/2006 + ,-1 + ,-3 + ,24 + ,6 + ,17 + ,28/02/2006 + ,-2 + ,-4 + ,24 + ,6 + ,13 + ,31/03/2006 + ,-5 + ,-7 + ,31 + ,5 + ,12 + ,30/04/2006 + ,-4 + ,-7 + ,25 + ,5 + ,13 + ,31/05/2006 + ,-6 + ,-7 + ,28 + ,3 + ,10 + ,30/06/2006 + ,-2 + ,-3 + ,24 + ,5 + ,14 + ,31/07/2006 + ,-2 + ,0 + ,25 + ,5 + ,13 + ,31/08/2006 + ,-2 + ,-5 + ,16 + ,5 + ,10 + ,30/09/2006 + ,-2 + ,-3 + ,17 + ,3 + ,11 + ,31/10/2006 + ,2 + ,3 + ,11 + ,6 + ,12 + ,30/11/2006 + ,1 + ,2 + ,12 + ,6 + ,7 + ,31/12/2006 + ,-8 + ,-7 + ,39 + ,4 + ,11 + ,31/01/2007 + ,-1 + ,-1 + ,19 + ,6 + ,9 + ,28/02/2007 + ,1 + ,0 + ,14 + ,5 + ,13 + ,31/03/2007 + ,-1 + ,-3 + ,15 + ,4 + ,12 + ,30/04/2007 + ,2 + ,4 + ,7 + ,5 + ,5 + ,31/05/2007 + ,2 + ,2 + ,12 + ,5 + ,13 + ,30/06/2007 + ,1 + ,3 + ,12 + ,4 + ,11 + ,31/07/2007 + ,-1 + ,0 + ,14 + ,3 + ,8 + ,31/08/2007 + ,-2 + ,-10 + ,9 + ,2 + ,8 + ,30/09/2007 + ,-2 + ,-10 + ,8 + ,3 + ,8 + ,31/10/2007 + ,-1 + ,-9 + ,4 + ,2 + ,8 + ,30/11/2007 + ,-8 + ,-22 + ,7 + ,-1 + ,0 + ,31/12/2007 + ,-4 + ,-16 + ,3 + ,0 + ,3 + ,31/01/2008 + ,-6 + ,-18 + ,5 + ,-2 + ,0 + ,29/02/2008 + ,-3 + ,-14 + ,0 + ,1 + ,-1 + ,31/03/2008 + ,-3 + ,-12 + ,-2 + ,-2 + ,-1 + ,30/04/2008 + ,-7 + ,-17 + ,6 + ,-2 + ,-4 + ,31/05/2008 + ,-9 + ,-23 + ,11 + ,-2 + ,1 + ,30/06/2008 + ,-11 + ,-28 + ,9 + ,-6 + ,-1 + ,31/07/2008 + ,-13 + ,-31 + ,17 + ,-4 + ,0 + ,31/08/2008 + ,-11 + ,-21 + ,21 + ,-2 + ,-1 + ,30/09/2008 + ,-9 + ,-19 + ,21 + ,0 + ,6 + ,31/10/2008 + ,-17 + ,-22 + ,41 + ,-5 + ,0 + ,30/11/2008 + ,-22 + ,-22 + ,57 + ,-4 + ,-3 + ,31/12/2008 + ,-25 + ,-25 + ,65 + ,-5 + ,-3 + ,31/01/2009 + ,-20 + ,-16 + ,68 + ,-1 + ,4 + ,28/02/2009 + ,-24 + ,-22 + ,73 + ,-2 + ,1 + ,31/03/2009 + ,-24 + ,-21 + ,71 + ,-4 + ,0 + ,30/04/2009 + ,-22 + ,-10 + ,71 + ,-1 + ,-4 + ,31/05/2009 + ,-19 + ,-7 + ,70 + ,1 + ,-2 + ,30/06/2009 + ,-18 + ,-5 + ,69 + ,1 + ,3 + ,31/07/2009 + ,-17 + ,-4 + ,65 + ,-2 + ,2 + ,31/08/2009 + ,-11 + ,7 + ,57 + ,1 + ,5 + ,30/09/2009 + ,-11 + ,6 + ,57 + ,1 + ,6 + ,31/10/2009 + ,-12 + ,3 + ,57 + ,3 + ,6 + ,30/11/2009 + ,-10 + ,10 + ,55 + ,3 + ,3 + ,31/12/2009 + ,-15 + ,0 + ,65 + ,1 + ,4 + ,31/01/2010 + ,-15 + ,-2 + ,65 + ,1 + ,7 + ,28/02/2010 + ,-15 + ,-1 + ,64 + ,0 + ,5 + ,31/03/2010 + ,-13 + ,2 + ,60 + ,2 + ,6 + ,30/04/2010 + ,-8 + ,8 + ,43 + ,2 + ,1 + ,31/05/2010 + ,-13 + ,-6 + ,47 + ,-1 + ,3 + ,30/06/2010 + ,-9 + ,-4 + ,40 + ,1 + ,6 + ,31/07/2010 + ,-7 + ,4 + ,31 + ,0 + ,0 + ,31/08/2010 + ,-4 + ,7 + ,27 + ,1 + ,3 + ,30/09/2010 + ,-4 + ,3 + ,24 + ,1 + ,4 + ,31/10/2010 + ,-2 + ,3 + ,23 + ,3 + ,7 + ,30/11/2010 + ,0 + ,8 + ,17 + ,2 + ,6 + ,31/12/2010 + ,-2 + ,3 + ,16 + ,0 + ,6 + ,31/01/2011 + ,-3 + ,-3 + ,15 + ,0 + ,6) + ,dim=c(6 + ,61) + ,dimnames=list(c('Maand' + ,'CVI' + ,'Econ.Sit.' + ,'Werkloos' + ,'Fin.Sit.' + ,'Spaarverm.') + ,1:61)) > y <- array(NA,dim=c(6,61),dimnames=list(c('Maand','CVI','Econ.Sit.','Werkloos','Fin.Sit.','Spaarverm.'),1:61)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '2' > #'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 > 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 CVI Maand Econ.Sit. Werkloos Fin.Sit. Spaarverm. 1 -1 0.015453639 -3 24 6 17 2 -2 0.006979063 -4 24 6 13 3 -5 0.005151213 -7 31 5 12 4 -4 0.003738784 -7 25 5 13 5 -6 0.003090728 -7 28 3 10 6 -2 0.002492522 -3 24 5 14 7 -2 0.002207663 0 25 5 13 8 -2 0.001931705 -5 16 5 10 9 -2 0.001661682 -3 17 3 11 10 2 0.001545364 3 11 6 12 11 1 0.001359558 2 12 6 7 12 -8 0.001287803 -7 39 4 11 13 -1 0.015445939 -1 19 6 9 14 1 0.006975585 0 14 5 13 15 -1 0.005148646 -3 15 4 12 16 2 0.003736921 4 7 5 5 17 2 0.003089188 2 12 5 13 18 1 0.002491281 3 12 4 11 19 -1 0.002206563 0 14 3 8 20 -2 0.001930742 -10 9 2 8 21 -2 0.001660854 -10 8 3 8 22 -1 0.001544594 -9 4 2 8 23 -8 0.001358880 -22 7 -1 0 24 -4 0.001287162 -16 3 0 3 25 -6 0.015438247 -18 5 -2 0 26 -3 0.007221116 -14 0 1 -1 27 -3 0.005146082 -12 -2 -2 -1 28 -7 0.003735060 -17 6 -2 -4 29 -9 0.003087649 -23 11 -2 1 30 -11 0.002490040 -28 9 -6 -1 31 -13 0.002205464 -31 17 -4 0 32 -11 0.001929781 -21 21 -2 -1 33 -9 0.001660027 -19 21 0 6 34 -17 0.001543825 -22 41 -5 0 35 -22 0.001358204 -22 57 -4 -3 36 -25 0.001286521 -25 65 -5 -3 37 -20 0.015430562 -16 68 -1 4 38 -24 0.006968641 -22 73 -2 1 39 -24 0.005143521 -21 71 -4 0 40 -22 0.003733201 -10 71 -1 -4 41 -19 0.003086112 -7 70 1 -2 42 -18 0.002488800 -5 69 1 3 43 -17 0.002204366 -4 65 -2 2 44 -11 0.001928820 7 57 1 5 45 -11 0.001659200 6 57 1 6 46 -12 0.001543056 3 57 3 6 47 -10 0.001357527 10 55 3 3 48 -15 0.001285880 0 65 1 4 49 -15 0.015422886 -2 65 1 7 50 -15 0.006965174 -1 64 0 5 51 -13 0.005140962 2 60 2 6 52 -8 0.003731343 8 43 2 1 53 -13 0.003084577 -6 47 -1 3 54 -9 0.002487562 -4 40 1 6 55 -7 0.002203269 4 31 0 0 56 -4 0.001927861 7 27 1 3 57 -4 0.001658375 3 24 1 4 58 -2 0.001542289 3 23 3 7 59 0 0.001356852 8 17 2 6 60 -2 0.001285240 3 16 0 6 61 -3 0.015415216 -3 15 0 6 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Maand Econ.Sit. Werkloos Fin.Sit. Spaarverm. 0.07421 25.71004 0.25439 -0.25338 0.26876 0.21970 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.55900 -0.26930 0.02529 0.21236 0.60650 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.074207 0.108860 0.682 0.49831 Maand 25.710039 9.412789 2.731 0.00846 ** Econ.Sit. 0.254386 0.005639 45.109 < 2e-16 *** Werkloos -0.253377 0.001832 -138.333 < 2e-16 *** Fin.Sit. 0.268756 0.028899 9.300 7.04e-13 *** Spaarverm. 0.219698 0.013993 15.701 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2929 on 55 degrees of freedom Multiple R-squared: 0.9986, Adjusted R-squared: 0.9985 F-statistic: 7760 on 5 and 55 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.67953043 0.640939149 0.320469575 [2,] 0.57434509 0.851309819 0.425654909 [3,] 0.52128019 0.957439618 0.478719809 [4,] 0.51693900 0.966122009 0.483061005 [5,] 0.44003210 0.880064191 0.559967904 [6,] 0.41689121 0.833782425 0.583108788 [7,] 0.33217193 0.664343866 0.667828067 [8,] 0.28639562 0.572791241 0.713604380 [9,] 0.27050227 0.541004531 0.729497735 [10,] 0.24957773 0.499155457 0.750422271 [11,] 0.19576489 0.391529772 0.804235114 [12,] 0.48988774 0.979775486 0.510112257 [13,] 0.42280019 0.845600387 0.577199807 [14,] 0.34272720 0.685454394 0.657272803 [15,] 0.39631160 0.792623203 0.603688398 [16,] 0.36924776 0.738495511 0.630752245 [17,] 0.30315308 0.606306164 0.696846918 [18,] 0.28087947 0.561758948 0.719120526 [19,] 0.25305432 0.506108639 0.746945681 [20,] 0.20275393 0.405507861 0.797246069 [21,] 0.16383340 0.327666796 0.836166602 [22,] 0.14484193 0.289683860 0.855158070 [23,] 0.10950062 0.219001248 0.890499376 [24,] 0.10260749 0.205214987 0.897392507 [25,] 0.11807159 0.236143190 0.881928405 [26,] 0.08576074 0.171521483 0.914239258 [27,] 0.12472579 0.249451572 0.875274214 [28,] 0.14289648 0.285792955 0.857103522 [29,] 0.13314903 0.266298055 0.866850972 [30,] 0.09593790 0.191875800 0.904062100 [31,] 0.07010093 0.140201862 0.929899069 [32,] 0.12465353 0.249307068 0.875346466 [33,] 0.32390293 0.647805854 0.676097073 [34,] 0.30179743 0.603594860 0.698202570 [35,] 0.39048994 0.780979872 0.609510064 [36,] 0.32587676 0.651753516 0.674123242 [37,] 0.28538482 0.570769642 0.714615179 [38,] 0.77941458 0.441170848 0.220585424 [39,] 0.73530113 0.529397738 0.264698869 [40,] 0.66264158 0.674716833 0.337358417 [41,] 0.56888708 0.862225836 0.431112918 [42,] 0.92174913 0.156501740 0.078250870 [43,] 0.98496978 0.030060444 0.015030222 [44,] 0.99847706 0.003045872 0.001522936 > postscript(file="/var/wessaorg/rcomp/tmp/1rb3g1322128996.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/2w13k1322128996.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/3zvqg1322128996.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/4pdgv1322128996.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/52nm41322128996.ps",horizontal=F,onefile=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 = 61 Frequency = 1 1 2 3 4 5 6 0.025291003 0.376350351 0.448596236 -0.255049898 -0.281652818 0.286370792 7 8 9 10 11 12 0.003609869 -0.338662364 -0.269302647 -0.338857562 0.272171966 0.063393980 13 14 15 16 17 18 0.007413369 0.093879468 -0.354160019 0.143543105 0.178271943 -0.352591147 19 20 21 22 23 24 -0.147508625 0.405318228 -0.109875506 -0.106025330 -0.470246196 0.063921829 25 26 27 28 29 30 -0.087771612 0.252491266 0.096580265 0.090899468 -0.197740660 0.097220308 31 32 33 34 35 36 0.137503196 0.296420723 -0.280812588 0.214838997 -0.336019005 -0.275245037 37 38 39 40 41 42 0.218856767 0.157465956 0.200458373 -0.489009204 0.534184233 -0.311097780 43 44 45 46 47 48 0.454285147 0.170741983 0.212362620 -0.559003034 -0.182599102 0.214691145 49 50 51 52 53 54 -0.299092222 0.118743568 -0.368232271 -0.067229762 -0.108811394 0.427521399 55 56 57 58 59 60 -0.293711909 0.008852456 0.053498128 0.606501156 0.307527725 -0.134564510 61 -0.224904814 > postscript(file="/var/wessaorg/rcomp/tmp/6zxhe1322128996.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 0.025291003 NA 1 0.376350351 0.025291003 2 0.448596236 0.376350351 3 -0.255049898 0.448596236 4 -0.281652818 -0.255049898 5 0.286370792 -0.281652818 6 0.003609869 0.286370792 7 -0.338662364 0.003609869 8 -0.269302647 -0.338662364 9 -0.338857562 -0.269302647 10 0.272171966 -0.338857562 11 0.063393980 0.272171966 12 0.007413369 0.063393980 13 0.093879468 0.007413369 14 -0.354160019 0.093879468 15 0.143543105 -0.354160019 16 0.178271943 0.143543105 17 -0.352591147 0.178271943 18 -0.147508625 -0.352591147 19 0.405318228 -0.147508625 20 -0.109875506 0.405318228 21 -0.106025330 -0.109875506 22 -0.470246196 -0.106025330 23 0.063921829 -0.470246196 24 -0.087771612 0.063921829 25 0.252491266 -0.087771612 26 0.096580265 0.252491266 27 0.090899468 0.096580265 28 -0.197740660 0.090899468 29 0.097220308 -0.197740660 30 0.137503196 0.097220308 31 0.296420723 0.137503196 32 -0.280812588 0.296420723 33 0.214838997 -0.280812588 34 -0.336019005 0.214838997 35 -0.275245037 -0.336019005 36 0.218856767 -0.275245037 37 0.157465956 0.218856767 38 0.200458373 0.157465956 39 -0.489009204 0.200458373 40 0.534184233 -0.489009204 41 -0.311097780 0.534184233 42 0.454285147 -0.311097780 43 0.170741983 0.454285147 44 0.212362620 0.170741983 45 -0.559003034 0.212362620 46 -0.182599102 -0.559003034 47 0.214691145 -0.182599102 48 -0.299092222 0.214691145 49 0.118743568 -0.299092222 50 -0.368232271 0.118743568 51 -0.067229762 -0.368232271 52 -0.108811394 -0.067229762 53 0.427521399 -0.108811394 54 -0.293711909 0.427521399 55 0.008852456 -0.293711909 56 0.053498128 0.008852456 57 0.606501156 0.053498128 58 0.307527725 0.606501156 59 -0.134564510 0.307527725 60 -0.224904814 -0.134564510 61 NA -0.224904814 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.376350351 0.025291003 [2,] 0.448596236 0.376350351 [3,] -0.255049898 0.448596236 [4,] -0.281652818 -0.255049898 [5,] 0.286370792 -0.281652818 [6,] 0.003609869 0.286370792 [7,] -0.338662364 0.003609869 [8,] -0.269302647 -0.338662364 [9,] -0.338857562 -0.269302647 [10,] 0.272171966 -0.338857562 [11,] 0.063393980 0.272171966 [12,] 0.007413369 0.063393980 [13,] 0.093879468 0.007413369 [14,] -0.354160019 0.093879468 [15,] 0.143543105 -0.354160019 [16,] 0.178271943 0.143543105 [17,] -0.352591147 0.178271943 [18,] -0.147508625 -0.352591147 [19,] 0.405318228 -0.147508625 [20,] -0.109875506 0.405318228 [21,] -0.106025330 -0.109875506 [22,] -0.470246196 -0.106025330 [23,] 0.063921829 -0.470246196 [24,] -0.087771612 0.063921829 [25,] 0.252491266 -0.087771612 [26,] 0.096580265 0.252491266 [27,] 0.090899468 0.096580265 [28,] -0.197740660 0.090899468 [29,] 0.097220308 -0.197740660 [30,] 0.137503196 0.097220308 [31,] 0.296420723 0.137503196 [32,] -0.280812588 0.296420723 [33,] 0.214838997 -0.280812588 [34,] -0.336019005 0.214838997 [35,] -0.275245037 -0.336019005 [36,] 0.218856767 -0.275245037 [37,] 0.157465956 0.218856767 [38,] 0.200458373 0.157465956 [39,] -0.489009204 0.200458373 [40,] 0.534184233 -0.489009204 [41,] -0.311097780 0.534184233 [42,] 0.454285147 -0.311097780 [43,] 0.170741983 0.454285147 [44,] 0.212362620 0.170741983 [45,] -0.559003034 0.212362620 [46,] -0.182599102 -0.559003034 [47,] 0.214691145 -0.182599102 [48,] -0.299092222 0.214691145 [49,] 0.118743568 -0.299092222 [50,] -0.368232271 0.118743568 [51,] -0.067229762 -0.368232271 [52,] -0.108811394 -0.067229762 [53,] 0.427521399 -0.108811394 [54,] -0.293711909 0.427521399 [55,] 0.008852456 -0.293711909 [56,] 0.053498128 0.008852456 [57,] 0.606501156 0.053498128 [58,] 0.307527725 0.606501156 [59,] -0.134564510 0.307527725 [60,] -0.224904814 -0.134564510 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.376350351 0.025291003 2 0.448596236 0.376350351 3 -0.255049898 0.448596236 4 -0.281652818 -0.255049898 5 0.286370792 -0.281652818 6 0.003609869 0.286370792 7 -0.338662364 0.003609869 8 -0.269302647 -0.338662364 9 -0.338857562 -0.269302647 10 0.272171966 -0.338857562 11 0.063393980 0.272171966 12 0.007413369 0.063393980 13 0.093879468 0.007413369 14 -0.354160019 0.093879468 15 0.143543105 -0.354160019 16 0.178271943 0.143543105 17 -0.352591147 0.178271943 18 -0.147508625 -0.352591147 19 0.405318228 -0.147508625 20 -0.109875506 0.405318228 21 -0.106025330 -0.109875506 22 -0.470246196 -0.106025330 23 0.063921829 -0.470246196 24 -0.087771612 0.063921829 25 0.252491266 -0.087771612 26 0.096580265 0.252491266 27 0.090899468 0.096580265 28 -0.197740660 0.090899468 29 0.097220308 -0.197740660 30 0.137503196 0.097220308 31 0.296420723 0.137503196 32 -0.280812588 0.296420723 33 0.214838997 -0.280812588 34 -0.336019005 0.214838997 35 -0.275245037 -0.336019005 36 0.218856767 -0.275245037 37 0.157465956 0.218856767 38 0.200458373 0.157465956 39 -0.489009204 0.200458373 40 0.534184233 -0.489009204 41 -0.311097780 0.534184233 42 0.454285147 -0.311097780 43 0.170741983 0.454285147 44 0.212362620 0.170741983 45 -0.559003034 0.212362620 46 -0.182599102 -0.559003034 47 0.214691145 -0.182599102 48 -0.299092222 0.214691145 49 0.118743568 -0.299092222 50 -0.368232271 0.118743568 51 -0.067229762 -0.368232271 52 -0.108811394 -0.067229762 53 0.427521399 -0.108811394 54 -0.293711909 0.427521399 55 0.008852456 -0.293711909 56 0.053498128 0.008852456 57 0.606501156 0.053498128 58 0.307527725 0.606501156 59 -0.134564510 0.307527725 60 -0.224904814 -0.134564510 > 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/wessaorg/rcomp/tmp/70qu31322128996.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/8cg431322128996.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/9s8ko1322128996.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/109o881322128996.ps",horizontal=F,onefile=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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11jzp91322128996.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/wessaorg/rcomp/tmp/12c65e1322128996.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/wessaorg/rcomp/tmp/13urjt1322128996.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/wessaorg/rcomp/tmp/14p08p1322128996.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/wessaorg/rcomp/tmp/15q3s21322128996.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/wessaorg/rcomp/tmp/16jx6c1322128996.tab") + } > > try(system("convert tmp/1rb3g1322128996.ps tmp/1rb3g1322128996.png",intern=TRUE)) character(0) > try(system("convert tmp/2w13k1322128996.ps tmp/2w13k1322128996.png",intern=TRUE)) character(0) > try(system("convert tmp/3zvqg1322128996.ps tmp/3zvqg1322128996.png",intern=TRUE)) character(0) > try(system("convert tmp/4pdgv1322128996.ps tmp/4pdgv1322128996.png",intern=TRUE)) character(0) > try(system("convert tmp/52nm41322128996.ps tmp/52nm41322128996.png",intern=TRUE)) character(0) > try(system("convert tmp/6zxhe1322128996.ps tmp/6zxhe1322128996.png",intern=TRUE)) character(0) > try(system("convert tmp/70qu31322128996.ps tmp/70qu31322128996.png",intern=TRUE)) character(0) > try(system("convert tmp/8cg431322128996.ps tmp/8cg431322128996.png",intern=TRUE)) character(0) > try(system("convert tmp/9s8ko1322128996.ps tmp/9s8ko1322128996.png",intern=TRUE)) character(0) > try(system("convert tmp/109o881322128996.ps tmp/109o881322128996.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.270 0.443 3.744