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(7.1,0,6.8,0,6.5,0,6.3,0,6.1,0,6.1,0,6.3,0,6.3,0,6.0,0,6.2,0,6.4,0,6.8,0,7.5,0,7.5,0,7.6,0,7.6,0,7.4,0,7.3,0,7.1,0,6.9,0,6.8,0,7.5,0,7.6,0,7.8,0,8.0,0,8.1,0,8.2,0,8.3,0,8.2,0,8.0,0,7.9,0,7.6,0,7.6,0,8.2,0,8.3,0,8.4,0,8.4,0,8.4,0,8.6,0,8.9,0,8.8,0,8.3,0,7.5,0,7.2,0,7.5,0,8.8,0,9.3,0,9.3,0,8.7,1,8.2,1,8.3,1,8.5,1,8.6,1,8.6,1,8.2,1,8.1,1,8.0,1,8.6,1,8.7,1,8.8,1,8.5,1,8.4,1,8.5,1,8.7,1,8.7,1,8.6,1,8.5,1,8.3,1,8.1,1,8.2,1,8.1,1,8.1,1,7.9,1,7.9,1,7.9,1,8.0,1,8.0,1,7.9,1,8.0,1,7.7,1,7.2,1,7.5,1,7.3,1,7.0,1,7.0,1,7.0,1,7.2,1,7.3,1,7.1,1,6.8,1,6.6,1,6.2,1,6.2,1,6.8,1,6.9,1,6.8,1),dim=c(2,96),dimnames=list(c('w','d'),1:96)) > y <- array(NA,dim=c(2,96),dimnames=list(c('w','d'),1:96)) > 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 w d M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 7.1 0 1 0 0 0 0 0 0 0 0 0 0 1 2 6.8 0 0 1 0 0 0 0 0 0 0 0 0 2 3 6.5 0 0 0 1 0 0 0 0 0 0 0 0 3 4 6.3 0 0 0 0 1 0 0 0 0 0 0 0 4 5 6.1 0 0 0 0 0 1 0 0 0 0 0 0 5 6 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8.2 1 0 0 0 0 0 0 0 0 0 1 0 70 71 8.1 1 0 0 0 0 0 0 0 0 0 0 1 71 72 8.1 1 0 0 0 0 0 0 0 0 0 0 0 72 73 7.9 1 1 0 0 0 0 0 0 0 0 0 0 73 74 7.9 1 0 1 0 0 0 0 0 0 0 0 0 74 75 7.9 1 0 0 1 0 0 0 0 0 0 0 0 75 76 8.0 1 0 0 0 1 0 0 0 0 0 0 0 76 77 8.0 1 0 0 0 0 1 0 0 0 0 0 0 77 78 7.9 1 0 0 0 0 0 1 0 0 0 0 0 78 79 8.0 1 0 0 0 0 0 0 1 0 0 0 0 79 80 7.7 1 0 0 0 0 0 0 0 1 0 0 0 80 81 7.2 1 0 0 0 0 0 0 0 0 1 0 0 81 82 7.5 1 0 0 0 0 0 0 0 0 0 1 0 82 83 7.3 1 0 0 0 0 0 0 0 0 0 0 1 83 84 7.0 1 0 0 0 0 0 0 0 0 0 0 0 84 85 7.0 1 1 0 0 0 0 0 0 0 0 0 0 85 86 7.0 1 0 1 0 0 0 0 0 0 0 0 0 86 87 7.2 1 0 0 1 0 0 0 0 0 0 0 0 87 88 7.3 1 0 0 0 1 0 0 0 0 0 0 0 88 89 7.1 1 0 0 0 0 1 0 0 0 0 0 0 89 90 6.8 1 0 0 0 0 0 1 0 0 0 0 0 90 91 6.6 1 0 0 0 0 0 0 1 0 0 0 0 91 92 6.2 1 0 0 0 0 0 0 0 1 0 0 0 92 93 6.2 1 0 0 0 0 0 0 0 0 1 0 0 93 94 6.8 1 0 0 0 0 0 0 0 0 0 1 0 94 95 6.9 1 0 0 0 0 0 0 0 0 0 0 1 95 96 6.8 1 0 0 0 0 0 0 0 0 0 0 0 96 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) d M1 M2 M3 M4 7.595833 0.037083 0.065590 -0.039236 0.018438 0.113611 M5 M6 M7 M8 M9 M10 0.021285 -0.146042 -0.338368 -0.568194 -0.685521 -0.140347 M11 t -0.045174 0.004826 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.5413 -0.7078 0.1040 0.5929 1.5225 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.595833 0.355588 21.361 <2e-16 *** d 0.037083 0.343531 0.108 0.9143 M1 0.065590 0.416309 0.158 0.8752 M2 -0.039236 0.415323 -0.094 0.9250 M3 0.018438 0.414430 0.044 0.9646 M4 0.113611 0.413628 0.275 0.7843 M5 0.021285 0.412920 0.052 0.9590 M6 -0.146042 0.412305 -0.354 0.7241 M7 -0.338368 0.411784 -0.822 0.4136 M8 -0.568194 0.411358 -1.381 0.1709 M9 -0.685521 0.411026 -1.668 0.0992 . M10 -0.140347 0.410788 -0.342 0.7335 M11 -0.045174 0.410646 -0.110 0.9127 t 0.004826 0.006247 0.773 0.4420 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.8212 on 82 degrees of freedom Multiple R-squared: 0.1207, Adjusted R-squared: -0.01869 F-statistic: 0.8659 on 13 and 82 DF, p-value: 0.5909 > 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.176077488 0.352154977 0.82392251 [2,] 0.095504551 0.191009102 0.90449545 [3,] 0.051283283 0.102566566 0.94871672 [4,] 0.037257740 0.074515480 0.96274226 [5,] 0.021588588 0.043177176 0.97841141 [6,] 0.019877335 0.039754670 0.98012266 [7,] 0.016078878 0.032157755 0.98392112 [8,] 0.010712817 0.021425633 0.98928718 [9,] 0.036688761 0.073377522 0.96331124 [10,] 0.030289823 0.060579646 0.96971018 [11,] 0.018890861 0.037781722 0.98110914 [12,] 0.012340281 0.024680562 0.98765972 [13,] 0.009327052 0.018654104 0.99067295 [14,] 0.006520065 0.013040131 0.99347993 [15,] 0.004269550 0.008539100 0.99573045 [16,] 0.003869634 0.007739268 0.99613037 [17,] 0.002635864 0.005271727 0.99736414 [18,] 0.001934445 0.003868889 0.99806556 [19,] 0.001437249 0.002874499 0.99856275 [20,] 0.001070547 0.002141094 0.99892945 [21,] 0.006749711 0.013499422 0.99325029 [22,] 0.012522855 0.025045711 0.98747714 [23,] 0.010175312 0.020350624 0.98982469 [24,] 0.006220960 0.012441920 0.99377904 [25,] 0.003737482 0.007474965 0.99626252 [26,] 0.003026096 0.006052191 0.99697390 [27,] 0.046587334 0.093174669 0.95341267 [28,] 0.346178955 0.692357910 0.65382104 [29,] 0.596171706 0.807656588 0.40382829 [30,] 0.584361132 0.831277735 0.41563887 [31,] 0.583143124 0.833713751 0.41685688 [32,] 0.533323304 0.933353392 0.46667670 [33,] 0.474139182 0.948278364 0.52586082 [34,] 0.540719422 0.918561155 0.45928058 [35,] 0.614293511 0.771412978 0.38570649 [36,] 0.688476897 0.623046206 0.31152310 [37,] 0.737590534 0.524818931 0.26240947 [38,] 0.765878122 0.468243755 0.23412188 [39,] 0.897913483 0.204173034 0.10208652 [40,] 0.957739183 0.084521634 0.04226082 [41,] 0.983550925 0.032898151 0.01644908 [42,] 0.987108368 0.025783264 0.01289163 [43,] 0.985366715 0.029266570 0.01463329 [44,] 0.977343357 0.045313286 0.02265664 [45,] 0.981376203 0.037247595 0.01862380 [46,] 0.984277472 0.031445056 0.01572253 [47,] 0.985112005 0.029775989 0.01488799 [48,] 0.981004207 0.037991586 0.01899579 [49,] 0.971499258 0.057001484 0.02850074 [50,] 0.955614866 0.088770268 0.04438513 [51,] 0.930951303 0.138097393 0.06904870 [52,] 0.899312770 0.201374460 0.10068723 [53,] 0.867401237 0.265197526 0.13259876 [54,] 0.861680506 0.276638988 0.13831949 [55,] 0.883515274 0.232969451 0.11648473 [56,] 0.884014072 0.231971856 0.11598593 [57,] 0.899014938 0.201970124 0.10098506 [58,] 0.883724088 0.232551823 0.11627591 [59,] 0.859900536 0.280198928 0.14009946 [60,] 0.818574368 0.362851264 0.18142563 [61,] 0.738680271 0.522639458 0.26131973 [62,] 0.637522398 0.724955204 0.36247760 [63,] 0.593633559 0.812732881 0.40636644 > postscript(file="/var/www/html/rcomp/tmp/1mk6o1227785842.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/23vlm1227785842.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/33umy1227785842.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/44dq91227785842.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/5l3gm1227785842.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 = 96 Frequency = 1 1 2 3 4 5 6 -0.56625000 -0.76625000 -1.12875000 -1.42875000 -1.54125000 -1.37875000 7 8 9 10 11 12 -0.99125000 -0.76625000 -0.95375000 -1.30375000 -1.20375000 -0.85375000 13 14 15 16 17 18 -0.22416667 -0.12416667 -0.08666667 -0.18666667 -0.29916667 -0.23666667 19 20 21 22 23 24 -0.24916667 -0.22416667 -0.21166667 -0.06166667 -0.06166667 0.08833333 25 26 27 28 29 30 0.21791667 0.41791667 0.45541667 0.45541667 0.44291667 0.40541667 31 32 33 34 35 36 0.49291667 0.41791667 0.53041667 0.58041667 0.58041667 0.63041667 37 38 39 40 41 42 0.56000000 0.66000000 0.79750000 0.99750000 0.98500000 0.64750000 43 44 45 46 47 48 0.03500000 -0.04000000 0.37250000 1.12250000 1.52250000 1.47250000 49 50 51 52 53 54 0.76500000 0.36500000 0.40250000 0.50250000 0.69000000 0.85250000 55 56 57 58 59 60 0.64000000 0.76500000 0.77750000 0.82750000 0.82750000 0.87750000 61 62 63 64 65 66 0.50708333 0.50708333 0.54458333 0.64458333 0.73208333 0.79458333 67 68 69 70 71 72 0.88208333 0.90708333 0.81958333 0.36958333 0.16958333 0.11958333 73 74 75 76 77 78 -0.15083333 -0.05083333 -0.11333333 -0.11333333 -0.02583333 0.03666667 79 80 81 82 83 84 0.32416667 0.24916667 -0.13833333 -0.38833333 -0.68833333 -1.03833333 85 86 87 88 89 90 -1.10875000 -1.00875000 -0.87125000 -0.87125000 -0.98375000 -1.12125000 91 92 93 94 95 96 -1.13375000 -1.30875000 -1.19625000 -1.14625000 -1.14625000 -1.29625000 > postscript(file="/var/www/html/rcomp/tmp/6gaec1227785842.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 = 96 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.56625000 NA 1 -0.76625000 -0.56625000 2 -1.12875000 -0.76625000 3 -1.42875000 -1.12875000 4 -1.54125000 -1.42875000 5 -1.37875000 -1.54125000 6 -0.99125000 -1.37875000 7 -0.76625000 -0.99125000 8 -0.95375000 -0.76625000 9 -1.30375000 -0.95375000 10 -1.20375000 -1.30375000 11 -0.85375000 -1.20375000 12 -0.22416667 -0.85375000 13 -0.12416667 -0.22416667 14 -0.08666667 -0.12416667 15 -0.18666667 -0.08666667 16 -0.29916667 -0.18666667 17 -0.23666667 -0.29916667 18 -0.24916667 -0.23666667 19 -0.22416667 -0.24916667 20 -0.21166667 -0.22416667 21 -0.06166667 -0.21166667 22 -0.06166667 -0.06166667 23 0.08833333 -0.06166667 24 0.21791667 0.08833333 25 0.41791667 0.21791667 26 0.45541667 0.41791667 27 0.45541667 0.45541667 28 0.44291667 0.45541667 29 0.40541667 0.44291667 30 0.49291667 0.40541667 31 0.41791667 0.49291667 32 0.53041667 0.41791667 33 0.58041667 0.53041667 34 0.58041667 0.58041667 35 0.63041667 0.58041667 36 0.56000000 0.63041667 37 0.66000000 0.56000000 38 0.79750000 0.66000000 39 0.99750000 0.79750000 40 0.98500000 0.99750000 41 0.64750000 0.98500000 42 0.03500000 0.64750000 43 -0.04000000 0.03500000 44 0.37250000 -0.04000000 45 1.12250000 0.37250000 46 1.52250000 1.12250000 47 1.47250000 1.52250000 48 0.76500000 1.47250000 49 0.36500000 0.76500000 50 0.40250000 0.36500000 51 0.50250000 0.40250000 52 0.69000000 0.50250000 53 0.85250000 0.69000000 54 0.64000000 0.85250000 55 0.76500000 0.64000000 56 0.77750000 0.76500000 57 0.82750000 0.77750000 58 0.82750000 0.82750000 59 0.87750000 0.82750000 60 0.50708333 0.87750000 61 0.50708333 0.50708333 62 0.54458333 0.50708333 63 0.64458333 0.54458333 64 0.73208333 0.64458333 65 0.79458333 0.73208333 66 0.88208333 0.79458333 67 0.90708333 0.88208333 68 0.81958333 0.90708333 69 0.36958333 0.81958333 70 0.16958333 0.36958333 71 0.11958333 0.16958333 72 -0.15083333 0.11958333 73 -0.05083333 -0.15083333 74 -0.11333333 -0.05083333 75 -0.11333333 -0.11333333 76 -0.02583333 -0.11333333 77 0.03666667 -0.02583333 78 0.32416667 0.03666667 79 0.24916667 0.32416667 80 -0.13833333 0.24916667 81 -0.38833333 -0.13833333 82 -0.68833333 -0.38833333 83 -1.03833333 -0.68833333 84 -1.10875000 -1.03833333 85 -1.00875000 -1.10875000 86 -0.87125000 -1.00875000 87 -0.87125000 -0.87125000 88 -0.98375000 -0.87125000 89 -1.12125000 -0.98375000 90 -1.13375000 -1.12125000 91 -1.30875000 -1.13375000 92 -1.19625000 -1.30875000 93 -1.14625000 -1.19625000 94 -1.14625000 -1.14625000 95 -1.29625000 -1.14625000 96 NA -1.29625000 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.76625000 -0.56625000 [2,] -1.12875000 -0.76625000 [3,] -1.42875000 -1.12875000 [4,] -1.54125000 -1.42875000 [5,] -1.37875000 -1.54125000 [6,] -0.99125000 -1.37875000 [7,] -0.76625000 -0.99125000 [8,] -0.95375000 -0.76625000 [9,] -1.30375000 -0.95375000 [10,] -1.20375000 -1.30375000 [11,] -0.85375000 -1.20375000 [12,] -0.22416667 -0.85375000 [13,] -0.12416667 -0.22416667 [14,] -0.08666667 -0.12416667 [15,] -0.18666667 -0.08666667 [16,] -0.29916667 -0.18666667 [17,] -0.23666667 -0.29916667 [18,] -0.24916667 -0.23666667 [19,] -0.22416667 -0.24916667 [20,] -0.21166667 -0.22416667 [21,] -0.06166667 -0.21166667 [22,] -0.06166667 -0.06166667 [23,] 0.08833333 -0.06166667 [24,] 0.21791667 0.08833333 [25,] 0.41791667 0.21791667 [26,] 0.45541667 0.41791667 [27,] 0.45541667 0.45541667 [28,] 0.44291667 0.45541667 [29,] 0.40541667 0.44291667 [30,] 0.49291667 0.40541667 [31,] 0.41791667 0.49291667 [32,] 0.53041667 0.41791667 [33,] 0.58041667 0.53041667 [34,] 0.58041667 0.58041667 [35,] 0.63041667 0.58041667 [36,] 0.56000000 0.63041667 [37,] 0.66000000 0.56000000 [38,] 0.79750000 0.66000000 [39,] 0.99750000 0.79750000 [40,] 0.98500000 0.99750000 [41,] 0.64750000 0.98500000 [42,] 0.03500000 0.64750000 [43,] -0.04000000 0.03500000 [44,] 0.37250000 -0.04000000 [45,] 1.12250000 0.37250000 [46,] 1.52250000 1.12250000 [47,] 1.47250000 1.52250000 [48,] 0.76500000 1.47250000 [49,] 0.36500000 0.76500000 [50,] 0.40250000 0.36500000 [51,] 0.50250000 0.40250000 [52,] 0.69000000 0.50250000 [53,] 0.85250000 0.69000000 [54,] 0.64000000 0.85250000 [55,] 0.76500000 0.64000000 [56,] 0.77750000 0.76500000 [57,] 0.82750000 0.77750000 [58,] 0.82750000 0.82750000 [59,] 0.87750000 0.82750000 [60,] 0.50708333 0.87750000 [61,] 0.50708333 0.50708333 [62,] 0.54458333 0.50708333 [63,] 0.64458333 0.54458333 [64,] 0.73208333 0.64458333 [65,] 0.79458333 0.73208333 [66,] 0.88208333 0.79458333 [67,] 0.90708333 0.88208333 [68,] 0.81958333 0.90708333 [69,] 0.36958333 0.81958333 [70,] 0.16958333 0.36958333 [71,] 0.11958333 0.16958333 [72,] -0.15083333 0.11958333 [73,] -0.05083333 -0.15083333 [74,] -0.11333333 -0.05083333 [75,] -0.11333333 -0.11333333 [76,] -0.02583333 -0.11333333 [77,] 0.03666667 -0.02583333 [78,] 0.32416667 0.03666667 [79,] 0.24916667 0.32416667 [80,] -0.13833333 0.24916667 [81,] -0.38833333 -0.13833333 [82,] -0.68833333 -0.38833333 [83,] -1.03833333 -0.68833333 [84,] -1.10875000 -1.03833333 [85,] -1.00875000 -1.10875000 [86,] -0.87125000 -1.00875000 [87,] -0.87125000 -0.87125000 [88,] -0.98375000 -0.87125000 [89,] -1.12125000 -0.98375000 [90,] -1.13375000 -1.12125000 [91,] -1.30875000 -1.13375000 [92,] -1.19625000 -1.30875000 [93,] -1.14625000 -1.19625000 [94,] -1.14625000 -1.14625000 [95,] -1.29625000 -1.14625000 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.76625000 -0.56625000 2 -1.12875000 -0.76625000 3 -1.42875000 -1.12875000 4 -1.54125000 -1.42875000 5 -1.37875000 -1.54125000 6 -0.99125000 -1.37875000 7 -0.76625000 -0.99125000 8 -0.95375000 -0.76625000 9 -1.30375000 -0.95375000 10 -1.20375000 -1.30375000 11 -0.85375000 -1.20375000 12 -0.22416667 -0.85375000 13 -0.12416667 -0.22416667 14 -0.08666667 -0.12416667 15 -0.18666667 -0.08666667 16 -0.29916667 -0.18666667 17 -0.23666667 -0.29916667 18 -0.24916667 -0.23666667 19 -0.22416667 -0.24916667 20 -0.21166667 -0.22416667 21 -0.06166667 -0.21166667 22 -0.06166667 -0.06166667 23 0.08833333 -0.06166667 24 0.21791667 0.08833333 25 0.41791667 0.21791667 26 0.45541667 0.41791667 27 0.45541667 0.45541667 28 0.44291667 0.45541667 29 0.40541667 0.44291667 30 0.49291667 0.40541667 31 0.41791667 0.49291667 32 0.53041667 0.41791667 33 0.58041667 0.53041667 34 0.58041667 0.58041667 35 0.63041667 0.58041667 36 0.56000000 0.63041667 37 0.66000000 0.56000000 38 0.79750000 0.66000000 39 0.99750000 0.79750000 40 0.98500000 0.99750000 41 0.64750000 0.98500000 42 0.03500000 0.64750000 43 -0.04000000 0.03500000 44 0.37250000 -0.04000000 45 1.12250000 0.37250000 46 1.52250000 1.12250000 47 1.47250000 1.52250000 48 0.76500000 1.47250000 49 0.36500000 0.76500000 50 0.40250000 0.36500000 51 0.50250000 0.40250000 52 0.69000000 0.50250000 53 0.85250000 0.69000000 54 0.64000000 0.85250000 55 0.76500000 0.64000000 56 0.77750000 0.76500000 57 0.82750000 0.77750000 58 0.82750000 0.82750000 59 0.87750000 0.82750000 60 0.50708333 0.87750000 61 0.50708333 0.50708333 62 0.54458333 0.50708333 63 0.64458333 0.54458333 64 0.73208333 0.64458333 65 0.79458333 0.73208333 66 0.88208333 0.79458333 67 0.90708333 0.88208333 68 0.81958333 0.90708333 69 0.36958333 0.81958333 70 0.16958333 0.36958333 71 0.11958333 0.16958333 72 -0.15083333 0.11958333 73 -0.05083333 -0.15083333 74 -0.11333333 -0.05083333 75 -0.11333333 -0.11333333 76 -0.02583333 -0.11333333 77 0.03666667 -0.02583333 78 0.32416667 0.03666667 79 0.24916667 0.32416667 80 -0.13833333 0.24916667 81 -0.38833333 -0.13833333 82 -0.68833333 -0.38833333 83 -1.03833333 -0.68833333 84 -1.10875000 -1.03833333 85 -1.00875000 -1.10875000 86 -0.87125000 -1.00875000 87 -0.87125000 -0.87125000 88 -0.98375000 -0.87125000 89 -1.12125000 -0.98375000 90 -1.13375000 -1.12125000 91 -1.30875000 -1.13375000 92 -1.19625000 -1.30875000 93 -1.14625000 -1.19625000 94 -1.14625000 -1.14625000 95 -1.29625000 -1.14625000 > 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/7hx2j1227785842.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/8jy8y1227785842.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/9yx871227785842.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/10dhce1227785843.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/11x6xy1227785843.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/12ompq1227785843.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/13w6aa1227785843.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/147oi41227785843.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/15d7s51227785843.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/16xdab1227785843.tab") + } > > system("convert tmp/1mk6o1227785842.ps tmp/1mk6o1227785842.png") > system("convert tmp/23vlm1227785842.ps tmp/23vlm1227785842.png") > system("convert tmp/33umy1227785842.ps tmp/33umy1227785842.png") > system("convert tmp/44dq91227785842.ps tmp/44dq91227785842.png") > system("convert tmp/5l3gm1227785842.ps tmp/5l3gm1227785842.png") > system("convert tmp/6gaec1227785842.ps tmp/6gaec1227785842.png") > system("convert tmp/7hx2j1227785842.ps tmp/7hx2j1227785842.png") > system("convert tmp/8jy8y1227785842.ps tmp/8jy8y1227785842.png") > system("convert tmp/9yx871227785842.ps tmp/9yx871227785842.png") > system("convert tmp/10dhce1227785843.ps tmp/10dhce1227785843.png") > > > proc.time() user system elapsed 2.922 1.590 3.446