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(99.9 + ,11554.5 + ,98.6 + ,13182.1 + ,107.2 + ,14800.1 + ,95.7 + ,12150.7 + ,93.7 + ,14478.2 + ,106.7 + ,13253.9 + ,86.7 + ,12036.8 + ,95.3 + ,12653.2 + ,99.3 + ,14035.4 + ,101.8 + ,14571.4 + ,96 + ,15400.9 + ,91.7 + ,14283.2 + ,95.3 + ,14485.3 + ,96.6 + ,14196.3 + ,107.2 + ,15559.1 + ,108 + ,13767.4 + ,98.4 + ,14634 + ,103.1 + ,14381.1 + ,81.1 + ,12509.9 + ,96.6 + ,12122.3 + ,103.7 + ,13122.3 + ,106.6 + ,13908.7 + ,97.6 + ,13456.5 + ,87.6 + ,12441.6 + ,99.4 + ,12953 + ,98.5 + ,13057.2 + ,105.2 + ,14350.1 + ,104.6 + ,13830.2 + ,97.5 + ,13755.5 + ,108.9 + ,13574.4 + ,86.8 + ,12802.6 + ,88.9 + ,11737.3 + ,110.3 + ,13850.2 + ,114.8 + ,15081.8 + ,94.6 + ,13653.3 + ,92 + ,14019.1 + ,93.8 + ,13962 + ,93.8 + ,13768.7 + ,107.6 + ,14747.1 + ,101 + ,13858.1 + ,95.4 + ,13188 + ,96.5 + ,13693.1 + ,89.2 + ,12970 + ,87.1 + ,11392.8 + ,110.5 + ,13985.2 + ,110.8 + ,14994.7 + ,104.2 + ,13584.7 + ,88.9 + ,14257.8 + ,89.8 + ,13553.4 + ,90 + ,14007.3 + ,93.9 + ,16535.8 + ,91.3 + ,14721.4 + ,87.8 + ,13664.6 + ,99.7 + ,16405.9 + ,73.5 + ,13829.4 + ,79.2 + ,13735.6 + ,96.9 + ,15870.5 + ,95.2 + ,15962.4 + ,95.6 + ,15744.1 + ,89.7 + ,16083.7 + ,92.8 + ,14863.9 + ,88 + ,15533.1 + ,101.1 + ,17473.1 + ,92.7 + ,15925.5 + ,95.8 + ,15573.7 + ,103.8 + ,17495 + ,81.8 + ,14155.8 + ,87.1 + ,14913.9 + ,105.9 + ,17250.4 + ,108.1 + ,15879.8 + ,102.6 + ,17647.8 + ,93.7 + ,17749.9) + ,dim=c(2 + ,72) + ,dimnames=list(c('metallurgie' + ,'Invoer') + ,1:72)) > y <- array(NA,dim=c(2,72),dimnames=list(c('metallurgie','Invoer'),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 = '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 metallurgie Invoer M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 99.9 11554.5 1 0 0 0 0 0 0 0 0 0 0 2 98.6 13182.1 0 1 0 0 0 0 0 0 0 0 0 3 107.2 14800.1 0 0 1 0 0 0 0 0 0 0 0 4 95.7 12150.7 0 0 0 1 0 0 0 0 0 0 0 5 93.7 14478.2 0 0 0 0 1 0 0 0 0 0 0 6 106.7 13253.9 0 0 0 0 0 1 0 0 0 0 0 7 86.7 12036.8 0 0 0 0 0 0 1 0 0 0 0 8 95.3 12653.2 0 0 0 0 0 0 0 1 0 0 0 9 99.3 14035.4 0 0 0 0 0 0 0 0 1 0 0 10 101.8 14571.4 0 0 0 0 0 0 0 0 0 1 0 11 96.0 15400.9 0 0 0 0 0 0 0 0 0 0 1 12 91.7 14283.2 0 0 0 0 0 0 0 0 0 0 0 13 95.3 14485.3 1 0 0 0 0 0 0 0 0 0 0 14 96.6 14196.3 0 1 0 0 0 0 0 0 0 0 0 15 107.2 15559.1 0 0 1 0 0 0 0 0 0 0 0 16 108.0 13767.4 0 0 0 1 0 0 0 0 0 0 0 17 98.4 14634.0 0 0 0 0 1 0 0 0 0 0 0 18 103.1 14381.1 0 0 0 0 0 1 0 0 0 0 0 19 81.1 12509.9 0 0 0 0 0 0 1 0 0 0 0 20 96.6 12122.3 0 0 0 0 0 0 0 1 0 0 0 21 103.7 13122.3 0 0 0 0 0 0 0 0 1 0 0 22 106.6 13908.7 0 0 0 0 0 0 0 0 0 1 0 23 97.6 13456.5 0 0 0 0 0 0 0 0 0 0 1 24 87.6 12441.6 0 0 0 0 0 0 0 0 0 0 0 25 99.4 12953.0 1 0 0 0 0 0 0 0 0 0 0 26 98.5 13057.2 0 1 0 0 0 0 0 0 0 0 0 27 105.2 14350.1 0 0 1 0 0 0 0 0 0 0 0 28 104.6 13830.2 0 0 0 1 0 0 0 0 0 0 0 29 97.5 13755.5 0 0 0 0 1 0 0 0 0 0 0 30 108.9 13574.4 0 0 0 0 0 1 0 0 0 0 0 31 86.8 12802.6 0 0 0 0 0 0 1 0 0 0 0 32 88.9 11737.3 0 0 0 0 0 0 0 1 0 0 0 33 110.3 13850.2 0 0 0 0 0 0 0 0 1 0 0 34 114.8 15081.8 0 0 0 0 0 0 0 0 0 1 0 35 94.6 13653.3 0 0 0 0 0 0 0 0 0 0 1 36 92.0 14019.1 0 0 0 0 0 0 0 0 0 0 0 37 93.8 13962.0 1 0 0 0 0 0 0 0 0 0 0 38 93.8 13768.7 0 1 0 0 0 0 0 0 0 0 0 39 107.6 14747.1 0 0 1 0 0 0 0 0 0 0 0 40 101.0 13858.1 0 0 0 1 0 0 0 0 0 0 0 41 95.4 13188.0 0 0 0 0 1 0 0 0 0 0 0 42 96.5 13693.1 0 0 0 0 0 1 0 0 0 0 0 43 89.2 12970.0 0 0 0 0 0 0 1 0 0 0 0 44 87.1 11392.8 0 0 0 0 0 0 0 1 0 0 0 45 110.5 13985.2 0 0 0 0 0 0 0 0 1 0 0 46 110.8 14994.7 0 0 0 0 0 0 0 0 0 1 0 47 104.2 13584.7 0 0 0 0 0 0 0 0 0 0 1 48 88.9 14257.8 0 0 0 0 0 0 0 0 0 0 0 49 89.8 13553.4 1 0 0 0 0 0 0 0 0 0 0 50 90.0 14007.3 0 1 0 0 0 0 0 0 0 0 0 51 93.9 16535.8 0 0 1 0 0 0 0 0 0 0 0 52 91.3 14721.4 0 0 0 1 0 0 0 0 0 0 0 53 87.8 13664.6 0 0 0 0 1 0 0 0 0 0 0 54 99.7 16405.9 0 0 0 0 0 1 0 0 0 0 0 55 73.5 13829.4 0 0 0 0 0 0 1 0 0 0 0 56 79.2 13735.6 0 0 0 0 0 0 0 1 0 0 0 57 96.9 15870.5 0 0 0 0 0 0 0 0 1 0 0 58 95.2 15962.4 0 0 0 0 0 0 0 0 0 1 0 59 95.6 15744.1 0 0 0 0 0 0 0 0 0 0 1 60 89.7 16083.7 0 0 0 0 0 0 0 0 0 0 0 61 92.8 14863.9 1 0 0 0 0 0 0 0 0 0 0 62 88.0 15533.1 0 1 0 0 0 0 0 0 0 0 0 63 101.1 17473.1 0 0 1 0 0 0 0 0 0 0 0 64 92.7 15925.5 0 0 0 1 0 0 0 0 0 0 0 65 95.8 15573.7 0 0 0 0 1 0 0 0 0 0 0 66 103.8 17495.0 0 0 0 0 0 1 0 0 0 0 0 67 81.8 14155.8 0 0 0 0 0 0 1 0 0 0 0 68 87.1 14913.9 0 0 0 0 0 0 0 1 0 0 0 69 105.9 17250.4 0 0 0 0 0 0 0 0 1 0 0 70 108.1 15879.8 0 0 0 0 0 0 0 0 0 1 0 71 102.6 17647.8 0 0 0 0 0 0 0 0 0 0 1 72 93.7 17749.9 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) Invoer M1 M2 M3 M4 104.81323 -0.00096 3.37259 2.83553 13.84078 7.55023 M5 M6 M7 M8 M9 M10 3.60008 12.51156 -9.10155 -3.53144 13.71793 15.86682 M11 7.93765 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -10.1566 -2.7632 0.2284 3.4099 8.8529 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.048e+02 7.609e+00 13.775 < 2e-16 *** Invoer -9.600e-04 4.949e-04 -1.940 0.05719 . M1 3.373e+00 2.966e+00 1.137 0.26016 M2 2.836e+00 2.932e+00 0.967 0.33744 M3 1.384e+01 2.927e+00 4.729 1.45e-05 *** M4 7.550e+00 2.926e+00 2.580 0.01239 * M5 3.600e+00 2.916e+00 1.234 0.22195 M6 1.251e+01 2.902e+00 4.312 6.24e-05 *** M7 -9.102e+00 3.029e+00 -3.005 0.00390 ** M8 -3.531e+00 3.073e+00 -1.149 0.25519 M9 1.372e+01 2.902e+00 4.726 1.46e-05 *** M10 1.587e+01 2.905e+00 5.463 9.88e-07 *** M11 7.938e+00 2.902e+00 2.735 0.00823 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.026 on 59 degrees of freedom Multiple R-squared: 0.6907, Adjusted R-squared: 0.6278 F-statistic: 10.98 on 12 and 59 DF, p-value: 4.702e-11 > 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.62580624 0.74838752 0.3741938 [2,] 0.52140751 0.95718497 0.4785925 [3,] 0.40732078 0.81464156 0.5926792 [4,] 0.34933962 0.69867925 0.6506604 [5,] 0.27680777 0.55361553 0.7231922 [6,] 0.21821253 0.43642506 0.7817875 [7,] 0.17117961 0.34235921 0.8288204 [8,] 0.11137635 0.22275270 0.8886237 [9,] 0.09845833 0.19691667 0.9015417 [10,] 0.06880160 0.13760319 0.9311984 [11,] 0.04635816 0.09271632 0.9536418 [12,] 0.02949326 0.05898652 0.9705067 [13,] 0.02517961 0.05035922 0.9748204 [14,] 0.01560401 0.03120802 0.9843960 [15,] 0.01455409 0.02910818 0.9854459 [16,] 0.01049662 0.02099324 0.9895034 [17,] 0.01500072 0.03000144 0.9849993 [18,] 0.02958886 0.05917772 0.9704111 [19,] 0.08510679 0.17021357 0.9148932 [20,] 0.07325583 0.14651166 0.9267442 [21,] 0.04932870 0.09865741 0.9506713 [22,] 0.04227427 0.08454854 0.9577257 [23,] 0.03520865 0.07041731 0.9647913 [24,] 0.03579976 0.07159952 0.9642002 [25,] 0.03744628 0.07489256 0.9625537 [26,] 0.02537136 0.05074272 0.9746286 [27,] 0.04671914 0.09343828 0.9532809 [28,] 0.08062350 0.16124701 0.9193765 [29,] 0.07862190 0.15724380 0.9213781 [30,] 0.14919284 0.29838569 0.8508072 [31,] 0.23331102 0.46662205 0.7666890 [32,] 0.52057487 0.95885026 0.4794251 [33,] 0.50954538 0.98090924 0.4904546 [34,] 0.47233431 0.94466863 0.5276657 [35,] 0.56572218 0.86855563 0.4342778 [36,] 0.60851910 0.78296180 0.3914809 [37,] 0.58733564 0.82532872 0.4126644 [38,] 0.50383776 0.99232447 0.4961622 [39,] 0.37333628 0.74667256 0.6266637 [40,] 0.39828230 0.79656460 0.6017177 [41,] 0.30286075 0.60572151 0.6971392 > postscript(file="/var/www/html/rcomp/tmp/1p0bk1229764819.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/27epp1229764819.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/3uefn1229764819.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/4zq8z1229764819.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/59z341229764819.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 2.8061738 3.6056858 2.7536699 -4.9991362 -0.8146420 2.0985768 7 8 9 10 11 12 2.5433032 6.1649256 -5.7575711 -4.8919167 -1.9664510 0.5982387 13 14 15 16 17 18 1.0196594 2.5792893 3.4822885 8.8528504 4.0349216 -0.4193429 19 20 21 22 23 24 -2.6025341 6.9552766 -2.2341214 -0.7280901 -2.2330203 -5.2696455 25 26 27 28 29 30 3.6486945 3.3857853 0.3216825 5.5131366 2.2915863 4.6062478 31 32 33 34 35 36 3.3784496 -1.1143126 5.0646422 8.5980529 -5.0440979 0.6447101 37 38 39 40 41 42 -0.9826939 -0.6311947 3.1027913 1.9399198 -0.3531978 -7.6798035 43 44 45 46 47 48 5.9391489 -3.2450229 5.3942384 4.5144394 4.4900481 -2.2261446 49 50 51 52 53 54 -5.3749384 -4.2021454 -8.8801069 -6.9313364 -7.4956752 -1.8755918 55 56 57 58 59 60 -8.9358512 -8.8960008 -6.3959266 -10.1565959 -2.0369887 0.3266681 61 62 63 64 65 66 -1.1168953 -4.7374203 -0.7803253 -4.3754343 2.3370072 3.2699136 67 68 69 70 71 72 -0.3225164 0.1351341 3.9287386 2.6641105 6.7905098 5.9261732 > postscript(file="/var/www/html/rcomp/tmp/64j7d1229764819.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 2.8061738 NA 1 3.6056858 2.8061738 2 2.7536699 3.6056858 3 -4.9991362 2.7536699 4 -0.8146420 -4.9991362 5 2.0985768 -0.8146420 6 2.5433032 2.0985768 7 6.1649256 2.5433032 8 -5.7575711 6.1649256 9 -4.8919167 -5.7575711 10 -1.9664510 -4.8919167 11 0.5982387 -1.9664510 12 1.0196594 0.5982387 13 2.5792893 1.0196594 14 3.4822885 2.5792893 15 8.8528504 3.4822885 16 4.0349216 8.8528504 17 -0.4193429 4.0349216 18 -2.6025341 -0.4193429 19 6.9552766 -2.6025341 20 -2.2341214 6.9552766 21 -0.7280901 -2.2341214 22 -2.2330203 -0.7280901 23 -5.2696455 -2.2330203 24 3.6486945 -5.2696455 25 3.3857853 3.6486945 26 0.3216825 3.3857853 27 5.5131366 0.3216825 28 2.2915863 5.5131366 29 4.6062478 2.2915863 30 3.3784496 4.6062478 31 -1.1143126 3.3784496 32 5.0646422 -1.1143126 33 8.5980529 5.0646422 34 -5.0440979 8.5980529 35 0.6447101 -5.0440979 36 -0.9826939 0.6447101 37 -0.6311947 -0.9826939 38 3.1027913 -0.6311947 39 1.9399198 3.1027913 40 -0.3531978 1.9399198 41 -7.6798035 -0.3531978 42 5.9391489 -7.6798035 43 -3.2450229 5.9391489 44 5.3942384 -3.2450229 45 4.5144394 5.3942384 46 4.4900481 4.5144394 47 -2.2261446 4.4900481 48 -5.3749384 -2.2261446 49 -4.2021454 -5.3749384 50 -8.8801069 -4.2021454 51 -6.9313364 -8.8801069 52 -7.4956752 -6.9313364 53 -1.8755918 -7.4956752 54 -8.9358512 -1.8755918 55 -8.8960008 -8.9358512 56 -6.3959266 -8.8960008 57 -10.1565959 -6.3959266 58 -2.0369887 -10.1565959 59 0.3266681 -2.0369887 60 -1.1168953 0.3266681 61 -4.7374203 -1.1168953 62 -0.7803253 -4.7374203 63 -4.3754343 -0.7803253 64 2.3370072 -4.3754343 65 3.2699136 2.3370072 66 -0.3225164 3.2699136 67 0.1351341 -0.3225164 68 3.9287386 0.1351341 69 2.6641105 3.9287386 70 6.7905098 2.6641105 71 5.9261732 6.7905098 72 NA 5.9261732 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3.6056858 2.8061738 [2,] 2.7536699 3.6056858 [3,] -4.9991362 2.7536699 [4,] -0.8146420 -4.9991362 [5,] 2.0985768 -0.8146420 [6,] 2.5433032 2.0985768 [7,] 6.1649256 2.5433032 [8,] -5.7575711 6.1649256 [9,] -4.8919167 -5.7575711 [10,] -1.9664510 -4.8919167 [11,] 0.5982387 -1.9664510 [12,] 1.0196594 0.5982387 [13,] 2.5792893 1.0196594 [14,] 3.4822885 2.5792893 [15,] 8.8528504 3.4822885 [16,] 4.0349216 8.8528504 [17,] -0.4193429 4.0349216 [18,] -2.6025341 -0.4193429 [19,] 6.9552766 -2.6025341 [20,] -2.2341214 6.9552766 [21,] -0.7280901 -2.2341214 [22,] -2.2330203 -0.7280901 [23,] -5.2696455 -2.2330203 [24,] 3.6486945 -5.2696455 [25,] 3.3857853 3.6486945 [26,] 0.3216825 3.3857853 [27,] 5.5131366 0.3216825 [28,] 2.2915863 5.5131366 [29,] 4.6062478 2.2915863 [30,] 3.3784496 4.6062478 [31,] -1.1143126 3.3784496 [32,] 5.0646422 -1.1143126 [33,] 8.5980529 5.0646422 [34,] -5.0440979 8.5980529 [35,] 0.6447101 -5.0440979 [36,] -0.9826939 0.6447101 [37,] -0.6311947 -0.9826939 [38,] 3.1027913 -0.6311947 [39,] 1.9399198 3.1027913 [40,] -0.3531978 1.9399198 [41,] -7.6798035 -0.3531978 [42,] 5.9391489 -7.6798035 [43,] -3.2450229 5.9391489 [44,] 5.3942384 -3.2450229 [45,] 4.5144394 5.3942384 [46,] 4.4900481 4.5144394 [47,] -2.2261446 4.4900481 [48,] -5.3749384 -2.2261446 [49,] -4.2021454 -5.3749384 [50,] -8.8801069 -4.2021454 [51,] -6.9313364 -8.8801069 [52,] -7.4956752 -6.9313364 [53,] -1.8755918 -7.4956752 [54,] -8.9358512 -1.8755918 [55,] -8.8960008 -8.9358512 [56,] -6.3959266 -8.8960008 [57,] -10.1565959 -6.3959266 [58,] -2.0369887 -10.1565959 [59,] 0.3266681 -2.0369887 [60,] -1.1168953 0.3266681 [61,] -4.7374203 -1.1168953 [62,] -0.7803253 -4.7374203 [63,] -4.3754343 -0.7803253 [64,] 2.3370072 -4.3754343 [65,] 3.2699136 2.3370072 [66,] -0.3225164 3.2699136 [67,] 0.1351341 -0.3225164 [68,] 3.9287386 0.1351341 [69,] 2.6641105 3.9287386 [70,] 6.7905098 2.6641105 [71,] 5.9261732 6.7905098 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3.6056858 2.8061738 2 2.7536699 3.6056858 3 -4.9991362 2.7536699 4 -0.8146420 -4.9991362 5 2.0985768 -0.8146420 6 2.5433032 2.0985768 7 6.1649256 2.5433032 8 -5.7575711 6.1649256 9 -4.8919167 -5.7575711 10 -1.9664510 -4.8919167 11 0.5982387 -1.9664510 12 1.0196594 0.5982387 13 2.5792893 1.0196594 14 3.4822885 2.5792893 15 8.8528504 3.4822885 16 4.0349216 8.8528504 17 -0.4193429 4.0349216 18 -2.6025341 -0.4193429 19 6.9552766 -2.6025341 20 -2.2341214 6.9552766 21 -0.7280901 -2.2341214 22 -2.2330203 -0.7280901 23 -5.2696455 -2.2330203 24 3.6486945 -5.2696455 25 3.3857853 3.6486945 26 0.3216825 3.3857853 27 5.5131366 0.3216825 28 2.2915863 5.5131366 29 4.6062478 2.2915863 30 3.3784496 4.6062478 31 -1.1143126 3.3784496 32 5.0646422 -1.1143126 33 8.5980529 5.0646422 34 -5.0440979 8.5980529 35 0.6447101 -5.0440979 36 -0.9826939 0.6447101 37 -0.6311947 -0.9826939 38 3.1027913 -0.6311947 39 1.9399198 3.1027913 40 -0.3531978 1.9399198 41 -7.6798035 -0.3531978 42 5.9391489 -7.6798035 43 -3.2450229 5.9391489 44 5.3942384 -3.2450229 45 4.5144394 5.3942384 46 4.4900481 4.5144394 47 -2.2261446 4.4900481 48 -5.3749384 -2.2261446 49 -4.2021454 -5.3749384 50 -8.8801069 -4.2021454 51 -6.9313364 -8.8801069 52 -7.4956752 -6.9313364 53 -1.8755918 -7.4956752 54 -8.9358512 -1.8755918 55 -8.8960008 -8.9358512 56 -6.3959266 -8.8960008 57 -10.1565959 -6.3959266 58 -2.0369887 -10.1565959 59 0.3266681 -2.0369887 60 -1.1168953 0.3266681 61 -4.7374203 -1.1168953 62 -0.7803253 -4.7374203 63 -4.3754343 -0.7803253 64 2.3370072 -4.3754343 65 3.2699136 2.3370072 66 -0.3225164 3.2699136 67 0.1351341 -0.3225164 68 3.9287386 0.1351341 69 2.6641105 3.9287386 70 6.7905098 2.6641105 71 5.9261732 6.7905098 > 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/7we211229764819.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/8em191229764819.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/9c79u1229764819.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/10wq4h1229764819.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/11uxpe1229764819.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/12gk881229764819.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/13q8n41229764819.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/14kcx81229764819.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/15k2zx1229764819.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/16ua3i1229764819.tab") + } > > system("convert tmp/1p0bk1229764819.ps tmp/1p0bk1229764819.png") > system("convert tmp/27epp1229764819.ps tmp/27epp1229764819.png") > system("convert tmp/3uefn1229764819.ps tmp/3uefn1229764819.png") > system("convert tmp/4zq8z1229764819.ps tmp/4zq8z1229764819.png") > system("convert tmp/59z341229764819.ps tmp/59z341229764819.png") > system("convert tmp/64j7d1229764819.ps tmp/64j7d1229764819.png") > system("convert tmp/7we211229764819.ps tmp/7we211229764819.png") > system("convert tmp/8em191229764819.ps tmp/8em191229764819.png") > system("convert tmp/9c79u1229764819.ps tmp/9c79u1229764819.png") > system("convert tmp/10wq4h1229764819.ps tmp/10wq4h1229764819.png") > > > proc.time() user system elapsed 2.621 1.623 8.917