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(103.91 + ,89.00 + ,103.88 + ,103.77 + ,103.66 + ,103.64 + ,103.63 + ,103.91 + ,86.40 + ,103.91 + ,103.88 + ,103.77 + ,103.66 + ,103.64 + ,103.92 + ,84.50 + ,103.91 + ,103.91 + ,103.88 + ,103.77 + ,103.66 + ,104.05 + ,82.70 + ,103.92 + ,103.91 + ,103.91 + ,103.88 + ,103.77 + ,104.23 + ,80.80 + ,104.05 + ,103.92 + ,103.91 + ,103.91 + ,103.88 + ,104.30 + ,81.80 + ,104.23 + ,104.05 + ,103.92 + ,103.91 + ,103.91 + ,104.31 + ,81.80 + ,104.30 + ,104.23 + ,104.05 + ,103.92 + ,103.91 + ,104.31 + ,82.90 + ,104.31 + ,104.30 + ,104.23 + ,104.05 + ,103.92 + ,104.34 + ,83.80 + ,104.31 + ,104.31 + ,104.30 + ,104.23 + ,104.05 + ,104.55 + ,86.20 + ,104.34 + ,104.31 + ,104.31 + ,104.30 + ,104.23 + ,104.65 + ,86.10 + ,104.55 + ,104.34 + ,104.31 + ,104.31 + ,104.30 + ,104.73 + ,86.20 + ,104.65 + ,104.55 + ,104.34 + ,104.31 + ,104.31 + ,104.75 + ,88.80 + ,104.73 + ,104.65 + ,104.55 + ,104.34 + ,104.31 + ,104.75 + ,89.60 + ,104.75 + ,104.73 + ,104.65 + ,104.55 + ,104.34 + ,104.76 + ,87.80 + ,104.75 + ,104.75 + ,104.73 + ,104.65 + ,104.55 + ,104.94 + ,88.30 + ,104.76 + ,104.75 + ,104.75 + ,104.73 + ,104.65 + ,105.29 + ,88.60 + ,104.94 + ,104.76 + ,104.75 + ,104.75 + ,104.73 + ,105.38 + ,91.00 + ,105.29 + ,104.94 + ,104.76 + ,104.75 + ,104.75 + ,105.43 + ,91.50 + ,105.38 + ,105.29 + ,104.94 + ,104.76 + ,104.75 + ,105.43 + ,95.40 + ,105.43 + ,105.38 + ,105.29 + ,104.94 + ,104.76 + ,105.42 + ,98.70 + ,105.43 + ,105.43 + ,105.38 + ,105.29 + ,104.94 + ,105.52 + ,99.90 + ,105.42 + ,105.43 + ,105.43 + ,105.38 + ,105.29 + ,105.69 + ,98.60 + ,105.52 + ,105.42 + ,105.43 + ,105.43 + ,105.38 + ,105.72 + ,100.30 + ,105.69 + ,105.52 + ,105.42 + ,105.43 + ,105.43 + ,105.74 + ,100.20 + ,105.72 + ,105.69 + ,105.52 + ,105.42 + ,105.43 + ,105.74 + ,100.40 + ,105.74 + ,105.72 + ,105.69 + ,105.52 + ,105.42 + ,105.74 + ,101.40 + ,105.74 + ,105.74 + ,105.72 + ,105.69 + ,105.52 + ,105.95 + ,103.00 + ,105.74 + ,105.74 + ,105.74 + ,105.72 + ,105.69 + ,106.17 + ,109.10 + ,105.95 + ,105.74 + ,105.74 + ,105.74 + ,105.72 + ,106.34 + ,111.40 + ,106.17 + ,105.95 + ,105.74 + ,105.74 + ,105.74 + ,106.37 + ,114.10 + ,106.34 + ,106.17 + ,105.95 + ,105.74 + ,105.74 + ,106.37 + ,121.80 + ,106.37 + ,106.34 + ,106.17 + ,105.95 + ,105.74 + ,106.36 + ,127.60 + ,106.37 + ,106.37 + ,106.34 + ,106.17 + ,105.95 + ,106.44 + ,129.90 + ,106.36 + ,106.37 + ,106.37 + ,106.34 + ,106.17 + ,106.29 + ,128.00 + ,106.44 + ,106.36 + ,106.37 + ,106.37 + ,106.34 + ,106.23 + ,123.50 + ,106.29 + ,106.44 + ,106.36 + ,106.37 + ,106.37 + ,106.23 + ,124.00 + ,106.23 + ,106.29 + ,106.44 + ,106.36 + ,106.37 + ,106.23 + ,127.40 + ,106.23 + ,106.23 + ,106.29 + ,106.44 + ,106.36 + ,106.23 + ,127.60 + ,106.23 + ,106.23 + ,106.23 + ,106.29 + ,106.44 + ,106.34 + ,128.40 + ,106.23 + ,106.23 + ,106.23 + ,106.23 + ,106.29 + ,106.44 + ,131.40 + ,106.34 + ,106.23 + ,106.23 + ,106.23 + ,106.23 + ,106.44 + ,135.10 + ,106.44 + ,106.34 + ,106.23 + ,106.23 + ,106.23 + ,106.48 + ,134.00 + ,106.44 + ,106.44 + ,106.34 + ,106.23 + ,106.23 + ,106.50 + ,144.50 + ,106.48 + ,106.44 + ,106.44 + ,106.34 + ,106.23 + ,106.57 + ,147.30 + ,106.50 + ,106.48 + ,106.44 + ,106.44 + ,106.34 + ,106.40 + ,150.90 + ,106.57 + ,106.50 + ,106.48 + ,106.44 + ,106.44 + ,106.37 + ,148.70 + ,106.40 + ,106.57 + ,106.50 + ,106.48 + ,106.44 + ,106.25 + ,141.40 + ,106.37 + ,106.40 + ,106.57 + ,106.50 + ,106.48 + ,106.21 + ,138.90 + ,106.25 + ,106.37 + ,106.40 + ,106.57 + ,106.50 + ,106.21 + ,139.80 + ,106.21 + ,106.25 + ,106.37 + ,106.40 + ,106.57 + ,106.24 + ,145.60 + ,106.21 + ,106.21 + ,106.25 + ,106.37 + ,106.40 + ,106.19 + ,147.90 + ,106.24 + ,106.21 + ,106.21 + ,106.25 + ,106.37 + ,106.08 + ,148.50 + ,106.19 + ,106.24 + ,106.21 + ,106.21 + ,106.25 + ,106.13 + ,151.10 + ,106.08 + ,106.19 + ,106.24 + ,106.21 + ,106.21 + ,106.09 + ,157.50 + ,106.13 + ,106.08 + ,106.19 + ,106.24 + ,106.21) + ,dim=c(7 + ,55) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4' + ,'Y5') + ,1:55)) > y <- array(NA,dim=c(7,55),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4','Y5'),1:55)) > 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 = 'Do not include Seasonal 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 Y X Y1 Y2 Y3 Y4 Y5 t 1 103.91 89.0 103.88 103.77 103.66 103.64 103.63 1 2 103.91 86.4 103.91 103.88 103.77 103.66 103.64 2 3 103.92 84.5 103.91 103.91 103.88 103.77 103.66 3 4 104.05 82.7 103.92 103.91 103.91 103.88 103.77 4 5 104.23 80.8 104.05 103.92 103.91 103.91 103.88 5 6 104.30 81.8 104.23 104.05 103.92 103.91 103.91 6 7 104.31 81.8 104.30 104.23 104.05 103.92 103.91 7 8 104.31 82.9 104.31 104.30 104.23 104.05 103.92 8 9 104.34 83.8 104.31 104.31 104.30 104.23 104.05 9 10 104.55 86.2 104.34 104.31 104.31 104.30 104.23 10 11 104.65 86.1 104.55 104.34 104.31 104.31 104.30 11 12 104.73 86.2 104.65 104.55 104.34 104.31 104.31 12 13 104.75 88.8 104.73 104.65 104.55 104.34 104.31 13 14 104.75 89.6 104.75 104.73 104.65 104.55 104.34 14 15 104.76 87.8 104.75 104.75 104.73 104.65 104.55 15 16 104.94 88.3 104.76 104.75 104.75 104.73 104.65 16 17 105.29 88.6 104.94 104.76 104.75 104.75 104.73 17 18 105.38 91.0 105.29 104.94 104.76 104.75 104.75 18 19 105.43 91.5 105.38 105.29 104.94 104.76 104.75 19 20 105.43 95.4 105.43 105.38 105.29 104.94 104.76 20 21 105.42 98.7 105.43 105.43 105.38 105.29 104.94 21 22 105.52 99.9 105.42 105.43 105.43 105.38 105.29 22 23 105.69 98.6 105.52 105.42 105.43 105.43 105.38 23 24 105.72 100.3 105.69 105.52 105.42 105.43 105.43 24 25 105.74 100.2 105.72 105.69 105.52 105.42 105.43 25 26 105.74 100.4 105.74 105.72 105.69 105.52 105.42 26 27 105.74 101.4 105.74 105.74 105.72 105.69 105.52 27 28 105.95 103.0 105.74 105.74 105.74 105.72 105.69 28 29 106.17 109.1 105.95 105.74 105.74 105.74 105.72 29 30 106.34 111.4 106.17 105.95 105.74 105.74 105.74 30 31 106.37 114.1 106.34 106.17 105.95 105.74 105.74 31 32 106.37 121.8 106.37 106.34 106.17 105.95 105.74 32 33 106.36 127.6 106.37 106.37 106.34 106.17 105.95 33 34 106.44 129.9 106.36 106.37 106.37 106.34 106.17 34 35 106.29 128.0 106.44 106.36 106.37 106.37 106.34 35 36 106.23 123.5 106.29 106.44 106.36 106.37 106.37 36 37 106.23 124.0 106.23 106.29 106.44 106.36 106.37 37 38 106.23 127.4 106.23 106.23 106.29 106.44 106.36 38 39 106.23 127.6 106.23 106.23 106.23 106.29 106.44 39 40 106.34 128.4 106.23 106.23 106.23 106.23 106.29 40 41 106.44 131.4 106.34 106.23 106.23 106.23 106.23 41 42 106.44 135.1 106.44 106.34 106.23 106.23 106.23 42 43 106.48 134.0 106.44 106.44 106.34 106.23 106.23 43 44 106.50 144.5 106.48 106.44 106.44 106.34 106.23 44 45 106.57 147.3 106.50 106.48 106.44 106.44 106.34 45 46 106.40 150.9 106.57 106.50 106.48 106.44 106.44 46 47 106.37 148.7 106.40 106.57 106.50 106.48 106.44 47 48 106.25 141.4 106.37 106.40 106.57 106.50 106.48 48 49 106.21 138.9 106.25 106.37 106.40 106.57 106.50 49 50 106.21 139.8 106.21 106.25 106.37 106.40 106.57 50 51 106.24 145.6 106.21 106.21 106.25 106.37 106.40 51 52 106.19 147.9 106.24 106.21 106.21 106.25 106.37 52 53 106.08 148.5 106.19 106.24 106.21 106.21 106.25 53 54 106.13 151.1 106.08 106.19 106.24 106.21 106.21 54 55 106.09 157.5 106.13 106.08 106.19 106.24 106.21 55 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 Y4 -0.882022 -0.004521 1.287768 -0.416249 -0.111638 0.271637 Y5 t -0.018862 0.003530 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.18390 -0.04620 -0.01479 0.05863 0.19599 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.882022 4.049460 -0.218 0.8285 X -0.004521 0.001859 -2.432 0.0189 * Y1 1.287768 0.138486 9.299 3.17e-12 *** Y2 -0.416249 0.229841 -1.811 0.0765 . Y3 -0.111638 0.243676 -0.458 0.6490 Y4 0.271637 0.236105 1.150 0.2558 Y5 -0.018862 0.149062 -0.127 0.8998 t 0.003530 0.003991 0.884 0.3809 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.07895 on 47 degrees of freedom Multiple R-squared: 0.9925, Adjusted R-squared: 0.9914 F-statistic: 887.4 on 7 and 47 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.0712659509 0.142531902 0.92873405 [2,] 0.0218894858 0.043778972 0.97811051 [3,] 0.0081467026 0.016293405 0.99185330 [4,] 0.0049330873 0.009866175 0.99506691 [5,] 0.0021666780 0.004333356 0.99783332 [6,] 0.0006359126 0.001271825 0.99936409 [7,] 0.1066322338 0.213264468 0.89336777 [8,] 0.0938331916 0.187666383 0.90616681 [9,] 0.2384143542 0.476828708 0.76158565 [10,] 0.1979306142 0.395861228 0.80206939 [11,] 0.1602051979 0.320410396 0.83979480 [12,] 0.1501414249 0.300282850 0.84985858 [13,] 0.1081637036 0.216327407 0.89183630 [14,] 0.1671819474 0.334363895 0.83281805 [15,] 0.1517987723 0.303597545 0.84820123 [16,] 0.1737674083 0.347534817 0.82623259 [17,] 0.3392357503 0.678471501 0.66076425 [18,] 0.2942318666 0.588463733 0.70576813 [19,] 0.2386372801 0.477274560 0.76136272 [20,] 0.2002142963 0.400428593 0.79978570 [21,] 0.1474724255 0.294944851 0.85252757 [22,] 0.1330162570 0.266032514 0.86698374 [23,] 0.1244495980 0.248899196 0.87555040 [24,] 0.0920529696 0.184105939 0.90794703 [25,] 0.5563518782 0.887296244 0.44364812 [26,] 0.6270494476 0.745901105 0.37295055 [27,] 0.5922743211 0.815451358 0.40772568 [28,] 0.6481576408 0.703684718 0.35184236 [29,] 0.6864296928 0.627140614 0.31357031 [30,] 0.6961571432 0.607685714 0.30384286 [31,] 0.6487543133 0.702491373 0.35124569 [32,] 0.8513944709 0.297211058 0.14860553 [33,] 0.7558498711 0.488300258 0.24415013 [34,] 0.9557873353 0.088425329 0.04421266 > postscript(file="/var/www/html/rcomp/tmp/1ufxy1259337308.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/2qqup1259337308.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/3r0gd1259337308.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/4kv2n1259337308.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/5vlna1259337308.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 = 55 Frequency = 1 1 2 3 4 5 6 -0.013694877 -0.014789755 -0.021645341 0.059352541 0.057910471 -0.047101747 7 8 9 10 11 12 -0.044053985 -0.041380046 -0.045306305 0.118878754 -0.044443133 -0.005347643 13 14 15 16 17 18 -0.023223766 -0.060906214 -0.068521218 0.079719789 0.195986725 -0.080992361 19 20 21 22 23 24 0.014904951 -0.007550535 -0.066978172 0.035531302 0.051300093 -0.092012536 25 26 27 28 29 30 -0.029985085 -0.054252462 -0.085879109 0.125115194 0.093867105 0.075216797 31 32 33 34 35 36 0.009992702 0.040922757 0.029283160 0.090350311 -0.183896647 -0.041857885 37 38 39 40 41 42 -0.016651005 -0.068448762 -0.035518202 0.088037905 0.055285741 -0.014504732 43 44 45 46 47 48 0.070897024 0.064613851 0.109549257 -0.123171028 0.072777418 -0.112750952 49 50 51 52 53 54 -0.063155353 -0.016905774 0.010683965 -0.043514899 -0.068854084 0.112808086 55 -0.025692286 > postscript(file="/var/www/html/rcomp/tmp/6wihf1259337308.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 = 55 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.013694877 NA 1 -0.014789755 -0.013694877 2 -0.021645341 -0.014789755 3 0.059352541 -0.021645341 4 0.057910471 0.059352541 5 -0.047101747 0.057910471 6 -0.044053985 -0.047101747 7 -0.041380046 -0.044053985 8 -0.045306305 -0.041380046 9 0.118878754 -0.045306305 10 -0.044443133 0.118878754 11 -0.005347643 -0.044443133 12 -0.023223766 -0.005347643 13 -0.060906214 -0.023223766 14 -0.068521218 -0.060906214 15 0.079719789 -0.068521218 16 0.195986725 0.079719789 17 -0.080992361 0.195986725 18 0.014904951 -0.080992361 19 -0.007550535 0.014904951 20 -0.066978172 -0.007550535 21 0.035531302 -0.066978172 22 0.051300093 0.035531302 23 -0.092012536 0.051300093 24 -0.029985085 -0.092012536 25 -0.054252462 -0.029985085 26 -0.085879109 -0.054252462 27 0.125115194 -0.085879109 28 0.093867105 0.125115194 29 0.075216797 0.093867105 30 0.009992702 0.075216797 31 0.040922757 0.009992702 32 0.029283160 0.040922757 33 0.090350311 0.029283160 34 -0.183896647 0.090350311 35 -0.041857885 -0.183896647 36 -0.016651005 -0.041857885 37 -0.068448762 -0.016651005 38 -0.035518202 -0.068448762 39 0.088037905 -0.035518202 40 0.055285741 0.088037905 41 -0.014504732 0.055285741 42 0.070897024 -0.014504732 43 0.064613851 0.070897024 44 0.109549257 0.064613851 45 -0.123171028 0.109549257 46 0.072777418 -0.123171028 47 -0.112750952 0.072777418 48 -0.063155353 -0.112750952 49 -0.016905774 -0.063155353 50 0.010683965 -0.016905774 51 -0.043514899 0.010683965 52 -0.068854084 -0.043514899 53 0.112808086 -0.068854084 54 -0.025692286 0.112808086 55 NA -0.025692286 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.014789755 -0.013694877 [2,] -0.021645341 -0.014789755 [3,] 0.059352541 -0.021645341 [4,] 0.057910471 0.059352541 [5,] -0.047101747 0.057910471 [6,] -0.044053985 -0.047101747 [7,] -0.041380046 -0.044053985 [8,] -0.045306305 -0.041380046 [9,] 0.118878754 -0.045306305 [10,] -0.044443133 0.118878754 [11,] -0.005347643 -0.044443133 [12,] -0.023223766 -0.005347643 [13,] -0.060906214 -0.023223766 [14,] -0.068521218 -0.060906214 [15,] 0.079719789 -0.068521218 [16,] 0.195986725 0.079719789 [17,] -0.080992361 0.195986725 [18,] 0.014904951 -0.080992361 [19,] -0.007550535 0.014904951 [20,] -0.066978172 -0.007550535 [21,] 0.035531302 -0.066978172 [22,] 0.051300093 0.035531302 [23,] -0.092012536 0.051300093 [24,] -0.029985085 -0.092012536 [25,] -0.054252462 -0.029985085 [26,] -0.085879109 -0.054252462 [27,] 0.125115194 -0.085879109 [28,] 0.093867105 0.125115194 [29,] 0.075216797 0.093867105 [30,] 0.009992702 0.075216797 [31,] 0.040922757 0.009992702 [32,] 0.029283160 0.040922757 [33,] 0.090350311 0.029283160 [34,] -0.183896647 0.090350311 [35,] -0.041857885 -0.183896647 [36,] -0.016651005 -0.041857885 [37,] -0.068448762 -0.016651005 [38,] -0.035518202 -0.068448762 [39,] 0.088037905 -0.035518202 [40,] 0.055285741 0.088037905 [41,] -0.014504732 0.055285741 [42,] 0.070897024 -0.014504732 [43,] 0.064613851 0.070897024 [44,] 0.109549257 0.064613851 [45,] -0.123171028 0.109549257 [46,] 0.072777418 -0.123171028 [47,] -0.112750952 0.072777418 [48,] -0.063155353 -0.112750952 [49,] -0.016905774 -0.063155353 [50,] 0.010683965 -0.016905774 [51,] -0.043514899 0.010683965 [52,] -0.068854084 -0.043514899 [53,] 0.112808086 -0.068854084 [54,] -0.025692286 0.112808086 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.014789755 -0.013694877 2 -0.021645341 -0.014789755 3 0.059352541 -0.021645341 4 0.057910471 0.059352541 5 -0.047101747 0.057910471 6 -0.044053985 -0.047101747 7 -0.041380046 -0.044053985 8 -0.045306305 -0.041380046 9 0.118878754 -0.045306305 10 -0.044443133 0.118878754 11 -0.005347643 -0.044443133 12 -0.023223766 -0.005347643 13 -0.060906214 -0.023223766 14 -0.068521218 -0.060906214 15 0.079719789 -0.068521218 16 0.195986725 0.079719789 17 -0.080992361 0.195986725 18 0.014904951 -0.080992361 19 -0.007550535 0.014904951 20 -0.066978172 -0.007550535 21 0.035531302 -0.066978172 22 0.051300093 0.035531302 23 -0.092012536 0.051300093 24 -0.029985085 -0.092012536 25 -0.054252462 -0.029985085 26 -0.085879109 -0.054252462 27 0.125115194 -0.085879109 28 0.093867105 0.125115194 29 0.075216797 0.093867105 30 0.009992702 0.075216797 31 0.040922757 0.009992702 32 0.029283160 0.040922757 33 0.090350311 0.029283160 34 -0.183896647 0.090350311 35 -0.041857885 -0.183896647 36 -0.016651005 -0.041857885 37 -0.068448762 -0.016651005 38 -0.035518202 -0.068448762 39 0.088037905 -0.035518202 40 0.055285741 0.088037905 41 -0.014504732 0.055285741 42 0.070897024 -0.014504732 43 0.064613851 0.070897024 44 0.109549257 0.064613851 45 -0.123171028 0.109549257 46 0.072777418 -0.123171028 47 -0.112750952 0.072777418 48 -0.063155353 -0.112750952 49 -0.016905774 -0.063155353 50 0.010683965 -0.016905774 51 -0.043514899 0.010683965 52 -0.068854084 -0.043514899 53 0.112808086 -0.068854084 54 -0.025692286 0.112808086 > 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/76ww91259337308.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/883pg1259337308.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/9hh681259337308.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/10lbrk1259337308.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/11rjli1259337308.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/12jul31259337308.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/13qhoq1259337308.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/144t6g1259337308.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/15u00e1259337308.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/16rltd1259337308.tab") + } > > system("convert tmp/1ufxy1259337308.ps tmp/1ufxy1259337308.png") > system("convert tmp/2qqup1259337308.ps tmp/2qqup1259337308.png") > system("convert tmp/3r0gd1259337308.ps tmp/3r0gd1259337308.png") > system("convert tmp/4kv2n1259337308.ps tmp/4kv2n1259337308.png") > system("convert tmp/5vlna1259337308.ps tmp/5vlna1259337308.png") > system("convert tmp/6wihf1259337308.ps tmp/6wihf1259337308.png") > system("convert tmp/76ww91259337308.ps tmp/76ww91259337308.png") > system("convert tmp/883pg1259337308.ps tmp/883pg1259337308.png") > system("convert tmp/9hh681259337308.ps tmp/9hh681259337308.png") > system("convert tmp/10lbrk1259337308.ps tmp/10lbrk1259337308.png") > > > proc.time() user system elapsed 2.413 1.552 3.846