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(124,0,113,0,109,0,109,0,106,0,101,0,98,0,93,0,91,0,122,1,139,1,140,1,132,1,117,0,114,0,113,0,110,0,107,0,103,0,98,0,98,0,137,1,148,1,147,1,139,1,130,0,128,0,127,0,123,0,118,0,114,0,108,0,111,0,151,1,159,1,158,1,148,1,138,0,137,0,136,0,133,0,126,0,120,0,114,0,116,0,153,1,162,1,161,1,149,1,139,0,135,0,130,0,127,0,122,0,117,0,112,0,113,0,149,1,157,1,157,1,147,1,137,0,132,0,125,0,123,0,117,0,114,0,111,0,112,0,144,1,150,1,149,1,134,1,123,0,116,0,117,0,111,0,105,0,102,0,95,0,93,0,124,1,130,1,124,1,115,1,106,0,105,0,105,0,101,0,95,0,93,0,84,0,87,0,116,1,120,1,117,1,109,1),dim=c(2,97),dimnames=list(c('Y','X'),1:97)) > y <- array(NA,dim=c(2,97),dimnames=list(c('Y','X'),1:97)) > 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 Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 124 0 1 0 0 0 0 0 0 0 0 0 0 1 2 113 0 0 1 0 0 0 0 0 0 0 0 0 2 3 109 0 0 0 1 0 0 0 0 0 0 0 0 3 4 109 0 0 0 0 1 0 0 0 0 0 0 0 4 5 106 0 0 0 0 0 1 0 0 0 0 0 0 5 6 101 0 0 0 0 0 0 1 0 0 0 0 0 6 7 98 0 0 0 0 0 0 0 1 0 0 0 0 7 8 93 0 0 0 0 0 0 0 0 1 0 0 0 8 9 91 0 0 0 0 0 0 0 0 0 1 0 0 9 10 122 1 0 0 0 0 0 0 0 0 0 1 0 10 11 139 1 0 0 0 0 0 0 0 0 0 0 1 11 12 140 1 0 0 0 0 0 0 0 0 0 0 0 12 13 132 1 1 0 0 0 0 0 0 0 0 0 0 13 14 117 0 0 1 0 0 0 0 0 0 0 0 0 14 15 114 0 0 0 1 0 0 0 0 0 0 0 0 15 16 113 0 0 0 0 1 0 0 0 0 0 0 0 16 17 110 0 0 0 0 0 1 0 0 0 0 0 0 17 18 107 0 0 0 0 0 0 1 0 0 0 0 0 18 19 103 0 0 0 0 0 0 0 1 0 0 0 0 19 20 98 0 0 0 0 0 0 0 0 1 0 0 0 20 21 98 0 0 0 0 0 0 0 0 0 1 0 0 21 22 137 1 0 0 0 0 0 0 0 0 0 1 0 22 23 148 1 0 0 0 0 0 0 0 0 0 0 1 23 24 147 1 0 0 0 0 0 0 0 0 0 0 0 24 25 139 1 1 0 0 0 0 0 0 0 0 0 0 25 26 130 0 0 1 0 0 0 0 0 0 0 0 0 26 27 128 0 0 0 1 0 0 0 0 0 0 0 0 27 28 127 0 0 0 0 1 0 0 0 0 0 0 0 28 29 123 0 0 0 0 0 1 0 0 0 0 0 0 29 30 118 0 0 0 0 0 0 1 0 0 0 0 0 30 31 114 0 0 0 0 0 0 0 1 0 0 0 0 31 32 108 0 0 0 0 0 0 0 0 1 0 0 0 32 33 111 0 0 0 0 0 0 0 0 0 1 0 0 33 34 151 1 0 0 0 0 0 0 0 0 0 1 0 34 35 159 1 0 0 0 0 0 0 0 0 0 0 1 35 36 158 1 0 0 0 0 0 0 0 0 0 0 0 36 37 148 1 1 0 0 0 0 0 0 0 0 0 0 37 38 138 0 0 1 0 0 0 0 0 0 0 0 0 38 39 137 0 0 0 1 0 0 0 0 0 0 0 0 39 40 136 0 0 0 0 1 0 0 0 0 0 0 0 40 41 133 0 0 0 0 0 1 0 0 0 0 0 0 41 42 126 0 0 0 0 0 0 1 0 0 0 0 0 42 43 120 0 0 0 0 0 0 0 1 0 0 0 0 43 44 114 0 0 0 0 0 0 0 0 1 0 0 0 44 45 116 0 0 0 0 0 0 0 0 0 1 0 0 45 46 153 1 0 0 0 0 0 0 0 0 0 1 0 46 47 162 1 0 0 0 0 0 0 0 0 0 0 1 47 48 161 1 0 0 0 0 0 0 0 0 0 0 0 48 49 149 1 1 0 0 0 0 0 0 0 0 0 0 49 50 139 0 0 1 0 0 0 0 0 0 0 0 0 50 51 135 0 0 0 1 0 0 0 0 0 0 0 0 51 52 130 0 0 0 0 1 0 0 0 0 0 0 0 52 53 127 0 0 0 0 0 1 0 0 0 0 0 0 53 54 122 0 0 0 0 0 0 1 0 0 0 0 0 54 55 117 0 0 0 0 0 0 0 1 0 0 0 0 55 56 112 0 0 0 0 0 0 0 0 1 0 0 0 56 57 113 0 0 0 0 0 0 0 0 0 1 0 0 57 58 149 1 0 0 0 0 0 0 0 0 0 1 0 58 59 157 1 0 0 0 0 0 0 0 0 0 0 1 59 60 157 1 0 0 0 0 0 0 0 0 0 0 0 60 61 147 1 1 0 0 0 0 0 0 0 0 0 0 61 62 137 0 0 1 0 0 0 0 0 0 0 0 0 62 63 132 0 0 0 1 0 0 0 0 0 0 0 0 63 64 125 0 0 0 0 1 0 0 0 0 0 0 0 64 65 123 0 0 0 0 0 1 0 0 0 0 0 0 65 66 117 0 0 0 0 0 0 1 0 0 0 0 0 66 67 114 0 0 0 0 0 0 0 1 0 0 0 0 67 68 111 0 0 0 0 0 0 0 0 1 0 0 0 68 69 112 0 0 0 0 0 0 0 0 0 1 0 0 69 70 144 1 0 0 0 0 0 0 0 0 0 1 0 70 71 150 1 0 0 0 0 0 0 0 0 0 0 1 71 72 149 1 0 0 0 0 0 0 0 0 0 0 0 72 73 134 1 1 0 0 0 0 0 0 0 0 0 0 73 74 123 0 0 1 0 0 0 0 0 0 0 0 0 74 75 116 0 0 0 1 0 0 0 0 0 0 0 0 75 76 117 0 0 0 0 1 0 0 0 0 0 0 0 76 77 111 0 0 0 0 0 1 0 0 0 0 0 0 77 78 105 0 0 0 0 0 0 1 0 0 0 0 0 78 79 102 0 0 0 0 0 0 0 1 0 0 0 0 79 80 95 0 0 0 0 0 0 0 0 1 0 0 0 80 81 93 0 0 0 0 0 0 0 0 0 1 0 0 81 82 124 1 0 0 0 0 0 0 0 0 0 1 0 82 83 130 1 0 0 0 0 0 0 0 0 0 0 1 83 84 124 1 0 0 0 0 0 0 0 0 0 0 0 84 85 115 1 1 0 0 0 0 0 0 0 0 0 0 85 86 106 0 0 1 0 0 0 0 0 0 0 0 0 86 87 105 0 0 0 1 0 0 0 0 0 0 0 0 87 88 105 0 0 0 0 1 0 0 0 0 0 0 0 88 89 101 0 0 0 0 0 1 0 0 0 0 0 0 89 90 95 0 0 0 0 0 0 1 0 0 0 0 0 90 91 93 0 0 0 0 0 0 0 1 0 0 0 0 91 92 84 0 0 0 0 0 0 0 0 1 0 0 0 92 93 87 0 0 0 0 0 0 0 0 0 1 0 0 93 94 116 1 0 0 0 0 0 0 0 0 0 1 0 94 95 120 1 0 0 0 0 0 0 0 0 0 0 1 95 96 117 1 0 0 0 0 0 0 0 0 0 0 0 96 97 109 1 1 0 0 0 0 0 0 0 0 0 0 97 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 134.0000 15.9554 -9.8920 -3.8743 -7.1414 -8.7834 M5 M6 M7 M8 M9 M10 -12.1754 -17.4425 -21.0845 -26.7265 -25.8686 -7.3409 M11 t 1.3920 -0.1080 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -22.590 -11.090 1.636 11.318 16.227 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 134.00000 13.89664 9.643 3.39e-15 *** X 15.95536 13.41687 1.189 0.2378 M1 -9.89203 6.21494 -1.592 0.1153 M2 -3.87434 14.71562 -0.263 0.7930 M3 -7.14137 14.72206 -0.485 0.6289 M4 -8.78340 14.72864 -0.596 0.5526 M5 -12.17543 14.73536 -0.826 0.4110 M6 -17.44246 14.74222 -1.183 0.2401 M7 -21.08449 14.74922 -1.430 0.1566 M8 -26.72652 14.75636 -1.811 0.0737 . M9 -25.86855 14.76364 -1.752 0.0834 . M10 -7.34094 6.21545 -1.181 0.2409 M11 1.39203 6.21494 0.224 0.8233 t -0.10797 0.04614 -2.340 0.0217 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 12.43 on 83 degrees of freedom Multiple R-squared: 0.6245, Adjusted R-squared: 0.5657 F-statistic: 10.62 on 13 and 83 DF, p-value: 7.495e-13 > 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,] 6.264170e-05 1.252834e-04 9.999374e-01 [2,] 3.703433e-05 7.406866e-05 9.999630e-01 [3,] 2.727052e-06 5.454103e-06 9.999973e-01 [4,] 2.020945e-07 4.041890e-07 9.999998e-01 [5,] 2.956695e-07 5.913390e-07 9.999997e-01 [6,] 5.299576e-04 1.059915e-03 9.994700e-01 [7,] 2.536804e-04 5.073608e-04 9.997463e-01 [8,] 9.585137e-05 1.917027e-04 9.999041e-01 [9,] 3.494995e-05 6.989989e-05 9.999651e-01 [10,] 5.340259e-05 1.068052e-04 9.999466e-01 [11,] 9.424383e-05 1.884877e-04 9.999058e-01 [12,] 9.494601e-05 1.898920e-04 9.999051e-01 [13,] 7.482660e-05 1.496532e-04 9.999252e-01 [14,] 5.290045e-05 1.058009e-04 9.999471e-01 [15,] 4.376942e-05 8.753884e-05 9.999562e-01 [16,] 4.703217e-05 9.406433e-05 9.999530e-01 [17,] 9.841620e-05 1.968324e-04 9.999016e-01 [18,] 7.917337e-04 1.583467e-03 9.992083e-01 [19,] 6.376229e-04 1.275246e-03 9.993624e-01 [20,] 4.688529e-04 9.377057e-04 9.995311e-01 [21,] 3.708591e-04 7.417182e-04 9.996291e-01 [22,] 3.359322e-04 6.718643e-04 9.996641e-01 [23,] 2.551753e-04 5.103507e-04 9.997448e-01 [24,] 1.658736e-04 3.317471e-04 9.998341e-01 [25,] 1.068730e-04 2.137460e-04 9.998931e-01 [26,] 8.335356e-05 1.667071e-04 9.999166e-01 [27,] 1.752268e-04 3.504536e-04 9.998248e-01 [28,] 5.112382e-04 1.022476e-03 9.994888e-01 [29,] 9.738938e-04 1.947788e-03 9.990261e-01 [30,] 8.800850e-04 1.760170e-03 9.991199e-01 [31,] 1.105501e-03 2.211003e-03 9.988945e-01 [32,] 1.386081e-03 2.772163e-03 9.986139e-01 [33,] 4.901548e-03 9.803096e-03 9.950985e-01 [34,] 9.437010e-03 1.887402e-02 9.905630e-01 [35,] 2.002063e-02 4.004126e-02 9.799794e-01 [36,] 1.025540e-01 2.051080e-01 8.974460e-01 [37,] 2.347023e-01 4.694046e-01 7.652977e-01 [38,] 3.752591e-01 7.505183e-01 6.247409e-01 [39,] 6.206140e-01 7.587721e-01 3.793860e-01 [40,] 7.969291e-01 4.061419e-01 2.030709e-01 [41,] 9.219515e-01 1.560971e-01 7.804853e-02 [42,] 9.425187e-01 1.149627e-01 5.748134e-02 [43,] 9.570657e-01 8.586859e-02 4.293430e-02 [44,] 9.595476e-01 8.090478e-02 4.045239e-02 [45,] 9.614364e-01 7.712715e-02 3.856358e-02 [46,] 9.604296e-01 7.914071e-02 3.957035e-02 [47,] 9.600738e-01 7.985241e-02 3.992620e-02 [48,] 9.785891e-01 4.282177e-02 2.141089e-02 [49,] 9.799203e-01 4.015946e-02 2.007973e-02 [50,] 9.806831e-01 3.863388e-02 1.931694e-02 [51,] 9.795267e-01 4.094651e-02 2.047326e-02 [52,] 9.706867e-01 5.862666e-02 2.931333e-02 [53,] 9.588542e-01 8.229150e-02 4.114575e-02 [54,] 9.594173e-01 8.116545e-02 4.058272e-02 [55,] 9.739826e-01 5.203486e-02 2.601743e-02 [56,] 9.984611e-01 3.077892e-03 1.538946e-03 [57,] 9.997012e-01 5.975248e-04 2.987624e-04 [58,] 9.999821e-01 3.589179e-05 1.794589e-05 [59,] 9.999628e-01 7.441287e-05 3.720643e-05 [60,] 9.999500e-01 9.998244e-05 4.999122e-05 [61,] 9.998262e-01 3.475741e-04 1.737870e-04 [62,] 9.993887e-01 1.222597e-03 6.112985e-04 [63,] 9.970698e-01 5.860481e-03 2.930241e-03 [64,] 9.945817e-01 1.083662e-02 5.418310e-03 > postscript(file="/var/www/html/rcomp/tmp/169f41227613924.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/216b91227613924.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/3wzyl1227613924.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/41rol1227613924.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/5m95r1227613924.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 = 97 Frequency = 1 1 2 3 4 5 -8.437695e-15 -1.690972e+01 -1.753472e+01 -1.578472e+01 -1.528472e+01 6 7 8 9 10 -1.490972e+01 -1.415972e+01 -1.340972e+01 -1.615972e+01 -1.953472e+01 11 12 13 14 15 -1.115972e+01 -8.659722e+00 -6.659722e+00 -1.161409e+01 -1.123909e+01 16 17 18 19 20 -1.048909e+01 -9.989087e+00 -7.614087e+00 -7.864087e+00 -7.114087e+00 21 22 23 24 25 -7.864087e+00 -3.239087e+00 -8.640873e-01 -3.640873e-01 1.635913e+00 26 27 28 29 30 2.681548e+00 4.056548e+00 4.806548e+00 4.306548e+00 4.681548e+00 31 32 33 34 35 4.431548e+00 4.181548e+00 6.431548e+00 1.205655e+01 1.143155e+01 36 37 38 39 40 1.193155e+01 1.193155e+01 1.197718e+01 1.435218e+01 1.510218e+01 41 42 43 44 45 1.560218e+01 1.397718e+01 1.172718e+01 1.147718e+01 1.272718e+01 46 47 48 49 50 1.535218e+01 1.572718e+01 1.622718e+01 1.422718e+01 1.427282e+01 51 52 53 54 55 1.364782e+01 1.039782e+01 1.089782e+01 1.127282e+01 1.002282e+01 56 57 58 59 60 1.077282e+01 1.102282e+01 1.264782e+01 1.202282e+01 1.352282e+01 61 62 63 64 65 1.352282e+01 1.356845e+01 1.194345e+01 6.693452e+00 8.193452e+00 66 67 68 69 70 7.568452e+00 8.318452e+00 1.106845e+01 1.131845e+01 8.943452e+00 71 72 73 74 75 6.318452e+00 6.818452e+00 1.818452e+00 8.640873e-01 -2.760913e+00 76 77 78 79 80 -1.091270e-02 -2.510913e+00 -3.135913e+00 -2.385913e+00 -3.635913e+00 81 82 83 84 85 -6.385913e+00 -9.760913e+00 -1.238591e+01 -1.688591e+01 -1.588591e+01 86 87 88 89 90 -1.484028e+01 -1.246528e+01 -1.071528e+01 -1.121528e+01 -1.184028e+01 91 92 93 94 95 -1.009028e+01 -1.334028e+01 -1.109028e+01 -1.646528e+01 -2.109028e+01 96 97 -2.259028e+01 -2.059028e+01 > postscript(file="/var/www/html/rcomp/tmp/60gdq1227613924.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 = 97 Frequency = 1 lag(myerror, k = 1) myerror 0 -8.437695e-15 NA 1 -1.690972e+01 -8.437695e-15 2 -1.753472e+01 -1.690972e+01 3 -1.578472e+01 -1.753472e+01 4 -1.528472e+01 -1.578472e+01 5 -1.490972e+01 -1.528472e+01 6 -1.415972e+01 -1.490972e+01 7 -1.340972e+01 -1.415972e+01 8 -1.615972e+01 -1.340972e+01 9 -1.953472e+01 -1.615972e+01 10 -1.115972e+01 -1.953472e+01 11 -8.659722e+00 -1.115972e+01 12 -6.659722e+00 -8.659722e+00 13 -1.161409e+01 -6.659722e+00 14 -1.123909e+01 -1.161409e+01 15 -1.048909e+01 -1.123909e+01 16 -9.989087e+00 -1.048909e+01 17 -7.614087e+00 -9.989087e+00 18 -7.864087e+00 -7.614087e+00 19 -7.114087e+00 -7.864087e+00 20 -7.864087e+00 -7.114087e+00 21 -3.239087e+00 -7.864087e+00 22 -8.640873e-01 -3.239087e+00 23 -3.640873e-01 -8.640873e-01 24 1.635913e+00 -3.640873e-01 25 2.681548e+00 1.635913e+00 26 4.056548e+00 2.681548e+00 27 4.806548e+00 4.056548e+00 28 4.306548e+00 4.806548e+00 29 4.681548e+00 4.306548e+00 30 4.431548e+00 4.681548e+00 31 4.181548e+00 4.431548e+00 32 6.431548e+00 4.181548e+00 33 1.205655e+01 6.431548e+00 34 1.143155e+01 1.205655e+01 35 1.193155e+01 1.143155e+01 36 1.193155e+01 1.193155e+01 37 1.197718e+01 1.193155e+01 38 1.435218e+01 1.197718e+01 39 1.510218e+01 1.435218e+01 40 1.560218e+01 1.510218e+01 41 1.397718e+01 1.560218e+01 42 1.172718e+01 1.397718e+01 43 1.147718e+01 1.172718e+01 44 1.272718e+01 1.147718e+01 45 1.535218e+01 1.272718e+01 46 1.572718e+01 1.535218e+01 47 1.622718e+01 1.572718e+01 48 1.422718e+01 1.622718e+01 49 1.427282e+01 1.422718e+01 50 1.364782e+01 1.427282e+01 51 1.039782e+01 1.364782e+01 52 1.089782e+01 1.039782e+01 53 1.127282e+01 1.089782e+01 54 1.002282e+01 1.127282e+01 55 1.077282e+01 1.002282e+01 56 1.102282e+01 1.077282e+01 57 1.264782e+01 1.102282e+01 58 1.202282e+01 1.264782e+01 59 1.352282e+01 1.202282e+01 60 1.352282e+01 1.352282e+01 61 1.356845e+01 1.352282e+01 62 1.194345e+01 1.356845e+01 63 6.693452e+00 1.194345e+01 64 8.193452e+00 6.693452e+00 65 7.568452e+00 8.193452e+00 66 8.318452e+00 7.568452e+00 67 1.106845e+01 8.318452e+00 68 1.131845e+01 1.106845e+01 69 8.943452e+00 1.131845e+01 70 6.318452e+00 8.943452e+00 71 6.818452e+00 6.318452e+00 72 1.818452e+00 6.818452e+00 73 8.640873e-01 1.818452e+00 74 -2.760913e+00 8.640873e-01 75 -1.091270e-02 -2.760913e+00 76 -2.510913e+00 -1.091270e-02 77 -3.135913e+00 -2.510913e+00 78 -2.385913e+00 -3.135913e+00 79 -3.635913e+00 -2.385913e+00 80 -6.385913e+00 -3.635913e+00 81 -9.760913e+00 -6.385913e+00 82 -1.238591e+01 -9.760913e+00 83 -1.688591e+01 -1.238591e+01 84 -1.588591e+01 -1.688591e+01 85 -1.484028e+01 -1.588591e+01 86 -1.246528e+01 -1.484028e+01 87 -1.071528e+01 -1.246528e+01 88 -1.121528e+01 -1.071528e+01 89 -1.184028e+01 -1.121528e+01 90 -1.009028e+01 -1.184028e+01 91 -1.334028e+01 -1.009028e+01 92 -1.109028e+01 -1.334028e+01 93 -1.646528e+01 -1.109028e+01 94 -2.109028e+01 -1.646528e+01 95 -2.259028e+01 -2.109028e+01 96 -2.059028e+01 -2.259028e+01 97 NA -2.059028e+01 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -16.90972222 -8.437695e-15 [2,] -17.53472222 -1.690972e+01 [3,] -15.78472222 -1.753472e+01 [4,] -15.28472222 -1.578472e+01 [5,] -14.90972222 -1.528472e+01 [6,] -14.15972222 -1.490972e+01 [7,] -13.40972222 -1.415972e+01 [8,] -16.15972222 -1.340972e+01 [9,] -19.53472222 -1.615972e+01 [10,] -11.15972222 -1.953472e+01 [11,] -8.65972222 -1.115972e+01 [12,] -6.65972222 -8.659722e+00 [13,] -11.61408730 -6.659722e+00 [14,] -11.23908730 -1.161409e+01 [15,] -10.48908730 -1.123909e+01 [16,] -9.98908730 -1.048909e+01 [17,] -7.61408730 -9.989087e+00 [18,] -7.86408730 -7.614087e+00 [19,] -7.11408730 -7.864087e+00 [20,] -7.86408730 -7.114087e+00 [21,] -3.23908730 -7.864087e+00 [22,] -0.86408730 -3.239087e+00 [23,] -0.36408730 -8.640873e-01 [24,] 1.63591270 -3.640873e-01 [25,] 2.68154762 1.635913e+00 [26,] 4.05654762 2.681548e+00 [27,] 4.80654762 4.056548e+00 [28,] 4.30654762 4.806548e+00 [29,] 4.68154762 4.306548e+00 [30,] 4.43154762 4.681548e+00 [31,] 4.18154762 4.431548e+00 [32,] 6.43154762 4.181548e+00 [33,] 12.05654762 6.431548e+00 [34,] 11.43154762 1.205655e+01 [35,] 11.93154762 1.143155e+01 [36,] 11.93154762 1.193155e+01 [37,] 11.97718254 1.193155e+01 [38,] 14.35218254 1.197718e+01 [39,] 15.10218254 1.435218e+01 [40,] 15.60218254 1.510218e+01 [41,] 13.97718254 1.560218e+01 [42,] 11.72718254 1.397718e+01 [43,] 11.47718254 1.172718e+01 [44,] 12.72718254 1.147718e+01 [45,] 15.35218254 1.272718e+01 [46,] 15.72718254 1.535218e+01 [47,] 16.22718254 1.572718e+01 [48,] 14.22718254 1.622718e+01 [49,] 14.27281746 1.422718e+01 [50,] 13.64781746 1.427282e+01 [51,] 10.39781746 1.364782e+01 [52,] 10.89781746 1.039782e+01 [53,] 11.27281746 1.089782e+01 [54,] 10.02281746 1.127282e+01 [55,] 10.77281746 1.002282e+01 [56,] 11.02281746 1.077282e+01 [57,] 12.64781746 1.102282e+01 [58,] 12.02281746 1.264782e+01 [59,] 13.52281746 1.202282e+01 [60,] 13.52281746 1.352282e+01 [61,] 13.56845238 1.352282e+01 [62,] 11.94345238 1.356845e+01 [63,] 6.69345238 1.194345e+01 [64,] 8.19345238 6.693452e+00 [65,] 7.56845238 8.193452e+00 [66,] 8.31845238 7.568452e+00 [67,] 11.06845238 8.318452e+00 [68,] 11.31845238 1.106845e+01 [69,] 8.94345238 1.131845e+01 [70,] 6.31845238 8.943452e+00 [71,] 6.81845238 6.318452e+00 [72,] 1.81845238 6.818452e+00 [73,] 0.86408730 1.818452e+00 [74,] -2.76091270 8.640873e-01 [75,] -0.01091270 -2.760913e+00 [76,] -2.51091270 -1.091270e-02 [77,] -3.13591270 -2.510913e+00 [78,] -2.38591270 -3.135913e+00 [79,] -3.63591270 -2.385913e+00 [80,] -6.38591270 -3.635913e+00 [81,] -9.76091270 -6.385913e+00 [82,] -12.38591270 -9.760913e+00 [83,] -16.88591270 -1.238591e+01 [84,] -15.88591270 -1.688591e+01 [85,] -14.84027778 -1.588591e+01 [86,] -12.46527778 -1.484028e+01 [87,] -10.71527778 -1.246528e+01 [88,] -11.21527778 -1.071528e+01 [89,] -11.84027778 -1.121528e+01 [90,] -10.09027778 -1.184028e+01 [91,] -13.34027778 -1.009028e+01 [92,] -11.09027778 -1.334028e+01 [93,] -16.46527778 -1.109028e+01 [94,] -21.09027778 -1.646528e+01 [95,] -22.59027778 -2.109028e+01 [96,] -20.59027778 -2.259028e+01 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -16.90972222 -8.437695e-15 2 -17.53472222 -1.690972e+01 3 -15.78472222 -1.753472e+01 4 -15.28472222 -1.578472e+01 5 -14.90972222 -1.528472e+01 6 -14.15972222 -1.490972e+01 7 -13.40972222 -1.415972e+01 8 -16.15972222 -1.340972e+01 9 -19.53472222 -1.615972e+01 10 -11.15972222 -1.953472e+01 11 -8.65972222 -1.115972e+01 12 -6.65972222 -8.659722e+00 13 -11.61408730 -6.659722e+00 14 -11.23908730 -1.161409e+01 15 -10.48908730 -1.123909e+01 16 -9.98908730 -1.048909e+01 17 -7.61408730 -9.989087e+00 18 -7.86408730 -7.614087e+00 19 -7.11408730 -7.864087e+00 20 -7.86408730 -7.114087e+00 21 -3.23908730 -7.864087e+00 22 -0.86408730 -3.239087e+00 23 -0.36408730 -8.640873e-01 24 1.63591270 -3.640873e-01 25 2.68154762 1.635913e+00 26 4.05654762 2.681548e+00 27 4.80654762 4.056548e+00 28 4.30654762 4.806548e+00 29 4.68154762 4.306548e+00 30 4.43154762 4.681548e+00 31 4.18154762 4.431548e+00 32 6.43154762 4.181548e+00 33 12.05654762 6.431548e+00 34 11.43154762 1.205655e+01 35 11.93154762 1.143155e+01 36 11.93154762 1.193155e+01 37 11.97718254 1.193155e+01 38 14.35218254 1.197718e+01 39 15.10218254 1.435218e+01 40 15.60218254 1.510218e+01 41 13.97718254 1.560218e+01 42 11.72718254 1.397718e+01 43 11.47718254 1.172718e+01 44 12.72718254 1.147718e+01 45 15.35218254 1.272718e+01 46 15.72718254 1.535218e+01 47 16.22718254 1.572718e+01 48 14.22718254 1.622718e+01 49 14.27281746 1.422718e+01 50 13.64781746 1.427282e+01 51 10.39781746 1.364782e+01 52 10.89781746 1.039782e+01 53 11.27281746 1.089782e+01 54 10.02281746 1.127282e+01 55 10.77281746 1.002282e+01 56 11.02281746 1.077282e+01 57 12.64781746 1.102282e+01 58 12.02281746 1.264782e+01 59 13.52281746 1.202282e+01 60 13.52281746 1.352282e+01 61 13.56845238 1.352282e+01 62 11.94345238 1.356845e+01 63 6.69345238 1.194345e+01 64 8.19345238 6.693452e+00 65 7.56845238 8.193452e+00 66 8.31845238 7.568452e+00 67 11.06845238 8.318452e+00 68 11.31845238 1.106845e+01 69 8.94345238 1.131845e+01 70 6.31845238 8.943452e+00 71 6.81845238 6.318452e+00 72 1.81845238 6.818452e+00 73 0.86408730 1.818452e+00 74 -2.76091270 8.640873e-01 75 -0.01091270 -2.760913e+00 76 -2.51091270 -1.091270e-02 77 -3.13591270 -2.510913e+00 78 -2.38591270 -3.135913e+00 79 -3.63591270 -2.385913e+00 80 -6.38591270 -3.635913e+00 81 -9.76091270 -6.385913e+00 82 -12.38591270 -9.760913e+00 83 -16.88591270 -1.238591e+01 84 -15.88591270 -1.688591e+01 85 -14.84027778 -1.588591e+01 86 -12.46527778 -1.484028e+01 87 -10.71527778 -1.246528e+01 88 -11.21527778 -1.071528e+01 89 -11.84027778 -1.121528e+01 90 -10.09027778 -1.184028e+01 91 -13.34027778 -1.009028e+01 92 -11.09027778 -1.334028e+01 93 -16.46527778 -1.109028e+01 94 -21.09027778 -1.646528e+01 95 -22.59027778 -2.109028e+01 96 -20.59027778 -2.259028e+01 > 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/7j6wz1227613924.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/8hjap1227613924.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/9fqkx1227613924.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') Warning message: In dropInf(r.w/(s * sqrt(1 - hii))) : Not plotting observations with leverage one: 1 > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10tqxl1227613924.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/11cmv41227613924.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/124njn1227613924.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/13wy7j1227613924.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/14ii5c1227613924.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/15ifpp1227613924.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/167ckh1227613924.tab") + } > > system("convert tmp/169f41227613924.ps tmp/169f41227613924.png") > system("convert tmp/216b91227613924.ps tmp/216b91227613924.png") > system("convert tmp/3wzyl1227613924.ps tmp/3wzyl1227613924.png") > system("convert tmp/41rol1227613924.ps tmp/41rol1227613924.png") > system("convert tmp/5m95r1227613924.ps tmp/5m95r1227613924.png") > system("convert tmp/60gdq1227613924.ps tmp/60gdq1227613924.png") > system("convert tmp/7j6wz1227613924.ps tmp/7j6wz1227613924.png") > system("convert tmp/8hjap1227613924.ps tmp/8hjap1227613924.png") > system("convert tmp/9fqkx1227613924.ps tmp/9fqkx1227613924.png") > system("convert tmp/10tqxl1227613924.ps tmp/10tqxl1227613924.png") > > > proc.time() user system elapsed 2.910 1.564 3.753