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(108.5 + ,98.71 + ,115.5 + ,116.6 + ,112.3 + ,108.5 + ,112.3 + ,98.54 + ,120.1 + ,115.5 + ,116.6 + ,112.3 + ,116.6 + ,98.2 + ,132.9 + ,120.1 + ,115.5 + ,116.6 + ,115.5 + ,96.92 + ,128.1 + ,132.9 + ,120.1 + ,115.5 + ,120.1 + ,99.06 + ,129.3 + ,128.1 + ,132.9 + ,120.1 + ,132.9 + ,99.65 + ,132.5 + ,129.3 + ,128.1 + ,132.9 + ,128.1 + ,99.82 + ,131 + ,132.5 + ,129.3 + ,128.1 + ,129.3 + ,99.99 + ,124.9 + ,131 + ,132.5 + ,129.3 + ,132.5 + ,100.33 + ,120.8 + ,124.9 + ,131 + ,132.5 + ,131 + ,99.31 + ,122 + ,120.8 + ,124.9 + ,131 + ,124.9 + ,101.1 + ,122.1 + ,122 + ,120.8 + ,124.9 + ,120.8 + ,101.1 + ,127.4 + ,122.1 + ,122 + ,120.8 + ,122 + ,100.93 + ,135.2 + ,127.4 + ,122.1 + ,122 + ,122.1 + ,100.85 + ,137.3 + ,135.2 + ,127.4 + ,122.1 + ,127.4 + ,100.93 + ,135 + ,137.3 + ,135.2 + ,127.4 + ,135.2 + ,99.6 + ,136 + ,135 + ,137.3 + ,135.2 + ,137.3 + ,101.88 + ,138.4 + ,136 + ,135 + ,137.3 + ,135 + ,101.81 + ,134.7 + ,138.4 + ,136 + ,135 + ,136 + ,102.38 + ,138.4 + ,134.7 + ,138.4 + ,136 + ,138.4 + ,102.74 + ,133.9 + ,138.4 + ,134.7 + ,138.4 + ,134.7 + ,102.82 + ,133.6 + ,133.9 + ,138.4 + ,134.7 + ,138.4 + ,101.72 + ,141.2 + ,133.6 + ,133.9 + ,138.4 + ,133.9 + ,103.47 + ,151.8 + ,141.2 + ,133.6 + ,133.9 + ,133.6 + ,102.98 + ,155.4 + ,151.8 + ,141.2 + ,133.6 + ,141.2 + ,102.68 + ,156.6 + ,155.4 + ,151.8 + ,141.2 + ,151.8 + ,102.9 + ,161.6 + ,156.6 + ,155.4 + ,151.8 + ,155.4 + ,103.03 + ,160.7 + ,161.6 + ,156.6 + ,155.4 + ,156.6 + ,101.29 + ,156 + ,160.7 + ,161.6 + ,156.6 + ,161.6 + ,103.69 + ,159.5 + ,156 + ,160.7 + ,161.6 + ,160.7 + ,103.68 + ,168.7 + ,159.5 + ,156 + ,160.7 + ,156 + ,104.2 + ,169.9 + ,168.7 + ,159.5 + ,156 + ,159.5 + ,104.08 + ,169.9 + ,169.9 + ,168.7 + ,159.5 + ,168.7 + ,104.16 + ,185.9 + ,169.9 + ,169.9 + ,168.7 + ,169.9 + ,103.05 + ,190.8 + ,185.9 + ,169.9 + ,169.9 + ,169.9 + ,104.66 + ,195.8 + ,190.8 + ,185.9 + ,169.9 + ,185.9 + ,104.46 + ,211.9 + ,195.8 + ,190.8 + ,185.9 + ,190.8 + ,104.95 + ,227.1 + ,211.9 + ,195.8 + ,190.8 + ,195.8 + ,105.85 + ,251.3 + ,227.1 + ,211.9 + ,195.8 + ,211.9 + ,106.23 + ,256.7 + ,251.3 + ,227.1 + ,211.9 + ,227.1 + ,104.86 + ,251.9 + ,256.7 + ,251.3 + ,227.1 + ,251.3 + ,107.44 + ,251.2 + ,251.9 + ,256.7 + ,251.3 + ,256.7 + ,108.23 + ,270.3 + ,251.2 + ,251.9 + ,256.7 + ,251.9 + ,108.45 + ,267.2 + ,270.3 + ,251.2 + ,251.9 + ,251.2 + ,109.39 + ,243 + ,267.2 + ,270.3 + ,251.2 + ,270.3 + ,110.15 + ,229.9 + ,243 + ,267.2 + ,270.3 + ,267.2 + ,109.13 + ,187.2 + ,229.9 + ,243 + ,267.2 + ,243 + ,110.28 + ,178.2 + ,187.2 + ,229.9 + ,243 + ,229.9 + ,110.17 + ,175.2 + ,178.2 + ,187.2 + ,229.9 + ,187.2 + ,109.99 + ,192.4 + ,175.2 + ,178.2 + ,187.2 + ,178.2 + ,109.26 + ,187 + ,192.4 + ,175.2 + ,178.2 + ,175.2 + ,109.11 + ,184 + ,187 + ,192.4 + ,175.2 + ,192.4 + ,107.06 + ,194.1 + ,184 + ,187 + ,192.4 + ,187 + ,109.53 + ,212.7 + ,194.1 + ,184 + ,187 + ,184 + ,108.92 + ,217.5 + ,212.7 + ,194.1 + ,184 + ,194.1 + ,109.24 + ,200.5 + ,217.5 + ,212.7 + ,194.1 + ,212.7 + ,109.12 + ,205.9 + ,200.5 + ,217.5 + ,212.7 + ,217.5 + ,109 + ,196.5 + ,205.9 + ,200.5 + ,217.5 + ,200.5 + ,107.23 + ,206.3 + ,196.5 + ,205.9 + ,200.5) + ,dim=c(6 + ,58) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4') + ,1:58)) > y <- array(NA,dim=c(6,58),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4'),1:58)) > 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 Y1 Y2 Y3 Y4 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 108.5 98.71 115.5 116.6 112.3 108.5 1 0 0 0 0 0 0 0 0 0 0 1 2 112.3 98.54 120.1 115.5 116.6 112.3 0 1 0 0 0 0 0 0 0 0 0 2 3 116.6 98.20 132.9 120.1 115.5 116.6 0 0 1 0 0 0 0 0 0 0 0 3 4 115.5 96.92 128.1 132.9 120.1 115.5 0 0 0 1 0 0 0 0 0 0 0 4 5 120.1 99.06 129.3 128.1 132.9 120.1 0 0 0 0 1 0 0 0 0 0 0 5 6 132.9 99.65 132.5 129.3 128.1 132.9 0 0 0 0 0 1 0 0 0 0 0 6 7 128.1 99.82 131.0 132.5 129.3 128.1 0 0 0 0 0 0 1 0 0 0 0 7 8 129.3 99.99 124.9 131.0 132.5 129.3 0 0 0 0 0 0 0 1 0 0 0 8 9 132.5 100.33 120.8 124.9 131.0 132.5 0 0 0 0 0 0 0 0 1 0 0 9 10 131.0 99.31 122.0 120.8 124.9 131.0 0 0 0 0 0 0 0 0 0 1 0 10 11 124.9 101.10 122.1 122.0 120.8 124.9 0 0 0 0 0 0 0 0 0 0 1 11 12 120.8 101.10 127.4 122.1 122.0 120.8 0 0 0 0 0 0 0 0 0 0 0 12 13 122.0 100.93 135.2 127.4 122.1 122.0 1 0 0 0 0 0 0 0 0 0 0 13 14 122.1 100.85 137.3 135.2 127.4 122.1 0 1 0 0 0 0 0 0 0 0 0 14 15 127.4 100.93 135.0 137.3 135.2 127.4 0 0 1 0 0 0 0 0 0 0 0 15 16 135.2 99.60 136.0 135.0 137.3 135.2 0 0 0 1 0 0 0 0 0 0 0 16 17 137.3 101.88 138.4 136.0 135.0 137.3 0 0 0 0 1 0 0 0 0 0 0 17 18 135.0 101.81 134.7 138.4 136.0 135.0 0 0 0 0 0 1 0 0 0 0 0 18 19 136.0 102.38 138.4 134.7 138.4 136.0 0 0 0 0 0 0 1 0 0 0 0 19 20 138.4 102.74 133.9 138.4 134.7 138.4 0 0 0 0 0 0 0 1 0 0 0 20 21 134.7 102.82 133.6 133.9 138.4 134.7 0 0 0 0 0 0 0 0 1 0 0 21 22 138.4 101.72 141.2 133.6 133.9 138.4 0 0 0 0 0 0 0 0 0 1 0 22 23 133.9 103.47 151.8 141.2 133.6 133.9 0 0 0 0 0 0 0 0 0 0 1 23 24 133.6 102.98 155.4 151.8 141.2 133.6 0 0 0 0 0 0 0 0 0 0 0 24 25 141.2 102.68 156.6 155.4 151.8 141.2 1 0 0 0 0 0 0 0 0 0 0 25 26 151.8 102.90 161.6 156.6 155.4 151.8 0 1 0 0 0 0 0 0 0 0 0 26 27 155.4 103.03 160.7 161.6 156.6 155.4 0 0 1 0 0 0 0 0 0 0 0 27 28 156.6 101.29 156.0 160.7 161.6 156.6 0 0 0 1 0 0 0 0 0 0 0 28 29 161.6 103.69 159.5 156.0 160.7 161.6 0 0 0 0 1 0 0 0 0 0 0 29 30 160.7 103.68 168.7 159.5 156.0 160.7 0 0 0 0 0 1 0 0 0 0 0 30 31 156.0 104.20 169.9 168.7 159.5 156.0 0 0 0 0 0 0 1 0 0 0 0 31 32 159.5 104.08 169.9 169.9 168.7 159.5 0 0 0 0 0 0 0 1 0 0 0 32 33 168.7 104.16 185.9 169.9 169.9 168.7 0 0 0 0 0 0 0 0 1 0 0 33 34 169.9 103.05 190.8 185.9 169.9 169.9 0 0 0 0 0 0 0 0 0 1 0 34 35 169.9 104.66 195.8 190.8 185.9 169.9 0 0 0 0 0 0 0 0 0 0 1 35 36 185.9 104.46 211.9 195.8 190.8 185.9 0 0 0 0 0 0 0 0 0 0 0 36 37 190.8 104.95 227.1 211.9 195.8 190.8 1 0 0 0 0 0 0 0 0 0 0 37 38 195.8 105.85 251.3 227.1 211.9 195.8 0 1 0 0 0 0 0 0 0 0 0 38 39 211.9 106.23 256.7 251.3 227.1 211.9 0 0 1 0 0 0 0 0 0 0 0 39 40 227.1 104.86 251.9 256.7 251.3 227.1 0 0 0 1 0 0 0 0 0 0 0 40 41 251.3 107.44 251.2 251.9 256.7 251.3 0 0 0 0 1 0 0 0 0 0 0 41 42 256.7 108.23 270.3 251.2 251.9 256.7 0 0 0 0 0 1 0 0 0 0 0 42 43 251.9 108.45 267.2 270.3 251.2 251.9 0 0 0 0 0 0 1 0 0 0 0 43 44 251.2 109.39 243.0 267.2 270.3 251.2 0 0 0 0 0 0 0 1 0 0 0 44 45 270.3 110.15 229.9 243.0 267.2 270.3 0 0 0 0 0 0 0 0 1 0 0 45 46 267.2 109.13 187.2 229.9 243.0 267.2 0 0 0 0 0 0 0 0 0 1 0 46 47 243.0 110.28 178.2 187.2 229.9 243.0 0 0 0 0 0 0 0 0 0 0 1 47 48 229.9 110.17 175.2 178.2 187.2 229.9 0 0 0 0 0 0 0 0 0 0 0 48 49 187.2 109.99 192.4 175.2 178.2 187.2 1 0 0 0 0 0 0 0 0 0 0 49 50 178.2 109.26 187.0 192.4 175.2 178.2 0 1 0 0 0 0 0 0 0 0 0 50 51 175.2 109.11 184.0 187.0 192.4 175.2 0 0 1 0 0 0 0 0 0 0 0 51 52 192.4 107.06 194.1 184.0 187.0 192.4 0 0 0 1 0 0 0 0 0 0 0 52 53 187.0 109.53 212.7 194.1 184.0 187.0 0 0 0 0 1 0 0 0 0 0 0 53 54 184.0 108.92 217.5 212.7 194.1 184.0 0 0 0 0 0 1 0 0 0 0 0 54 55 194.1 109.24 200.5 217.5 212.7 194.1 0 0 0 0 0 0 1 0 0 0 0 55 56 212.7 109.12 205.9 200.5 217.5 212.7 0 0 0 0 0 0 0 1 0 0 0 56 57 217.5 109.00 196.5 205.9 200.5 217.5 0 0 0 0 0 0 0 0 1 0 0 57 58 200.5 107.23 206.3 196.5 205.9 200.5 0 0 0 0 0 0 0 0 0 1 0 58 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 Y4 2.164e-14 -5.164e-16 1.591e-16 -7.928e-17 -4.191e-16 1.000e+00 M1 M2 M3 M4 M5 M6 -4.894e-16 -6.665e-16 5.340e-16 2.157e-16 2.350e-16 6.200e-15 M7 M8 M9 M10 M11 t 8.969e-16 1.857e-16 7.648e-16 -2.310e-16 -7.899e-17 6.329e-18 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.356e-15 -6.590e-16 -3.132e-17 6.650e-16 2.071e-14 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.164e-14 8.686e-14 2.490e-01 0.8046 X -5.164e-16 8.995e-16 -5.740e-01 0.5691 Y1 1.591e-16 6.271e-17 2.537e+00 0.0152 * Y2 -7.928e-17 9.198e-17 -8.620e-01 0.3939 Y3 -4.191e-16 9.511e-17 -4.407e+00 7.67e-05 *** Y4 1.000e+00 7.201e-17 1.389e+16 < 2e-16 *** M1 -4.894e-16 2.670e-15 -1.830e-01 0.8555 M2 -6.665e-16 2.705e-15 -2.460e-01 0.8067 M3 5.340e-16 2.757e-15 1.940e-01 0.8474 M4 2.157e-16 3.354e-15 6.400e-02 0.9491 M5 2.350e-16 2.678e-15 8.800e-02 0.9305 M6 6.200e-15 2.638e-15 2.350e+00 0.0238 * M7 8.969e-16 2.764e-15 3.250e-01 0.7472 M8 1.857e-16 2.843e-15 6.500e-02 0.9482 M9 7.648e-16 2.707e-15 2.830e-01 0.7790 M10 -2.310e-16 3.103e-15 -7.400e-02 0.9410 M11 -7.899e-17 2.861e-15 -2.800e-02 0.9781 t 6.329e-18 1.695e-16 3.700e-02 0.9704 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.877e-15 on 40 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 4.524e+32 on 17 and 40 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,] 3.549222e-03 7.098444e-03 9.964508e-01 [2,] 6.727446e-05 1.345489e-04 9.999327e-01 [3,] 3.582081e-02 7.164163e-02 9.641792e-01 [4,] 9.038895e-01 1.922210e-01 9.611052e-02 [5,] 8.312190e-04 1.662438e-03 9.991688e-01 [6,] 9.854102e-01 2.917951e-02 1.458975e-02 [7,] 1.449311e-07 2.898622e-07 9.999999e-01 [8,] 9.999866e-01 2.675064e-05 1.337532e-05 [9,] 4.183705e-03 8.367410e-03 9.958163e-01 [10,] 9.881849e-01 2.363017e-02 1.181508e-02 [11,] 4.556925e-01 9.113851e-01 5.443075e-01 [12,] 1.375385e-07 2.750770e-07 9.999999e-01 [13,] 2.001861e-04 4.003721e-04 9.997998e-01 [14,] 9.999899e-01 2.013565e-05 1.006783e-05 [15,] 7.040510e-01 5.918980e-01 2.959490e-01 [16,] 6.154823e-14 1.230965e-13 1.000000e+00 [17,] 2.474344e-04 4.948688e-04 9.997526e-01 > postscript(file="/var/www/html/rcomp/tmp/1466r1258725464.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/2l2n21258725464.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/32lgz1258725464.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/4b76a1258725464.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/53y681258725464.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 = 58 Frequency = 1 1 2 3 4 5 -3.298397e-15 -3.311881e-15 -8.770209e-16 7.661830e-16 -6.903672e-16 6 7 8 9 10 2.070677e-14 -1.328108e-15 -5.378453e-16 -1.191667e-15 1.322773e-15 11 12 13 14 15 -2.125310e-16 -3.789682e-16 1.518222e-16 1.636712e-16 -1.289410e-15 16 17 18 19 20 -6.370880e-16 -6.663576e-16 -6.355886e-15 -8.267010e-16 5.890122e-17 21 22 23 24 25 -4.199945e-16 -5.088215e-16 8.210877e-17 2.319369e-16 7.147671e-16 26 27 28 29 30 5.977735e-16 -5.107185e-16 -3.245215e-16 -1.271274e-16 -5.380048e-15 31 32 33 34 35 -6.649721e-16 -3.193224e-16 -5.784941e-16 3.382878e-16 -4.465881e-16 36 37 38 39 40 7.881017e-16 1.137866e-15 1.120559e-15 6.815183e-16 -1.215501e-16 41 42 43 44 45 8.684294e-16 -5.072836e-15 4.790320e-16 4.287687e-16 5.220210e-16 46 47 48 49 50 -1.982339e-15 5.770104e-16 -6.410704e-16 1.293942e-15 1.429876e-15 51 52 53 54 55 1.995631e-15 3.169766e-16 6.154228e-16 -3.898002e-15 2.340749e-15 56 57 58 3.694978e-16 1.668135e-15 8.301000e-16 > postscript(file="/var/www/html/rcomp/tmp/6phg81258725464.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 = 58 Frequency = 1 lag(myerror, k = 1) myerror 0 -3.298397e-15 NA 1 -3.311881e-15 -3.298397e-15 2 -8.770209e-16 -3.311881e-15 3 7.661830e-16 -8.770209e-16 4 -6.903672e-16 7.661830e-16 5 2.070677e-14 -6.903672e-16 6 -1.328108e-15 2.070677e-14 7 -5.378453e-16 -1.328108e-15 8 -1.191667e-15 -5.378453e-16 9 1.322773e-15 -1.191667e-15 10 -2.125310e-16 1.322773e-15 11 -3.789682e-16 -2.125310e-16 12 1.518222e-16 -3.789682e-16 13 1.636712e-16 1.518222e-16 14 -1.289410e-15 1.636712e-16 15 -6.370880e-16 -1.289410e-15 16 -6.663576e-16 -6.370880e-16 17 -6.355886e-15 -6.663576e-16 18 -8.267010e-16 -6.355886e-15 19 5.890122e-17 -8.267010e-16 20 -4.199945e-16 5.890122e-17 21 -5.088215e-16 -4.199945e-16 22 8.210877e-17 -5.088215e-16 23 2.319369e-16 8.210877e-17 24 7.147671e-16 2.319369e-16 25 5.977735e-16 7.147671e-16 26 -5.107185e-16 5.977735e-16 27 -3.245215e-16 -5.107185e-16 28 -1.271274e-16 -3.245215e-16 29 -5.380048e-15 -1.271274e-16 30 -6.649721e-16 -5.380048e-15 31 -3.193224e-16 -6.649721e-16 32 -5.784941e-16 -3.193224e-16 33 3.382878e-16 -5.784941e-16 34 -4.465881e-16 3.382878e-16 35 7.881017e-16 -4.465881e-16 36 1.137866e-15 7.881017e-16 37 1.120559e-15 1.137866e-15 38 6.815183e-16 1.120559e-15 39 -1.215501e-16 6.815183e-16 40 8.684294e-16 -1.215501e-16 41 -5.072836e-15 8.684294e-16 42 4.790320e-16 -5.072836e-15 43 4.287687e-16 4.790320e-16 44 5.220210e-16 4.287687e-16 45 -1.982339e-15 5.220210e-16 46 5.770104e-16 -1.982339e-15 47 -6.410704e-16 5.770104e-16 48 1.293942e-15 -6.410704e-16 49 1.429876e-15 1.293942e-15 50 1.995631e-15 1.429876e-15 51 3.169766e-16 1.995631e-15 52 6.154228e-16 3.169766e-16 53 -3.898002e-15 6.154228e-16 54 2.340749e-15 -3.898002e-15 55 3.694978e-16 2.340749e-15 56 1.668135e-15 3.694978e-16 57 8.301000e-16 1.668135e-15 58 NA 8.301000e-16 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -3.311881e-15 -3.298397e-15 [2,] -8.770209e-16 -3.311881e-15 [3,] 7.661830e-16 -8.770209e-16 [4,] -6.903672e-16 7.661830e-16 [5,] 2.070677e-14 -6.903672e-16 [6,] -1.328108e-15 2.070677e-14 [7,] -5.378453e-16 -1.328108e-15 [8,] -1.191667e-15 -5.378453e-16 [9,] 1.322773e-15 -1.191667e-15 [10,] -2.125310e-16 1.322773e-15 [11,] -3.789682e-16 -2.125310e-16 [12,] 1.518222e-16 -3.789682e-16 [13,] 1.636712e-16 1.518222e-16 [14,] -1.289410e-15 1.636712e-16 [15,] -6.370880e-16 -1.289410e-15 [16,] -6.663576e-16 -6.370880e-16 [17,] -6.355886e-15 -6.663576e-16 [18,] -8.267010e-16 -6.355886e-15 [19,] 5.890122e-17 -8.267010e-16 [20,] -4.199945e-16 5.890122e-17 [21,] -5.088215e-16 -4.199945e-16 [22,] 8.210877e-17 -5.088215e-16 [23,] 2.319369e-16 8.210877e-17 [24,] 7.147671e-16 2.319369e-16 [25,] 5.977735e-16 7.147671e-16 [26,] -5.107185e-16 5.977735e-16 [27,] -3.245215e-16 -5.107185e-16 [28,] -1.271274e-16 -3.245215e-16 [29,] -5.380048e-15 -1.271274e-16 [30,] -6.649721e-16 -5.380048e-15 [31,] -3.193224e-16 -6.649721e-16 [32,] -5.784941e-16 -3.193224e-16 [33,] 3.382878e-16 -5.784941e-16 [34,] -4.465881e-16 3.382878e-16 [35,] 7.881017e-16 -4.465881e-16 [36,] 1.137866e-15 7.881017e-16 [37,] 1.120559e-15 1.137866e-15 [38,] 6.815183e-16 1.120559e-15 [39,] -1.215501e-16 6.815183e-16 [40,] 8.684294e-16 -1.215501e-16 [41,] -5.072836e-15 8.684294e-16 [42,] 4.790320e-16 -5.072836e-15 [43,] 4.287687e-16 4.790320e-16 [44,] 5.220210e-16 4.287687e-16 [45,] -1.982339e-15 5.220210e-16 [46,] 5.770104e-16 -1.982339e-15 [47,] -6.410704e-16 5.770104e-16 [48,] 1.293942e-15 -6.410704e-16 [49,] 1.429876e-15 1.293942e-15 [50,] 1.995631e-15 1.429876e-15 [51,] 3.169766e-16 1.995631e-15 [52,] 6.154228e-16 3.169766e-16 [53,] -3.898002e-15 6.154228e-16 [54,] 2.340749e-15 -3.898002e-15 [55,] 3.694978e-16 2.340749e-15 [56,] 1.668135e-15 3.694978e-16 [57,] 8.301000e-16 1.668135e-15 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -3.311881e-15 -3.298397e-15 2 -8.770209e-16 -3.311881e-15 3 7.661830e-16 -8.770209e-16 4 -6.903672e-16 7.661830e-16 5 2.070677e-14 -6.903672e-16 6 -1.328108e-15 2.070677e-14 7 -5.378453e-16 -1.328108e-15 8 -1.191667e-15 -5.378453e-16 9 1.322773e-15 -1.191667e-15 10 -2.125310e-16 1.322773e-15 11 -3.789682e-16 -2.125310e-16 12 1.518222e-16 -3.789682e-16 13 1.636712e-16 1.518222e-16 14 -1.289410e-15 1.636712e-16 15 -6.370880e-16 -1.289410e-15 16 -6.663576e-16 -6.370880e-16 17 -6.355886e-15 -6.663576e-16 18 -8.267010e-16 -6.355886e-15 19 5.890122e-17 -8.267010e-16 20 -4.199945e-16 5.890122e-17 21 -5.088215e-16 -4.199945e-16 22 8.210877e-17 -5.088215e-16 23 2.319369e-16 8.210877e-17 24 7.147671e-16 2.319369e-16 25 5.977735e-16 7.147671e-16 26 -5.107185e-16 5.977735e-16 27 -3.245215e-16 -5.107185e-16 28 -1.271274e-16 -3.245215e-16 29 -5.380048e-15 -1.271274e-16 30 -6.649721e-16 -5.380048e-15 31 -3.193224e-16 -6.649721e-16 32 -5.784941e-16 -3.193224e-16 33 3.382878e-16 -5.784941e-16 34 -4.465881e-16 3.382878e-16 35 7.881017e-16 -4.465881e-16 36 1.137866e-15 7.881017e-16 37 1.120559e-15 1.137866e-15 38 6.815183e-16 1.120559e-15 39 -1.215501e-16 6.815183e-16 40 8.684294e-16 -1.215501e-16 41 -5.072836e-15 8.684294e-16 42 4.790320e-16 -5.072836e-15 43 4.287687e-16 4.790320e-16 44 5.220210e-16 4.287687e-16 45 -1.982339e-15 5.220210e-16 46 5.770104e-16 -1.982339e-15 47 -6.410704e-16 5.770104e-16 48 1.293942e-15 -6.410704e-16 49 1.429876e-15 1.293942e-15 50 1.995631e-15 1.429876e-15 51 3.169766e-16 1.995631e-15 52 6.154228e-16 3.169766e-16 53 -3.898002e-15 6.154228e-16 54 2.340749e-15 -3.898002e-15 55 3.694978e-16 2.340749e-15 56 1.668135e-15 3.694978e-16 57 8.301000e-16 1.668135e-15 > 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/7fm3r1258725464.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/8c0kr1258725464.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/9uixg1258725464.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/10ipti1258725464.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/11galj1258725464.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/12xhcg1258725464.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/13w0xz1258725464.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/14a2mc1258725464.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/15033n1258725464.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/16fftx1258725464.tab") + } > > system("convert tmp/1466r1258725464.ps tmp/1466r1258725464.png") > system("convert tmp/2l2n21258725464.ps tmp/2l2n21258725464.png") > system("convert tmp/32lgz1258725464.ps tmp/32lgz1258725464.png") > system("convert tmp/4b76a1258725464.ps tmp/4b76a1258725464.png") > system("convert tmp/53y681258725464.ps tmp/53y681258725464.png") > system("convert tmp/6phg81258725464.ps tmp/6phg81258725464.png") > system("convert tmp/7fm3r1258725464.ps tmp/7fm3r1258725464.png") > system("convert tmp/8c0kr1258725464.ps tmp/8c0kr1258725464.png") > system("convert tmp/9uixg1258725464.ps tmp/9uixg1258725464.png") > system("convert tmp/10ipti1258725464.ps tmp/10ipti1258725464.png") > > > proc.time() user system elapsed 2.375 1.572 2.743