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(102.9 + ,127.5 + ,112.7 + ,97 + ,95.1 + ,97.4 + ,134.6 + ,102.9 + ,112.7 + ,97 + ,111.4 + ,131.8 + ,97.4 + ,102.9 + ,112.7 + ,87.4 + ,135.9 + ,111.4 + ,97.4 + ,102.9 + ,96.8 + ,142.7 + ,87.4 + ,111.4 + ,97.4 + ,114.1 + ,141.7 + ,96.8 + ,87.4 + ,111.4 + ,110.3 + ,153.4 + ,114.1 + ,96.8 + ,87.4 + ,103.9 + ,145 + ,110.3 + ,114.1 + ,96.8 + ,101.6 + ,137.7 + ,103.9 + ,110.3 + ,114.1 + ,94.6 + ,148.3 + ,101.6 + ,103.9 + ,110.3 + ,95.9 + ,152.2 + ,94.6 + ,101.6 + ,103.9 + ,104.7 + ,169.4 + ,95.9 + ,94.6 + ,101.6 + ,102.8 + ,168.6 + ,104.7 + ,95.9 + ,94.6 + ,98.1 + ,161.1 + ,102.8 + ,104.7 + ,95.9 + ,113.9 + ,174.1 + ,98.1 + ,102.8 + ,104.7 + ,80.9 + ,179 + ,113.9 + ,98.1 + ,102.8 + ,95.7 + ,190.6 + ,80.9 + ,113.9 + ,98.1 + ,113.2 + ,190 + ,95.7 + ,80.9 + ,113.9 + ,105.9 + ,181.6 + ,113.2 + ,95.7 + ,80.9 + ,108.8 + ,174.8 + ,105.9 + ,113.2 + ,95.7 + ,102.3 + ,180.5 + ,108.8 + ,105.9 + ,113.2 + ,99 + ,196.8 + ,102.3 + ,108.8 + ,105.9 + ,100.7 + ,193.8 + ,99 + ,102.3 + ,108.8 + ,115.5 + ,197 + ,100.7 + ,99 + ,102.3 + ,100.7 + ,216.3 + ,115.5 + ,100.7 + ,99 + ,109.9 + ,221.4 + ,100.7 + ,115.5 + ,100.7 + ,114.6 + ,217.9 + ,109.9 + ,100.7 + ,115.5 + ,85.4 + ,229.7 + ,114.6 + ,109.9 + ,100.7 + ,100.5 + ,227.4 + ,85.4 + ,114.6 + ,109.9 + ,114.8 + ,204.2 + ,100.5 + ,85.4 + ,114.6 + ,116.5 + ,196.6 + ,114.8 + ,100.5 + ,85.4 + ,112.9 + ,198.8 + ,116.5 + ,114.8 + ,100.5 + ,102 + ,207.5 + ,112.9 + ,116.5 + ,114.8 + ,106 + ,190.7 + ,102 + ,112.9 + ,116.5 + ,105.3 + ,201.6 + ,106 + ,102 + ,112.9 + ,118.8 + ,210.5 + ,105.3 + ,106 + ,102 + ,106.1 + ,223.5 + ,118.8 + ,105.3 + ,106 + ,109.3 + ,223.8 + ,106.1 + ,118.8 + ,105.3 + ,117.2 + ,231.2 + ,109.3 + ,106.1 + ,118.8 + ,92.5 + ,244 + ,117.2 + ,109.3 + ,106.1 + ,104.2 + ,234.7 + ,92.5 + ,117.2 + ,109.3 + ,112.5 + ,250.2 + ,104.2 + ,92.5 + ,117.2 + ,122.4 + ,265.7 + ,112.5 + ,104.2 + ,92.5 + ,113.3 + ,287.6 + ,122.4 + ,112.5 + ,104.2 + ,100 + ,283.3 + ,113.3 + ,122.4 + ,112.5 + ,110.7 + ,295.4 + ,100 + ,113.3 + ,122.4 + ,112.8 + ,312.3 + ,110.7 + ,100 + ,113.3 + ,109.8 + ,333.8 + ,112.8 + ,110.7 + ,100 + ,117.3 + ,347.7 + ,109.8 + ,112.8 + ,110.7 + ,109.1 + ,383.2 + ,117.3 + ,109.8 + ,112.8 + ,115.9 + ,407.1 + ,109.1 + ,117.3 + ,109.8 + ,96 + ,413.6 + ,115.9 + ,109.1 + ,117.3 + ,99.8 + ,362.7 + ,96 + ,115.9 + ,109.1 + ,116.8 + ,321.9 + ,99.8 + ,96 + ,115.9 + ,115.7 + ,239.4 + ,116.8 + ,99.8 + ,96 + ,99.4 + ,191 + ,115.7 + ,116.8 + ,99.8 + ,94.3 + ,159.7 + ,99.4 + ,115.7 + ,116.8 + ,91 + ,163.4 + ,94.3 + ,99.4 + ,115.7) + ,dim=c(5 + ,58) + ,dimnames=list(c('tot.ind.prod.index' + ,'prijsindex.grondst.incl.energie' + ,'y(t-1)' + ,'y(t-2)' + ,'y(t-3)') + ,1:58)) > y <- array(NA,dim=c(5,58),dimnames=list(c('tot.ind.prod.index','prijsindex.grondst.incl.energie','y(t-1)','y(t-2)','y(t-3)'),1:58)) > 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 = '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 tot.ind.prod.index prijsindex.grondst.incl.energie y(t-1) y(t-2) y(t-3) 1 102.9 127.5 112.7 97.0 95.1 2 97.4 134.6 102.9 112.7 97.0 3 111.4 131.8 97.4 102.9 112.7 4 87.4 135.9 111.4 97.4 102.9 5 96.8 142.7 87.4 111.4 97.4 6 114.1 141.7 96.8 87.4 111.4 7 110.3 153.4 114.1 96.8 87.4 8 103.9 145.0 110.3 114.1 96.8 9 101.6 137.7 103.9 110.3 114.1 10 94.6 148.3 101.6 103.9 110.3 11 95.9 152.2 94.6 101.6 103.9 12 104.7 169.4 95.9 94.6 101.6 13 102.8 168.6 104.7 95.9 94.6 14 98.1 161.1 102.8 104.7 95.9 15 113.9 174.1 98.1 102.8 104.7 16 80.9 179.0 113.9 98.1 102.8 17 95.7 190.6 80.9 113.9 98.1 18 113.2 190.0 95.7 80.9 113.9 19 105.9 181.6 113.2 95.7 80.9 20 108.8 174.8 105.9 113.2 95.7 21 102.3 180.5 108.8 105.9 113.2 22 99.0 196.8 102.3 108.8 105.9 23 100.7 193.8 99.0 102.3 108.8 24 115.5 197.0 100.7 99.0 102.3 25 100.7 216.3 115.5 100.7 99.0 26 109.9 221.4 100.7 115.5 100.7 27 114.6 217.9 109.9 100.7 115.5 28 85.4 229.7 114.6 109.9 100.7 29 100.5 227.4 85.4 114.6 109.9 30 114.8 204.2 100.5 85.4 114.6 31 116.5 196.6 114.8 100.5 85.4 32 112.9 198.8 116.5 114.8 100.5 33 102.0 207.5 112.9 116.5 114.8 34 106.0 190.7 102.0 112.9 116.5 35 105.3 201.6 106.0 102.0 112.9 36 118.8 210.5 105.3 106.0 102.0 37 106.1 223.5 118.8 105.3 106.0 38 109.3 223.8 106.1 118.8 105.3 39 117.2 231.2 109.3 106.1 118.8 40 92.5 244.0 117.2 109.3 106.1 41 104.2 234.7 92.5 117.2 109.3 42 112.5 250.2 104.2 92.5 117.2 43 122.4 265.7 112.5 104.2 92.5 44 113.3 287.6 122.4 112.5 104.2 45 100.0 283.3 113.3 122.4 112.5 46 110.7 295.4 100.0 113.3 122.4 47 112.8 312.3 110.7 100.0 113.3 48 109.8 333.8 112.8 110.7 100.0 49 117.3 347.7 109.8 112.8 110.7 50 109.1 383.2 117.3 109.8 112.8 51 115.9 407.1 109.1 117.3 109.8 52 96.0 413.6 115.9 109.1 117.3 53 99.8 362.7 96.0 115.9 109.1 54 116.8 321.9 99.8 96.0 115.9 55 115.7 239.4 116.8 99.8 96.0 56 99.4 191.0 115.7 116.8 99.8 57 94.3 159.7 99.4 115.7 116.8 58 91.0 163.4 94.3 99.4 115.7 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) prijsindex.grondst.incl.energie 136.36955 0.05308 `y(t-1)` `y(t-2)` -0.01194 -0.30107 `y(t-3)` -0.08919 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -24.9089 -4.0726 0.8583 6.5405 13.5234 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 136.36955 27.04674 5.042 5.73e-06 *** prijsindex.grondst.incl.energie 0.05308 0.01925 2.758 0.00796 ** `y(t-1)` -0.01194 0.14143 -0.084 0.93305 `y(t-2)` -0.30107 0.13435 -2.241 0.02924 * `y(t-3)` -0.08919 0.14287 -0.624 0.53514 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 8.633 on 53 degrees of freedom Multiple R-squared: 0.1696, Adjusted R-squared: 0.1069 F-statistic: 2.706 on 4 and 53 DF, p-value: 0.03994 > 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.8265919 0.3468162 0.1734081 [2,] 0.7095685 0.5808630 0.2904315 [3,] 0.7234941 0.5530117 0.2765059 [4,] 0.6821941 0.6356117 0.3178059 [5,] 0.5673192 0.8653616 0.4326808 [6,] 0.4562084 0.9124168 0.5437916 [7,] 0.3626370 0.7252741 0.6373630 [8,] 0.4020058 0.8040115 0.5979942 [9,] 0.7991737 0.4016526 0.2008263 [10,] 0.7544868 0.4910264 0.2455132 [11,] 0.7032600 0.5934799 0.2967400 [12,] 0.6754124 0.6491753 0.3245876 [13,] 0.7200736 0.5598528 0.2799264 [14,] 0.6531093 0.6937813 0.3468907 [15,] 0.5872973 0.8254055 0.4127027 [16,] 0.5239628 0.9520743 0.4760372 [17,] 0.5424395 0.9151210 0.4575605 [18,] 0.5112167 0.9775666 0.4887833 [19,] 0.4856244 0.9712488 0.5143756 [20,] 0.4770395 0.9540791 0.5229605 [21,] 0.8089951 0.3820098 0.1910049 [22,] 0.7599925 0.4800150 0.2400075 [23,] 0.7011726 0.5976548 0.2988274 [24,] 0.7083909 0.5832181 0.2916091 [25,] 0.7313424 0.5373152 0.2686576 [26,] 0.6606600 0.6786800 0.3393400 [27,] 0.6087645 0.7824711 0.3912355 [28,] 0.5252385 0.9495229 0.4747615 [29,] 0.5757768 0.8484464 0.4242232 [30,] 0.4902510 0.9805020 0.5097490 [31,] 0.4522386 0.9044772 0.5477614 [32,] 0.5905679 0.8188642 0.4094321 [33,] 0.7221570 0.5556859 0.2778430 [34,] 0.6472567 0.7054865 0.3527433 [35,] 0.5657883 0.8684233 0.4342117 [36,] 0.5591099 0.8817803 0.4408901 [37,] 0.4853249 0.9706498 0.5146751 [38,] 0.3887976 0.7775951 0.6112024 [39,] 0.4410137 0.8820274 0.5589863 [40,] 0.3453262 0.6906525 0.6546738 [41,] 0.2522777 0.5045553 0.7477223 [42,] 0.2803584 0.5607168 0.7196416 [43,] 0.1762376 0.3524753 0.8237624 > postscript(file="/var/www/html/rcomp/tmp/1p5cx1258646084.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/2eswz1258646084.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/3ofm61258646084.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/4u7y01258646084.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/5ykv61258646084.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 = 58 Frequency = 1 1 2 3 4 5 6 -1.2072888 -2.3049339 10.2277920 -16.3526385 -3.8756512 7.6125869 7 8 9 10 11 12 4.0875946 4.1349800 2.5449524 -7.3109422 -7.5647751 -1.9749167 13 14 15 16 17 18 -3.9603169 -5.5195171 9.7470879 -24.9089016 -6.7808770 2.4015006 19 20 21 22 23 24 -2.7310095 7.0314793 -0.3735368 -4.3943563 -4.2728032 8.8043850 25 26 27 28 29 30 -6.6259751 6.7340658 8.5938091 -19.7265992 -2.6175250 4.7222391 31 32 33 34 35 36 8.9382906 10.8937864 1.2761537 5.1056281 0.2720370 13.5233815 37 38 39 40 41 42 0.4404257 7.4749032 12.4007102 -13.0537078 1.5089776 2.3939975 43 44 45 46 47 48 12.8898826 6.2878538 -3.1716847 4.8704492 1.3852413 -0.6957385 49 50 51 52 53 54 7.6171112 -3.0937734 4.3300891 -17.6336607 -10.0532642 3.7731292 55 56 57 58 6.6247756 -1.6619976 -4.1100448 -12.6728602 > postscript(file="/var/www/html/rcomp/tmp/6pu201258646084.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 = 58 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.2072888 NA 1 -2.3049339 -1.2072888 2 10.2277920 -2.3049339 3 -16.3526385 10.2277920 4 -3.8756512 -16.3526385 5 7.6125869 -3.8756512 6 4.0875946 7.6125869 7 4.1349800 4.0875946 8 2.5449524 4.1349800 9 -7.3109422 2.5449524 10 -7.5647751 -7.3109422 11 -1.9749167 -7.5647751 12 -3.9603169 -1.9749167 13 -5.5195171 -3.9603169 14 9.7470879 -5.5195171 15 -24.9089016 9.7470879 16 -6.7808770 -24.9089016 17 2.4015006 -6.7808770 18 -2.7310095 2.4015006 19 7.0314793 -2.7310095 20 -0.3735368 7.0314793 21 -4.3943563 -0.3735368 22 -4.2728032 -4.3943563 23 8.8043850 -4.2728032 24 -6.6259751 8.8043850 25 6.7340658 -6.6259751 26 8.5938091 6.7340658 27 -19.7265992 8.5938091 28 -2.6175250 -19.7265992 29 4.7222391 -2.6175250 30 8.9382906 4.7222391 31 10.8937864 8.9382906 32 1.2761537 10.8937864 33 5.1056281 1.2761537 34 0.2720370 5.1056281 35 13.5233815 0.2720370 36 0.4404257 13.5233815 37 7.4749032 0.4404257 38 12.4007102 7.4749032 39 -13.0537078 12.4007102 40 1.5089776 -13.0537078 41 2.3939975 1.5089776 42 12.8898826 2.3939975 43 6.2878538 12.8898826 44 -3.1716847 6.2878538 45 4.8704492 -3.1716847 46 1.3852413 4.8704492 47 -0.6957385 1.3852413 48 7.6171112 -0.6957385 49 -3.0937734 7.6171112 50 4.3300891 -3.0937734 51 -17.6336607 4.3300891 52 -10.0532642 -17.6336607 53 3.7731292 -10.0532642 54 6.6247756 3.7731292 55 -1.6619976 6.6247756 56 -4.1100448 -1.6619976 57 -12.6728602 -4.1100448 58 NA -12.6728602 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.3049339 -1.2072888 [2,] 10.2277920 -2.3049339 [3,] -16.3526385 10.2277920 [4,] -3.8756512 -16.3526385 [5,] 7.6125869 -3.8756512 [6,] 4.0875946 7.6125869 [7,] 4.1349800 4.0875946 [8,] 2.5449524 4.1349800 [9,] -7.3109422 2.5449524 [10,] -7.5647751 -7.3109422 [11,] -1.9749167 -7.5647751 [12,] -3.9603169 -1.9749167 [13,] -5.5195171 -3.9603169 [14,] 9.7470879 -5.5195171 [15,] -24.9089016 9.7470879 [16,] -6.7808770 -24.9089016 [17,] 2.4015006 -6.7808770 [18,] -2.7310095 2.4015006 [19,] 7.0314793 -2.7310095 [20,] -0.3735368 7.0314793 [21,] -4.3943563 -0.3735368 [22,] -4.2728032 -4.3943563 [23,] 8.8043850 -4.2728032 [24,] -6.6259751 8.8043850 [25,] 6.7340658 -6.6259751 [26,] 8.5938091 6.7340658 [27,] -19.7265992 8.5938091 [28,] -2.6175250 -19.7265992 [29,] 4.7222391 -2.6175250 [30,] 8.9382906 4.7222391 [31,] 10.8937864 8.9382906 [32,] 1.2761537 10.8937864 [33,] 5.1056281 1.2761537 [34,] 0.2720370 5.1056281 [35,] 13.5233815 0.2720370 [36,] 0.4404257 13.5233815 [37,] 7.4749032 0.4404257 [38,] 12.4007102 7.4749032 [39,] -13.0537078 12.4007102 [40,] 1.5089776 -13.0537078 [41,] 2.3939975 1.5089776 [42,] 12.8898826 2.3939975 [43,] 6.2878538 12.8898826 [44,] -3.1716847 6.2878538 [45,] 4.8704492 -3.1716847 [46,] 1.3852413 4.8704492 [47,] -0.6957385 1.3852413 [48,] 7.6171112 -0.6957385 [49,] -3.0937734 7.6171112 [50,] 4.3300891 -3.0937734 [51,] -17.6336607 4.3300891 [52,] -10.0532642 -17.6336607 [53,] 3.7731292 -10.0532642 [54,] 6.6247756 3.7731292 [55,] -1.6619976 6.6247756 [56,] -4.1100448 -1.6619976 [57,] -12.6728602 -4.1100448 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.3049339 -1.2072888 2 10.2277920 -2.3049339 3 -16.3526385 10.2277920 4 -3.8756512 -16.3526385 5 7.6125869 -3.8756512 6 4.0875946 7.6125869 7 4.1349800 4.0875946 8 2.5449524 4.1349800 9 -7.3109422 2.5449524 10 -7.5647751 -7.3109422 11 -1.9749167 -7.5647751 12 -3.9603169 -1.9749167 13 -5.5195171 -3.9603169 14 9.7470879 -5.5195171 15 -24.9089016 9.7470879 16 -6.7808770 -24.9089016 17 2.4015006 -6.7808770 18 -2.7310095 2.4015006 19 7.0314793 -2.7310095 20 -0.3735368 7.0314793 21 -4.3943563 -0.3735368 22 -4.2728032 -4.3943563 23 8.8043850 -4.2728032 24 -6.6259751 8.8043850 25 6.7340658 -6.6259751 26 8.5938091 6.7340658 27 -19.7265992 8.5938091 28 -2.6175250 -19.7265992 29 4.7222391 -2.6175250 30 8.9382906 4.7222391 31 10.8937864 8.9382906 32 1.2761537 10.8937864 33 5.1056281 1.2761537 34 0.2720370 5.1056281 35 13.5233815 0.2720370 36 0.4404257 13.5233815 37 7.4749032 0.4404257 38 12.4007102 7.4749032 39 -13.0537078 12.4007102 40 1.5089776 -13.0537078 41 2.3939975 1.5089776 42 12.8898826 2.3939975 43 6.2878538 12.8898826 44 -3.1716847 6.2878538 45 4.8704492 -3.1716847 46 1.3852413 4.8704492 47 -0.6957385 1.3852413 48 7.6171112 -0.6957385 49 -3.0937734 7.6171112 50 4.3300891 -3.0937734 51 -17.6336607 4.3300891 52 -10.0532642 -17.6336607 53 3.7731292 -10.0532642 54 6.6247756 3.7731292 55 -1.6619976 6.6247756 56 -4.1100448 -1.6619976 57 -12.6728602 -4.1100448 > 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/70n9v1258646084.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/8aeps1258646084.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/9pqx51258646084.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/10q1a61258646084.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/11swmr1258646084.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/12komw1258646084.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/13ptx61258646084.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/14sgld1258646084.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/15wasw1258646084.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/16nmi21258646084.tab") + } > > system("convert tmp/1p5cx1258646084.ps tmp/1p5cx1258646084.png") > system("convert tmp/2eswz1258646084.ps tmp/2eswz1258646084.png") > system("convert tmp/3ofm61258646084.ps tmp/3ofm61258646084.png") > system("convert tmp/4u7y01258646084.ps tmp/4u7y01258646084.png") > system("convert tmp/5ykv61258646084.ps tmp/5ykv61258646084.png") > system("convert tmp/6pu201258646084.ps tmp/6pu201258646084.png") > system("convert tmp/70n9v1258646084.ps tmp/70n9v1258646084.png") > system("convert tmp/8aeps1258646084.ps tmp/8aeps1258646084.png") > system("convert tmp/9pqx51258646084.ps tmp/9pqx51258646084.png") > system("convert tmp/10q1a61258646084.ps tmp/10q1a61258646084.png") > > > proc.time() user system elapsed 2.471 1.570 2.858