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(7.2,102.9,7.4,97.4,8.8,111.4,9.3,87.4,9.3,96.8,8.7,114.1,8.2,110.3,8.3,103.9,8.5,101.6,8.6,94.6,8.5,95.9,8.2,104.7,8.1,102.8,7.9,98.1,8.6,113.9,8.7,80.9,8.7,95.7,8.5,113.2,8.4,105.9,8.5,108.8,8.7,102.3,8.7,99,8.6,100.7,8.5,115.5,8.3,100.7,8,109.9,8.2,114.6,8.1,85.4,8.1,100.5,8,114.8,7.9,116.5,7.9,112.9,8,102,8,106,7.9,105.3,8,118.8,7.7,106.1,7.2,109.3,7.5,117.2,7.3,92.5,7,104.2,7,112.5,7,122.4,7.2,113.3,7.3,100,7.1,110.7,6.8,112.8,6.4,109.8,6.1,117.3,6.5,109.1,7.7,115.9,7.9,96,7.5,99.8,6.9,116.8,6.6,115.7,6.9,99.4,7.7,94.3,8,91,8,93.2,7.7,103.1,7.3,94.1,7.4,91.8,8.1,102.7,8.3,82.6,8.2,89.1),dim=c(2,65),dimnames=list(c('Werkl.graad','Industr.prod.'),1:65)) > y <- array(NA,dim=c(2,65),dimnames=list(c('Werkl.graad','Industr.prod.'),1:65)) > 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 Werkl.graad Industr.prod. M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 7.2 102.9 1 0 0 0 0 0 0 0 0 0 0 1 2 7.4 97.4 0 1 0 0 0 0 0 0 0 0 0 2 3 8.8 111.4 0 0 1 0 0 0 0 0 0 0 0 3 4 9.3 87.4 0 0 0 1 0 0 0 0 0 0 0 4 5 9.3 96.8 0 0 0 0 1 0 0 0 0 0 0 5 6 8.7 114.1 0 0 0 0 0 1 0 0 0 0 0 6 7 8.2 110.3 0 0 0 0 0 0 1 0 0 0 0 7 8 8.3 103.9 0 0 0 0 0 0 0 1 0 0 0 8 9 8.5 101.6 0 0 0 0 0 0 0 0 1 0 0 9 10 8.6 94.6 0 0 0 0 0 0 0 0 0 1 0 10 11 8.5 95.9 0 0 0 0 0 0 0 0 0 0 1 11 12 8.2 104.7 0 0 0 0 0 0 0 0 0 0 0 12 13 8.1 102.8 1 0 0 0 0 0 0 0 0 0 0 13 14 7.9 98.1 0 1 0 0 0 0 0 0 0 0 0 14 15 8.6 113.9 0 0 1 0 0 0 0 0 0 0 0 15 16 8.7 80.9 0 0 0 1 0 0 0 0 0 0 0 16 17 8.7 95.7 0 0 0 0 1 0 0 0 0 0 0 17 18 8.5 113.2 0 0 0 0 0 1 0 0 0 0 0 18 19 8.4 105.9 0 0 0 0 0 0 1 0 0 0 0 19 20 8.5 108.8 0 0 0 0 0 0 0 1 0 0 0 20 21 8.7 102.3 0 0 0 0 0 0 0 0 1 0 0 21 22 8.7 99.0 0 0 0 0 0 0 0 0 0 1 0 22 23 8.6 100.7 0 0 0 0 0 0 0 0 0 0 1 23 24 8.5 115.5 0 0 0 0 0 0 0 0 0 0 0 24 25 8.3 100.7 1 0 0 0 0 0 0 0 0 0 0 25 26 8.0 109.9 0 1 0 0 0 0 0 0 0 0 0 26 27 8.2 114.6 0 0 1 0 0 0 0 0 0 0 0 27 28 8.1 85.4 0 0 0 1 0 0 0 0 0 0 0 28 29 8.1 100.5 0 0 0 0 1 0 0 0 0 0 0 29 30 8.0 114.8 0 0 0 0 0 1 0 0 0 0 0 30 31 7.9 116.5 0 0 0 0 0 0 1 0 0 0 0 31 32 7.9 112.9 0 0 0 0 0 0 0 1 0 0 0 32 33 8.0 102.0 0 0 0 0 0 0 0 0 1 0 0 33 34 8.0 106.0 0 0 0 0 0 0 0 0 0 1 0 34 35 7.9 105.3 0 0 0 0 0 0 0 0 0 0 1 35 36 8.0 118.8 0 0 0 0 0 0 0 0 0 0 0 36 37 7.7 106.1 1 0 0 0 0 0 0 0 0 0 0 37 38 7.2 109.3 0 1 0 0 0 0 0 0 0 0 0 38 39 7.5 117.2 0 0 1 0 0 0 0 0 0 0 0 39 40 7.3 92.5 0 0 0 1 0 0 0 0 0 0 0 40 41 7.0 104.2 0 0 0 0 1 0 0 0 0 0 0 41 42 7.0 112.5 0 0 0 0 0 1 0 0 0 0 0 42 43 7.0 122.4 0 0 0 0 0 0 1 0 0 0 0 43 44 7.2 113.3 0 0 0 0 0 0 0 1 0 0 0 44 45 7.3 100.0 0 0 0 0 0 0 0 0 1 0 0 45 46 7.1 110.7 0 0 0 0 0 0 0 0 0 1 0 46 47 6.8 112.8 0 0 0 0 0 0 0 0 0 0 1 47 48 6.4 109.8 0 0 0 0 0 0 0 0 0 0 0 48 49 6.1 117.3 1 0 0 0 0 0 0 0 0 0 0 49 50 6.5 109.1 0 1 0 0 0 0 0 0 0 0 0 50 51 7.7 115.9 0 0 1 0 0 0 0 0 0 0 0 51 52 7.9 96.0 0 0 0 1 0 0 0 0 0 0 0 52 53 7.5 99.8 0 0 0 0 1 0 0 0 0 0 0 53 54 6.9 116.8 0 0 0 0 0 1 0 0 0 0 0 54 55 6.6 115.7 0 0 0 0 0 0 1 0 0 0 0 55 56 6.9 99.4 0 0 0 0 0 0 0 1 0 0 0 56 57 7.7 94.3 0 0 0 0 0 0 0 0 1 0 0 57 58 8.0 91.0 0 0 0 0 0 0 0 0 0 1 0 58 59 8.0 93.2 0 0 0 0 0 0 0 0 0 0 1 59 60 7.7 103.1 0 0 0 0 0 0 0 0 0 0 0 60 61 7.3 94.1 1 0 0 0 0 0 0 0 0 0 0 61 62 7.4 91.8 0 1 0 0 0 0 0 0 0 0 0 62 63 8.1 102.7 0 0 1 0 0 0 0 0 0 0 0 63 64 8.3 82.6 0 0 0 1 0 0 0 0 0 0 0 64 65 8.2 89.1 0 0 0 0 1 0 0 0 0 0 0 65 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Industr.prod. M1 M2 M3 13.09433 -0.04081 -0.68631 -0.76971 0.41211 M4 M5 M6 M7 M8 -0.47448 -0.16784 0.08081 -0.10103 -0.20322 M9 M10 M11 t -0.21112 -0.13908 -0.18216 -0.02306 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.10700 -0.26383 0.07073 0.31931 0.75956 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 13.09433 1.13490 11.538 7.87e-16 *** Industr.prod. -0.04081 0.01007 -4.053 0.000173 *** M1 -0.68631 0.28586 -2.401 0.020043 * M2 -0.76970 0.28917 -2.662 0.010371 * M3 0.41210 0.27918 1.476 0.146055 M4 -0.47448 0.36137 -1.313 0.195064 M5 -0.16784 0.30610 -0.548 0.585858 M6 0.08081 0.29371 0.275 0.784311 M7 -0.10103 0.29337 -0.344 0.731986 M8 -0.20322 0.29202 -0.696 0.489641 M9 -0.21112 0.30869 -0.684 0.497130 M10 -0.13908 0.30788 -0.452 0.653371 M11 -0.18216 0.30370 -0.600 0.551295 t -0.02306 0.00305 -7.560 7.13e-10 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4593 on 51 degrees of freedom Multiple R-squared: 0.6575, Adjusted R-squared: 0.5702 F-statistic: 7.532 on 13 and 51 DF, p-value: 5.488e-08 > 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.69932107 0.6013579 0.30067893 [2,] 0.55448053 0.8910389 0.44551947 [3,] 0.48474858 0.9694972 0.51525142 [4,] 0.36164288 0.7232858 0.63835712 [5,] 0.25916765 0.5183353 0.74083235 [6,] 0.17402384 0.3480477 0.82597616 [7,] 0.11016090 0.2203218 0.88983910 [8,] 0.07793796 0.1558759 0.92206204 [9,] 0.09449374 0.1889875 0.90550626 [10,] 0.06983127 0.1396625 0.93016873 [11,] 0.09445724 0.1889145 0.90554276 [12,] 0.23104737 0.4620947 0.76895263 [13,] 0.30603122 0.6120624 0.69396878 [14,] 0.27909341 0.5581868 0.72090659 [15,] 0.23699661 0.4739932 0.76300339 [16,] 0.24107387 0.4821477 0.75892613 [17,] 0.20078307 0.4015661 0.79921693 [18,] 0.17895297 0.3579059 0.82104703 [19,] 0.14755830 0.2951166 0.85244170 [20,] 0.32350798 0.6470160 0.67649202 [21,] 0.48498229 0.9699646 0.51501771 [22,] 0.59506245 0.8098751 0.40493755 [23,] 0.57629928 0.8474014 0.42370072 [24,] 0.64809955 0.7038009 0.35190045 [25,] 0.71986553 0.5602689 0.28013447 [26,] 0.66911714 0.6617657 0.33088286 [27,] 0.74348939 0.5130212 0.25651061 [28,] 0.93429264 0.1314147 0.06570736 [29,] 0.89694451 0.2061110 0.10305549 [30,] 0.82538291 0.3492342 0.17461709 [31,] 0.76046721 0.4790656 0.23953279 [32,] 0.95075465 0.0984907 0.04924535 > postscript(file="/var/www/html/rcomp/tmp/12viv1258661397.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/2l5na1258661397.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/3lj2f1258661397.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/4ijs61258661397.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/5ndve1258661397.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 = 65 Frequency = 1 1 2 3 4 5 6 -0.985883240 -0.903873807 -0.091324230 0.338937642 0.438944912 0.319314507 7 8 9 10 11 12 -0.130856818 -0.166776075 -0.029680574 -0.264310183 -0.245126332 -0.345126332 13 14 15 16 17 18 0.186706096 -0.098638531 0.087364411 -0.249640543 0.070726822 0.359257902 19 20 21 22 23 24 0.166260590 0.509850386 0.475554702 0.291912566 0.327419387 0.672263938 25 26 27 28 29 30 0.577680581 0.759559164 -0.007400313 -0.389337051 -0.056727458 0.201219861 31 32 33 34 35 36 0.375489375 0.353830908 0.039982553 0.154234620 0.091803622 0.583598520 37 38 39 40 41 42 0.474710756 0.211744788 -0.324630929 -0.622934254 -0.729069907 -0.615967138 43 44 45 46 47 48 -0.007076738 -0.053176044 -0.464962219 -0.277300403 -0.425470611 -1.106998228 49 50 51 52 53 54 -0.391576004 -0.219746619 0.098989497 0.396561812 -0.131952499 -0.263825132 55 56 57 58 59 60 -0.403816408 -0.643729175 -0.020894464 0.095463400 0.251373934 0.196262102 61 62 63 64 65 0.138361811 0.250955004 0.237001563 0.526412394 0.408078130 > postscript(file="/var/www/html/rcomp/tmp/6tj3t1258661397.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 = 65 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.985883240 NA 1 -0.903873807 -0.985883240 2 -0.091324230 -0.903873807 3 0.338937642 -0.091324230 4 0.438944912 0.338937642 5 0.319314507 0.438944912 6 -0.130856818 0.319314507 7 -0.166776075 -0.130856818 8 -0.029680574 -0.166776075 9 -0.264310183 -0.029680574 10 -0.245126332 -0.264310183 11 -0.345126332 -0.245126332 12 0.186706096 -0.345126332 13 -0.098638531 0.186706096 14 0.087364411 -0.098638531 15 -0.249640543 0.087364411 16 0.070726822 -0.249640543 17 0.359257902 0.070726822 18 0.166260590 0.359257902 19 0.509850386 0.166260590 20 0.475554702 0.509850386 21 0.291912566 0.475554702 22 0.327419387 0.291912566 23 0.672263938 0.327419387 24 0.577680581 0.672263938 25 0.759559164 0.577680581 26 -0.007400313 0.759559164 27 -0.389337051 -0.007400313 28 -0.056727458 -0.389337051 29 0.201219861 -0.056727458 30 0.375489375 0.201219861 31 0.353830908 0.375489375 32 0.039982553 0.353830908 33 0.154234620 0.039982553 34 0.091803622 0.154234620 35 0.583598520 0.091803622 36 0.474710756 0.583598520 37 0.211744788 0.474710756 38 -0.324630929 0.211744788 39 -0.622934254 -0.324630929 40 -0.729069907 -0.622934254 41 -0.615967138 -0.729069907 42 -0.007076738 -0.615967138 43 -0.053176044 -0.007076738 44 -0.464962219 -0.053176044 45 -0.277300403 -0.464962219 46 -0.425470611 -0.277300403 47 -1.106998228 -0.425470611 48 -0.391576004 -1.106998228 49 -0.219746619 -0.391576004 50 0.098989497 -0.219746619 51 0.396561812 0.098989497 52 -0.131952499 0.396561812 53 -0.263825132 -0.131952499 54 -0.403816408 -0.263825132 55 -0.643729175 -0.403816408 56 -0.020894464 -0.643729175 57 0.095463400 -0.020894464 58 0.251373934 0.095463400 59 0.196262102 0.251373934 60 0.138361811 0.196262102 61 0.250955004 0.138361811 62 0.237001563 0.250955004 63 0.526412394 0.237001563 64 0.408078130 0.526412394 65 NA 0.408078130 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.903873807 -0.985883240 [2,] -0.091324230 -0.903873807 [3,] 0.338937642 -0.091324230 [4,] 0.438944912 0.338937642 [5,] 0.319314507 0.438944912 [6,] -0.130856818 0.319314507 [7,] -0.166776075 -0.130856818 [8,] -0.029680574 -0.166776075 [9,] -0.264310183 -0.029680574 [10,] -0.245126332 -0.264310183 [11,] -0.345126332 -0.245126332 [12,] 0.186706096 -0.345126332 [13,] -0.098638531 0.186706096 [14,] 0.087364411 -0.098638531 [15,] -0.249640543 0.087364411 [16,] 0.070726822 -0.249640543 [17,] 0.359257902 0.070726822 [18,] 0.166260590 0.359257902 [19,] 0.509850386 0.166260590 [20,] 0.475554702 0.509850386 [21,] 0.291912566 0.475554702 [22,] 0.327419387 0.291912566 [23,] 0.672263938 0.327419387 [24,] 0.577680581 0.672263938 [25,] 0.759559164 0.577680581 [26,] -0.007400313 0.759559164 [27,] -0.389337051 -0.007400313 [28,] -0.056727458 -0.389337051 [29,] 0.201219861 -0.056727458 [30,] 0.375489375 0.201219861 [31,] 0.353830908 0.375489375 [32,] 0.039982553 0.353830908 [33,] 0.154234620 0.039982553 [34,] 0.091803622 0.154234620 [35,] 0.583598520 0.091803622 [36,] 0.474710756 0.583598520 [37,] 0.211744788 0.474710756 [38,] -0.324630929 0.211744788 [39,] -0.622934254 -0.324630929 [40,] -0.729069907 -0.622934254 [41,] -0.615967138 -0.729069907 [42,] -0.007076738 -0.615967138 [43,] -0.053176044 -0.007076738 [44,] -0.464962219 -0.053176044 [45,] -0.277300403 -0.464962219 [46,] -0.425470611 -0.277300403 [47,] -1.106998228 -0.425470611 [48,] -0.391576004 -1.106998228 [49,] -0.219746619 -0.391576004 [50,] 0.098989497 -0.219746619 [51,] 0.396561812 0.098989497 [52,] -0.131952499 0.396561812 [53,] -0.263825132 -0.131952499 [54,] -0.403816408 -0.263825132 [55,] -0.643729175 -0.403816408 [56,] -0.020894464 -0.643729175 [57,] 0.095463400 -0.020894464 [58,] 0.251373934 0.095463400 [59,] 0.196262102 0.251373934 [60,] 0.138361811 0.196262102 [61,] 0.250955004 0.138361811 [62,] 0.237001563 0.250955004 [63,] 0.526412394 0.237001563 [64,] 0.408078130 0.526412394 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.903873807 -0.985883240 2 -0.091324230 -0.903873807 3 0.338937642 -0.091324230 4 0.438944912 0.338937642 5 0.319314507 0.438944912 6 -0.130856818 0.319314507 7 -0.166776075 -0.130856818 8 -0.029680574 -0.166776075 9 -0.264310183 -0.029680574 10 -0.245126332 -0.264310183 11 -0.345126332 -0.245126332 12 0.186706096 -0.345126332 13 -0.098638531 0.186706096 14 0.087364411 -0.098638531 15 -0.249640543 0.087364411 16 0.070726822 -0.249640543 17 0.359257902 0.070726822 18 0.166260590 0.359257902 19 0.509850386 0.166260590 20 0.475554702 0.509850386 21 0.291912566 0.475554702 22 0.327419387 0.291912566 23 0.672263938 0.327419387 24 0.577680581 0.672263938 25 0.759559164 0.577680581 26 -0.007400313 0.759559164 27 -0.389337051 -0.007400313 28 -0.056727458 -0.389337051 29 0.201219861 -0.056727458 30 0.375489375 0.201219861 31 0.353830908 0.375489375 32 0.039982553 0.353830908 33 0.154234620 0.039982553 34 0.091803622 0.154234620 35 0.583598520 0.091803622 36 0.474710756 0.583598520 37 0.211744788 0.474710756 38 -0.324630929 0.211744788 39 -0.622934254 -0.324630929 40 -0.729069907 -0.622934254 41 -0.615967138 -0.729069907 42 -0.007076738 -0.615967138 43 -0.053176044 -0.007076738 44 -0.464962219 -0.053176044 45 -0.277300403 -0.464962219 46 -0.425470611 -0.277300403 47 -1.106998228 -0.425470611 48 -0.391576004 -1.106998228 49 -0.219746619 -0.391576004 50 0.098989497 -0.219746619 51 0.396561812 0.098989497 52 -0.131952499 0.396561812 53 -0.263825132 -0.131952499 54 -0.403816408 -0.263825132 55 -0.643729175 -0.403816408 56 -0.020894464 -0.643729175 57 0.095463400 -0.020894464 58 0.251373934 0.095463400 59 0.196262102 0.251373934 60 0.138361811 0.196262102 61 0.250955004 0.138361811 62 0.237001563 0.250955004 63 0.526412394 0.237001563 64 0.408078130 0.526412394 > 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/7obh51258661397.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/8prdr1258661397.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/9zy211258661397.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/104y0k1258661397.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/11u0ts1258661398.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/12dx5d1258661398.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/13p1b61258661398.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/14ydfm1258661398.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/15y25d1258661398.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/16d3r61258661398.tab") + } > > system("convert tmp/12viv1258661397.ps tmp/12viv1258661397.png") > system("convert tmp/2l5na1258661397.ps tmp/2l5na1258661397.png") > system("convert tmp/3lj2f1258661397.ps tmp/3lj2f1258661397.png") > system("convert tmp/4ijs61258661397.ps tmp/4ijs61258661397.png") > system("convert tmp/5ndve1258661397.ps tmp/5ndve1258661397.png") > system("convert tmp/6tj3t1258661397.ps tmp/6tj3t1258661397.png") > system("convert tmp/7obh51258661397.ps tmp/7obh51258661397.png") > system("convert tmp/8prdr1258661397.ps tmp/8prdr1258661397.png") > system("convert tmp/9zy211258661397.ps tmp/9zy211258661397.png") > system("convert tmp/104y0k1258661397.ps tmp/104y0k1258661397.png") > > > proc.time() user system elapsed 2.415 1.551 2.830