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(100.0,100.0,95.3,100.6,90.7,114.2,88.4,91.5,86.0,94.7,86.0,110.6,95.3,71.3,95.3,104.1,88.4,112.3,86.0,110.2,81.4,112.9,83.7,95.1,95.3,103.1,88.4,101.9,86.0,100.4,83.7,106.9,76.7,100.7,79.1,114.3,86.0,73.3,86.0,105.9,79.1,113.9,76.7,112.1,69.8,117.5,69.8,97.5,76.7,112.3,69.8,106.9,67.4,120.9,65.1,92.7,58.1,110.9,60.5,116.5,65.1,77.1,62.8,113.1,55.8,115.9,51.2,123.5,48.8,123.6,48.8,101.5,53.5,121.0,48.8,112.2,46.5,126.0,44.2,101.8,39.5,117.9,41.9,122.2,48.8,82.7,46.5,120.5,41.9,120.3,39.5,134.2,37.2,128.2,37.2,100.5,41.9,126.0,39.5,122.9,39.5,106.1,34.9,130.4,34.9,121.3,34.9,126.1,41.9,88.7,41.9,118.7,39.5,129.3,39.5,136.2,41.9,123.0,46.5,103.5),dim=c(2,60),dimnames=list(c('Werkloosheid','Productie'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Werkloosheid','Productie'),1:60)) > 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 Werkloosheid Productie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 100.0 100.0 1 0 0 0 0 0 0 0 0 0 0 2 95.3 100.6 0 1 0 0 0 0 0 0 0 0 0 3 90.7 114.2 0 0 1 0 0 0 0 0 0 0 0 4 88.4 91.5 0 0 0 1 0 0 0 0 0 0 0 5 86.0 94.7 0 0 0 0 1 0 0 0 0 0 0 6 86.0 110.6 0 0 0 0 0 1 0 0 0 0 0 7 95.3 71.3 0 0 0 0 0 0 1 0 0 0 0 8 95.3 104.1 0 0 0 0 0 0 0 1 0 0 0 9 88.4 112.3 0 0 0 0 0 0 0 0 1 0 0 10 86.0 110.2 0 0 0 0 0 0 0 0 0 1 0 11 81.4 112.9 0 0 0 0 0 0 0 0 0 0 1 12 83.7 95.1 0 0 0 0 0 0 0 0 0 0 0 13 95.3 103.1 1 0 0 0 0 0 0 0 0 0 0 14 88.4 101.9 0 1 0 0 0 0 0 0 0 0 0 15 86.0 100.4 0 0 1 0 0 0 0 0 0 0 0 16 83.7 106.9 0 0 0 1 0 0 0 0 0 0 0 17 76.7 100.7 0 0 0 0 1 0 0 0 0 0 0 18 79.1 114.3 0 0 0 0 0 1 0 0 0 0 0 19 86.0 73.3 0 0 0 0 0 0 1 0 0 0 0 20 86.0 105.9 0 0 0 0 0 0 0 1 0 0 0 21 79.1 113.9 0 0 0 0 0 0 0 0 1 0 0 22 76.7 112.1 0 0 0 0 0 0 0 0 0 1 0 23 69.8 117.5 0 0 0 0 0 0 0 0 0 0 1 24 69.8 97.5 0 0 0 0 0 0 0 0 0 0 0 25 76.7 112.3 1 0 0 0 0 0 0 0 0 0 0 26 69.8 106.9 0 1 0 0 0 0 0 0 0 0 0 27 67.4 120.9 0 0 1 0 0 0 0 0 0 0 0 28 65.1 92.7 0 0 0 1 0 0 0 0 0 0 0 29 58.1 110.9 0 0 0 0 1 0 0 0 0 0 0 30 60.5 116.5 0 0 0 0 0 1 0 0 0 0 0 31 65.1 77.1 0 0 0 0 0 0 1 0 0 0 0 32 62.8 113.1 0 0 0 0 0 0 0 1 0 0 0 33 55.8 115.9 0 0 0 0 0 0 0 0 1 0 0 34 51.2 123.5 0 0 0 0 0 0 0 0 0 1 0 35 48.8 123.6 0 0 0 0 0 0 0 0 0 0 1 36 48.8 101.5 0 0 0 0 0 0 0 0 0 0 0 37 53.5 121.0 1 0 0 0 0 0 0 0 0 0 0 38 48.8 112.2 0 1 0 0 0 0 0 0 0 0 0 39 46.5 126.0 0 0 1 0 0 0 0 0 0 0 0 40 44.2 101.8 0 0 0 1 0 0 0 0 0 0 0 41 39.5 117.9 0 0 0 0 1 0 0 0 0 0 0 42 41.9 122.2 0 0 0 0 0 1 0 0 0 0 0 43 48.8 82.7 0 0 0 0 0 0 1 0 0 0 0 44 46.5 120.5 0 0 0 0 0 0 0 1 0 0 0 45 41.9 120.3 0 0 0 0 0 0 0 0 1 0 0 46 39.5 134.2 0 0 0 0 0 0 0 0 0 1 0 47 37.2 128.2 0 0 0 0 0 0 0 0 0 0 1 48 37.2 100.5 0 0 0 0 0 0 0 0 0 0 0 49 41.9 126.0 1 0 0 0 0 0 0 0 0 0 0 50 39.5 122.9 0 1 0 0 0 0 0 0 0 0 0 51 39.5 106.1 0 0 1 0 0 0 0 0 0 0 0 52 34.9 130.4 0 0 0 1 0 0 0 0 0 0 0 53 34.9 121.3 0 0 0 0 1 0 0 0 0 0 0 54 34.9 126.1 0 0 0 0 0 1 0 0 0 0 0 55 41.9 88.7 0 0 0 0 0 0 1 0 0 0 0 56 41.9 118.7 0 0 0 0 0 0 0 1 0 0 0 57 39.5 129.3 0 0 0 0 0 0 0 0 1 0 0 58 39.5 136.2 0 0 0 0 0 0 0 0 0 1 0 59 41.9 123.0 0 0 0 0 0 0 0 0 0 0 1 60 46.5 103.5 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Productie M1 M2 M3 M4 249.415 -1.929 41.093 29.066 35.640 15.785 M5 M6 M7 M8 M9 M10 20.132 38.628 -30.299 34.075 39.860 46.954 M11 39.950 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -40.8368 -5.3745 -0.7124 7.4410 25.9920 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 249.4152 21.0715 11.837 1.06e-15 *** Productie -1.9295 0.2029 -9.508 1.59e-12 *** M1 41.0932 8.8034 4.668 2.56e-05 *** M2 29.0656 8.6160 3.373 0.001495 ** M3 35.6398 8.8682 4.019 0.000210 *** M4 15.7846 8.4697 1.864 0.068624 . M5 20.1315 8.6250 2.334 0.023917 * M6 38.6281 9.1929 4.202 0.000117 *** M7 -30.2992 9.4260 -3.214 0.002364 ** M8 34.0746 8.8022 3.871 0.000333 *** M9 39.8599 9.2261 4.320 8.01e-05 *** M10 46.9544 9.6780 4.852 1.39e-05 *** M11 39.9495 9.4648 4.221 0.000110 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 13.29 on 47 degrees of freedom Multiple R-squared: 0.6785, Adjusted R-squared: 0.5964 F-statistic: 8.266 on 12 and 47 DF, p-value: 4.502e-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.05844334 0.116886681 0.941556660 [2,] 0.04219800 0.084395993 0.957802003 [3,] 0.02551279 0.051025577 0.974487211 [4,] 0.02351446 0.047028924 0.976485538 [5,] 0.02254237 0.045084742 0.977457629 [6,] 0.02558780 0.051175597 0.974412202 [7,] 0.02164482 0.043289645 0.978355177 [8,] 0.02650451 0.053009017 0.973495492 [9,] 0.05157543 0.103150859 0.948424571 [10,] 0.10816889 0.216337772 0.891831114 [11,] 0.23153868 0.463077356 0.768461322 [12,] 0.42499255 0.849985095 0.575007452 [13,] 0.75073978 0.498520446 0.249260223 [14,] 0.79223238 0.415535248 0.207767624 [15,] 0.90479974 0.190400525 0.095200263 [16,] 0.96273313 0.074533734 0.037266867 [17,] 0.98822414 0.023551729 0.011775865 [18,] 0.99623259 0.007534828 0.003767414 [19,] 0.99604456 0.007910884 0.003955442 [20,] 0.99648789 0.007024230 0.003512115 [21,] 0.99654011 0.006919782 0.003459891 [22,] 0.99700069 0.005998620 0.002999310 [23,] 0.99666918 0.006661631 0.003330816 [24,] 0.99856172 0.002876559 0.001438280 [25,] 0.99721746 0.005565080 0.002782540 [26,] 0.99206594 0.015868115 0.007934057 [27,] 0.98516529 0.029669415 0.014834707 [28,] 0.97131458 0.057370847 0.028685423 [29,] 0.93246647 0.135067062 0.067533531 > postscript(file="/var/www/html/rcomp/tmp/16osa1261305346.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/22mgh1261305346.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/3y7h81261305346.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/44hft1261305346.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/5sckt1261305346.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 = 60 Frequency = 1 1 2 3 4 5 6 2.4400409 10.9252836 25.9920491 -0.2520081 -0.8245682 11.3575882 7 8 9 10 11 12 13.7561779 12.6695146 15.8059172 2.2595300 9.8740011 17.7787328 13 14 15 16 17 18 3.7214410 6.5336127 -5.3348288 24.7620439 1.4523352 11.5966786 19 20 21 22 23 24 8.3151457 6.8425856 9.5930915 -3.3744506 7.1496270 8.5094941 25 26 27 28 29 30 2.8726929 -2.4189678 15.6195912 -21.2366274 2.5330710 -2.7584568 31 32 33 34 35 36 -5.2528155 -2.4651303 -9.8479407 -6.8783342 -2.0805212 -4.7725703 37 38 39 40 41 42 -3.5407972 -13.1927031 4.5599591 -24.5783240 -2.5605417 -10.3603986 43 44 45 46 47 48 -10.7477057 -4.4869494 -15.2582116 2.0671435 -4.8048953 -18.3020542 49 50 51 52 53 54 -5.4933777 -1.8472254 -40.8367705 21.3049156 -0.6002964 -9.8354114 55 56 57 58 59 60 -6.0708023 -12.5600205 -0.2928565 5.9261113 -10.1382116 -3.2136025 > postscript(file="/var/www/html/rcomp/tmp/6t5061261305346.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 2.4400409 NA 1 10.9252836 2.4400409 2 25.9920491 10.9252836 3 -0.2520081 25.9920491 4 -0.8245682 -0.2520081 5 11.3575882 -0.8245682 6 13.7561779 11.3575882 7 12.6695146 13.7561779 8 15.8059172 12.6695146 9 2.2595300 15.8059172 10 9.8740011 2.2595300 11 17.7787328 9.8740011 12 3.7214410 17.7787328 13 6.5336127 3.7214410 14 -5.3348288 6.5336127 15 24.7620439 -5.3348288 16 1.4523352 24.7620439 17 11.5966786 1.4523352 18 8.3151457 11.5966786 19 6.8425856 8.3151457 20 9.5930915 6.8425856 21 -3.3744506 9.5930915 22 7.1496270 -3.3744506 23 8.5094941 7.1496270 24 2.8726929 8.5094941 25 -2.4189678 2.8726929 26 15.6195912 -2.4189678 27 -21.2366274 15.6195912 28 2.5330710 -21.2366274 29 -2.7584568 2.5330710 30 -5.2528155 -2.7584568 31 -2.4651303 -5.2528155 32 -9.8479407 -2.4651303 33 -6.8783342 -9.8479407 34 -2.0805212 -6.8783342 35 -4.7725703 -2.0805212 36 -3.5407972 -4.7725703 37 -13.1927031 -3.5407972 38 4.5599591 -13.1927031 39 -24.5783240 4.5599591 40 -2.5605417 -24.5783240 41 -10.3603986 -2.5605417 42 -10.7477057 -10.3603986 43 -4.4869494 -10.7477057 44 -15.2582116 -4.4869494 45 2.0671435 -15.2582116 46 -4.8048953 2.0671435 47 -18.3020542 -4.8048953 48 -5.4933777 -18.3020542 49 -1.8472254 -5.4933777 50 -40.8367705 -1.8472254 51 21.3049156 -40.8367705 52 -0.6002964 21.3049156 53 -9.8354114 -0.6002964 54 -6.0708023 -9.8354114 55 -12.5600205 -6.0708023 56 -0.2928565 -12.5600205 57 5.9261113 -0.2928565 58 -10.1382116 5.9261113 59 -3.2136025 -10.1382116 60 NA -3.2136025 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 10.9252836 2.4400409 [2,] 25.9920491 10.9252836 [3,] -0.2520081 25.9920491 [4,] -0.8245682 -0.2520081 [5,] 11.3575882 -0.8245682 [6,] 13.7561779 11.3575882 [7,] 12.6695146 13.7561779 [8,] 15.8059172 12.6695146 [9,] 2.2595300 15.8059172 [10,] 9.8740011 2.2595300 [11,] 17.7787328 9.8740011 [12,] 3.7214410 17.7787328 [13,] 6.5336127 3.7214410 [14,] -5.3348288 6.5336127 [15,] 24.7620439 -5.3348288 [16,] 1.4523352 24.7620439 [17,] 11.5966786 1.4523352 [18,] 8.3151457 11.5966786 [19,] 6.8425856 8.3151457 [20,] 9.5930915 6.8425856 [21,] -3.3744506 9.5930915 [22,] 7.1496270 -3.3744506 [23,] 8.5094941 7.1496270 [24,] 2.8726929 8.5094941 [25,] -2.4189678 2.8726929 [26,] 15.6195912 -2.4189678 [27,] -21.2366274 15.6195912 [28,] 2.5330710 -21.2366274 [29,] -2.7584568 2.5330710 [30,] -5.2528155 -2.7584568 [31,] -2.4651303 -5.2528155 [32,] -9.8479407 -2.4651303 [33,] -6.8783342 -9.8479407 [34,] -2.0805212 -6.8783342 [35,] -4.7725703 -2.0805212 [36,] -3.5407972 -4.7725703 [37,] -13.1927031 -3.5407972 [38,] 4.5599591 -13.1927031 [39,] -24.5783240 4.5599591 [40,] -2.5605417 -24.5783240 [41,] -10.3603986 -2.5605417 [42,] -10.7477057 -10.3603986 [43,] -4.4869494 -10.7477057 [44,] -15.2582116 -4.4869494 [45,] 2.0671435 -15.2582116 [46,] -4.8048953 2.0671435 [47,] -18.3020542 -4.8048953 [48,] -5.4933777 -18.3020542 [49,] -1.8472254 -5.4933777 [50,] -40.8367705 -1.8472254 [51,] 21.3049156 -40.8367705 [52,] -0.6002964 21.3049156 [53,] -9.8354114 -0.6002964 [54,] -6.0708023 -9.8354114 [55,] -12.5600205 -6.0708023 [56,] -0.2928565 -12.5600205 [57,] 5.9261113 -0.2928565 [58,] -10.1382116 5.9261113 [59,] -3.2136025 -10.1382116 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 10.9252836 2.4400409 2 25.9920491 10.9252836 3 -0.2520081 25.9920491 4 -0.8245682 -0.2520081 5 11.3575882 -0.8245682 6 13.7561779 11.3575882 7 12.6695146 13.7561779 8 15.8059172 12.6695146 9 2.2595300 15.8059172 10 9.8740011 2.2595300 11 17.7787328 9.8740011 12 3.7214410 17.7787328 13 6.5336127 3.7214410 14 -5.3348288 6.5336127 15 24.7620439 -5.3348288 16 1.4523352 24.7620439 17 11.5966786 1.4523352 18 8.3151457 11.5966786 19 6.8425856 8.3151457 20 9.5930915 6.8425856 21 -3.3744506 9.5930915 22 7.1496270 -3.3744506 23 8.5094941 7.1496270 24 2.8726929 8.5094941 25 -2.4189678 2.8726929 26 15.6195912 -2.4189678 27 -21.2366274 15.6195912 28 2.5330710 -21.2366274 29 -2.7584568 2.5330710 30 -5.2528155 -2.7584568 31 -2.4651303 -5.2528155 32 -9.8479407 -2.4651303 33 -6.8783342 -9.8479407 34 -2.0805212 -6.8783342 35 -4.7725703 -2.0805212 36 -3.5407972 -4.7725703 37 -13.1927031 -3.5407972 38 4.5599591 -13.1927031 39 -24.5783240 4.5599591 40 -2.5605417 -24.5783240 41 -10.3603986 -2.5605417 42 -10.7477057 -10.3603986 43 -4.4869494 -10.7477057 44 -15.2582116 -4.4869494 45 2.0671435 -15.2582116 46 -4.8048953 2.0671435 47 -18.3020542 -4.8048953 48 -5.4933777 -18.3020542 49 -1.8472254 -5.4933777 50 -40.8367705 -1.8472254 51 21.3049156 -40.8367705 52 -0.6002964 21.3049156 53 -9.8354114 -0.6002964 54 -6.0708023 -9.8354114 55 -12.5600205 -6.0708023 56 -0.2928565 -12.5600205 57 5.9261113 -0.2928565 58 -10.1382116 5.9261113 59 -3.2136025 -10.1382116 > 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/7xgkr1261305346.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/8oorm1261305346.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/95eay1261305346.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/10fuws1261305346.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/11lpk41261305347.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/12azjf1261305347.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/1300nj1261305347.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/14w4o01261305347.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/15jybu1261305347.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/16yzbw1261305347.tab") + } > > try(system("convert tmp/16osa1261305346.ps tmp/16osa1261305346.png",intern=TRUE)) character(0) > try(system("convert tmp/22mgh1261305346.ps tmp/22mgh1261305346.png",intern=TRUE)) character(0) > try(system("convert tmp/3y7h81261305346.ps tmp/3y7h81261305346.png",intern=TRUE)) character(0) > try(system("convert tmp/44hft1261305346.ps tmp/44hft1261305346.png",intern=TRUE)) character(0) > try(system("convert tmp/5sckt1261305346.ps tmp/5sckt1261305346.png",intern=TRUE)) character(0) > try(system("convert tmp/6t5061261305346.ps tmp/6t5061261305346.png",intern=TRUE)) character(0) > try(system("convert tmp/7xgkr1261305346.ps tmp/7xgkr1261305346.png",intern=TRUE)) character(0) > try(system("convert tmp/8oorm1261305346.ps tmp/8oorm1261305346.png",intern=TRUE)) character(0) > try(system("convert tmp/95eay1261305346.ps tmp/95eay1261305346.png",intern=TRUE)) character(0) > try(system("convert tmp/10fuws1261305346.ps tmp/10fuws1261305346.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.394 1.555 3.334