R version 2.12.0 (2010-10-15) Copyright (C) 2010 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(100.00 + ,0 + ,100.21 + ,100.42 + ,0 + ,100.00 + ,100.50 + ,0 + ,100.42 + ,101.14 + ,0 + ,100.50 + ,101.98 + ,0 + ,101.14 + ,102.31 + ,0 + ,101.98 + ,103.27 + ,0 + ,102.31 + ,103.80 + ,0 + ,103.27 + ,103.46 + ,0 + ,103.80 + ,105.06 + ,0 + ,103.46 + ,106.08 + ,0 + ,105.06 + ,106.74 + ,0 + ,106.08 + ,107.35 + ,0 + ,106.74 + ,108.96 + ,0 + ,107.35 + ,109.85 + ,0 + ,108.96 + ,109.81 + ,0 + ,109.85 + ,109.99 + ,0 + ,109.81 + ,111.60 + ,0 + ,109.99 + ,112.74 + ,0 + ,111.60 + ,112.78 + ,0 + ,112.74 + ,113.66 + ,0 + ,112.78 + ,115.37 + ,0 + ,113.66 + ,116.26 + ,0 + ,115.37 + ,116.24 + ,0 + ,116.26 + ,116.73 + ,0 + ,116.24 + ,118.76 + ,0 + ,116.73 + ,119.78 + ,0 + ,118.76 + ,120.23 + ,0 + ,119.78 + ,121.48 + ,0 + ,120.23 + ,124.07 + ,0 + ,121.48 + ,125.82 + ,0 + ,124.07 + ,126.92 + ,0 + ,125.82 + ,128.48 + ,0 + ,126.92 + ,131.44 + ,0 + ,128.48 + ,133.51 + ,0 + ,131.44 + ,134.58 + ,0 + ,133.51 + ,136.68 + ,0 + ,134.58 + ,140.10 + ,0 + ,136.68 + ,142.45 + ,0 + ,140.10 + ,143.91 + ,0 + ,142.45 + ,146.19 + ,0 + ,143.91 + ,149.84 + ,0 + ,146.19 + ,152.31 + ,0 + ,149.84 + ,153.62 + ,0 + ,152.31 + ,155.79 + ,0 + ,153.62 + ,159.89 + ,0 + ,155.79 + ,163.21 + ,0 + ,159.89 + ,165.32 + ,0 + ,163.21 + ,167.68 + ,0 + ,165.32 + ,171.79 + ,0 + ,167.68 + ,175.38 + ,0 + ,171.79 + ,177.81 + ,0 + ,175.38 + ,181.09 + ,0 + ,177.81 + ,186.48 + ,0 + ,181.09 + ,191.07 + ,0 + ,186.48 + ,194.23 + ,0 + ,191.07 + ,197.82 + ,0 + ,194.23 + ,204.41 + ,0 + ,197.82 + ,209.26 + ,0 + ,204.41 + ,212.24 + ,0 + ,209.26 + ,214.88 + ,0 + ,212.24 + ,218.87 + ,0 + ,214.88 + ,219.86 + ,0 + ,218.87 + ,219.75 + ,0 + ,219.86 + ,220.89 + ,0 + ,219.75 + ,224.02 + ,0 + ,220.89 + ,222.27 + ,0 + ,224.02 + ,217.27 + ,1 + ,222.27 + ,213.23 + ,1 + ,217.27 + ,212.44 + ,1 + ,213.23 + ,207.87 + ,1 + ,212.44 + ,199.46 + ,1 + ,207.87 + ,198.19 + ,1 + ,199.46 + ,199.77 + ,1 + ,198.19 + ,200.10 + ,1 + ,199.77 + ,195.76 + ,1 + ,200.10 + ,191.27 + ,1 + ,195.76 + ,195.79 + ,1 + ,191.27 + ,192.7 + ,1 + ,195.79) + ,dim=c(3 + ,79) + ,dimnames=list(c('woningprijsindex_us' + ,'Dummy_' + ,'Y1') + ,1:79)) > y <- array(NA,dim=c(3,79),dimnames=list(c('woningprijsindex_us','Dummy_','Y1'),1:79)) > 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 = '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 > 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 woningprijsindex_us Dummy_ Y1 t 1 100.00 0 100.21 1 2 100.42 0 100.00 2 3 100.50 0 100.42 3 4 101.14 0 100.50 4 5 101.98 0 101.14 5 6 102.31 0 101.98 6 7 103.27 0 102.31 7 8 103.80 0 103.27 8 9 103.46 0 103.80 9 10 105.06 0 103.46 10 11 106.08 0 105.06 11 12 106.74 0 106.08 12 13 107.35 0 106.74 13 14 108.96 0 107.35 14 15 109.85 0 108.96 15 16 109.81 0 109.85 16 17 109.99 0 109.81 17 18 111.60 0 109.99 18 19 112.74 0 111.60 19 20 112.78 0 112.74 20 21 113.66 0 112.78 21 22 115.37 0 113.66 22 23 116.26 0 115.37 23 24 116.24 0 116.26 24 25 116.73 0 116.24 25 26 118.76 0 116.73 26 27 119.78 0 118.76 27 28 120.23 0 119.78 28 29 121.48 0 120.23 29 30 124.07 0 121.48 30 31 125.82 0 124.07 31 32 126.92 0 125.82 32 33 128.48 0 126.92 33 34 131.44 0 128.48 34 35 133.51 0 131.44 35 36 134.58 0 133.51 36 37 136.68 0 134.58 37 38 140.10 0 136.68 38 39 142.45 0 140.10 39 40 143.91 0 142.45 40 41 146.19 0 143.91 41 42 149.84 0 146.19 42 43 152.31 0 149.84 43 44 153.62 0 152.31 44 45 155.79 0 153.62 45 46 159.89 0 155.79 46 47 163.21 0 159.89 47 48 165.32 0 163.21 48 49 167.68 0 165.32 49 50 171.79 0 167.68 50 51 175.38 0 171.79 51 52 177.81 0 175.38 52 53 181.09 0 177.81 53 54 186.48 0 181.09 54 55 191.07 0 186.48 55 56 194.23 0 191.07 56 57 197.82 0 194.23 57 58 204.41 0 197.82 58 59 209.26 0 204.41 59 60 212.24 0 209.26 60 61 214.88 0 212.24 61 62 218.87 0 214.88 62 63 219.86 0 218.87 63 64 219.75 0 219.86 64 65 220.89 0 219.75 65 66 224.02 0 220.89 66 67 222.27 0 224.02 67 68 217.27 1 222.27 68 69 213.23 1 217.27 69 70 212.44 1 213.23 70 71 207.87 1 212.44 71 72 199.46 1 207.87 72 73 198.19 1 199.46 73 74 199.77 1 198.19 74 75 200.10 1 199.77 75 76 195.76 1 200.10 76 77 191.27 1 195.76 77 78 195.79 1 191.27 78 79 192.70 1 195.79 79 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Dummy_ Y1 t 3.2681 -6.7293 0.9606 0.1232 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -5.6262 -0.8735 0.0692 0.8447 5.9099 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.26808 1.28961 2.534 0.013357 * Dummy_ -6.72930 0.70942 -9.486 1.78e-14 *** Y1 0.96057 0.01559 61.601 < 2e-16 *** t 0.12323 0.03153 3.909 0.000202 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.691 on 75 degrees of freedom Multiple R-squared: 0.9985, Adjusted R-squared: 0.9984 F-statistic: 1.634e+04 on 3 and 75 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,] 5.889857e-03 1.177971e-02 0.9941101 [2,] 7.814208e-04 1.562842e-03 0.9992186 [3,] 1.280059e-03 2.560118e-03 0.9987199 [4,] 6.131279e-04 1.226256e-03 0.9993869 [5,] 4.417590e-04 8.835181e-04 0.9995582 [6,] 1.270043e-04 2.540086e-04 0.9998730 [7,] 2.947365e-05 5.894731e-05 0.9999705 [8,] 4.404691e-05 8.809382e-05 0.9999560 [9,] 1.291163e-05 2.582327e-05 0.9999871 [10,] 6.074255e-06 1.214851e-05 0.9999939 [11,] 2.582035e-06 5.164069e-06 0.9999974 [12,] 1.530271e-06 3.060543e-06 0.9999985 [13,] 6.170173e-07 1.234035e-06 0.9999994 [14,] 2.232331e-07 4.464663e-07 0.9999998 [15,] 5.559842e-08 1.111968e-07 0.9999999 [16,] 6.870533e-08 1.374107e-07 0.9999999 [17,] 2.249996e-08 4.499993e-08 1.0000000 [18,] 8.689745e-09 1.737949e-08 1.0000000 [19,] 2.448054e-09 4.896107e-09 1.0000000 [20,] 4.914147e-09 9.828295e-09 1.0000000 [21,] 1.968784e-09 3.937569e-09 1.0000000 [22,] 5.249397e-10 1.049879e-09 1.0000000 [23,] 2.295584e-10 4.591168e-10 1.0000000 [24,] 6.160627e-09 1.232125e-08 1.0000000 [25,] 5.224038e-09 1.044808e-08 1.0000000 [26,] 1.675410e-09 3.350820e-09 1.0000000 [27,] 6.549321e-10 1.309864e-09 1.0000000 [28,] 2.224622e-09 4.449243e-09 1.0000000 [29,] 7.176728e-10 1.435346e-09 1.0000000 [30,] 4.112384e-10 8.224768e-10 1.0000000 [31,] 1.423597e-10 2.847194e-10 1.0000000 [32,] 2.295410e-10 4.590820e-10 1.0000000 [33,] 7.002619e-11 1.400524e-10 1.0000000 [34,] 5.422153e-11 1.084431e-10 1.0000000 [35,] 1.735740e-11 3.471481e-11 1.0000000 [36,] 1.553172e-11 3.106343e-11 1.0000000 [37,] 5.268510e-12 1.053702e-11 1.0000000 [38,] 1.217504e-11 2.435008e-11 1.0000000 [39,] 5.630124e-12 1.126025e-11 1.0000000 [40,] 8.181728e-12 1.636346e-11 1.0000000 [41,] 2.788961e-12 5.577922e-12 1.0000000 [42,] 2.831231e-12 5.662462e-12 1.0000000 [43,] 2.191407e-12 4.382814e-12 1.0000000 [44,] 1.623249e-12 3.246497e-12 1.0000000 [45,] 6.662847e-13 1.332569e-12 1.0000000 [46,] 1.266666e-12 2.533332e-12 1.0000000 [47,] 1.152750e-12 2.305500e-12 1.0000000 [48,] 3.494040e-12 6.988080e-12 1.0000000 [49,] 1.732960e-12 3.465921e-12 1.0000000 [50,] 3.988737e-12 7.977473e-12 1.0000000 [51,] 8.942740e-12 1.788548e-11 1.0000000 [52,] 4.461278e-11 8.922557e-11 1.0000000 [53,] 1.433176e-11 2.866352e-11 1.0000000 [54,] 4.458506e-11 8.917013e-11 1.0000000 [55,] 1.674631e-10 3.349263e-10 1.0000000 [56,] 5.506883e-11 1.101377e-10 1.0000000 [57,] 1.610514e-09 3.221027e-09 1.0000000 [58,] 1.281627e-07 2.563255e-07 0.9999999 [59,] 2.795468e-07 5.590936e-07 0.9999997 [60,] 1.444213e-07 2.888427e-07 0.9999999 [61,] 2.573453e-06 5.146906e-06 0.9999974 [62,] 1.408025e-06 2.816051e-06 0.9999986 [63,] 7.566871e-07 1.513374e-06 0.9999992 [64,] 5.676201e-05 1.135240e-04 0.9999432 [65,] 2.756242e-03 5.512484e-03 0.9972438 [66,] 3.250482e-03 6.500963e-03 0.9967495 > postscript(file="/var/www/rcomp/tmp/102m51292596344.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/www/rcomp/tmp/202m51292596344.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/www/rcomp/tmp/3atmp1292596344.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/www/rcomp/tmp/4atmp1292596344.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/www/rcomp/tmp/5atmp1292596344.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 = 79 Frequency = 1 1 2 3 4 5 6 0.34954827 0.84803443 0.40135888 0.84127853 0.94327667 0.34315997 7 8 9 10 11 12 0.86293609 0.34755049 -0.62478822 1.17857258 0.53841953 0.09539949 13 14 15 16 17 18 -0.05181386 0.84900150 0.06924270 -0.94890270 -0.85371415 0.46014809 19 20 21 22 23 24 -0.06961070 -1.24789964 -0.52955702 0.21190332 -0.66391289 -1.66205829 25 26 27 28 29 30 -1.27608122 0.16000304 -0.89319690 -1.54621694 -0.85170972 0.41433818 31 32 33 34 35 36 -0.44678328 -1.15102245 -0.77088843 0.56738149 -0.32915241 -1.37077531 37 38 39 40 41 42 -0.42182406 0.85773581 -0.20066219 -1.12124585 -0.36691852 0.96973801 43 44 45 46 47 48 -0.18959205 -1.37544461 -0.58703116 1.30528852 0.56370010 -0.63864049 49 50 51 52 53 54 -0.42868636 1.29112424 0.80993007 -0.33176554 0.49080487 2.60688725 55 56 57 58 59 60 1.89615817 0.52388841 0.95523969 3.97354408 2.37012602 0.56810698 61 62 63 64 65 66 0.22236161 1.55321144 -1.41271383 -2.59691665 -1.47448790 0.43722316 67 68 69 70 71 72 -4.44260834 -1.15554113 -0.51590479 2.45158036 -1.48280047 -5.62621102 73 74 75 76 77 78 1.05898317 3.73567793 2.42473636 -2.35548752 -2.79983012 5.90991340 79 -1.64511617 > postscript(file="/var/www/rcomp/tmp/63k3a1292596344.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 = 79 Frequency = 1 lag(myerror, k = 1) myerror 0 0.34954827 NA 1 0.84803443 0.34954827 2 0.40135888 0.84803443 3 0.84127853 0.40135888 4 0.94327667 0.84127853 5 0.34315997 0.94327667 6 0.86293609 0.34315997 7 0.34755049 0.86293609 8 -0.62478822 0.34755049 9 1.17857258 -0.62478822 10 0.53841953 1.17857258 11 0.09539949 0.53841953 12 -0.05181386 0.09539949 13 0.84900150 -0.05181386 14 0.06924270 0.84900150 15 -0.94890270 0.06924270 16 -0.85371415 -0.94890270 17 0.46014809 -0.85371415 18 -0.06961070 0.46014809 19 -1.24789964 -0.06961070 20 -0.52955702 -1.24789964 21 0.21190332 -0.52955702 22 -0.66391289 0.21190332 23 -1.66205829 -0.66391289 24 -1.27608122 -1.66205829 25 0.16000304 -1.27608122 26 -0.89319690 0.16000304 27 -1.54621694 -0.89319690 28 -0.85170972 -1.54621694 29 0.41433818 -0.85170972 30 -0.44678328 0.41433818 31 -1.15102245 -0.44678328 32 -0.77088843 -1.15102245 33 0.56738149 -0.77088843 34 -0.32915241 0.56738149 35 -1.37077531 -0.32915241 36 -0.42182406 -1.37077531 37 0.85773581 -0.42182406 38 -0.20066219 0.85773581 39 -1.12124585 -0.20066219 40 -0.36691852 -1.12124585 41 0.96973801 -0.36691852 42 -0.18959205 0.96973801 43 -1.37544461 -0.18959205 44 -0.58703116 -1.37544461 45 1.30528852 -0.58703116 46 0.56370010 1.30528852 47 -0.63864049 0.56370010 48 -0.42868636 -0.63864049 49 1.29112424 -0.42868636 50 0.80993007 1.29112424 51 -0.33176554 0.80993007 52 0.49080487 -0.33176554 53 2.60688725 0.49080487 54 1.89615817 2.60688725 55 0.52388841 1.89615817 56 0.95523969 0.52388841 57 3.97354408 0.95523969 58 2.37012602 3.97354408 59 0.56810698 2.37012602 60 0.22236161 0.56810698 61 1.55321144 0.22236161 62 -1.41271383 1.55321144 63 -2.59691665 -1.41271383 64 -1.47448790 -2.59691665 65 0.43722316 -1.47448790 66 -4.44260834 0.43722316 67 -1.15554113 -4.44260834 68 -0.51590479 -1.15554113 69 2.45158036 -0.51590479 70 -1.48280047 2.45158036 71 -5.62621102 -1.48280047 72 1.05898317 -5.62621102 73 3.73567793 1.05898317 74 2.42473636 3.73567793 75 -2.35548752 2.42473636 76 -2.79983012 -2.35548752 77 5.90991340 -2.79983012 78 -1.64511617 5.90991340 79 NA -1.64511617 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.84803443 0.34954827 [2,] 0.40135888 0.84803443 [3,] 0.84127853 0.40135888 [4,] 0.94327667 0.84127853 [5,] 0.34315997 0.94327667 [6,] 0.86293609 0.34315997 [7,] 0.34755049 0.86293609 [8,] -0.62478822 0.34755049 [9,] 1.17857258 -0.62478822 [10,] 0.53841953 1.17857258 [11,] 0.09539949 0.53841953 [12,] -0.05181386 0.09539949 [13,] 0.84900150 -0.05181386 [14,] 0.06924270 0.84900150 [15,] -0.94890270 0.06924270 [16,] -0.85371415 -0.94890270 [17,] 0.46014809 -0.85371415 [18,] -0.06961070 0.46014809 [19,] -1.24789964 -0.06961070 [20,] -0.52955702 -1.24789964 [21,] 0.21190332 -0.52955702 [22,] -0.66391289 0.21190332 [23,] -1.66205829 -0.66391289 [24,] -1.27608122 -1.66205829 [25,] 0.16000304 -1.27608122 [26,] -0.89319690 0.16000304 [27,] -1.54621694 -0.89319690 [28,] -0.85170972 -1.54621694 [29,] 0.41433818 -0.85170972 [30,] -0.44678328 0.41433818 [31,] -1.15102245 -0.44678328 [32,] -0.77088843 -1.15102245 [33,] 0.56738149 -0.77088843 [34,] -0.32915241 0.56738149 [35,] -1.37077531 -0.32915241 [36,] -0.42182406 -1.37077531 [37,] 0.85773581 -0.42182406 [38,] -0.20066219 0.85773581 [39,] -1.12124585 -0.20066219 [40,] -0.36691852 -1.12124585 [41,] 0.96973801 -0.36691852 [42,] -0.18959205 0.96973801 [43,] -1.37544461 -0.18959205 [44,] -0.58703116 -1.37544461 [45,] 1.30528852 -0.58703116 [46,] 0.56370010 1.30528852 [47,] -0.63864049 0.56370010 [48,] -0.42868636 -0.63864049 [49,] 1.29112424 -0.42868636 [50,] 0.80993007 1.29112424 [51,] -0.33176554 0.80993007 [52,] 0.49080487 -0.33176554 [53,] 2.60688725 0.49080487 [54,] 1.89615817 2.60688725 [55,] 0.52388841 1.89615817 [56,] 0.95523969 0.52388841 [57,] 3.97354408 0.95523969 [58,] 2.37012602 3.97354408 [59,] 0.56810698 2.37012602 [60,] 0.22236161 0.56810698 [61,] 1.55321144 0.22236161 [62,] -1.41271383 1.55321144 [63,] -2.59691665 -1.41271383 [64,] -1.47448790 -2.59691665 [65,] 0.43722316 -1.47448790 [66,] -4.44260834 0.43722316 [67,] -1.15554113 -4.44260834 [68,] -0.51590479 -1.15554113 [69,] 2.45158036 -0.51590479 [70,] -1.48280047 2.45158036 [71,] -5.62621102 -1.48280047 [72,] 1.05898317 -5.62621102 [73,] 3.73567793 1.05898317 [74,] 2.42473636 3.73567793 [75,] -2.35548752 2.42473636 [76,] -2.79983012 -2.35548752 [77,] 5.90991340 -2.79983012 [78,] -1.64511617 5.90991340 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.84803443 0.34954827 2 0.40135888 0.84803443 3 0.84127853 0.40135888 4 0.94327667 0.84127853 5 0.34315997 0.94327667 6 0.86293609 0.34315997 7 0.34755049 0.86293609 8 -0.62478822 0.34755049 9 1.17857258 -0.62478822 10 0.53841953 1.17857258 11 0.09539949 0.53841953 12 -0.05181386 0.09539949 13 0.84900150 -0.05181386 14 0.06924270 0.84900150 15 -0.94890270 0.06924270 16 -0.85371415 -0.94890270 17 0.46014809 -0.85371415 18 -0.06961070 0.46014809 19 -1.24789964 -0.06961070 20 -0.52955702 -1.24789964 21 0.21190332 -0.52955702 22 -0.66391289 0.21190332 23 -1.66205829 -0.66391289 24 -1.27608122 -1.66205829 25 0.16000304 -1.27608122 26 -0.89319690 0.16000304 27 -1.54621694 -0.89319690 28 -0.85170972 -1.54621694 29 0.41433818 -0.85170972 30 -0.44678328 0.41433818 31 -1.15102245 -0.44678328 32 -0.77088843 -1.15102245 33 0.56738149 -0.77088843 34 -0.32915241 0.56738149 35 -1.37077531 -0.32915241 36 -0.42182406 -1.37077531 37 0.85773581 -0.42182406 38 -0.20066219 0.85773581 39 -1.12124585 -0.20066219 40 -0.36691852 -1.12124585 41 0.96973801 -0.36691852 42 -0.18959205 0.96973801 43 -1.37544461 -0.18959205 44 -0.58703116 -1.37544461 45 1.30528852 -0.58703116 46 0.56370010 1.30528852 47 -0.63864049 0.56370010 48 -0.42868636 -0.63864049 49 1.29112424 -0.42868636 50 0.80993007 1.29112424 51 -0.33176554 0.80993007 52 0.49080487 -0.33176554 53 2.60688725 0.49080487 54 1.89615817 2.60688725 55 0.52388841 1.89615817 56 0.95523969 0.52388841 57 3.97354408 0.95523969 58 2.37012602 3.97354408 59 0.56810698 2.37012602 60 0.22236161 0.56810698 61 1.55321144 0.22236161 62 -1.41271383 1.55321144 63 -2.59691665 -1.41271383 64 -1.47448790 -2.59691665 65 0.43722316 -1.47448790 66 -4.44260834 0.43722316 67 -1.15554113 -4.44260834 68 -0.51590479 -1.15554113 69 2.45158036 -0.51590479 70 -1.48280047 2.45158036 71 -5.62621102 -1.48280047 72 1.05898317 -5.62621102 73 3.73567793 1.05898317 74 2.42473636 3.73567793 75 -2.35548752 2.42473636 76 -2.79983012 -2.35548752 77 5.90991340 -2.79983012 78 -1.64511617 5.90991340 > 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/rcomp/tmp/7wu2v1292596344.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/www/rcomp/tmp/8wu2v1292596344.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/www/rcomp/tmp/9wu2v1292596344.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/www/rcomp/tmp/10631y1292596344.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/11a3im1292596344.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/rcomp/tmp/12d4za1292596344.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/rcomp/tmp/139ww11292596344.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/rcomp/tmp/14dwv71292596344.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/rcomp/tmp/15yftd1292596344.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/rcomp/tmp/161fai1292596344.tab") + } > > try(system("convert tmp/102m51292596344.ps tmp/102m51292596344.png",intern=TRUE)) character(0) > try(system("convert tmp/202m51292596344.ps tmp/202m51292596344.png",intern=TRUE)) character(0) > try(system("convert tmp/3atmp1292596344.ps tmp/3atmp1292596344.png",intern=TRUE)) character(0) > try(system("convert tmp/4atmp1292596344.ps tmp/4atmp1292596344.png",intern=TRUE)) character(0) > try(system("convert tmp/5atmp1292596344.ps tmp/5atmp1292596344.png",intern=TRUE)) character(0) > try(system("convert tmp/63k3a1292596344.ps tmp/63k3a1292596344.png",intern=TRUE)) character(0) > try(system("convert tmp/7wu2v1292596344.ps tmp/7wu2v1292596344.png",intern=TRUE)) character(0) > try(system("convert tmp/8wu2v1292596344.ps tmp/8wu2v1292596344.png",intern=TRUE)) character(0) > try(system("convert tmp/9wu2v1292596344.ps tmp/9wu2v1292596344.png",intern=TRUE)) character(0) > try(system("convert tmp/10631y1292596344.ps tmp/10631y1292596344.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.410 1.670 5.056