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(106.1,97.89,106,98.69,105.9,99.01,105.8,99.18,105.7,98.45,105.6,98.13,105.4,98.29,105.4,99.1,105.5,99.26,105.6,98.85,105.7,98.05,105.9,98.53,106.1,99.34,106,100.14,105.8,100.3,105.8,100.22,105.7,99.9,105.5,99.58,105.3,99.9,105.2,100.78,105.2,100.78,105,100.46,105.1,100.06,105.1,100.28,105.2,100.78,104.9,101.58,104.8,102.06,104.5,102.02,104.5,101.68,104.4,101.32,104.4,101.81,104.2,102.3,104.1,102.12,103.9,102.1,103.8,101.75,103.9,101.5,104.2,102.16,104.1,103.47,103.8,104.05,103.6,104.09,103.7,103.55,103.5,102.77,103.4,102.89,103.1,103.6,103.1,103.76,103.1,103.92,103.2,103.35,103.3,103.32,103.5,104.2,103.6,105.44,103.5,105.81,103.3,106.25,103.2,105.94,103.1,105.82,103.2,105.96,103,106.49,103,106.32,103.1,105.88,103.4,105.07),dim=c(2,59),dimnames=list(c('Werkl','Infl'),1:59)) > y <- array(NA,dim=c(2,59),dimnames=list(c('Werkl','Infl'),1:59)) > 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 = '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 Werkl Infl M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 106.1 97.89 1 0 0 0 0 0 0 0 0 0 0 2 106.0 98.69 0 1 0 0 0 0 0 0 0 0 0 3 105.9 99.01 0 0 1 0 0 0 0 0 0 0 0 4 105.8 99.18 0 0 0 1 0 0 0 0 0 0 0 5 105.7 98.45 0 0 0 0 1 0 0 0 0 0 0 6 105.6 98.13 0 0 0 0 0 1 0 0 0 0 0 7 105.4 98.29 0 0 0 0 0 0 1 0 0 0 0 8 105.4 99.10 0 0 0 0 0 0 0 1 0 0 0 9 105.5 99.26 0 0 0 0 0 0 0 0 1 0 0 10 105.6 98.85 0 0 0 0 0 0 0 0 0 1 0 11 105.7 98.05 0 0 0 0 0 0 0 0 0 0 1 12 105.9 98.53 0 0 0 0 0 0 0 0 0 0 0 13 106.1 99.34 1 0 0 0 0 0 0 0 0 0 0 14 106.0 100.14 0 1 0 0 0 0 0 0 0 0 0 15 105.8 100.30 0 0 1 0 0 0 0 0 0 0 0 16 105.8 100.22 0 0 0 1 0 0 0 0 0 0 0 17 105.7 99.90 0 0 0 0 1 0 0 0 0 0 0 18 105.5 99.58 0 0 0 0 0 1 0 0 0 0 0 19 105.3 99.90 0 0 0 0 0 0 1 0 0 0 0 20 105.2 100.78 0 0 0 0 0 0 0 1 0 0 0 21 105.2 100.78 0 0 0 0 0 0 0 0 1 0 0 22 105.0 100.46 0 0 0 0 0 0 0 0 0 1 0 23 105.1 100.06 0 0 0 0 0 0 0 0 0 0 1 24 105.1 100.28 0 0 0 0 0 0 0 0 0 0 0 25 105.2 100.78 1 0 0 0 0 0 0 0 0 0 0 26 104.9 101.58 0 1 0 0 0 0 0 0 0 0 0 27 104.8 102.06 0 0 1 0 0 0 0 0 0 0 0 28 104.5 102.02 0 0 0 1 0 0 0 0 0 0 0 29 104.5 101.68 0 0 0 0 1 0 0 0 0 0 0 30 104.4 101.32 0 0 0 0 0 1 0 0 0 0 0 31 104.4 101.81 0 0 0 0 0 0 1 0 0 0 0 32 104.2 102.30 0 0 0 0 0 0 0 1 0 0 0 33 104.1 102.12 0 0 0 0 0 0 0 0 1 0 0 34 103.9 102.10 0 0 0 0 0 0 0 0 0 1 0 35 103.8 101.75 0 0 0 0 0 0 0 0 0 0 1 36 103.9 101.50 0 0 0 0 0 0 0 0 0 0 0 37 104.2 102.16 1 0 0 0 0 0 0 0 0 0 0 38 104.1 103.47 0 1 0 0 0 0 0 0 0 0 0 39 103.8 104.05 0 0 1 0 0 0 0 0 0 0 0 40 103.6 104.09 0 0 0 1 0 0 0 0 0 0 0 41 103.7 103.55 0 0 0 0 1 0 0 0 0 0 0 42 103.5 102.77 0 0 0 0 0 1 0 0 0 0 0 43 103.4 102.89 0 0 0 0 0 0 1 0 0 0 0 44 103.1 103.60 0 0 0 0 0 0 0 1 0 0 0 45 103.1 103.76 0 0 0 0 0 0 0 0 1 0 0 46 103.1 103.92 0 0 0 0 0 0 0 0 0 1 0 47 103.2 103.35 0 0 0 0 0 0 0 0 0 0 1 48 103.3 103.32 0 0 0 0 0 0 0 0 0 0 0 49 103.5 104.20 1 0 0 0 0 0 0 0 0 0 0 50 103.6 105.44 0 1 0 0 0 0 0 0 0 0 0 51 103.5 105.81 0 0 1 0 0 0 0 0 0 0 0 52 103.3 106.25 0 0 0 1 0 0 0 0 0 0 0 53 103.2 105.94 0 0 0 0 1 0 0 0 0 0 0 54 103.1 105.82 0 0 0 0 0 1 0 0 0 0 0 55 103.2 105.96 0 0 0 0 0 0 1 0 0 0 0 56 103.0 106.49 0 0 0 0 0 0 0 1 0 0 0 57 103.0 106.32 0 0 0 0 0 0 0 0 1 0 0 58 103.1 105.88 0 0 0 0 0 0 0 0 0 1 0 59 103.4 105.07 0 0 0 0 0 0 0 0 0 0 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Infl M1 M2 M3 M4 143.97372 -0.39069 0.45691 0.74370 0.73294 0.61435 M5 M6 M7 M8 M9 M10 0.39932 0.11086 0.12697 0.23420 0.23186 0.11138 M11 -0.01757 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.63227 -0.22513 -0.03927 0.29228 0.49700 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 143.97372 1.85253 77.717 < 2e-16 *** Infl -0.39069 0.01828 -21.374 < 2e-16 *** M1 0.45691 0.23101 1.978 0.05395 . M2 0.74370 0.23167 3.210 0.00242 ** M3 0.73294 0.23230 3.155 0.00283 ** M4 0.61435 0.23251 2.642 0.01122 * M5 0.39932 0.23173 1.723 0.09156 . M6 0.11086 0.23128 0.479 0.63397 M7 0.12697 0.23155 0.548 0.58609 M8 0.23420 0.23273 1.006 0.31952 M9 0.23186 0.23272 0.996 0.32431 M10 0.11138 0.23229 0.479 0.63387 M11 -0.01757 0.23141 -0.076 0.93982 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.3444 on 46 degrees of freedom Multiple R-squared: 0.9154, Adjusted R-squared: 0.8933 F-statistic: 41.45 on 12 and 46 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,] 1.224131e-03 2.448262e-03 0.99877587 [2,] 1.162501e-04 2.325003e-04 0.99988375 [3,] 3.109137e-05 6.218274e-05 0.99996891 [4,] 5.111783e-06 1.022357e-05 0.99999489 [5,] 7.557763e-06 1.511553e-05 0.99999244 [6,] 4.005785e-05 8.011570e-05 0.99995994 [7,] 2.131631e-03 4.263261e-03 0.99786837 [8,] 5.142889e-03 1.028578e-02 0.99485711 [9,] 3.995516e-02 7.991032e-02 0.96004484 [10,] 1.334341e-01 2.668682e-01 0.86656588 [11,] 2.652389e-01 5.304779e-01 0.73476107 [12,] 3.120984e-01 6.241967e-01 0.68790165 [13,] 4.228364e-01 8.456728e-01 0.57716360 [14,] 4.260531e-01 8.521062e-01 0.57394688 [15,] 4.393589e-01 8.787178e-01 0.56064109 [16,] 4.832886e-01 9.665772e-01 0.51671142 [17,] 6.422771e-01 7.154457e-01 0.35772287 [18,] 8.305245e-01 3.389510e-01 0.16947552 [19,] 8.965069e-01 2.069861e-01 0.10349305 [20,] 8.976132e-01 2.047737e-01 0.10238684 [21,] 9.454822e-01 1.090356e-01 0.05451779 [22,] 9.780925e-01 4.381499e-02 0.02190750 [23,] 9.803688e-01 3.926237e-02 0.01963118 [24,] 9.653626e-01 6.927486e-02 0.03463743 [25,] 9.375666e-01 1.248668e-01 0.06243339 [26,] 9.602663e-01 7.946749e-02 0.03973374 [27,] 9.720421e-01 5.591582e-02 0.02795791 [28,] 9.450905e-01 1.098191e-01 0.05490953 > postscript(file="/var/www/html/rcomp/tmp/1x78g1258668001.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/2h6yn1258668001.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/3q0ks1258668001.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/4ycgz1258668001.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/518jb1258668001.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 = 59 Frequency = 1 1 2 3 4 5 6 -0.08582383 -0.16005524 -0.12427812 -0.03927386 -0.20944890 -0.14600740 7 8 9 10 11 12 -0.29960688 -0.09037973 0.07447508 0.13477399 0.05116598 0.42113065 13 14 15 16 17 18 0.48067904 0.40644763 0.27971409 0.36704544 0.35705397 0.32049547 19 20 21 22 23 24 0.22940665 0.36598221 0.36832636 0.16378751 0.23645616 0.30484100 25 26 27 28 29 30 0.14327499 -0.13095642 -0.03266864 -0.22970962 -0.14751493 -0.09970109 31 32 33 34 35 36 0.07562767 -0.04016651 -0.20814686 -0.29547821 -0.40327499 -0.41851521 37 38 39 40 41 42 -0.31757056 -0.19254924 -0.25519230 -0.32097794 -0.21692157 -0.43319823 43 44 45 46 47 48 -0.50242537 -0.63226739 -0.56741258 -0.38441944 -0.37816838 -0.30745644 49 50 51 52 53 54 -0.22055963 0.07711327 0.13242497 0.22291598 0.21683142 0.35841125 55 56 57 58 59 0.49699794 0.39683142 0.33275800 0.38133616 0.49382123 > postscript(file="/var/www/html/rcomp/tmp/6j3vp1258668001.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 = 59 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.08582383 NA 1 -0.16005524 -0.08582383 2 -0.12427812 -0.16005524 3 -0.03927386 -0.12427812 4 -0.20944890 -0.03927386 5 -0.14600740 -0.20944890 6 -0.29960688 -0.14600740 7 -0.09037973 -0.29960688 8 0.07447508 -0.09037973 9 0.13477399 0.07447508 10 0.05116598 0.13477399 11 0.42113065 0.05116598 12 0.48067904 0.42113065 13 0.40644763 0.48067904 14 0.27971409 0.40644763 15 0.36704544 0.27971409 16 0.35705397 0.36704544 17 0.32049547 0.35705397 18 0.22940665 0.32049547 19 0.36598221 0.22940665 20 0.36832636 0.36598221 21 0.16378751 0.36832636 22 0.23645616 0.16378751 23 0.30484100 0.23645616 24 0.14327499 0.30484100 25 -0.13095642 0.14327499 26 -0.03266864 -0.13095642 27 -0.22970962 -0.03266864 28 -0.14751493 -0.22970962 29 -0.09970109 -0.14751493 30 0.07562767 -0.09970109 31 -0.04016651 0.07562767 32 -0.20814686 -0.04016651 33 -0.29547821 -0.20814686 34 -0.40327499 -0.29547821 35 -0.41851521 -0.40327499 36 -0.31757056 -0.41851521 37 -0.19254924 -0.31757056 38 -0.25519230 -0.19254924 39 -0.32097794 -0.25519230 40 -0.21692157 -0.32097794 41 -0.43319823 -0.21692157 42 -0.50242537 -0.43319823 43 -0.63226739 -0.50242537 44 -0.56741258 -0.63226739 45 -0.38441944 -0.56741258 46 -0.37816838 -0.38441944 47 -0.30745644 -0.37816838 48 -0.22055963 -0.30745644 49 0.07711327 -0.22055963 50 0.13242497 0.07711327 51 0.22291598 0.13242497 52 0.21683142 0.22291598 53 0.35841125 0.21683142 54 0.49699794 0.35841125 55 0.39683142 0.49699794 56 0.33275800 0.39683142 57 0.38133616 0.33275800 58 0.49382123 0.38133616 59 NA 0.49382123 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.16005524 -0.08582383 [2,] -0.12427812 -0.16005524 [3,] -0.03927386 -0.12427812 [4,] -0.20944890 -0.03927386 [5,] -0.14600740 -0.20944890 [6,] -0.29960688 -0.14600740 [7,] -0.09037973 -0.29960688 [8,] 0.07447508 -0.09037973 [9,] 0.13477399 0.07447508 [10,] 0.05116598 0.13477399 [11,] 0.42113065 0.05116598 [12,] 0.48067904 0.42113065 [13,] 0.40644763 0.48067904 [14,] 0.27971409 0.40644763 [15,] 0.36704544 0.27971409 [16,] 0.35705397 0.36704544 [17,] 0.32049547 0.35705397 [18,] 0.22940665 0.32049547 [19,] 0.36598221 0.22940665 [20,] 0.36832636 0.36598221 [21,] 0.16378751 0.36832636 [22,] 0.23645616 0.16378751 [23,] 0.30484100 0.23645616 [24,] 0.14327499 0.30484100 [25,] -0.13095642 0.14327499 [26,] -0.03266864 -0.13095642 [27,] -0.22970962 -0.03266864 [28,] -0.14751493 -0.22970962 [29,] -0.09970109 -0.14751493 [30,] 0.07562767 -0.09970109 [31,] -0.04016651 0.07562767 [32,] -0.20814686 -0.04016651 [33,] -0.29547821 -0.20814686 [34,] -0.40327499 -0.29547821 [35,] -0.41851521 -0.40327499 [36,] -0.31757056 -0.41851521 [37,] -0.19254924 -0.31757056 [38,] -0.25519230 -0.19254924 [39,] -0.32097794 -0.25519230 [40,] -0.21692157 -0.32097794 [41,] -0.43319823 -0.21692157 [42,] -0.50242537 -0.43319823 [43,] -0.63226739 -0.50242537 [44,] -0.56741258 -0.63226739 [45,] -0.38441944 -0.56741258 [46,] -0.37816838 -0.38441944 [47,] -0.30745644 -0.37816838 [48,] -0.22055963 -0.30745644 [49,] 0.07711327 -0.22055963 [50,] 0.13242497 0.07711327 [51,] 0.22291598 0.13242497 [52,] 0.21683142 0.22291598 [53,] 0.35841125 0.21683142 [54,] 0.49699794 0.35841125 [55,] 0.39683142 0.49699794 [56,] 0.33275800 0.39683142 [57,] 0.38133616 0.33275800 [58,] 0.49382123 0.38133616 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.16005524 -0.08582383 2 -0.12427812 -0.16005524 3 -0.03927386 -0.12427812 4 -0.20944890 -0.03927386 5 -0.14600740 -0.20944890 6 -0.29960688 -0.14600740 7 -0.09037973 -0.29960688 8 0.07447508 -0.09037973 9 0.13477399 0.07447508 10 0.05116598 0.13477399 11 0.42113065 0.05116598 12 0.48067904 0.42113065 13 0.40644763 0.48067904 14 0.27971409 0.40644763 15 0.36704544 0.27971409 16 0.35705397 0.36704544 17 0.32049547 0.35705397 18 0.22940665 0.32049547 19 0.36598221 0.22940665 20 0.36832636 0.36598221 21 0.16378751 0.36832636 22 0.23645616 0.16378751 23 0.30484100 0.23645616 24 0.14327499 0.30484100 25 -0.13095642 0.14327499 26 -0.03266864 -0.13095642 27 -0.22970962 -0.03266864 28 -0.14751493 -0.22970962 29 -0.09970109 -0.14751493 30 0.07562767 -0.09970109 31 -0.04016651 0.07562767 32 -0.20814686 -0.04016651 33 -0.29547821 -0.20814686 34 -0.40327499 -0.29547821 35 -0.41851521 -0.40327499 36 -0.31757056 -0.41851521 37 -0.19254924 -0.31757056 38 -0.25519230 -0.19254924 39 -0.32097794 -0.25519230 40 -0.21692157 -0.32097794 41 -0.43319823 -0.21692157 42 -0.50242537 -0.43319823 43 -0.63226739 -0.50242537 44 -0.56741258 -0.63226739 45 -0.38441944 -0.56741258 46 -0.37816838 -0.38441944 47 -0.30745644 -0.37816838 48 -0.22055963 -0.30745644 49 0.07711327 -0.22055963 50 0.13242497 0.07711327 51 0.22291598 0.13242497 52 0.21683142 0.22291598 53 0.35841125 0.21683142 54 0.49699794 0.35841125 55 0.39683142 0.49699794 56 0.33275800 0.39683142 57 0.38133616 0.33275800 58 0.49382123 0.38133616 > 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/7k0nd1258668001.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/8imqw1258668001.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/9qoh41258668001.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/1000sp1258668002.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/11sadw1258668002.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/12osf41258668002.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/13n9fm1258668002.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/14zqyy1258668002.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/15dot81258668002.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/16z8m61258668002.tab") + } > > system("convert tmp/1x78g1258668001.ps tmp/1x78g1258668001.png") > system("convert tmp/2h6yn1258668001.ps tmp/2h6yn1258668001.png") > system("convert tmp/3q0ks1258668001.ps tmp/3q0ks1258668001.png") > system("convert tmp/4ycgz1258668001.ps tmp/4ycgz1258668001.png") > system("convert tmp/518jb1258668001.ps tmp/518jb1258668001.png") > system("convert tmp/6j3vp1258668001.ps tmp/6j3vp1258668001.png") > system("convert tmp/7k0nd1258668001.ps tmp/7k0nd1258668001.png") > system("convert tmp/8imqw1258668001.ps tmp/8imqw1258668001.png") > system("convert tmp/9qoh41258668001.ps tmp/9qoh41258668001.png") > system("convert tmp/1000sp1258668002.ps tmp/1000sp1258668002.png") > > > proc.time() user system elapsed 2.515 1.635 3.321