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(103.9 + ,91.1 + ,110.3 + ,114.1 + ,96.8 + ,101.6 + ,79.8 + ,103.9 + ,110.3 + ,114.1 + ,94.6 + ,71.9 + ,101.6 + ,103.9 + ,110.3 + ,95.9 + ,82.9 + ,94.6 + ,101.6 + ,103.9 + ,104.7 + ,90.1 + ,95.9 + ,94.6 + ,101.6 + ,102.8 + ,100.7 + ,104.7 + ,95.9 + ,94.6 + ,98.1 + ,90.7 + ,102.8 + ,104.7 + ,95.9 + ,113.9 + ,108.8 + ,98.1 + ,102.8 + ,104.7 + ,80.9 + ,44.1 + ,113.9 + ,98.1 + ,102.8 + ,95.7 + ,93.6 + ,80.9 + ,113.9 + ,98.1 + ,113.2 + ,107.4 + ,95.7 + ,80.9 + ,113.9 + ,105.9 + ,96.5 + ,113.2 + ,95.7 + ,80.9 + ,108.8 + ,93.6 + ,105.9 + ,113.2 + ,95.7 + ,102.3 + ,76.5 + ,108.8 + ,105.9 + ,113.2 + ,99 + ,76.7 + ,102.3 + ,108.8 + ,105.9 + ,100.7 + ,84 + ,99 + ,102.3 + ,108.8 + ,115.5 + ,103.3 + ,100.7 + ,99 + ,102.3 + ,100.7 + ,88.5 + ,115.5 + ,100.7 + ,99 + ,109.9 + ,99 + ,100.7 + ,115.5 + ,100.7 + ,114.6 + ,105.9 + ,109.9 + ,100.7 + ,115.5 + ,85.4 + ,44.7 + ,114.6 + ,109.9 + ,100.7 + ,100.5 + ,94 + ,85.4 + ,114.6 + ,109.9 + ,114.8 + ,107.1 + ,100.5 + ,85.4 + ,114.6 + ,116.5 + ,104.8 + ,114.8 + ,100.5 + ,85.4 + ,112.9 + ,102.5 + ,116.5 + ,114.8 + ,100.5 + ,102 + ,77.7 + ,112.9 + ,116.5 + ,114.8 + ,106 + ,85.2 + ,102 + ,112.9 + ,116.5 + ,105.3 + ,91.3 + ,106 + ,102 + ,112.9 + ,118.8 + ,106.5 + ,105.3 + ,106 + ,102 + ,106.1 + ,92.4 + ,118.8 + ,105.3 + ,106 + ,109.3 + ,97.5 + ,106.1 + ,118.8 + ,105.3 + ,117.2 + ,107 + ,109.3 + ,106.1 + ,118.8 + ,92.5 + ,51.1 + ,117.2 + ,109.3 + ,106.1 + ,104.2 + ,98.6 + ,92.5 + ,117.2 + ,109.3 + ,112.5 + ,102.2 + ,104.2 + ,92.5 + ,117.2 + ,122.4 + ,114.3 + ,112.5 + ,104.2 + ,92.5 + ,113.3 + ,99.4 + ,122.4 + ,112.5 + ,104.2 + ,100 + ,72.5 + ,113.3 + ,122.4 + ,112.5 + ,110.7 + ,92.3 + ,100 + ,113.3 + ,122.4 + ,112.8 + ,99.4 + ,110.7 + ,100 + ,113.3 + ,109.8 + ,85.9 + ,112.8 + ,110.7 + ,100 + ,117.3 + ,109.4 + ,109.8 + ,112.8 + ,110.7 + ,109.1 + ,97.6 + ,117.3 + ,109.8 + ,112.8 + ,115.9 + ,104.7 + ,109.1 + ,117.3 + ,109.8 + ,96 + ,56.9 + ,115.9 + ,109.1 + ,117.3 + ,99.8 + ,86.7 + ,96 + ,115.9 + ,109.1 + ,116.8 + ,108.5 + ,99.8 + ,96 + ,115.9 + ,115.7 + ,103.4 + ,116.8 + ,99.8 + ,96 + ,99.4 + ,86.2 + ,115.7 + ,116.8 + ,99.8 + ,94.3 + ,71 + ,99.4 + ,115.7 + ,116.8 + ,91 + ,75.9 + ,94.3 + ,99.4 + ,115.7 + ,93.2 + ,87.1 + ,91 + ,94.3 + ,99.4 + ,103.1 + ,102 + ,93.2 + ,91 + ,94.3 + ,94.1 + ,88.5 + ,103.1 + ,93.2 + ,91 + ,91.8 + ,87.8 + ,94.1 + ,103.1 + ,93.2 + ,102.7 + ,100.8 + ,91.8 + ,94.1 + ,103.1 + ,82.6 + ,50.6 + ,102.7 + ,91.8 + ,94.1) + ,dim=c(5 + ,57) + ,dimnames=list(c('Totind' + ,'Bouw' + ,'Yt-1' + ,'Yt-2' + ,'Yt-3') + ,1:57)) > y <- array(NA,dim=c(5,57),dimnames=list(c('Totind','Bouw','Yt-1','Yt-2','Yt-3'),1:57)) > 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 Totind Bouw Yt-1 Yt-2 Yt-3 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 103.9 91.1 110.3 114.1 96.8 1 0 0 0 0 0 0 0 0 0 0 1 2 101.6 79.8 103.9 110.3 114.1 0 1 0 0 0 0 0 0 0 0 0 2 3 94.6 71.9 101.6 103.9 110.3 0 0 1 0 0 0 0 0 0 0 0 3 4 95.9 82.9 94.6 101.6 103.9 0 0 0 1 0 0 0 0 0 0 0 4 5 104.7 90.1 95.9 94.6 101.6 0 0 0 0 1 0 0 0 0 0 0 5 6 102.8 100.7 104.7 95.9 94.6 0 0 0 0 0 1 0 0 0 0 0 6 7 98.1 90.7 102.8 104.7 95.9 0 0 0 0 0 0 1 0 0 0 0 7 8 113.9 108.8 98.1 102.8 104.7 0 0 0 0 0 0 0 1 0 0 0 8 9 80.9 44.1 113.9 98.1 102.8 0 0 0 0 0 0 0 0 1 0 0 9 10 95.7 93.6 80.9 113.9 98.1 0 0 0 0 0 0 0 0 0 1 0 10 11 113.2 107.4 95.7 80.9 113.9 0 0 0 0 0 0 0 0 0 0 1 11 12 105.9 96.5 113.2 95.7 80.9 0 0 0 0 0 0 0 0 0 0 0 12 13 108.8 93.6 105.9 113.2 95.7 1 0 0 0 0 0 0 0 0 0 0 13 14 102.3 76.5 108.8 105.9 113.2 0 1 0 0 0 0 0 0 0 0 0 14 15 99.0 76.7 102.3 108.8 105.9 0 0 1 0 0 0 0 0 0 0 0 15 16 100.7 84.0 99.0 102.3 108.8 0 0 0 1 0 0 0 0 0 0 0 16 17 115.5 103.3 100.7 99.0 102.3 0 0 0 0 1 0 0 0 0 0 0 17 18 100.7 88.5 115.5 100.7 99.0 0 0 0 0 0 1 0 0 0 0 0 18 19 109.9 99.0 100.7 115.5 100.7 0 0 0 0 0 0 1 0 0 0 0 19 20 114.6 105.9 109.9 100.7 115.5 0 0 0 0 0 0 0 1 0 0 0 20 21 85.4 44.7 114.6 109.9 100.7 0 0 0 0 0 0 0 0 1 0 0 21 22 100.5 94.0 85.4 114.6 109.9 0 0 0 0 0 0 0 0 0 1 0 22 23 114.8 107.1 100.5 85.4 114.6 0 0 0 0 0 0 0 0 0 0 1 23 24 116.5 104.8 114.8 100.5 85.4 0 0 0 0 0 0 0 0 0 0 0 24 25 112.9 102.5 116.5 114.8 100.5 1 0 0 0 0 0 0 0 0 0 0 25 26 102.0 77.7 112.9 116.5 114.8 0 1 0 0 0 0 0 0 0 0 0 26 27 106.0 85.2 102.0 112.9 116.5 0 0 1 0 0 0 0 0 0 0 0 27 28 105.3 91.3 106.0 102.0 112.9 0 0 0 1 0 0 0 0 0 0 0 28 29 118.8 106.5 105.3 106.0 102.0 0 0 0 0 1 0 0 0 0 0 0 29 30 106.1 92.4 118.8 105.3 106.0 0 0 0 0 0 1 0 0 0 0 0 30 31 109.3 97.5 106.1 118.8 105.3 0 0 0 0 0 0 1 0 0 0 0 31 32 117.2 107.0 109.3 106.1 118.8 0 0 0 0 0 0 0 1 0 0 0 32 33 92.5 51.1 117.2 109.3 106.1 0 0 0 0 0 0 0 0 1 0 0 33 34 104.2 98.6 92.5 117.2 109.3 0 0 0 0 0 0 0 0 0 1 0 34 35 112.5 102.2 104.2 92.5 117.2 0 0 0 0 0 0 0 0 0 0 1 35 36 122.4 114.3 112.5 104.2 92.5 0 0 0 0 0 0 0 0 0 0 0 36 37 113.3 99.4 122.4 112.5 104.2 1 0 0 0 0 0 0 0 0 0 0 37 38 100.0 72.5 113.3 122.4 112.5 0 1 0 0 0 0 0 0 0 0 0 38 39 110.7 92.3 100.0 113.3 122.4 0 0 1 0 0 0 0 0 0 0 0 39 40 112.8 99.4 110.7 100.0 113.3 0 0 0 1 0 0 0 0 0 0 0 40 41 109.8 85.9 112.8 110.7 100.0 0 0 0 0 1 0 0 0 0 0 0 41 42 117.3 109.4 109.8 112.8 110.7 0 0 0 0 0 1 0 0 0 0 0 42 43 109.1 97.6 117.3 109.8 112.8 0 0 0 0 0 0 1 0 0 0 0 43 44 115.9 104.7 109.1 117.3 109.8 0 0 0 0 0 0 0 1 0 0 0 44 45 96.0 56.9 115.9 109.1 117.3 0 0 0 0 0 0 0 0 1 0 0 45 46 99.8 86.7 96.0 115.9 109.1 0 0 0 0 0 0 0 0 0 1 0 46 47 116.8 108.5 99.8 96.0 115.9 0 0 0 0 0 0 0 0 0 0 1 47 48 115.7 103.4 116.8 99.8 96.0 0 0 0 0 0 0 0 0 0 0 0 48 49 99.4 86.2 115.7 116.8 99.8 1 0 0 0 0 0 0 0 0 0 0 49 50 94.3 71.0 99.4 115.7 116.8 0 1 0 0 0 0 0 0 0 0 0 50 51 91.0 75.9 94.3 99.4 115.7 0 0 1 0 0 0 0 0 0 0 0 51 52 93.2 87.1 91.0 94.3 99.4 0 0 0 1 0 0 0 0 0 0 0 52 53 103.1 102.0 93.2 91.0 94.3 0 0 0 0 1 0 0 0 0 0 0 53 54 94.1 88.5 103.1 93.2 91.0 0 0 0 0 0 1 0 0 0 0 0 54 55 91.8 87.8 94.1 103.1 93.2 0 0 0 0 0 0 1 0 0 0 0 55 56 102.7 100.8 91.8 94.1 103.1 0 0 0 0 0 0 0 1 0 0 0 56 57 82.6 50.6 102.7 91.8 94.1 0 0 0 0 0 0 0 0 1 0 0 57 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Bouw `Yt-1` `Yt-2` `Yt-3` M1 -24.05167 0.67039 0.25400 0.26998 0.16064 -6.37661 M2 M3 M4 M5 M6 M7 -1.88111 -1.19157 -2.50634 1.38914 -6.26009 -6.86827 M8 M9 M10 M11 t -4.52699 6.45482 -7.94932 0.51710 -0.04483 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3.630027 -0.994329 -0.008976 0.930098 4.229584 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -24.05167 6.17579 -3.895 0.000365 *** Bouw 0.67039 0.04824 13.897 < 2e-16 *** `Yt-1` 0.25400 0.05667 4.482 6.06e-05 *** `Yt-2` 0.26998 0.05135 5.258 5.19e-06 *** `Yt-3` 0.16064 0.06655 2.414 0.020462 * M1 -6.37661 1.71596 -3.716 0.000619 *** M2 -1.88111 3.21020 -0.586 0.561183 M3 -1.19157 3.24308 -0.367 0.715244 M4 -2.50634 2.56130 -0.979 0.333686 M5 1.38914 1.89124 0.735 0.466922 M6 -6.26009 1.66124 -3.768 0.000531 *** M7 -6.86827 2.04321 -3.362 0.001716 ** M8 -4.52699 2.17372 -2.083 0.043727 * M9 6.45482 3.53398 1.827 0.075245 . M10 -7.94932 3.09398 -2.569 0.014025 * M11 0.51710 2.66372 0.194 0.847058 t -0.04483 0.01455 -3.082 0.003713 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.747 on 40 degrees of freedom Multiple R-squared: 0.9761, Adjusted R-squared: 0.9665 F-statistic: 102.1 on 16 and 40 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.22573200 0.4514640 0.7742680 [2,] 0.16156478 0.3231296 0.8384352 [3,] 0.09003874 0.1800775 0.9099613 [4,] 0.09443937 0.1888787 0.9055606 [5,] 0.07536843 0.1507369 0.9246316 [6,] 0.15565609 0.3113122 0.8443439 [7,] 0.44615367 0.8923073 0.5538463 [8,] 0.51810158 0.9637968 0.4818984 [9,] 0.39944718 0.7988944 0.6005528 [10,] 0.30341439 0.6068288 0.6965856 [11,] 0.22597470 0.4519494 0.7740253 [12,] 0.19723774 0.3944755 0.8027623 [13,] 0.14659187 0.2931837 0.8534081 [14,] 0.10050674 0.2010135 0.8994933 [15,] 0.08281197 0.1656239 0.9171880 [16,] 0.11478466 0.2295693 0.8852153 [17,] 0.11139114 0.2227823 0.8886089 [18,] 0.05580666 0.1116133 0.9441933 > postscript(file="/var/www/html/rcomp/tmp/1kgq51258732249.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/2eol61258732249.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/3wkl41258732249.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/4xc7a1258732249.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/5tfl51258732249.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 = 57 Frequency = 1 1 2 3 4 5 6 -1.069683629 -0.372519572 0.201325947 -1.086306183 0.965370801 -1.808374380 7 8 9 10 11 12 -1.253532074 0.409129481 -2.592815013 -1.656746035 0.782319345 -1.788100344 13 14 15 16 17 18 4.229583878 3.165605966 1.127539954 1.420516396 0.934661703 0.062423755 19 20 21 22 23 24 2.366770819 -0.573916597 -0.983292001 0.185540537 0.574850412 1.360469227 25 26 27 28 29 30 -0.994329491 -1.561089292 0.233717958 -0.690974117 -0.382672809 0.181301190 31 32 33 34 35 36 0.308851010 -0.008976487 0.998324681 -1.069237422 -1.176592704 -0.125515905 37 38 39 40 41 42 0.549826364 -0.862115564 0.164159847 1.198749242 2.112666874 0.028813265 43 44 45 46 47 48 -1.040000366 -0.756334519 -0.266926785 2.540442920 -0.180577053 0.553147022 49 50 51 52 53 54 -2.715397122 -0.369881538 -1.726743706 -0.841985340 -3.630026570 1.535836169 55 56 57 -0.382089389 0.930098121 2.844709119 > postscript(file="/var/www/html/rcomp/tmp/6uchk1258732249.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 = 57 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.069683629 NA 1 -0.372519572 -1.069683629 2 0.201325947 -0.372519572 3 -1.086306183 0.201325947 4 0.965370801 -1.086306183 5 -1.808374380 0.965370801 6 -1.253532074 -1.808374380 7 0.409129481 -1.253532074 8 -2.592815013 0.409129481 9 -1.656746035 -2.592815013 10 0.782319345 -1.656746035 11 -1.788100344 0.782319345 12 4.229583878 -1.788100344 13 3.165605966 4.229583878 14 1.127539954 3.165605966 15 1.420516396 1.127539954 16 0.934661703 1.420516396 17 0.062423755 0.934661703 18 2.366770819 0.062423755 19 -0.573916597 2.366770819 20 -0.983292001 -0.573916597 21 0.185540537 -0.983292001 22 0.574850412 0.185540537 23 1.360469227 0.574850412 24 -0.994329491 1.360469227 25 -1.561089292 -0.994329491 26 0.233717958 -1.561089292 27 -0.690974117 0.233717958 28 -0.382672809 -0.690974117 29 0.181301190 -0.382672809 30 0.308851010 0.181301190 31 -0.008976487 0.308851010 32 0.998324681 -0.008976487 33 -1.069237422 0.998324681 34 -1.176592704 -1.069237422 35 -0.125515905 -1.176592704 36 0.549826364 -0.125515905 37 -0.862115564 0.549826364 38 0.164159847 -0.862115564 39 1.198749242 0.164159847 40 2.112666874 1.198749242 41 0.028813265 2.112666874 42 -1.040000366 0.028813265 43 -0.756334519 -1.040000366 44 -0.266926785 -0.756334519 45 2.540442920 -0.266926785 46 -0.180577053 2.540442920 47 0.553147022 -0.180577053 48 -2.715397122 0.553147022 49 -0.369881538 -2.715397122 50 -1.726743706 -0.369881538 51 -0.841985340 -1.726743706 52 -3.630026570 -0.841985340 53 1.535836169 -3.630026570 54 -0.382089389 1.535836169 55 0.930098121 -0.382089389 56 2.844709119 0.930098121 57 NA 2.844709119 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.372519572 -1.069683629 [2,] 0.201325947 -0.372519572 [3,] -1.086306183 0.201325947 [4,] 0.965370801 -1.086306183 [5,] -1.808374380 0.965370801 [6,] -1.253532074 -1.808374380 [7,] 0.409129481 -1.253532074 [8,] -2.592815013 0.409129481 [9,] -1.656746035 -2.592815013 [10,] 0.782319345 -1.656746035 [11,] -1.788100344 0.782319345 [12,] 4.229583878 -1.788100344 [13,] 3.165605966 4.229583878 [14,] 1.127539954 3.165605966 [15,] 1.420516396 1.127539954 [16,] 0.934661703 1.420516396 [17,] 0.062423755 0.934661703 [18,] 2.366770819 0.062423755 [19,] -0.573916597 2.366770819 [20,] -0.983292001 -0.573916597 [21,] 0.185540537 -0.983292001 [22,] 0.574850412 0.185540537 [23,] 1.360469227 0.574850412 [24,] -0.994329491 1.360469227 [25,] -1.561089292 -0.994329491 [26,] 0.233717958 -1.561089292 [27,] -0.690974117 0.233717958 [28,] -0.382672809 -0.690974117 [29,] 0.181301190 -0.382672809 [30,] 0.308851010 0.181301190 [31,] -0.008976487 0.308851010 [32,] 0.998324681 -0.008976487 [33,] -1.069237422 0.998324681 [34,] -1.176592704 -1.069237422 [35,] -0.125515905 -1.176592704 [36,] 0.549826364 -0.125515905 [37,] -0.862115564 0.549826364 [38,] 0.164159847 -0.862115564 [39,] 1.198749242 0.164159847 [40,] 2.112666874 1.198749242 [41,] 0.028813265 2.112666874 [42,] -1.040000366 0.028813265 [43,] -0.756334519 -1.040000366 [44,] -0.266926785 -0.756334519 [45,] 2.540442920 -0.266926785 [46,] -0.180577053 2.540442920 [47,] 0.553147022 -0.180577053 [48,] -2.715397122 0.553147022 [49,] -0.369881538 -2.715397122 [50,] -1.726743706 -0.369881538 [51,] -0.841985340 -1.726743706 [52,] -3.630026570 -0.841985340 [53,] 1.535836169 -3.630026570 [54,] -0.382089389 1.535836169 [55,] 0.930098121 -0.382089389 [56,] 2.844709119 0.930098121 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.372519572 -1.069683629 2 0.201325947 -0.372519572 3 -1.086306183 0.201325947 4 0.965370801 -1.086306183 5 -1.808374380 0.965370801 6 -1.253532074 -1.808374380 7 0.409129481 -1.253532074 8 -2.592815013 0.409129481 9 -1.656746035 -2.592815013 10 0.782319345 -1.656746035 11 -1.788100344 0.782319345 12 4.229583878 -1.788100344 13 3.165605966 4.229583878 14 1.127539954 3.165605966 15 1.420516396 1.127539954 16 0.934661703 1.420516396 17 0.062423755 0.934661703 18 2.366770819 0.062423755 19 -0.573916597 2.366770819 20 -0.983292001 -0.573916597 21 0.185540537 -0.983292001 22 0.574850412 0.185540537 23 1.360469227 0.574850412 24 -0.994329491 1.360469227 25 -1.561089292 -0.994329491 26 0.233717958 -1.561089292 27 -0.690974117 0.233717958 28 -0.382672809 -0.690974117 29 0.181301190 -0.382672809 30 0.308851010 0.181301190 31 -0.008976487 0.308851010 32 0.998324681 -0.008976487 33 -1.069237422 0.998324681 34 -1.176592704 -1.069237422 35 -0.125515905 -1.176592704 36 0.549826364 -0.125515905 37 -0.862115564 0.549826364 38 0.164159847 -0.862115564 39 1.198749242 0.164159847 40 2.112666874 1.198749242 41 0.028813265 2.112666874 42 -1.040000366 0.028813265 43 -0.756334519 -1.040000366 44 -0.266926785 -0.756334519 45 2.540442920 -0.266926785 46 -0.180577053 2.540442920 47 0.553147022 -0.180577053 48 -2.715397122 0.553147022 49 -0.369881538 -2.715397122 50 -1.726743706 -0.369881538 51 -0.841985340 -1.726743706 52 -3.630026570 -0.841985340 53 1.535836169 -3.630026570 54 -0.382089389 1.535836169 55 0.930098121 -0.382089389 56 2.844709119 0.930098121 > 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/7ydg81258732249.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/8yl6p1258732249.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/97x8t1258732249.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/10slk61258732249.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/11hahl1258732249.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/12mb1j1258732249.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/13ri0z1258732249.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/146tlw1258732249.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/1573561258732249.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/168hct1258732249.tab") + } > > system("convert tmp/1kgq51258732249.ps tmp/1kgq51258732249.png") > system("convert tmp/2eol61258732249.ps tmp/2eol61258732249.png") > system("convert tmp/3wkl41258732249.ps tmp/3wkl41258732249.png") > system("convert tmp/4xc7a1258732249.ps tmp/4xc7a1258732249.png") > system("convert tmp/5tfl51258732249.ps tmp/5tfl51258732249.png") > system("convert tmp/6uchk1258732249.ps tmp/6uchk1258732249.png") > system("convert tmp/7ydg81258732249.ps tmp/7ydg81258732249.png") > system("convert tmp/8yl6p1258732249.ps tmp/8yl6p1258732249.png") > system("convert tmp/97x8t1258732249.ps tmp/97x8t1258732249.png") > system("convert tmp/10slk61258732249.ps tmp/10slk61258732249.png") > > > proc.time() user system elapsed 2.319 1.544 2.758