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(4 + ,7.2 + ,102.9 + ,271244 + ,4.1 + ,7.4 + ,97.4 + ,269907 + ,4 + ,8.8 + ,111.4 + ,271296 + ,3.8 + ,9.3 + ,87.4 + ,270157 + ,4.7 + ,9.3 + ,96.8 + ,271322 + ,4.3 + ,8.7 + ,114.1 + ,267179 + ,3.9 + ,8.2 + ,110.3 + ,264101 + ,4 + ,8.3 + ,103.9 + ,265518 + ,4.3 + ,8.5 + ,101.6 + ,269419 + ,4.8 + ,8.6 + ,94.6 + ,268714 + ,4.4 + ,8.5 + ,95.9 + ,272482 + ,4.3 + ,8.2 + ,104.7 + ,268351 + ,4.7 + ,8.1 + ,102.8 + ,268175 + ,4.7 + ,7.9 + ,98.1 + ,270674 + ,4.9 + ,8.6 + ,113.9 + ,272764 + ,5 + ,8.7 + ,80.9 + ,272599 + ,4.2 + ,8.7 + ,95.7 + ,270333 + ,4.3 + ,8.5 + ,113.2 + ,270846 + ,4.8 + ,8.4 + ,105.9 + ,270491 + ,4.8 + ,8.5 + ,108.8 + ,269160 + ,4.8 + ,8.7 + ,102.3 + ,274027 + ,4.2 + ,8.7 + ,99 + ,273784 + ,4.6 + ,8.6 + ,100.7 + ,276663 + ,4.8 + ,8.5 + ,115.5 + ,274525 + ,4.5 + ,8.3 + ,100.7 + ,271344 + ,4.4 + ,8 + ,109.9 + ,271115 + ,4.3 + ,8.2 + ,114.6 + ,270798 + ,3.9 + ,8.1 + ,85.4 + ,273911 + ,3.7 + ,8.1 + ,100.5 + ,273985 + ,4 + ,8 + ,114.8 + ,271917 + ,4.1 + ,7.9 + ,116.5 + ,273338 + ,3.7 + ,7.9 + ,112.9 + ,270601 + ,3.8 + ,8 + ,102 + ,273547 + ,3.8 + ,8 + ,106 + ,275363 + ,3.8 + ,7.9 + ,105.3 + ,281229 + ,3.3 + ,8 + ,118.8 + ,277793 + ,3.3 + ,7.7 + ,106.1 + ,279913 + ,3.3 + ,7.2 + ,109.3 + ,282500 + ,3.2 + ,7.5 + ,117.2 + ,280041 + ,3.4 + ,7.3 + ,92.5 + ,282166 + ,4.2 + ,7 + ,104.2 + ,290304 + ,4.9 + ,7 + ,112.5 + ,283519 + ,5.1 + ,7 + ,122.4 + ,287816 + ,5.5 + ,7.2 + ,113.3 + ,285226 + ,5.6 + ,7.3 + ,100 + ,287595 + ,6.4 + ,7.1 + ,110.7 + ,289741 + ,6.1 + ,6.8 + ,112.8 + ,289148 + ,7.1 + ,6.4 + ,109.8 + ,288301 + ,7.8 + ,6.1 + ,117.3 + ,290155 + ,7.9 + ,6.5 + ,109.1 + ,289648 + ,7.4 + ,7.7 + ,115.9 + ,288225 + ,7.5 + ,7.9 + ,96 + ,289351 + ,6.8 + ,7.5 + ,99.8 + ,294735 + ,5.2 + ,6.9 + ,116.8 + ,305333 + ,4.7 + ,6.6 + ,115.7 + ,309030 + ,4.1 + ,6.9 + ,99.4 + ,310215 + ,3.9 + ,7.7 + ,94.3 + ,321935 + ,2.6 + ,8 + ,91 + ,325734 + ,2.7 + ,8 + ,93.2 + ,320846 + ,1.8 + ,7.7 + ,103.1 + ,323023 + ,1 + ,7.3 + ,94.1 + ,319753 + ,0.3 + ,7.4 + ,91.8 + ,321753 + ,1.3 + ,8.1 + ,102.7 + ,320757 + ,1 + ,8.3 + ,82.6 + ,324479 + ,1.1 + ,8.2 + ,89.1 + ,324641) + ,dim=c(4 + ,65) + ,dimnames=list(c('Cons.index' + ,'Werkl.graad' + ,'Industr.prod.' + ,'BrutoSchuld') + ,1:65)) > y <- array(NA,dim=c(4,65),dimnames=list(c('Cons.index','Werkl.graad','Industr.prod.','BrutoSchuld'),1:65)) > 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 Cons.index Werkl.graad Industr.prod. BrutoSchuld M1 M2 M3 M4 M5 M6 M7 M8 M9 1 4.0 7.2 102.9 271244 1 0 0 0 0 0 0 0 0 2 4.1 7.4 97.4 269907 0 1 0 0 0 0 0 0 0 3 4.0 8.8 111.4 271296 0 0 1 0 0 0 0 0 0 4 3.8 9.3 87.4 270157 0 0 0 1 0 0 0 0 0 5 4.7 9.3 96.8 271322 0 0 0 0 1 0 0 0 0 6 4.3 8.7 114.1 267179 0 0 0 0 0 1 0 0 0 7 3.9 8.2 110.3 264101 0 0 0 0 0 0 1 0 0 8 4.0 8.3 103.9 265518 0 0 0 0 0 0 0 1 0 9 4.3 8.5 101.6 269419 0 0 0 0 0 0 0 0 1 10 4.8 8.6 94.6 268714 0 0 0 0 0 0 0 0 0 11 4.4 8.5 95.9 272482 0 0 0 0 0 0 0 0 0 12 4.3 8.2 104.7 268351 0 0 0 0 0 0 0 0 0 13 4.7 8.1 102.8 268175 1 0 0 0 0 0 0 0 0 14 4.7 7.9 98.1 270674 0 1 0 0 0 0 0 0 0 15 4.9 8.6 113.9 272764 0 0 1 0 0 0 0 0 0 16 5.0 8.7 80.9 272599 0 0 0 1 0 0 0 0 0 17 4.2 8.7 95.7 270333 0 0 0 0 1 0 0 0 0 18 4.3 8.5 113.2 270846 0 0 0 0 0 1 0 0 0 19 4.8 8.4 105.9 270491 0 0 0 0 0 0 1 0 0 20 4.8 8.5 108.8 269160 0 0 0 0 0 0 0 1 0 21 4.8 8.7 102.3 274027 0 0 0 0 0 0 0 0 1 22 4.2 8.7 99.0 273784 0 0 0 0 0 0 0 0 0 23 4.6 8.6 100.7 276663 0 0 0 0 0 0 0 0 0 24 4.8 8.5 115.5 274525 0 0 0 0 0 0 0 0 0 25 4.5 8.3 100.7 271344 1 0 0 0 0 0 0 0 0 26 4.4 8.0 109.9 271115 0 1 0 0 0 0 0 0 0 27 4.3 8.2 114.6 270798 0 0 1 0 0 0 0 0 0 28 3.9 8.1 85.4 273911 0 0 0 1 0 0 0 0 0 29 3.7 8.1 100.5 273985 0 0 0 0 1 0 0 0 0 30 4.0 8.0 114.8 271917 0 0 0 0 0 1 0 0 0 31 4.1 7.9 116.5 273338 0 0 0 0 0 0 1 0 0 32 3.7 7.9 112.9 270601 0 0 0 0 0 0 0 1 0 33 3.8 8.0 102.0 273547 0 0 0 0 0 0 0 0 1 34 3.8 8.0 106.0 275363 0 0 0 0 0 0 0 0 0 35 3.8 7.9 105.3 281229 0 0 0 0 0 0 0 0 0 36 3.3 8.0 118.8 277793 0 0 0 0 0 0 0 0 0 37 3.3 7.7 106.1 279913 1 0 0 0 0 0 0 0 0 38 3.3 7.2 109.3 282500 0 1 0 0 0 0 0 0 0 39 3.2 7.5 117.2 280041 0 0 1 0 0 0 0 0 0 40 3.4 7.3 92.5 282166 0 0 0 1 0 0 0 0 0 41 4.2 7.0 104.2 290304 0 0 0 0 1 0 0 0 0 42 4.9 7.0 112.5 283519 0 0 0 0 0 1 0 0 0 43 5.1 7.0 122.4 287816 0 0 0 0 0 0 1 0 0 44 5.5 7.2 113.3 285226 0 0 0 0 0 0 0 1 0 45 5.6 7.3 100.0 287595 0 0 0 0 0 0 0 0 1 46 6.4 7.1 110.7 289741 0 0 0 0 0 0 0 0 0 47 6.1 6.8 112.8 289148 0 0 0 0 0 0 0 0 0 48 7.1 6.4 109.8 288301 0 0 0 0 0 0 0 0 0 49 7.8 6.1 117.3 290155 1 0 0 0 0 0 0 0 0 50 7.9 6.5 109.1 289648 0 1 0 0 0 0 0 0 0 51 7.4 7.7 115.9 288225 0 0 1 0 0 0 0 0 0 52 7.5 7.9 96.0 289351 0 0 0 1 0 0 0 0 0 53 6.8 7.5 99.8 294735 0 0 0 0 1 0 0 0 0 54 5.2 6.9 116.8 305333 0 0 0 0 0 1 0 0 0 55 4.7 6.6 115.7 309030 0 0 0 0 0 0 1 0 0 56 4.1 6.9 99.4 310215 0 0 0 0 0 0 0 1 0 57 3.9 7.7 94.3 321935 0 0 0 0 0 0 0 0 1 58 2.6 8.0 91.0 325734 0 0 0 0 0 0 0 0 0 59 2.7 8.0 93.2 320846 0 0 0 0 0 0 0 0 0 60 1.8 7.7 103.1 323023 0 0 0 0 0 0 0 0 0 61 1.0 7.3 94.1 319753 1 0 0 0 0 0 0 0 0 62 0.3 7.4 91.8 321753 0 1 0 0 0 0 0 0 0 63 1.3 8.1 102.7 320757 0 0 1 0 0 0 0 0 0 64 1.0 8.3 82.6 324479 0 0 0 1 0 0 0 0 0 65 1.1 8.2 89.1 324641 0 0 0 0 1 0 0 0 0 M10 M11 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10 1 0 11 0 1 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 17 0 0 18 0 0 19 0 0 20 0 0 21 0 0 22 1 0 23 0 1 24 0 0 25 0 0 26 0 0 27 0 0 28 0 0 29 0 0 30 0 0 31 0 0 32 0 0 33 0 0 34 1 0 35 0 1 36 0 0 37 0 0 38 0 0 39 0 0 40 0 0 41 0 0 42 0 0 43 0 0 44 0 0 45 0 0 46 1 0 47 0 1 48 0 0 49 0 0 50 0 0 51 0 0 52 0 0 53 0 0 54 0 0 55 0 0 56 0 0 57 0 0 58 1 0 59 0 1 60 0 0 61 0 0 62 0 0 63 0 0 64 0 0 65 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Werkl.graad Industr.prod. BrutoSchuld M1 1.918e+01 -1.128e+00 6.117e-02 -4.511e-05 -1.355e-01 M2 M3 M4 M5 M6 -1.696e-01 1.172e-01 1.770e+00 1.106e+00 -1.904e-01 M7 M8 M9 M10 M11 -3.747e-01 4.422e-02 1.119e+00 1.092e+00 8.994e-01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.24589 -0.74334 0.06685 0.57200 2.69985 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.918e+01 9.161e+00 2.094 0.04140 * Werkl.graad -1.128e+00 3.547e-01 -3.179 0.00254 ** Industr.prod. 6.117e-02 3.746e-02 1.633 0.10872 BrutoSchuld -4.511e-05 1.243e-05 -3.628 0.00067 *** M1 -1.355e-01 8.273e-01 -0.164 0.87053 M2 -1.696e-01 8.527e-01 -0.199 0.84314 M3 1.172e-01 7.723e-01 0.152 0.87997 M4 1.770e+00 1.071e+00 1.653 0.10456 M5 1.106e+00 8.493e-01 1.303 0.19864 M6 -1.904e-01 7.936e-01 -0.240 0.81134 M7 -3.747e-01 7.909e-01 -0.474 0.63774 M8 4.422e-02 8.007e-01 0.055 0.95617 M9 1.119e+00 8.548e-01 1.309 0.19651 M10 1.092e+00 8.459e-01 1.291 0.20265 M11 8.994e-01 8.322e-01 1.081 0.28498 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.24 on 50 degrees of freedom Multiple R-squared: 0.4914, Adjusted R-squared: 0.349 F-statistic: 3.45 on 14 and 50 DF, p-value: 0.0006122 > 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,] 7.920899e-02 1.584180e-01 0.9207910 [2,] 3.201988e-02 6.403976e-02 0.9679801 [3,] 1.391945e-02 2.783889e-02 0.9860806 [4,] 4.406578e-03 8.813156e-03 0.9955934 [5,] 2.924122e-03 5.848243e-03 0.9970759 [6,] 1.015662e-03 2.031324e-03 0.9989843 [7,] 4.047880e-04 8.095759e-04 0.9995952 [8,] 2.404460e-04 4.808920e-04 0.9997596 [9,] 8.055967e-05 1.611193e-04 0.9999194 [10,] 2.338909e-05 4.677818e-05 0.9999766 [11,] 7.443027e-06 1.488605e-05 0.9999926 [12,] 2.421876e-06 4.843753e-06 0.9999976 [13,] 6.185938e-07 1.237188e-06 0.9999994 [14,] 1.931701e-07 3.863401e-07 0.9999998 [15,] 5.633791e-08 1.126758e-07 0.9999999 [16,] 2.127252e-08 4.254504e-08 1.0000000 [17,] 4.799145e-09 9.598290e-09 1.0000000 [18,] 1.252619e-09 2.505238e-09 1.0000000 [19,] 2.424763e-09 4.849525e-09 1.0000000 [20,] 4.560922e-09 9.121843e-09 1.0000000 [21,] 3.512763e-09 7.025526e-09 1.0000000 [22,] 1.074816e-08 2.149632e-08 1.0000000 [23,] 4.785357e-08 9.570713e-08 1.0000000 [24,] 3.162332e-06 6.324665e-06 0.9999968 [25,] 3.763685e-06 7.527370e-06 0.9999962 [26,] 9.971958e-06 1.994392e-05 0.9999900 [27,] 2.747464e-05 5.494928e-05 0.9999725 [28,] 3.888239e-04 7.776478e-04 0.9996112 [29,] 2.788240e-02 5.576480e-02 0.9721176 [30,] 7.852885e-01 4.294230e-01 0.2147115 > postscript(file="/var/www/html/rcomp/tmp/1kzc01258649899.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/28gd91258649899.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/3sdp11258649899.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/4a1p41258649899.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/5y9bq1258649899.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 = 65 Frequency = 1 1 2 3 4 5 6 -0.98209585 -0.34635576 0.05189601 0.17976343 1.22080622 0.19589959 7 8 9 10 11 12 -0.49013729 -0.24084399 -0.47330973 0.56272754 0.33304228 0.06947494 13 14 15 16 17 18 0.60051764 0.80928502 0.63965193 1.21090260 0.06684682 0.19083562 19 20 21 22 23 24 1.19282171 0.64926463 0.41729176 0.03506969 0.54081163 0.52567577 25 26 27 28 29 30 0.89747897 -0.07985605 -0.54294478 -0.78180624 -1.23865050 -0.72258018 31 32 33 34 35 36 -0.59100582 -1.31315669 -1.37541338 -1.51129124 -1.12399087 -1.59261771 37 38 39 40 41 42 -0.92290370 -1.53172560 -2.17441727 -2.24588686 -1.46928319 -0.28621472 43 44 45 46 47 48 -0.31372081 0.33273895 0.39126078 0.43488669 -0.16601251 1.42760420 49 50 51 52 53 54 1.54968210 2.61356814 2.69984568 2.64077950 2.16361627 0.62205969 55 56 57 58 59 60 0.20204222 0.57199711 1.04017057 0.47860732 0.41614947 -0.43013720 61 62 63 64 65 -1.14267915 -1.46491575 -0.67403156 -1.00375243 -0.74333561 > postscript(file="/var/www/html/rcomp/tmp/6kfrk1258649899.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 = 65 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.98209585 NA 1 -0.34635576 -0.98209585 2 0.05189601 -0.34635576 3 0.17976343 0.05189601 4 1.22080622 0.17976343 5 0.19589959 1.22080622 6 -0.49013729 0.19589959 7 -0.24084399 -0.49013729 8 -0.47330973 -0.24084399 9 0.56272754 -0.47330973 10 0.33304228 0.56272754 11 0.06947494 0.33304228 12 0.60051764 0.06947494 13 0.80928502 0.60051764 14 0.63965193 0.80928502 15 1.21090260 0.63965193 16 0.06684682 1.21090260 17 0.19083562 0.06684682 18 1.19282171 0.19083562 19 0.64926463 1.19282171 20 0.41729176 0.64926463 21 0.03506969 0.41729176 22 0.54081163 0.03506969 23 0.52567577 0.54081163 24 0.89747897 0.52567577 25 -0.07985605 0.89747897 26 -0.54294478 -0.07985605 27 -0.78180624 -0.54294478 28 -1.23865050 -0.78180624 29 -0.72258018 -1.23865050 30 -0.59100582 -0.72258018 31 -1.31315669 -0.59100582 32 -1.37541338 -1.31315669 33 -1.51129124 -1.37541338 34 -1.12399087 -1.51129124 35 -1.59261771 -1.12399087 36 -0.92290370 -1.59261771 37 -1.53172560 -0.92290370 38 -2.17441727 -1.53172560 39 -2.24588686 -2.17441727 40 -1.46928319 -2.24588686 41 -0.28621472 -1.46928319 42 -0.31372081 -0.28621472 43 0.33273895 -0.31372081 44 0.39126078 0.33273895 45 0.43488669 0.39126078 46 -0.16601251 0.43488669 47 1.42760420 -0.16601251 48 1.54968210 1.42760420 49 2.61356814 1.54968210 50 2.69984568 2.61356814 51 2.64077950 2.69984568 52 2.16361627 2.64077950 53 0.62205969 2.16361627 54 0.20204222 0.62205969 55 0.57199711 0.20204222 56 1.04017057 0.57199711 57 0.47860732 1.04017057 58 0.41614947 0.47860732 59 -0.43013720 0.41614947 60 -1.14267915 -0.43013720 61 -1.46491575 -1.14267915 62 -0.67403156 -1.46491575 63 -1.00375243 -0.67403156 64 -0.74333561 -1.00375243 65 NA -0.74333561 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.34635576 -0.98209585 [2,] 0.05189601 -0.34635576 [3,] 0.17976343 0.05189601 [4,] 1.22080622 0.17976343 [5,] 0.19589959 1.22080622 [6,] -0.49013729 0.19589959 [7,] -0.24084399 -0.49013729 [8,] -0.47330973 -0.24084399 [9,] 0.56272754 -0.47330973 [10,] 0.33304228 0.56272754 [11,] 0.06947494 0.33304228 [12,] 0.60051764 0.06947494 [13,] 0.80928502 0.60051764 [14,] 0.63965193 0.80928502 [15,] 1.21090260 0.63965193 [16,] 0.06684682 1.21090260 [17,] 0.19083562 0.06684682 [18,] 1.19282171 0.19083562 [19,] 0.64926463 1.19282171 [20,] 0.41729176 0.64926463 [21,] 0.03506969 0.41729176 [22,] 0.54081163 0.03506969 [23,] 0.52567577 0.54081163 [24,] 0.89747897 0.52567577 [25,] -0.07985605 0.89747897 [26,] -0.54294478 -0.07985605 [27,] -0.78180624 -0.54294478 [28,] -1.23865050 -0.78180624 [29,] -0.72258018 -1.23865050 [30,] -0.59100582 -0.72258018 [31,] -1.31315669 -0.59100582 [32,] -1.37541338 -1.31315669 [33,] -1.51129124 -1.37541338 [34,] -1.12399087 -1.51129124 [35,] -1.59261771 -1.12399087 [36,] -0.92290370 -1.59261771 [37,] -1.53172560 -0.92290370 [38,] -2.17441727 -1.53172560 [39,] -2.24588686 -2.17441727 [40,] -1.46928319 -2.24588686 [41,] -0.28621472 -1.46928319 [42,] -0.31372081 -0.28621472 [43,] 0.33273895 -0.31372081 [44,] 0.39126078 0.33273895 [45,] 0.43488669 0.39126078 [46,] -0.16601251 0.43488669 [47,] 1.42760420 -0.16601251 [48,] 1.54968210 1.42760420 [49,] 2.61356814 1.54968210 [50,] 2.69984568 2.61356814 [51,] 2.64077950 2.69984568 [52,] 2.16361627 2.64077950 [53,] 0.62205969 2.16361627 [54,] 0.20204222 0.62205969 [55,] 0.57199711 0.20204222 [56,] 1.04017057 0.57199711 [57,] 0.47860732 1.04017057 [58,] 0.41614947 0.47860732 [59,] -0.43013720 0.41614947 [60,] -1.14267915 -0.43013720 [61,] -1.46491575 -1.14267915 [62,] -0.67403156 -1.46491575 [63,] -1.00375243 -0.67403156 [64,] -0.74333561 -1.00375243 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.34635576 -0.98209585 2 0.05189601 -0.34635576 3 0.17976343 0.05189601 4 1.22080622 0.17976343 5 0.19589959 1.22080622 6 -0.49013729 0.19589959 7 -0.24084399 -0.49013729 8 -0.47330973 -0.24084399 9 0.56272754 -0.47330973 10 0.33304228 0.56272754 11 0.06947494 0.33304228 12 0.60051764 0.06947494 13 0.80928502 0.60051764 14 0.63965193 0.80928502 15 1.21090260 0.63965193 16 0.06684682 1.21090260 17 0.19083562 0.06684682 18 1.19282171 0.19083562 19 0.64926463 1.19282171 20 0.41729176 0.64926463 21 0.03506969 0.41729176 22 0.54081163 0.03506969 23 0.52567577 0.54081163 24 0.89747897 0.52567577 25 -0.07985605 0.89747897 26 -0.54294478 -0.07985605 27 -0.78180624 -0.54294478 28 -1.23865050 -0.78180624 29 -0.72258018 -1.23865050 30 -0.59100582 -0.72258018 31 -1.31315669 -0.59100582 32 -1.37541338 -1.31315669 33 -1.51129124 -1.37541338 34 -1.12399087 -1.51129124 35 -1.59261771 -1.12399087 36 -0.92290370 -1.59261771 37 -1.53172560 -0.92290370 38 -2.17441727 -1.53172560 39 -2.24588686 -2.17441727 40 -1.46928319 -2.24588686 41 -0.28621472 -1.46928319 42 -0.31372081 -0.28621472 43 0.33273895 -0.31372081 44 0.39126078 0.33273895 45 0.43488669 0.39126078 46 -0.16601251 0.43488669 47 1.42760420 -0.16601251 48 1.54968210 1.42760420 49 2.61356814 1.54968210 50 2.69984568 2.61356814 51 2.64077950 2.69984568 52 2.16361627 2.64077950 53 0.62205969 2.16361627 54 0.20204222 0.62205969 55 0.57199711 0.20204222 56 1.04017057 0.57199711 57 0.47860732 1.04017057 58 0.41614947 0.47860732 59 -0.43013720 0.41614947 60 -1.14267915 -0.43013720 61 -1.46491575 -1.14267915 62 -0.67403156 -1.46491575 63 -1.00375243 -0.67403156 64 -0.74333561 -1.00375243 > 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/7maq91258649899.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/8lm741258649899.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/9dmto1258649899.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/103hs21258649899.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/11jyz71258649899.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/126j131258649900.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/137is11258649900.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/14d86a1258649900.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/15wilb1258649900.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/16qr9m1258649900.tab") + } > > system("convert tmp/1kzc01258649899.ps tmp/1kzc01258649899.png") > system("convert tmp/28gd91258649899.ps tmp/28gd91258649899.png") > system("convert tmp/3sdp11258649899.ps tmp/3sdp11258649899.png") > system("convert tmp/4a1p41258649899.ps tmp/4a1p41258649899.png") > system("convert tmp/5y9bq1258649899.ps tmp/5y9bq1258649899.png") > system("convert tmp/6kfrk1258649899.ps tmp/6kfrk1258649899.png") > system("convert tmp/7maq91258649899.ps tmp/7maq91258649899.png") > system("convert tmp/8lm741258649899.ps tmp/8lm741258649899.png") > system("convert tmp/9dmto1258649899.ps tmp/9dmto1258649899.png") > system("convert tmp/103hs21258649899.ps tmp/103hs21258649899.png") > > > proc.time() user system elapsed 2.443 1.550 2.861