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(105.7,109.5,105.3,102.8,100.6,97.6,110.3,107.2,107.2,108.1,97.1,92.2,112.2,111.6,115.7,111.3,104.2,103.2,112.7,106.4,102.6,110.6,95.2,89,112.5,116.8,107.2,113.6,101.8,102.6,122.7,110.3,110.5,121.6,100.3,100.7,123.4,127.1,124.1,131.2,111.6,114.2,130.1,125.9,119,133.8,107.5,113.5,134.4,126.8,135.6,139.9,129.8,131,153.1,134.1,144.1,155.9,123.3,128.1,144.3,153,149.9,150.9,141,138.9,157.4,142.9,151.7,161,138.5,135.9,151.5,164,159.1,157,142.1,144.8,152.1,154.6,148.7,157.7,146.4,136.5),dim=c(1,84),dimnames=list(c('Totale_industrie'),1:84)) > y <- array(NA,dim=c(1,84),dimnames=list(c('Totale_industrie'),1:84)) > 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 Totale_industrie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 105.7 1 0 0 0 0 0 0 0 0 0 0 1 2 109.5 0 1 0 0 0 0 0 0 0 0 0 2 3 105.3 0 0 1 0 0 0 0 0 0 0 0 3 4 102.8 0 0 0 1 0 0 0 0 0 0 0 4 5 100.6 0 0 0 0 1 0 0 0 0 0 0 5 6 97.6 0 0 0 0 0 1 0 0 0 0 0 6 7 110.3 0 0 0 0 0 0 1 0 0 0 0 7 8 107.2 0 0 0 0 0 0 0 1 0 0 0 8 9 107.2 0 0 0 0 0 0 0 0 1 0 0 9 10 108.1 0 0 0 0 0 0 0 0 0 1 0 10 11 97.1 0 0 0 0 0 0 0 0 0 0 1 11 12 92.2 0 0 0 0 0 0 0 0 0 0 0 12 13 112.2 1 0 0 0 0 0 0 0 0 0 0 13 14 111.6 0 1 0 0 0 0 0 0 0 0 0 14 15 115.7 0 0 1 0 0 0 0 0 0 0 0 15 16 111.3 0 0 0 1 0 0 0 0 0 0 0 16 17 104.2 0 0 0 0 1 0 0 0 0 0 0 17 18 103.2 0 0 0 0 0 1 0 0 0 0 0 18 19 112.7 0 0 0 0 0 0 1 0 0 0 0 19 20 106.4 0 0 0 0 0 0 0 1 0 0 0 20 21 102.6 0 0 0 0 0 0 0 0 1 0 0 21 22 110.6 0 0 0 0 0 0 0 0 0 1 0 22 23 95.2 0 0 0 0 0 0 0 0 0 0 1 23 24 89.0 0 0 0 0 0 0 0 0 0 0 0 24 25 112.5 1 0 0 0 0 0 0 0 0 0 0 25 26 116.8 0 1 0 0 0 0 0 0 0 0 0 26 27 107.2 0 0 1 0 0 0 0 0 0 0 0 27 28 113.6 0 0 0 1 0 0 0 0 0 0 0 28 29 101.8 0 0 0 0 1 0 0 0 0 0 0 29 30 102.6 0 0 0 0 0 1 0 0 0 0 0 30 31 122.7 0 0 0 0 0 0 1 0 0 0 0 31 32 110.3 0 0 0 0 0 0 0 1 0 0 0 32 33 110.5 0 0 0 0 0 0 0 0 1 0 0 33 34 121.6 0 0 0 0 0 0 0 0 0 1 0 34 35 100.3 0 0 0 0 0 0 0 0 0 0 1 35 36 100.7 0 0 0 0 0 0 0 0 0 0 0 36 37 123.4 1 0 0 0 0 0 0 0 0 0 0 37 38 127.1 0 1 0 0 0 0 0 0 0 0 0 38 39 124.1 0 0 1 0 0 0 0 0 0 0 0 39 40 131.2 0 0 0 1 0 0 0 0 0 0 0 40 41 111.6 0 0 0 0 1 0 0 0 0 0 0 41 42 114.2 0 0 0 0 0 1 0 0 0 0 0 42 43 130.1 0 0 0 0 0 0 1 0 0 0 0 43 44 125.9 0 0 0 0 0 0 0 1 0 0 0 44 45 119.0 0 0 0 0 0 0 0 0 1 0 0 45 46 133.8 0 0 0 0 0 0 0 0 0 1 0 46 47 107.5 0 0 0 0 0 0 0 0 0 0 1 47 48 113.5 0 0 0 0 0 0 0 0 0 0 0 48 49 134.4 1 0 0 0 0 0 0 0 0 0 0 49 50 126.8 0 1 0 0 0 0 0 0 0 0 0 50 51 135.6 0 0 1 0 0 0 0 0 0 0 0 51 52 139.9 0 0 0 1 0 0 0 0 0 0 0 52 53 129.8 0 0 0 0 1 0 0 0 0 0 0 53 54 131.0 0 0 0 0 0 1 0 0 0 0 0 54 55 153.1 0 0 0 0 0 0 1 0 0 0 0 55 56 134.1 0 0 0 0 0 0 0 1 0 0 0 56 57 144.1 0 0 0 0 0 0 0 0 1 0 0 57 58 155.9 0 0 0 0 0 0 0 0 0 1 0 58 59 123.3 0 0 0 0 0 0 0 0 0 0 1 59 60 128.1 0 0 0 0 0 0 0 0 0 0 0 60 61 144.3 1 0 0 0 0 0 0 0 0 0 0 61 62 153.0 0 1 0 0 0 0 0 0 0 0 0 62 63 149.9 0 0 1 0 0 0 0 0 0 0 0 63 64 150.9 0 0 0 1 0 0 0 0 0 0 0 64 65 141.0 0 0 0 0 1 0 0 0 0 0 0 65 66 138.9 0 0 0 0 0 1 0 0 0 0 0 66 67 157.4 0 0 0 0 0 0 1 0 0 0 0 67 68 142.9 0 0 0 0 0 0 0 1 0 0 0 68 69 151.7 0 0 0 0 0 0 0 0 1 0 0 69 70 161.0 0 0 0 0 0 0 0 0 0 1 0 70 71 138.5 0 0 0 0 0 0 0 0 0 0 1 71 72 135.9 0 0 0 0 0 0 0 0 0 0 0 72 73 151.5 1 0 0 0 0 0 0 0 0 0 0 73 74 164.0 0 1 0 0 0 0 0 0 0 0 0 74 75 159.1 0 0 1 0 0 0 0 0 0 0 0 75 76 157.0 0 0 0 1 0 0 0 0 0 0 0 76 77 142.1 0 0 0 0 1 0 0 0 0 0 0 77 78 144.8 0 0 0 0 0 1 0 0 0 0 0 78 79 152.1 0 0 0 0 0 0 1 0 0 0 0 79 80 154.6 0 0 0 0 0 0 0 1 0 0 0 80 81 148.7 0 0 0 0 0 0 0 0 1 0 0 81 82 157.7 0 0 0 0 0 0 0 0 0 1 0 82 83 146.4 0 0 0 0 0 0 0 0 0 0 1 83 84 136.5 0 0 0 0 0 0 0 0 0 0 0 84 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) M1 M2 M3 M4 M5 77.8714 20.7964 23.5929 21.1464 21.8000 10.2536 M6 M7 M8 M9 M10 M11 9.6786 24.0893 15.2000 14.7964 23.3214 2.5179 t 0.7464 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -11.9857 -4.0714 -0.3143 4.1464 11.4143 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 77.87143 2.55665 30.458 < 2e-16 *** M1 20.79643 3.14491 6.613 5.98e-09 *** M2 23.59286 3.14255 7.508 1.37e-10 *** M3 21.14643 3.14040 6.734 3.60e-09 *** M4 21.80000 3.13848 6.946 1.47e-09 *** M5 10.25357 3.13679 3.269 0.00167 ** M6 9.67857 3.13532 3.087 0.00288 ** M7 24.08929 3.13407 7.686 6.38e-11 *** M8 15.20000 3.13305 4.851 7.02e-06 *** M9 14.79643 3.13226 4.724 1.13e-05 *** M10 23.32143 3.13169 7.447 1.77e-10 *** M11 2.51786 3.13135 0.804 0.42404 t 0.74643 0.02663 28.028 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.858 on 71 degrees of freedom Multiple R-squared: 0.9266, Adjusted R-squared: 0.9142 F-statistic: 74.73 on 12 and 71 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.129381925 0.25876385 0.87061808 [2,] 0.077908291 0.15581658 0.92209171 [3,] 0.034123605 0.06824721 0.96587640 [4,] 0.022529715 0.04505943 0.97747029 [5,] 0.035291875 0.07058375 0.96470813 [6,] 0.093851737 0.18770347 0.90614826 [7,] 0.054868144 0.10973629 0.94513186 [8,] 0.050564480 0.10112896 0.94943552 [9,] 0.050974319 0.10194864 0.94902568 [10,] 0.028839596 0.05767919 0.97116040 [11,] 0.017566141 0.03513228 0.98243386 [12,] 0.032509755 0.06501951 0.96749024 [13,] 0.024186272 0.04837254 0.97581373 [14,] 0.019107356 0.03821471 0.98089264 [15,] 0.011351289 0.02270258 0.98864871 [16,] 0.019624121 0.03924824 0.98037588 [17,] 0.011765100 0.02353020 0.98823490 [18,] 0.007633994 0.01526799 0.99236601 [19,] 0.014313818 0.02862764 0.98568618 [20,] 0.008781780 0.01756356 0.99121822 [21,] 0.008341700 0.01668340 0.99165830 [22,] 0.009542734 0.01908547 0.99045727 [23,] 0.011393726 0.02278745 0.98860627 [24,] 0.012994119 0.02598824 0.98700588 [25,] 0.044617438 0.08923488 0.95538256 [26,] 0.034996329 0.06999266 0.96500367 [27,] 0.027816913 0.05563383 0.97218309 [28,] 0.025008636 0.05001727 0.97499136 [29,] 0.025666489 0.05133298 0.97433351 [30,] 0.030274935 0.06054987 0.96972507 [31,] 0.048051765 0.09610353 0.95194823 [32,] 0.069821816 0.13964363 0.93017818 [33,] 0.079442180 0.15888436 0.92055782 [34,] 0.070552456 0.14110491 0.92944754 [35,] 0.402815069 0.80563014 0.59718493 [36,] 0.538432352 0.92313530 0.46156765 [37,] 0.600349235 0.79930153 0.39965077 [38,] 0.613952780 0.77209444 0.38604722 [39,] 0.624306837 0.75138633 0.37569316 [40,] 0.776391904 0.44721619 0.22360810 [41,] 0.777986921 0.44402616 0.22201308 [42,] 0.809421603 0.38115679 0.19057840 [43,] 0.863169251 0.27366150 0.13683075 [44,] 0.942969097 0.11406181 0.05703090 [45,] 0.920540781 0.15891844 0.07945922 [46,] 0.883601794 0.23279641 0.11639821 [47,] 0.897154178 0.20569164 0.10284582 [48,] 0.889576732 0.22084654 0.11042327 [49,] 0.844762197 0.31047561 0.15523780 [50,] 0.759006990 0.48198602 0.24099301 [51,] 0.672189582 0.65562084 0.32781042 [52,] 0.652776974 0.69444605 0.34722303 [53,] 0.770066964 0.45986607 0.22993304 > postscript(file="/var/www/html/rcomp/tmp/155hh1230126221.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/2raqw1230126221.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/3zgfc1230126221.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/4xgd41230126221.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/5rf8a1230126221.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 = 84 Frequency = 1 1 2 3 4 5 6 6.28571429 6.54285714 4.04285714 0.14285714 8.74285714 5.57142857 7 8 9 10 11 12 3.11428571 8.15714286 7.81428571 -0.55714286 8.50000000 5.37142857 13 14 15 16 17 18 3.82857143 -0.31428571 5.48571429 -0.31428571 3.38571429 2.21428571 19 20 21 22 23 24 -3.44285714 -1.60000000 -5.74285714 -7.01428571 -2.35714286 -6.78571429 25 26 27 28 29 30 -4.82857143 -4.07142857 -11.97142857 -6.97142857 -7.97142857 -7.34285714 31 32 33 34 35 36 -2.40000000 -6.65714286 -6.80000000 -4.97142857 -6.21428571 -4.04285714 37 38 39 40 41 42 -2.88571429 -2.72857143 -4.02857143 1.67142857 -7.12857143 -4.70000000 43 44 45 46 47 48 -3.95714286 -0.01428571 -7.25714286 -1.72857143 -7.97142857 -0.20000000 49 50 51 52 53 54 -0.84285714 -11.98571429 -1.48571429 1.41428571 2.11428571 3.14285714 55 56 57 58 59 60 10.08571429 -0.77142857 8.88571429 11.41428571 -1.12857143 5.44285714 61 62 63 64 65 66 0.10000000 5.25714286 3.85714286 3.45714286 4.35714286 2.08571429 67 68 69 70 71 72 5.42857143 -0.92857143 7.52857143 7.55714286 5.11428571 4.28571429 73 74 75 76 77 78 -1.65714286 7.30000000 4.10000000 0.60000000 -3.50000000 -0.97142857 79 80 81 82 83 84 -8.82857143 1.81428571 -4.42857143 -4.70000000 4.05714286 -4.07142857 > postscript(file="/var/www/html/rcomp/tmp/6psun1230126221.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 = 84 Frequency = 1 lag(myerror, k = 1) myerror 0 6.28571429 NA 1 6.54285714 6.28571429 2 4.04285714 6.54285714 3 0.14285714 4.04285714 4 8.74285714 0.14285714 5 5.57142857 8.74285714 6 3.11428571 5.57142857 7 8.15714286 3.11428571 8 7.81428571 8.15714286 9 -0.55714286 7.81428571 10 8.50000000 -0.55714286 11 5.37142857 8.50000000 12 3.82857143 5.37142857 13 -0.31428571 3.82857143 14 5.48571429 -0.31428571 15 -0.31428571 5.48571429 16 3.38571429 -0.31428571 17 2.21428571 3.38571429 18 -3.44285714 2.21428571 19 -1.60000000 -3.44285714 20 -5.74285714 -1.60000000 21 -7.01428571 -5.74285714 22 -2.35714286 -7.01428571 23 -6.78571429 -2.35714286 24 -4.82857143 -6.78571429 25 -4.07142857 -4.82857143 26 -11.97142857 -4.07142857 27 -6.97142857 -11.97142857 28 -7.97142857 -6.97142857 29 -7.34285714 -7.97142857 30 -2.40000000 -7.34285714 31 -6.65714286 -2.40000000 32 -6.80000000 -6.65714286 33 -4.97142857 -6.80000000 34 -6.21428571 -4.97142857 35 -4.04285714 -6.21428571 36 -2.88571429 -4.04285714 37 -2.72857143 -2.88571429 38 -4.02857143 -2.72857143 39 1.67142857 -4.02857143 40 -7.12857143 1.67142857 41 -4.70000000 -7.12857143 42 -3.95714286 -4.70000000 43 -0.01428571 -3.95714286 44 -7.25714286 -0.01428571 45 -1.72857143 -7.25714286 46 -7.97142857 -1.72857143 47 -0.20000000 -7.97142857 48 -0.84285714 -0.20000000 49 -11.98571429 -0.84285714 50 -1.48571429 -11.98571429 51 1.41428571 -1.48571429 52 2.11428571 1.41428571 53 3.14285714 2.11428571 54 10.08571429 3.14285714 55 -0.77142857 10.08571429 56 8.88571429 -0.77142857 57 11.41428571 8.88571429 58 -1.12857143 11.41428571 59 5.44285714 -1.12857143 60 0.10000000 5.44285714 61 5.25714286 0.10000000 62 3.85714286 5.25714286 63 3.45714286 3.85714286 64 4.35714286 3.45714286 65 2.08571429 4.35714286 66 5.42857143 2.08571429 67 -0.92857143 5.42857143 68 7.52857143 -0.92857143 69 7.55714286 7.52857143 70 5.11428571 7.55714286 71 4.28571429 5.11428571 72 -1.65714286 4.28571429 73 7.30000000 -1.65714286 74 4.10000000 7.30000000 75 0.60000000 4.10000000 76 -3.50000000 0.60000000 77 -0.97142857 -3.50000000 78 -8.82857143 -0.97142857 79 1.81428571 -8.82857143 80 -4.42857143 1.81428571 81 -4.70000000 -4.42857143 82 4.05714286 -4.70000000 83 -4.07142857 4.05714286 84 NA -4.07142857 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 6.54285714 6.28571429 [2,] 4.04285714 6.54285714 [3,] 0.14285714 4.04285714 [4,] 8.74285714 0.14285714 [5,] 5.57142857 8.74285714 [6,] 3.11428571 5.57142857 [7,] 8.15714286 3.11428571 [8,] 7.81428571 8.15714286 [9,] -0.55714286 7.81428571 [10,] 8.50000000 -0.55714286 [11,] 5.37142857 8.50000000 [12,] 3.82857143 5.37142857 [13,] -0.31428571 3.82857143 [14,] 5.48571429 -0.31428571 [15,] -0.31428571 5.48571429 [16,] 3.38571429 -0.31428571 [17,] 2.21428571 3.38571429 [18,] -3.44285714 2.21428571 [19,] -1.60000000 -3.44285714 [20,] -5.74285714 -1.60000000 [21,] -7.01428571 -5.74285714 [22,] -2.35714286 -7.01428571 [23,] -6.78571429 -2.35714286 [24,] -4.82857143 -6.78571429 [25,] -4.07142857 -4.82857143 [26,] -11.97142857 -4.07142857 [27,] -6.97142857 -11.97142857 [28,] -7.97142857 -6.97142857 [29,] -7.34285714 -7.97142857 [30,] -2.40000000 -7.34285714 [31,] -6.65714286 -2.40000000 [32,] -6.80000000 -6.65714286 [33,] -4.97142857 -6.80000000 [34,] -6.21428571 -4.97142857 [35,] -4.04285714 -6.21428571 [36,] -2.88571429 -4.04285714 [37,] -2.72857143 -2.88571429 [38,] -4.02857143 -2.72857143 [39,] 1.67142857 -4.02857143 [40,] -7.12857143 1.67142857 [41,] -4.70000000 -7.12857143 [42,] -3.95714286 -4.70000000 [43,] -0.01428571 -3.95714286 [44,] -7.25714286 -0.01428571 [45,] -1.72857143 -7.25714286 [46,] -7.97142857 -1.72857143 [47,] -0.20000000 -7.97142857 [48,] -0.84285714 -0.20000000 [49,] -11.98571429 -0.84285714 [50,] -1.48571429 -11.98571429 [51,] 1.41428571 -1.48571429 [52,] 2.11428571 1.41428571 [53,] 3.14285714 2.11428571 [54,] 10.08571429 3.14285714 [55,] -0.77142857 10.08571429 [56,] 8.88571429 -0.77142857 [57,] 11.41428571 8.88571429 [58,] -1.12857143 11.41428571 [59,] 5.44285714 -1.12857143 [60,] 0.10000000 5.44285714 [61,] 5.25714286 0.10000000 [62,] 3.85714286 5.25714286 [63,] 3.45714286 3.85714286 [64,] 4.35714286 3.45714286 [65,] 2.08571429 4.35714286 [66,] 5.42857143 2.08571429 [67,] -0.92857143 5.42857143 [68,] 7.52857143 -0.92857143 [69,] 7.55714286 7.52857143 [70,] 5.11428571 7.55714286 [71,] 4.28571429 5.11428571 [72,] -1.65714286 4.28571429 [73,] 7.30000000 -1.65714286 [74,] 4.10000000 7.30000000 [75,] 0.60000000 4.10000000 [76,] -3.50000000 0.60000000 [77,] -0.97142857 -3.50000000 [78,] -8.82857143 -0.97142857 [79,] 1.81428571 -8.82857143 [80,] -4.42857143 1.81428571 [81,] -4.70000000 -4.42857143 [82,] 4.05714286 -4.70000000 [83,] -4.07142857 4.05714286 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 6.54285714 6.28571429 2 4.04285714 6.54285714 3 0.14285714 4.04285714 4 8.74285714 0.14285714 5 5.57142857 8.74285714 6 3.11428571 5.57142857 7 8.15714286 3.11428571 8 7.81428571 8.15714286 9 -0.55714286 7.81428571 10 8.50000000 -0.55714286 11 5.37142857 8.50000000 12 3.82857143 5.37142857 13 -0.31428571 3.82857143 14 5.48571429 -0.31428571 15 -0.31428571 5.48571429 16 3.38571429 -0.31428571 17 2.21428571 3.38571429 18 -3.44285714 2.21428571 19 -1.60000000 -3.44285714 20 -5.74285714 -1.60000000 21 -7.01428571 -5.74285714 22 -2.35714286 -7.01428571 23 -6.78571429 -2.35714286 24 -4.82857143 -6.78571429 25 -4.07142857 -4.82857143 26 -11.97142857 -4.07142857 27 -6.97142857 -11.97142857 28 -7.97142857 -6.97142857 29 -7.34285714 -7.97142857 30 -2.40000000 -7.34285714 31 -6.65714286 -2.40000000 32 -6.80000000 -6.65714286 33 -4.97142857 -6.80000000 34 -6.21428571 -4.97142857 35 -4.04285714 -6.21428571 36 -2.88571429 -4.04285714 37 -2.72857143 -2.88571429 38 -4.02857143 -2.72857143 39 1.67142857 -4.02857143 40 -7.12857143 1.67142857 41 -4.70000000 -7.12857143 42 -3.95714286 -4.70000000 43 -0.01428571 -3.95714286 44 -7.25714286 -0.01428571 45 -1.72857143 -7.25714286 46 -7.97142857 -1.72857143 47 -0.20000000 -7.97142857 48 -0.84285714 -0.20000000 49 -11.98571429 -0.84285714 50 -1.48571429 -11.98571429 51 1.41428571 -1.48571429 52 2.11428571 1.41428571 53 3.14285714 2.11428571 54 10.08571429 3.14285714 55 -0.77142857 10.08571429 56 8.88571429 -0.77142857 57 11.41428571 8.88571429 58 -1.12857143 11.41428571 59 5.44285714 -1.12857143 60 0.10000000 5.44285714 61 5.25714286 0.10000000 62 3.85714286 5.25714286 63 3.45714286 3.85714286 64 4.35714286 3.45714286 65 2.08571429 4.35714286 66 5.42857143 2.08571429 67 -0.92857143 5.42857143 68 7.52857143 -0.92857143 69 7.55714286 7.52857143 70 5.11428571 7.55714286 71 4.28571429 5.11428571 72 -1.65714286 4.28571429 73 7.30000000 -1.65714286 74 4.10000000 7.30000000 75 0.60000000 4.10000000 76 -3.50000000 0.60000000 77 -0.97142857 -3.50000000 78 -8.82857143 -0.97142857 79 1.81428571 -8.82857143 80 -4.42857143 1.81428571 81 -4.70000000 -4.42857143 82 4.05714286 -4.70000000 83 -4.07142857 4.05714286 > 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/7zktq1230126221.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/8k0lw1230126221.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/9rm1c1230126221.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/10n1ui1230126222.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/1123os1230126222.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/12qp5c1230126222.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/132ffs1230126222.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/14qyhm1230126222.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/157hrs1230126222.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/16bod81230126222.tab") + } > > system("convert tmp/155hh1230126221.ps tmp/155hh1230126221.png") > system("convert tmp/2raqw1230126221.ps tmp/2raqw1230126221.png") > system("convert tmp/3zgfc1230126221.ps tmp/3zgfc1230126221.png") > system("convert tmp/4xgd41230126221.ps tmp/4xgd41230126221.png") > system("convert tmp/5rf8a1230126221.ps tmp/5rf8a1230126221.png") > system("convert tmp/6psun1230126221.ps tmp/6psun1230126221.png") > system("convert tmp/7zktq1230126221.ps tmp/7zktq1230126221.png") > system("convert tmp/8k0lw1230126221.ps tmp/8k0lw1230126221.png") > system("convert tmp/9rm1c1230126221.ps tmp/9rm1c1230126221.png") > system("convert tmp/10n1ui1230126222.ps tmp/10n1ui1230126222.png") > > > proc.time() user system elapsed 2.773 1.633 3.444