R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(95.2,0,95.00,0,94.00,0,92.2,0,91.00,0,91.2,0,103.4,1,105.00,0,104.6,0,103.8,0,101.8,0,102.4,0,103.8,0,103.4,0,102.00,0,101.8,0,100.2,0,101.4,0,113.8,0,116.00,0,115.6,0,113.00,0,109.4,0,111.00,0,112.4,0,112.2,0,111.00,0,108.8,0,107.4,0,108.6,0,118.8,0,122.2,1,122.6,0,122.2,0,118.8,0,119.00,0,118.2,0,117.8,0,116.8,0,114.6,0,113.4,0,113.8,0,124.2,0,125.8,0,125.6,0,122.4,0,119.00,0,119.4,0,118.6,0,118.00,0,116.00,0,114.8,0,114.6,0,114.6,0,124.00,0,125.2,0,124.00,0,117.6,1,113.2,0,111.4,0,112.2,0,109.8,0,106.4,0,105.2,0,102.2,0,99.8,0,111.00,0,113.00,0,108.4,0,105.4,0,102.00,0,102.8,0),dim=c(2,72),dimnames=list(c('Werkloosheid','Dumivariabele'),1:72)) > y <- array(NA,dim=c(2,72),dimnames=list(c('Werkloosheid','Dumivariabele'),1:72)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Werkloosheid Dumivariabele M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 95.2 0 1 0 0 0 0 0 0 0 0 0 0 1 2 95.0 0 0 1 0 0 0 0 0 0 0 0 0 2 3 94.0 0 0 0 1 0 0 0 0 0 0 0 0 3 4 92.2 0 0 0 0 1 0 0 0 0 0 0 0 4 5 91.0 0 0 0 0 0 1 0 0 0 0 0 0 5 6 91.2 0 0 0 0 0 0 1 0 0 0 0 0 6 7 103.4 1 0 0 0 0 0 0 1 0 0 0 0 7 8 105.0 0 0 0 0 0 0 0 0 1 0 0 0 8 9 104.6 0 0 0 0 0 0 0 0 0 1 0 0 9 10 103.8 0 0 0 0 0 0 0 0 0 0 1 0 10 11 101.8 0 0 0 0 0 0 0 0 0 0 0 1 11 12 102.4 0 0 0 0 0 0 0 0 0 0 0 0 12 13 103.8 0 1 0 0 0 0 0 0 0 0 0 0 13 14 103.4 0 0 1 0 0 0 0 0 0 0 0 0 14 15 102.0 0 0 0 1 0 0 0 0 0 0 0 0 15 16 101.8 0 0 0 0 1 0 0 0 0 0 0 0 16 17 100.2 0 0 0 0 0 1 0 0 0 0 0 0 17 18 101.4 0 0 0 0 0 0 1 0 0 0 0 0 18 19 113.8 0 0 0 0 0 0 0 1 0 0 0 0 19 20 116.0 0 0 0 0 0 0 0 0 1 0 0 0 20 21 115.6 0 0 0 0 0 0 0 0 0 1 0 0 21 22 113.0 0 0 0 0 0 0 0 0 0 0 1 0 22 23 109.4 0 0 0 0 0 0 0 0 0 0 0 1 23 24 111.0 0 0 0 0 0 0 0 0 0 0 0 0 24 25 112.4 0 1 0 0 0 0 0 0 0 0 0 0 25 26 112.2 0 0 1 0 0 0 0 0 0 0 0 0 26 27 111.0 0 0 0 1 0 0 0 0 0 0 0 0 27 28 108.8 0 0 0 0 1 0 0 0 0 0 0 0 28 29 107.4 0 0 0 0 0 1 0 0 0 0 0 0 29 30 108.6 0 0 0 0 0 0 1 0 0 0 0 0 30 31 118.8 0 0 0 0 0 0 0 1 0 0 0 0 31 32 122.2 1 0 0 0 0 0 0 0 1 0 0 0 32 33 122.6 0 0 0 0 0 0 0 0 0 1 0 0 33 34 122.2 0 0 0 0 0 0 0 0 0 0 1 0 34 35 118.8 0 0 0 0 0 0 0 0 0 0 0 1 35 36 119.0 0 0 0 0 0 0 0 0 0 0 0 0 36 37 118.2 0 1 0 0 0 0 0 0 0 0 0 0 37 38 117.8 0 0 1 0 0 0 0 0 0 0 0 0 38 39 116.8 0 0 0 1 0 0 0 0 0 0 0 0 39 40 114.6 0 0 0 0 1 0 0 0 0 0 0 0 40 41 113.4 0 0 0 0 0 1 0 0 0 0 0 0 41 42 113.8 0 0 0 0 0 0 1 0 0 0 0 0 42 43 124.2 0 0 0 0 0 0 0 1 0 0 0 0 43 44 125.8 0 0 0 0 0 0 0 0 1 0 0 0 44 45 125.6 0 0 0 0 0 0 0 0 0 1 0 0 45 46 122.4 0 0 0 0 0 0 0 0 0 0 1 0 46 47 119.0 0 0 0 0 0 0 0 0 0 0 0 1 47 48 119.4 0 0 0 0 0 0 0 0 0 0 0 0 48 49 118.6 0 1 0 0 0 0 0 0 0 0 0 0 49 50 118.0 0 0 1 0 0 0 0 0 0 0 0 0 50 51 116.0 0 0 0 1 0 0 0 0 0 0 0 0 51 52 114.8 0 0 0 0 1 0 0 0 0 0 0 0 52 53 114.6 0 0 0 0 0 1 0 0 0 0 0 0 53 54 114.6 0 0 0 0 0 0 1 0 0 0 0 0 54 55 124.0 0 0 0 0 0 0 0 1 0 0 0 0 55 56 125.2 0 0 0 0 0 0 0 0 1 0 0 0 56 57 124.0 0 0 0 0 0 0 0 0 0 1 0 0 57 58 117.6 1 0 0 0 0 0 0 0 0 0 1 0 58 59 113.2 0 0 0 0 0 0 0 0 0 0 0 1 59 60 111.4 0 0 0 0 0 0 0 0 0 0 0 0 60 61 112.2 0 1 0 0 0 0 0 0 0 0 0 0 61 62 109.8 0 0 1 0 0 0 0 0 0 0 0 0 62 63 106.4 0 0 0 1 0 0 0 0 0 0 0 0 63 64 105.2 0 0 0 0 1 0 0 0 0 0 0 0 64 65 102.2 0 0 0 0 0 1 0 0 0 0 0 0 65 66 99.8 0 0 0 0 0 0 1 0 0 0 0 0 66 67 111.0 0 0 0 0 0 0 0 1 0 0 0 0 67 68 113.0 0 0 0 0 0 0 0 0 1 0 0 0 68 69 108.4 0 0 0 0 0 0 0 0 0 1 0 0 69 70 105.4 0 0 0 0 0 0 0 0 0 0 1 0 70 71 102.0 0 0 0 0 0 0 0 0 0 0 0 1 71 72 102.8 0 0 0 0 0 0 0 0 0 0 0 0 72 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Dumivariabele M1 M2 M3 103.4989 -0.5541 1.0313 0.1527 -1.6926 M4 M5 M6 M7 M8 -3.3379 -4.9498 -5.0284 5.8520 7.6734 M9 M10 M11 t 6.3358 3.5162 -0.1214 0.1786 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -14.117 -6.455 1.965 6.021 9.172 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 103.49885 3.60099 28.742 < 2e-16 *** Dumivariabele -0.55409 4.80896 -0.115 0.908669 M1 1.03125 4.40687 0.234 0.815801 M2 0.15265 4.40231 0.035 0.972457 M3 -1.69261 4.39818 -0.385 0.701761 M4 -3.33788 4.39448 -0.760 0.450594 M5 -4.94981 4.39122 -1.127 0.264297 M6 -5.02841 4.38839 -1.146 0.256566 M7 5.85201 4.45605 1.313 0.194263 M8 7.67341 4.45463 1.723 0.090295 . M9 6.33580 4.38250 1.446 0.153643 M10 3.51621 4.45309 0.790 0.432971 M11 -0.12140 4.38076 -0.028 0.977987 t 0.17860 0.04373 4.085 0.000137 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 7.587 on 58 degrees of freedom Multiple R-squared: 0.4106, Adjusted R-squared: 0.2785 F-statistic: 3.108 on 13 and 58 DF, p-value: 0.001491 > 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,] 9.281522e-04 1.856304e-03 0.9990718 [2,] 3.092471e-04 6.184942e-04 0.9996908 [3,] 3.235678e-05 6.471356e-05 0.9999676 [4,] 2.632873e-05 5.265747e-05 0.9999737 [5,] 1.112941e-05 2.225883e-05 0.9999889 [6,] 1.870003e-06 3.740005e-06 0.9999981 [7,] 1.133874e-06 2.267748e-06 0.9999989 [8,] 2.525550e-07 5.051100e-07 0.9999997 [9,] 7.587109e-08 1.517422e-07 0.9999999 [10,] 1.998546e-08 3.997093e-08 1.0000000 [11,] 5.176997e-09 1.035399e-08 1.0000000 [12,] 5.590914e-09 1.118183e-08 1.0000000 [13,] 5.797482e-09 1.159496e-08 1.0000000 [14,] 3.259177e-09 6.518354e-09 1.0000000 [15,] 1.028110e-07 2.056220e-07 0.9999999 [16,] 1.151464e-07 2.302928e-07 0.9999999 [17,] 8.633360e-08 1.726672e-07 0.9999999 [18,] 3.774220e-08 7.548440e-08 1.0000000 [19,] 1.541236e-08 3.082472e-08 1.0000000 [20,] 6.854350e-09 1.370870e-08 1.0000000 [21,] 5.254962e-08 1.050992e-07 0.9999999 [22,] 2.286033e-07 4.572066e-07 0.9999998 [23,] 3.960151e-07 7.920302e-07 0.9999996 [24,] 2.292810e-06 4.585619e-06 0.9999977 [25,] 1.070993e-05 2.141985e-05 0.9999893 [26,] 4.343555e-05 8.687109e-05 0.9999566 [27,] 5.619411e-04 1.123882e-03 0.9994381 [28,] 1.122112e-02 2.244225e-02 0.9887789 [29,] 4.898820e-02 9.797639e-02 0.9510118 [30,] 1.205921e-01 2.411842e-01 0.8794079 [31,] 2.862946e-01 5.725893e-01 0.7137054 [32,] 4.888763e-01 9.777526e-01 0.5111237 [33,] 7.508418e-01 4.983165e-01 0.2491582 [34,] 8.446858e-01 3.106284e-01 0.1553142 [35,] 8.677206e-01 2.645588e-01 0.1322794 [36,] 8.814271e-01 2.371457e-01 0.1185729 [37,] 8.072495e-01 3.855011e-01 0.1927505 [38,] 7.743667e-01 4.512665e-01 0.2256333 [39,] 6.637856e-01 6.724288e-01 0.3362144 > postscript(file="/var/www/html/rcomp/tmp/1pr6p1228490759.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/2obl21228490759.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/3gesp1228490759.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/4cg2f1228490759.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/5qerd1228490759.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 72 Frequency = 1 1 2 3 4 5 6 -9.5087040 -9.0087040 -8.3420373 -8.6753706 -8.4420373 -8.3420373 7 8 9 10 11 12 -6.6469632 -7.6010521 -6.8420373 -5.0010521 -3.5420373 -3.2420373 13 14 15 16 17 18 -3.0518890 -2.7518890 -2.4852224 -1.2185557 -1.3852224 -0.2852224 19 20 21 22 23 24 1.0557628 1.2557628 2.0147776 2.0557628 1.9147776 3.2147776 25 26 27 28 29 30 3.4049259 3.9049259 4.3715925 3.6382592 3.6715925 4.7715925 31 32 33 34 35 36 3.9125777 5.8666667 6.8715925 9.1125777 9.1715925 9.0715925 37 38 39 40 41 42 7.0617408 7.3617408 8.0284075 7.2950741 7.5284075 7.8284075 43 44 45 46 47 48 7.1693926 6.7693926 7.7284075 7.1693926 7.2284075 7.3284075 49 50 51 52 53 54 5.3185557 5.4185557 5.0852224 5.3518890 6.5852224 6.4852224 55 56 57 58 59 60 4.8262076 4.0262076 3.9852224 0.7802965 -0.7147776 -2.8147776 61 62 63 64 65 66 -3.2246294 -4.9246294 -6.6579627 -6.3912960 -7.9579627 -10.4579627 67 68 69 70 71 72 -10.3169775 -10.3169775 -13.7579627 -14.1169775 -14.0579627 -13.5579627 > postscript(file="/var/www/html/rcomp/tmp/6opwg1228490759.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 72 Frequency = 1 lag(myerror, k = 1) myerror 0 -9.5087040 NA 1 -9.0087040 -9.5087040 2 -8.3420373 -9.0087040 3 -8.6753706 -8.3420373 4 -8.4420373 -8.6753706 5 -8.3420373 -8.4420373 6 -6.6469632 -8.3420373 7 -7.6010521 -6.6469632 8 -6.8420373 -7.6010521 9 -5.0010521 -6.8420373 10 -3.5420373 -5.0010521 11 -3.2420373 -3.5420373 12 -3.0518890 -3.2420373 13 -2.7518890 -3.0518890 14 -2.4852224 -2.7518890 15 -1.2185557 -2.4852224 16 -1.3852224 -1.2185557 17 -0.2852224 -1.3852224 18 1.0557628 -0.2852224 19 1.2557628 1.0557628 20 2.0147776 1.2557628 21 2.0557628 2.0147776 22 1.9147776 2.0557628 23 3.2147776 1.9147776 24 3.4049259 3.2147776 25 3.9049259 3.4049259 26 4.3715925 3.9049259 27 3.6382592 4.3715925 28 3.6715925 3.6382592 29 4.7715925 3.6715925 30 3.9125777 4.7715925 31 5.8666667 3.9125777 32 6.8715925 5.8666667 33 9.1125777 6.8715925 34 9.1715925 9.1125777 35 9.0715925 9.1715925 36 7.0617408 9.0715925 37 7.3617408 7.0617408 38 8.0284075 7.3617408 39 7.2950741 8.0284075 40 7.5284075 7.2950741 41 7.8284075 7.5284075 42 7.1693926 7.8284075 43 6.7693926 7.1693926 44 7.7284075 6.7693926 45 7.1693926 7.7284075 46 7.2284075 7.1693926 47 7.3284075 7.2284075 48 5.3185557 7.3284075 49 5.4185557 5.3185557 50 5.0852224 5.4185557 51 5.3518890 5.0852224 52 6.5852224 5.3518890 53 6.4852224 6.5852224 54 4.8262076 6.4852224 55 4.0262076 4.8262076 56 3.9852224 4.0262076 57 0.7802965 3.9852224 58 -0.7147776 0.7802965 59 -2.8147776 -0.7147776 60 -3.2246294 -2.8147776 61 -4.9246294 -3.2246294 62 -6.6579627 -4.9246294 63 -6.3912960 -6.6579627 64 -7.9579627 -6.3912960 65 -10.4579627 -7.9579627 66 -10.3169775 -10.4579627 67 -10.3169775 -10.3169775 68 -13.7579627 -10.3169775 69 -14.1169775 -13.7579627 70 -14.0579627 -14.1169775 71 -13.5579627 -14.0579627 72 NA -13.5579627 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -9.0087040 -9.5087040 [2,] -8.3420373 -9.0087040 [3,] -8.6753706 -8.3420373 [4,] -8.4420373 -8.6753706 [5,] -8.3420373 -8.4420373 [6,] -6.6469632 -8.3420373 [7,] -7.6010521 -6.6469632 [8,] -6.8420373 -7.6010521 [9,] -5.0010521 -6.8420373 [10,] -3.5420373 -5.0010521 [11,] -3.2420373 -3.5420373 [12,] -3.0518890 -3.2420373 [13,] -2.7518890 -3.0518890 [14,] -2.4852224 -2.7518890 [15,] -1.2185557 -2.4852224 [16,] -1.3852224 -1.2185557 [17,] -0.2852224 -1.3852224 [18,] 1.0557628 -0.2852224 [19,] 1.2557628 1.0557628 [20,] 2.0147776 1.2557628 [21,] 2.0557628 2.0147776 [22,] 1.9147776 2.0557628 [23,] 3.2147776 1.9147776 [24,] 3.4049259 3.2147776 [25,] 3.9049259 3.4049259 [26,] 4.3715925 3.9049259 [27,] 3.6382592 4.3715925 [28,] 3.6715925 3.6382592 [29,] 4.7715925 3.6715925 [30,] 3.9125777 4.7715925 [31,] 5.8666667 3.9125777 [32,] 6.8715925 5.8666667 [33,] 9.1125777 6.8715925 [34,] 9.1715925 9.1125777 [35,] 9.0715925 9.1715925 [36,] 7.0617408 9.0715925 [37,] 7.3617408 7.0617408 [38,] 8.0284075 7.3617408 [39,] 7.2950741 8.0284075 [40,] 7.5284075 7.2950741 [41,] 7.8284075 7.5284075 [42,] 7.1693926 7.8284075 [43,] 6.7693926 7.1693926 [44,] 7.7284075 6.7693926 [45,] 7.1693926 7.7284075 [46,] 7.2284075 7.1693926 [47,] 7.3284075 7.2284075 [48,] 5.3185557 7.3284075 [49,] 5.4185557 5.3185557 [50,] 5.0852224 5.4185557 [51,] 5.3518890 5.0852224 [52,] 6.5852224 5.3518890 [53,] 6.4852224 6.5852224 [54,] 4.8262076 6.4852224 [55,] 4.0262076 4.8262076 [56,] 3.9852224 4.0262076 [57,] 0.7802965 3.9852224 [58,] -0.7147776 0.7802965 [59,] -2.8147776 -0.7147776 [60,] -3.2246294 -2.8147776 [61,] -4.9246294 -3.2246294 [62,] -6.6579627 -4.9246294 [63,] -6.3912960 -6.6579627 [64,] -7.9579627 -6.3912960 [65,] -10.4579627 -7.9579627 [66,] -10.3169775 -10.4579627 [67,] -10.3169775 -10.3169775 [68,] -13.7579627 -10.3169775 [69,] -14.1169775 -13.7579627 [70,] -14.0579627 -14.1169775 [71,] -13.5579627 -14.0579627 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -9.0087040 -9.5087040 2 -8.3420373 -9.0087040 3 -8.6753706 -8.3420373 4 -8.4420373 -8.6753706 5 -8.3420373 -8.4420373 6 -6.6469632 -8.3420373 7 -7.6010521 -6.6469632 8 -6.8420373 -7.6010521 9 -5.0010521 -6.8420373 10 -3.5420373 -5.0010521 11 -3.2420373 -3.5420373 12 -3.0518890 -3.2420373 13 -2.7518890 -3.0518890 14 -2.4852224 -2.7518890 15 -1.2185557 -2.4852224 16 -1.3852224 -1.2185557 17 -0.2852224 -1.3852224 18 1.0557628 -0.2852224 19 1.2557628 1.0557628 20 2.0147776 1.2557628 21 2.0557628 2.0147776 22 1.9147776 2.0557628 23 3.2147776 1.9147776 24 3.4049259 3.2147776 25 3.9049259 3.4049259 26 4.3715925 3.9049259 27 3.6382592 4.3715925 28 3.6715925 3.6382592 29 4.7715925 3.6715925 30 3.9125777 4.7715925 31 5.8666667 3.9125777 32 6.8715925 5.8666667 33 9.1125777 6.8715925 34 9.1715925 9.1125777 35 9.0715925 9.1715925 36 7.0617408 9.0715925 37 7.3617408 7.0617408 38 8.0284075 7.3617408 39 7.2950741 8.0284075 40 7.5284075 7.2950741 41 7.8284075 7.5284075 42 7.1693926 7.8284075 43 6.7693926 7.1693926 44 7.7284075 6.7693926 45 7.1693926 7.7284075 46 7.2284075 7.1693926 47 7.3284075 7.2284075 48 5.3185557 7.3284075 49 5.4185557 5.3185557 50 5.0852224 5.4185557 51 5.3518890 5.0852224 52 6.5852224 5.3518890 53 6.4852224 6.5852224 54 4.8262076 6.4852224 55 4.0262076 4.8262076 56 3.9852224 4.0262076 57 0.7802965 3.9852224 58 -0.7147776 0.7802965 59 -2.8147776 -0.7147776 60 -3.2246294 -2.8147776 61 -4.9246294 -3.2246294 62 -6.6579627 -4.9246294 63 -6.3912960 -6.6579627 64 -7.9579627 -6.3912960 65 -10.4579627 -7.9579627 66 -10.3169775 -10.4579627 67 -10.3169775 -10.3169775 68 -13.7579627 -10.3169775 69 -14.1169775 -13.7579627 70 -14.0579627 -14.1169775 71 -13.5579627 -14.0579627 > 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/7auax1228490759.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/818mw1228490759.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/9ptpw1228490759.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/10cdv31228490759.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/11ucvh1228490759.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/12qkhp1228490759.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/13d1741228490759.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/14p8qf1228490759.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/15k5q81228490759.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/16bt961228490760.tab") + } > > system("convert tmp/1pr6p1228490759.ps tmp/1pr6p1228490759.png") > system("convert tmp/2obl21228490759.ps tmp/2obl21228490759.png") > system("convert tmp/3gesp1228490759.ps tmp/3gesp1228490759.png") > system("convert tmp/4cg2f1228490759.ps tmp/4cg2f1228490759.png") > system("convert tmp/5qerd1228490759.ps tmp/5qerd1228490759.png") > system("convert tmp/6opwg1228490759.ps tmp/6opwg1228490759.png") > system("convert tmp/7auax1228490759.ps tmp/7auax1228490759.png") > system("convert tmp/818mw1228490759.ps tmp/818mw1228490759.png") > system("convert tmp/9ptpw1228490759.ps tmp/9ptpw1228490759.png") > system("convert tmp/10cdv31228490759.ps tmp/10cdv31228490759.png") > > > proc.time() user system elapsed 2.474 1.568 3.103