R version 2.8.0 (2008-10-20) 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(108.00,0,99.00,0,108.00,0,104.00,0,111.00,0,110.00,0,106.00,0,101.00,0,102.00,0,99.00,0,100.00,0,98.00,0,92.00,1,87.00,1,79.00,1,87.00,1,87.00,1,88.00,1,83.00,1,85.00,1,92.00,1,84.00,1,92.00,1,98.00,1,103.00,0,104.00,0,109.00,0,107.00,0,106.00,0,113.00,0,107.00,0,114.00,0,108.00,0,104.00,0,105.00,0,109.00,0,109.00,0,112.00,0,118.00,0,111.00,0,99.00,1,92.00,1,92.00,1,98.00,1,87.00,1,97.00,1,102.00,0,105.00,0,111.00,0,110.00,0,109.00,0,111.00,0,113.00,0,114.00,0,120.00,0,114.00,0,120.00,0,122.00,0,123.00,0,115.00,0,123.00,0,124.00,0,124.00,0,132.00,0,126.00,0,126.00,0,122.00,0,120.00,0,114.00,0,116.00,0,100.00,0,97.00,0),dim=c(2,72),dimnames=list(c('Consumentenvertrouwen','Dummy'),1:72)) > y <- array(NA,dim=c(2,72),dimnames=list(c('Consumentenvertrouwen','Dummy'),1:72)) > 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 Consumentenvertrouwen Dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 108 0 1 0 0 0 0 0 0 0 0 0 0 1 2 99 0 0 1 0 0 0 0 0 0 0 0 0 2 3 108 0 0 0 1 0 0 0 0 0 0 0 0 3 4 104 0 0 0 0 1 0 0 0 0 0 0 0 4 5 111 0 0 0 0 0 1 0 0 0 0 0 0 5 6 110 0 0 0 0 0 0 1 0 0 0 0 0 6 7 106 0 0 0 0 0 0 0 1 0 0 0 0 7 8 101 0 0 0 0 0 0 0 0 1 0 0 0 8 9 102 0 0 0 0 0 0 0 0 0 1 0 0 9 10 99 0 0 0 0 0 0 0 0 0 0 1 0 10 11 100 0 0 0 0 0 0 0 0 0 0 0 1 11 12 98 0 0 0 0 0 0 0 0 0 0 0 0 12 13 92 1 1 0 0 0 0 0 0 0 0 0 0 13 14 87 1 0 1 0 0 0 0 0 0 0 0 0 14 15 79 1 0 0 1 0 0 0 0 0 0 0 0 15 16 87 1 0 0 0 1 0 0 0 0 0 0 0 16 17 87 1 0 0 0 0 1 0 0 0 0 0 0 17 18 88 1 0 0 0 0 0 1 0 0 0 0 0 18 19 83 1 0 0 0 0 0 0 1 0 0 0 0 19 20 85 1 0 0 0 0 0 0 0 1 0 0 0 20 21 92 1 0 0 0 0 0 0 0 0 1 0 0 21 22 84 1 0 0 0 0 0 0 0 0 0 1 0 22 23 92 1 0 0 0 0 0 0 0 0 0 0 1 23 24 98 1 0 0 0 0 0 0 0 0 0 0 0 24 25 103 0 1 0 0 0 0 0 0 0 0 0 0 25 26 104 0 0 1 0 0 0 0 0 0 0 0 0 26 27 109 0 0 0 1 0 0 0 0 0 0 0 0 27 28 107 0 0 0 0 1 0 0 0 0 0 0 0 28 29 106 0 0 0 0 0 1 0 0 0 0 0 0 29 30 113 0 0 0 0 0 0 1 0 0 0 0 0 30 31 107 0 0 0 0 0 0 0 1 0 0 0 0 31 32 114 0 0 0 0 0 0 0 0 1 0 0 0 32 33 108 0 0 0 0 0 0 0 0 0 1 0 0 33 34 104 0 0 0 0 0 0 0 0 0 0 1 0 34 35 105 0 0 0 0 0 0 0 0 0 0 0 1 35 36 109 0 0 0 0 0 0 0 0 0 0 0 0 36 37 109 0 1 0 0 0 0 0 0 0 0 0 0 37 38 112 0 0 1 0 0 0 0 0 0 0 0 0 38 39 118 0 0 0 1 0 0 0 0 0 0 0 0 39 40 111 0 0 0 0 1 0 0 0 0 0 0 0 40 41 99 1 0 0 0 0 1 0 0 0 0 0 0 41 42 92 1 0 0 0 0 0 1 0 0 0 0 0 42 43 92 1 0 0 0 0 0 0 1 0 0 0 0 43 44 98 1 0 0 0 0 0 0 0 1 0 0 0 44 45 87 1 0 0 0 0 0 0 0 0 1 0 0 45 46 97 1 0 0 0 0 0 0 0 0 0 1 0 46 47 102 0 0 0 0 0 0 0 0 0 0 0 1 47 48 105 0 0 0 0 0 0 0 0 0 0 0 0 48 49 111 0 1 0 0 0 0 0 0 0 0 0 0 49 50 110 0 0 1 0 0 0 0 0 0 0 0 0 50 51 109 0 0 0 1 0 0 0 0 0 0 0 0 51 52 111 0 0 0 0 1 0 0 0 0 0 0 0 52 53 113 0 0 0 0 0 1 0 0 0 0 0 0 53 54 114 0 0 0 0 0 0 1 0 0 0 0 0 54 55 120 0 0 0 0 0 0 0 1 0 0 0 0 55 56 114 0 0 0 0 0 0 0 0 1 0 0 0 56 57 120 0 0 0 0 0 0 0 0 0 1 0 0 57 58 122 0 0 0 0 0 0 0 0 0 0 1 0 58 59 123 0 0 0 0 0 0 0 0 0 0 0 1 59 60 115 0 0 0 0 0 0 0 0 0 0 0 0 60 61 123 0 1 0 0 0 0 0 0 0 0 0 0 61 62 124 0 0 1 0 0 0 0 0 0 0 0 0 62 63 124 0 0 0 1 0 0 0 0 0 0 0 0 63 64 132 0 0 0 0 1 0 0 0 0 0 0 0 64 65 126 0 0 0 0 0 1 0 0 0 0 0 0 65 66 126 0 0 0 0 0 0 1 0 0 0 0 0 66 67 122 0 0 0 0 0 0 0 1 0 0 0 0 67 68 120 0 0 0 0 0 0 0 0 1 0 0 0 68 69 114 0 0 0 0 0 0 0 0 0 1 0 0 69 70 116 0 0 0 0 0 0 0 0 0 0 1 0 70 71 100 0 0 0 0 0 0 0 0 0 0 0 1 71 72 97 0 0 0 0 0 0 0 0 0 0 0 0 72 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Dummy M1 M2 M3 M4 96.2219 -18.2725 6.7474 4.8310 6.4146 6.9981 M5 M6 M7 M8 M9 M10 8.1271 8.0440 5.6276 5.7111 3.9614 3.5449 M11 t 0.2498 0.2498 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -17.2051 -3.4482 -0.4283 4.1147 14.0562 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 96.22186 3.00379 32.033 < 2e-16 *** Dummy -18.27246 1.77694 -10.283 1.09e-14 *** M1 6.74744 3.56639 1.892 0.0635 . M2 4.83100 3.56240 1.356 0.1803 M3 6.41457 3.55877 1.802 0.0767 . M4 6.99814 3.55553 1.968 0.0538 . M5 8.12711 3.55883 2.284 0.0261 * M6 8.04401 3.55723 2.261 0.0275 * M7 5.62758 3.55601 1.583 0.1190 M8 5.71114 3.55518 1.606 0.1136 M9 3.96138 3.55472 1.114 0.2697 M10 3.54494 3.55465 0.997 0.3228 M11 0.24977 3.54348 0.070 0.9440 t 0.24977 0.03684 6.779 6.88e-09 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.137 on 58 degrees of freedom Multiple R-squared: 0.7875, Adjusted R-squared: 0.7399 F-statistic: 16.53 on 13 and 58 DF, p-value: 6.025e-15 > 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.4267589440 0.8535178879 0.5732411 [2,] 0.2690991029 0.5381982057 0.7309009 [3,] 0.1678674580 0.3357349161 0.8321325 [4,] 0.1112903783 0.2225807567 0.8887096 [5,] 0.1337865939 0.2675731878 0.8662134 [6,] 0.0884195869 0.1768391738 0.9115804 [7,] 0.1165939213 0.2331878426 0.8834061 [8,] 0.3825096462 0.7650192923 0.6174904 [9,] 0.2919686110 0.5839372220 0.7080314 [10,] 0.2506417800 0.5012835600 0.7493582 [11,] 0.2246241797 0.4492483594 0.7753758 [12,] 0.1644488215 0.3288976429 0.8355512 [13,] 0.1269568852 0.2539137705 0.8730431 [14,] 0.0937444903 0.1874889806 0.9062555 [15,] 0.0651141101 0.1302282203 0.9348859 [16,] 0.0750700569 0.1501401139 0.9249299 [17,] 0.0482315850 0.0964631700 0.9517684 [18,] 0.0362697661 0.0725395322 0.9637302 [19,] 0.0232274809 0.0464549618 0.9767725 [20,] 0.0182163840 0.0364327679 0.9817836 [21,] 0.0108275912 0.0216551824 0.9891724 [22,] 0.0079900773 0.0159801547 0.9920099 [23,] 0.0101298247 0.0202596495 0.9898702 [24,] 0.0060630421 0.0121260842 0.9939370 [25,] 0.0041560290 0.0083120579 0.9958440 [26,] 0.0026855586 0.0053711172 0.9973144 [27,] 0.0014608262 0.0029216523 0.9985392 [28,] 0.0010067475 0.0020134951 0.9989933 [29,] 0.0008248527 0.0016497054 0.9991751 [30,] 0.0006772225 0.0013544450 0.9993228 [31,] 0.0005656540 0.0011313080 0.9994343 [32,] 0.0003929432 0.0007858863 0.9996071 [33,] 0.0002294545 0.0004589091 0.9997705 [34,] 0.0001656558 0.0003313116 0.9998343 [35,] 0.0001850155 0.0003700309 0.9998150 [36,] 0.0009906481 0.0019812962 0.9990094 [37,] 0.0022164694 0.0044329387 0.9977835 [38,] 0.0095654273 0.0191308547 0.9904346 [39,] 0.0132802711 0.0265605422 0.9867197 > postscript(file="/var/www/html/rcomp/tmp/105d51228942176.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/2qflc1228942176.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/33zn91228942176.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/4c42k1228942176.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/5q9nh1228942176.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 = 72 Frequency = 1 1 2 3 4 5 6 4.7809381 -2.5523952 4.6142715 -0.2190619 5.4021956 4.2355289 7 8 9 10 11 12 2.4021956 -2.9311377 -0.4311377 -3.2644711 0.7809381 -1.2190619 13 14 15 16 17 18 4.0561876 0.7228543 -9.1104790 -1.9438124 -3.3225549 -2.4892216 19 20 21 22 23 24 -5.3225549 -3.6558882 4.8441118 -2.9892216 8.0561876 14.0561876 25 26 27 28 29 30 -6.2134731 -3.5468064 -0.3801397 -3.2134731 -5.5922156 1.2411178 31 32 33 34 35 36 -2.5922156 4.0744511 -0.4255489 -4.2588822 -0.2134731 3.7865269 37 38 39 40 41 42 -3.2106786 1.4559880 5.6226547 -2.2106786 2.6830339 -4.4836327 43 44 45 46 47 48 -2.3169661 3.3497006 -6.1502994 4.0163673 -6.2106786 -3.2106786 49 50 51 52 53 54 -4.2078842 -3.5412176 -6.3745509 -5.2078842 -4.5866267 -3.7532934 55 56 57 58 59 60 4.4133733 -1.9199601 5.5800399 7.7467066 11.7921158 3.7921158 61 62 63 64 65 66 4.7949102 7.4615768 5.6282435 12.7949102 5.4161677 5.2495010 67 68 69 70 71 72 3.4161677 1.0828343 -3.4171657 -1.2504990 -14.2050898 -17.2050898 > postscript(file="/var/www/html/rcomp/tmp/6qdjx1228942176.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 = 72 Frequency = 1 lag(myerror, k = 1) myerror 0 4.7809381 NA 1 -2.5523952 4.7809381 2 4.6142715 -2.5523952 3 -0.2190619 4.6142715 4 5.4021956 -0.2190619 5 4.2355289 5.4021956 6 2.4021956 4.2355289 7 -2.9311377 2.4021956 8 -0.4311377 -2.9311377 9 -3.2644711 -0.4311377 10 0.7809381 -3.2644711 11 -1.2190619 0.7809381 12 4.0561876 -1.2190619 13 0.7228543 4.0561876 14 -9.1104790 0.7228543 15 -1.9438124 -9.1104790 16 -3.3225549 -1.9438124 17 -2.4892216 -3.3225549 18 -5.3225549 -2.4892216 19 -3.6558882 -5.3225549 20 4.8441118 -3.6558882 21 -2.9892216 4.8441118 22 8.0561876 -2.9892216 23 14.0561876 8.0561876 24 -6.2134731 14.0561876 25 -3.5468064 -6.2134731 26 -0.3801397 -3.5468064 27 -3.2134731 -0.3801397 28 -5.5922156 -3.2134731 29 1.2411178 -5.5922156 30 -2.5922156 1.2411178 31 4.0744511 -2.5922156 32 -0.4255489 4.0744511 33 -4.2588822 -0.4255489 34 -0.2134731 -4.2588822 35 3.7865269 -0.2134731 36 -3.2106786 3.7865269 37 1.4559880 -3.2106786 38 5.6226547 1.4559880 39 -2.2106786 5.6226547 40 2.6830339 -2.2106786 41 -4.4836327 2.6830339 42 -2.3169661 -4.4836327 43 3.3497006 -2.3169661 44 -6.1502994 3.3497006 45 4.0163673 -6.1502994 46 -6.2106786 4.0163673 47 -3.2106786 -6.2106786 48 -4.2078842 -3.2106786 49 -3.5412176 -4.2078842 50 -6.3745509 -3.5412176 51 -5.2078842 -6.3745509 52 -4.5866267 -5.2078842 53 -3.7532934 -4.5866267 54 4.4133733 -3.7532934 55 -1.9199601 4.4133733 56 5.5800399 -1.9199601 57 7.7467066 5.5800399 58 11.7921158 7.7467066 59 3.7921158 11.7921158 60 4.7949102 3.7921158 61 7.4615768 4.7949102 62 5.6282435 7.4615768 63 12.7949102 5.6282435 64 5.4161677 12.7949102 65 5.2495010 5.4161677 66 3.4161677 5.2495010 67 1.0828343 3.4161677 68 -3.4171657 1.0828343 69 -1.2504990 -3.4171657 70 -14.2050898 -1.2504990 71 -17.2050898 -14.2050898 72 NA -17.2050898 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.5523952 4.7809381 [2,] 4.6142715 -2.5523952 [3,] -0.2190619 4.6142715 [4,] 5.4021956 -0.2190619 [5,] 4.2355289 5.4021956 [6,] 2.4021956 4.2355289 [7,] -2.9311377 2.4021956 [8,] -0.4311377 -2.9311377 [9,] -3.2644711 -0.4311377 [10,] 0.7809381 -3.2644711 [11,] -1.2190619 0.7809381 [12,] 4.0561876 -1.2190619 [13,] 0.7228543 4.0561876 [14,] -9.1104790 0.7228543 [15,] -1.9438124 -9.1104790 [16,] -3.3225549 -1.9438124 [17,] -2.4892216 -3.3225549 [18,] -5.3225549 -2.4892216 [19,] -3.6558882 -5.3225549 [20,] 4.8441118 -3.6558882 [21,] -2.9892216 4.8441118 [22,] 8.0561876 -2.9892216 [23,] 14.0561876 8.0561876 [24,] -6.2134731 14.0561876 [25,] -3.5468064 -6.2134731 [26,] -0.3801397 -3.5468064 [27,] -3.2134731 -0.3801397 [28,] -5.5922156 -3.2134731 [29,] 1.2411178 -5.5922156 [30,] -2.5922156 1.2411178 [31,] 4.0744511 -2.5922156 [32,] -0.4255489 4.0744511 [33,] -4.2588822 -0.4255489 [34,] -0.2134731 -4.2588822 [35,] 3.7865269 -0.2134731 [36,] -3.2106786 3.7865269 [37,] 1.4559880 -3.2106786 [38,] 5.6226547 1.4559880 [39,] -2.2106786 5.6226547 [40,] 2.6830339 -2.2106786 [41,] -4.4836327 2.6830339 [42,] -2.3169661 -4.4836327 [43,] 3.3497006 -2.3169661 [44,] -6.1502994 3.3497006 [45,] 4.0163673 -6.1502994 [46,] -6.2106786 4.0163673 [47,] -3.2106786 -6.2106786 [48,] -4.2078842 -3.2106786 [49,] -3.5412176 -4.2078842 [50,] -6.3745509 -3.5412176 [51,] -5.2078842 -6.3745509 [52,] -4.5866267 -5.2078842 [53,] -3.7532934 -4.5866267 [54,] 4.4133733 -3.7532934 [55,] -1.9199601 4.4133733 [56,] 5.5800399 -1.9199601 [57,] 7.7467066 5.5800399 [58,] 11.7921158 7.7467066 [59,] 3.7921158 11.7921158 [60,] 4.7949102 3.7921158 [61,] 7.4615768 4.7949102 [62,] 5.6282435 7.4615768 [63,] 12.7949102 5.6282435 [64,] 5.4161677 12.7949102 [65,] 5.2495010 5.4161677 [66,] 3.4161677 5.2495010 [67,] 1.0828343 3.4161677 [68,] -3.4171657 1.0828343 [69,] -1.2504990 -3.4171657 [70,] -14.2050898 -1.2504990 [71,] -17.2050898 -14.2050898 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.5523952 4.7809381 2 4.6142715 -2.5523952 3 -0.2190619 4.6142715 4 5.4021956 -0.2190619 5 4.2355289 5.4021956 6 2.4021956 4.2355289 7 -2.9311377 2.4021956 8 -0.4311377 -2.9311377 9 -3.2644711 -0.4311377 10 0.7809381 -3.2644711 11 -1.2190619 0.7809381 12 4.0561876 -1.2190619 13 0.7228543 4.0561876 14 -9.1104790 0.7228543 15 -1.9438124 -9.1104790 16 -3.3225549 -1.9438124 17 -2.4892216 -3.3225549 18 -5.3225549 -2.4892216 19 -3.6558882 -5.3225549 20 4.8441118 -3.6558882 21 -2.9892216 4.8441118 22 8.0561876 -2.9892216 23 14.0561876 8.0561876 24 -6.2134731 14.0561876 25 -3.5468064 -6.2134731 26 -0.3801397 -3.5468064 27 -3.2134731 -0.3801397 28 -5.5922156 -3.2134731 29 1.2411178 -5.5922156 30 -2.5922156 1.2411178 31 4.0744511 -2.5922156 32 -0.4255489 4.0744511 33 -4.2588822 -0.4255489 34 -0.2134731 -4.2588822 35 3.7865269 -0.2134731 36 -3.2106786 3.7865269 37 1.4559880 -3.2106786 38 5.6226547 1.4559880 39 -2.2106786 5.6226547 40 2.6830339 -2.2106786 41 -4.4836327 2.6830339 42 -2.3169661 -4.4836327 43 3.3497006 -2.3169661 44 -6.1502994 3.3497006 45 4.0163673 -6.1502994 46 -6.2106786 4.0163673 47 -3.2106786 -6.2106786 48 -4.2078842 -3.2106786 49 -3.5412176 -4.2078842 50 -6.3745509 -3.5412176 51 -5.2078842 -6.3745509 52 -4.5866267 -5.2078842 53 -3.7532934 -4.5866267 54 4.4133733 -3.7532934 55 -1.9199601 4.4133733 56 5.5800399 -1.9199601 57 7.7467066 5.5800399 58 11.7921158 7.7467066 59 3.7921158 11.7921158 60 4.7949102 3.7921158 61 7.4615768 4.7949102 62 5.6282435 7.4615768 63 12.7949102 5.6282435 64 5.4161677 12.7949102 65 5.2495010 5.4161677 66 3.4161677 5.2495010 67 1.0828343 3.4161677 68 -3.4171657 1.0828343 69 -1.2504990 -3.4171657 70 -14.2050898 -1.2504990 71 -17.2050898 -14.2050898 > 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/7wjhr1228942176.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/8dqv91228942176.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/9zmvn1228942176.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/10xbas1228942176.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/11t85p1228942176.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/12tl8n1228942176.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/13056o1228942176.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/14ducd1228942176.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/15ge3a1228942176.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/167zzp1228942176.tab") + } > > system("convert tmp/105d51228942176.ps tmp/105d51228942176.png") > system("convert tmp/2qflc1228942176.ps tmp/2qflc1228942176.png") > system("convert tmp/33zn91228942176.ps tmp/33zn91228942176.png") > system("convert tmp/4c42k1228942176.ps tmp/4c42k1228942176.png") > system("convert tmp/5q9nh1228942176.ps tmp/5q9nh1228942176.png") > system("convert tmp/6qdjx1228942176.ps tmp/6qdjx1228942176.png") > system("convert tmp/7wjhr1228942176.ps tmp/7wjhr1228942176.png") > system("convert tmp/8dqv91228942176.ps tmp/8dqv91228942176.png") > system("convert tmp/9zmvn1228942176.ps tmp/9zmvn1228942176.png") > system("convert tmp/10xbas1228942176.ps tmp/10xbas1228942176.png") > > > proc.time() user system elapsed 2.639 1.665 4.047