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(95.1 + ,93.8 + ,111.7 + ,97 + ,93.8 + ,98.6 + ,112.7 + ,107.6 + ,96.9 + ,102.9 + ,101 + ,95.1 + ,97.4 + ,95.4 + ,97 + ,111.4 + ,96.5 + ,112.7 + ,87.4 + ,89.2 + ,102.9 + ,96.8 + ,87.1 + ,97.4 + ,114.1 + ,110.5 + ,111.4 + ,110.3 + ,110.8 + ,87.4 + ,103.9 + ,104.2 + ,96.8 + ,101.6 + ,88.9 + ,114.1 + ,94.6 + ,89.8 + ,110.3 + ,95.9 + ,90 + ,103.9 + ,104.7 + ,93.9 + ,101.6 + ,102.8 + ,91.3 + ,94.6 + ,98.1 + ,87.8 + ,95.9 + ,113.9 + ,99.7 + ,104.7 + ,80.9 + ,73.5 + ,102.8 + ,95.7 + ,79.2 + ,98.1 + ,113.2 + ,96.9 + ,113.9 + ,105.9 + ,95.2 + ,80.9 + ,108.8 + ,95.6 + ,95.7 + ,102.3 + ,89.7 + ,113.2 + ,99 + ,92.8 + ,105.9 + ,100.7 + ,88 + ,108.8 + ,115.5 + ,101.1 + ,102.3 + ,100.7 + ,92.7 + ,99 + ,109.9 + ,95.8 + ,100.7 + ,114.6 + ,103.8 + ,115.5 + ,85.4 + ,81.8 + ,100.7 + ,100.5 + ,87.1 + ,109.9 + ,114.8 + ,105.9 + ,114.6 + ,116.5 + ,108.1 + ,85.4 + ,112.9 + ,102.6 + ,100.5 + ,102 + ,93.7 + ,114.8 + ,106 + ,103.5 + ,116.5 + ,105.3 + ,100.6 + ,112.9 + ,118.8 + ,113.3 + ,102 + ,106.1 + ,102.4 + ,106 + ,109.3 + ,102.1 + ,105.3 + ,117.2 + ,106.9 + ,118.8 + ,92.5 + ,87.3 + ,106.1 + ,104.2 + ,93.1 + ,109.3 + ,112.5 + ,109.1 + ,117.2 + ,122.4 + ,120.3 + ,92.5 + ,113.3 + ,104.9 + ,104.2 + ,100 + ,92.6 + ,112.5 + ,110.7 + ,109.8 + ,122.4 + ,112.8 + ,111.4 + ,113.3 + ,109.8 + ,117.9 + ,100 + ,117.3 + ,121.6 + ,110.7 + ,109.1 + ,117.8 + ,112.8 + ,115.9 + ,124.2 + ,109.8 + ,96 + ,106.8 + ,117.3 + ,99.8 + ,102.7 + ,109.1 + ,116.8 + ,116.8 + ,115.9 + ,115.7 + ,113.6 + ,96 + ,99.4 + ,96.1 + ,99.8 + ,94.3 + ,85 + ,116.8) + ,dim=c(3 + ,60) + ,dimnames=list(c('TIA' + ,'IAidM' + ,'TIA(t-3)') + ,1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('TIA','IAidM','TIA(t-3)'),1:60)) > 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 TIA IAidM TIA(t-3) M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 95.1 93.8 111.7 1 0 0 0 0 0 0 0 0 0 0 1 2 97.0 93.8 98.6 0 1 0 0 0 0 0 0 0 0 0 2 3 112.7 107.6 96.9 0 0 1 0 0 0 0 0 0 0 0 3 4 102.9 101.0 95.1 0 0 0 1 0 0 0 0 0 0 0 4 5 97.4 95.4 97.0 0 0 0 0 1 0 0 0 0 0 0 5 6 111.4 96.5 112.7 0 0 0 0 0 1 0 0 0 0 0 6 7 87.4 89.2 102.9 0 0 0 0 0 0 1 0 0 0 0 7 8 96.8 87.1 97.4 0 0 0 0 0 0 0 1 0 0 0 8 9 114.1 110.5 111.4 0 0 0 0 0 0 0 0 1 0 0 9 10 110.3 110.8 87.4 0 0 0 0 0 0 0 0 0 1 0 10 11 103.9 104.2 96.8 0 0 0 0 0 0 0 0 0 0 1 11 12 101.6 88.9 114.1 0 0 0 0 0 0 0 0 0 0 0 12 13 94.6 89.8 110.3 1 0 0 0 0 0 0 0 0 0 0 13 14 95.9 90.0 103.9 0 1 0 0 0 0 0 0 0 0 0 14 15 104.7 93.9 101.6 0 0 1 0 0 0 0 0 0 0 0 15 16 102.8 91.3 94.6 0 0 0 1 0 0 0 0 0 0 0 16 17 98.1 87.8 95.9 0 0 0 0 1 0 0 0 0 0 0 17 18 113.9 99.7 104.7 0 0 0 0 0 1 0 0 0 0 0 18 19 80.9 73.5 102.8 0 0 0 0 0 0 1 0 0 0 0 19 20 95.7 79.2 98.1 0 0 0 0 0 0 0 1 0 0 0 20 21 113.2 96.9 113.9 0 0 0 0 0 0 0 0 1 0 0 21 22 105.9 95.2 80.9 0 0 0 0 0 0 0 0 0 1 0 22 23 108.8 95.6 95.7 0 0 0 0 0 0 0 0 0 0 1 23 24 102.3 89.7 113.2 0 0 0 0 0 0 0 0 0 0 0 24 25 99.0 92.8 105.9 1 0 0 0 0 0 0 0 0 0 0 25 26 100.7 88.0 108.8 0 1 0 0 0 0 0 0 0 0 0 26 27 115.5 101.1 102.3 0 0 1 0 0 0 0 0 0 0 0 27 28 100.7 92.7 99.0 0 0 0 1 0 0 0 0 0 0 0 28 29 109.9 95.8 100.7 0 0 0 0 1 0 0 0 0 0 0 29 30 114.6 103.8 115.5 0 0 0 0 0 1 0 0 0 0 0 30 31 85.4 81.8 100.7 0 0 0 0 0 0 1 0 0 0 0 31 32 100.5 87.1 109.9 0 0 0 0 0 0 0 1 0 0 0 32 33 114.8 105.9 114.6 0 0 0 0 0 0 0 0 1 0 0 33 34 116.5 108.1 85.4 0 0 0 0 0 0 0 0 0 1 0 34 35 112.9 102.6 100.5 0 0 0 0 0 0 0 0 0 0 1 35 36 102.0 93.7 114.8 0 0 0 0 0 0 0 0 0 0 0 36 37 106.0 103.5 116.5 1 0 0 0 0 0 0 0 0 0 0 37 38 105.3 100.6 112.9 0 1 0 0 0 0 0 0 0 0 0 38 39 118.8 113.3 102.0 0 0 1 0 0 0 0 0 0 0 0 39 40 106.1 102.4 106.0 0 0 0 1 0 0 0 0 0 0 0 40 41 109.3 102.1 105.3 0 0 0 0 1 0 0 0 0 0 0 41 42 117.2 106.9 118.8 0 0 0 0 0 1 0 0 0 0 0 42 43 92.5 87.3 106.1 0 0 0 0 0 0 1 0 0 0 0 43 44 104.2 93.1 109.3 0 0 0 0 0 0 0 1 0 0 0 44 45 112.5 109.1 117.2 0 0 0 0 0 0 0 0 1 0 0 45 46 122.4 120.3 92.5 0 0 0 0 0 0 0 0 0 1 0 46 47 113.3 104.9 104.2 0 0 0 0 0 0 0 0 0 0 1 47 48 100.0 92.6 112.5 0 0 0 0 0 0 0 0 0 0 0 48 49 110.7 109.8 122.4 1 0 0 0 0 0 0 0 0 0 0 49 50 112.8 111.4 113.3 0 1 0 0 0 0 0 0 0 0 0 50 51 109.8 117.9 100.0 0 0 1 0 0 0 0 0 0 0 0 51 52 117.3 121.6 110.7 0 0 0 1 0 0 0 0 0 0 0 52 53 109.1 117.8 112.8 0 0 0 0 1 0 0 0 0 0 0 53 54 115.9 124.2 109.8 0 0 0 0 0 1 0 0 0 0 0 54 55 96.0 106.8 117.3 0 0 0 0 0 0 1 0 0 0 0 55 56 99.8 102.7 109.1 0 0 0 0 0 0 0 1 0 0 0 56 57 116.8 116.8 115.9 0 0 0 0 0 0 0 0 1 0 0 57 58 115.7 113.6 96.0 0 0 0 0 0 0 0 0 0 1 0 58 59 99.4 96.1 99.8 0 0 0 0 0 0 0 0 0 0 1 59 60 94.3 85.0 116.8 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) IAidM `TIA(t-3)` M1 M2 M3 32.504936 0.303639 0.354779 -1.151563 2.554919 11.949880 M4 M5 M6 M7 M8 M9 6.940625 5.916135 10.276281 -8.007920 2.743283 8.675938 M10 M11 t 17.311741 9.640999 -0.009181 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.7909 -2.1551 0.0484 2.3272 6.9303 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 32.504936 14.565839 2.232 0.030668 * IAidM 0.303639 0.075723 4.010 0.000226 *** `TIA(t-3)` 0.354779 0.144699 2.452 0.018158 * M1 -1.151563 2.402733 -0.479 0.634066 M2 2.554919 2.549927 1.002 0.321722 M3 11.949880 3.475651 3.438 0.001272 ** M4 6.940625 3.218519 2.156 0.036428 * M5 5.916135 3.032412 1.951 0.057304 . M6 10.276281 2.655537 3.870 0.000349 *** M7 -8.007920 2.475079 -3.235 0.002280 ** M8 2.743283 2.590436 1.059 0.295249 M9 8.675938 2.634067 3.294 0.001931 ** M10 17.311741 4.998995 3.463 0.001183 ** M11 9.640999 3.392720 2.842 0.006721 ** t -0.009181 0.040456 -0.227 0.821492 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.546 on 45 degrees of freedom Multiple R-squared: 0.8816, Adjusted R-squared: 0.8448 F-statistic: 23.94 on 14 and 45 DF, p-value: 2.898e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.24040277 0.4808055 0.7595972 [2,] 0.15606932 0.3121386 0.8439307 [3,] 0.08037441 0.1607488 0.9196256 [4,] 0.08921720 0.1784344 0.9107828 [5,] 0.05828384 0.1165677 0.9417162 [6,] 0.18436607 0.3687321 0.8156339 [7,] 0.12719375 0.2543875 0.8728062 [8,] 0.07997637 0.1599527 0.9200236 [9,] 0.07802156 0.1560431 0.9219784 [10,] 0.06032998 0.1206600 0.9396700 [11,] 0.10414072 0.2082814 0.8958593 [12,] 0.20477569 0.4095514 0.7952243 [13,] 0.24696106 0.4939221 0.7530389 [14,] 0.22402694 0.4480539 0.7759731 [15,] 0.16850391 0.3370078 0.8314961 [16,] 0.13922168 0.2784434 0.8607783 [17,] 0.10632712 0.2126542 0.8936729 [18,] 0.06886467 0.1377293 0.9311353 [19,] 0.08892015 0.1778403 0.9110798 [20,] 0.07531025 0.1506205 0.9246898 [21,] 0.12575436 0.2515087 0.8742456 [22,] 0.12276687 0.2455337 0.8772331 [23,] 0.27049270 0.5409854 0.7295073 [24,] 0.19474028 0.3894806 0.8052597 [25,] 0.11370186 0.2274037 0.8862981 > postscript(file="/var/www/html/rcomp/tmp/1r1eo1258747802.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/2kdjo1258747802.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/3qjl01258747802.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/497bw1258747802.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/527hh1258747802.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 = 60 Frequency = 1 1 2 3 4 5 6 -4.35435572 -1.50404744 1.22308173 -0.91586272 -4.35589464 -0.61089667 7 8 9 10 11 12 -0.62411466 0.62279193 -0.07273932 -4.07574996 -4.12673624 1.73143626 13 14 15 16 17 18 -3.03293266 -3.22037336 -4.17435270 2.21700002 -0.84780575 3.86587049 19 20 21 22 23 24 -2.21133095 1.78336973 2.37997680 -1.32274269 3.88499142 2.61800355 25 26 27 28 29 30 2.12735682 0.55866263 4.30127953 -1.75894619 6.93032037 -0.40048788 31 32 33 34 35 36 0.62368063 0.10840471 1.10905923 3.87398721 4.26675633 0.64597851 37 38 39 40 41 42 2.22793837 -0.01160412 4.11349715 -1.67752042 2.89558828 0.19763720 43 44 45 46 47 48 4.24803613 2.30961656 -2.97483407 3.66083810 2.76588071 -0.09384952 49 50 51 52 53 54 3.03199320 4.17736229 -5.46350571 2.13532931 -4.62220827 -3.05212314 55 56 57 58 59 60 -2.03627115 -4.82418292 -0.44146265 -2.13633265 -6.79089222 -4.90156880 > postscript(file="/var/www/html/rcomp/tmp/6gt7b1258747802.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -4.35435572 NA 1 -1.50404744 -4.35435572 2 1.22308173 -1.50404744 3 -0.91586272 1.22308173 4 -4.35589464 -0.91586272 5 -0.61089667 -4.35589464 6 -0.62411466 -0.61089667 7 0.62279193 -0.62411466 8 -0.07273932 0.62279193 9 -4.07574996 -0.07273932 10 -4.12673624 -4.07574996 11 1.73143626 -4.12673624 12 -3.03293266 1.73143626 13 -3.22037336 -3.03293266 14 -4.17435270 -3.22037336 15 2.21700002 -4.17435270 16 -0.84780575 2.21700002 17 3.86587049 -0.84780575 18 -2.21133095 3.86587049 19 1.78336973 -2.21133095 20 2.37997680 1.78336973 21 -1.32274269 2.37997680 22 3.88499142 -1.32274269 23 2.61800355 3.88499142 24 2.12735682 2.61800355 25 0.55866263 2.12735682 26 4.30127953 0.55866263 27 -1.75894619 4.30127953 28 6.93032037 -1.75894619 29 -0.40048788 6.93032037 30 0.62368063 -0.40048788 31 0.10840471 0.62368063 32 1.10905923 0.10840471 33 3.87398721 1.10905923 34 4.26675633 3.87398721 35 0.64597851 4.26675633 36 2.22793837 0.64597851 37 -0.01160412 2.22793837 38 4.11349715 -0.01160412 39 -1.67752042 4.11349715 40 2.89558828 -1.67752042 41 0.19763720 2.89558828 42 4.24803613 0.19763720 43 2.30961656 4.24803613 44 -2.97483407 2.30961656 45 3.66083810 -2.97483407 46 2.76588071 3.66083810 47 -0.09384952 2.76588071 48 3.03199320 -0.09384952 49 4.17736229 3.03199320 50 -5.46350571 4.17736229 51 2.13532931 -5.46350571 52 -4.62220827 2.13532931 53 -3.05212314 -4.62220827 54 -2.03627115 -3.05212314 55 -4.82418292 -2.03627115 56 -0.44146265 -4.82418292 57 -2.13633265 -0.44146265 58 -6.79089222 -2.13633265 59 -4.90156880 -6.79089222 60 NA -4.90156880 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.50404744 -4.35435572 [2,] 1.22308173 -1.50404744 [3,] -0.91586272 1.22308173 [4,] -4.35589464 -0.91586272 [5,] -0.61089667 -4.35589464 [6,] -0.62411466 -0.61089667 [7,] 0.62279193 -0.62411466 [8,] -0.07273932 0.62279193 [9,] -4.07574996 -0.07273932 [10,] -4.12673624 -4.07574996 [11,] 1.73143626 -4.12673624 [12,] -3.03293266 1.73143626 [13,] -3.22037336 -3.03293266 [14,] -4.17435270 -3.22037336 [15,] 2.21700002 -4.17435270 [16,] -0.84780575 2.21700002 [17,] 3.86587049 -0.84780575 [18,] -2.21133095 3.86587049 [19,] 1.78336973 -2.21133095 [20,] 2.37997680 1.78336973 [21,] -1.32274269 2.37997680 [22,] 3.88499142 -1.32274269 [23,] 2.61800355 3.88499142 [24,] 2.12735682 2.61800355 [25,] 0.55866263 2.12735682 [26,] 4.30127953 0.55866263 [27,] -1.75894619 4.30127953 [28,] 6.93032037 -1.75894619 [29,] -0.40048788 6.93032037 [30,] 0.62368063 -0.40048788 [31,] 0.10840471 0.62368063 [32,] 1.10905923 0.10840471 [33,] 3.87398721 1.10905923 [34,] 4.26675633 3.87398721 [35,] 0.64597851 4.26675633 [36,] 2.22793837 0.64597851 [37,] -0.01160412 2.22793837 [38,] 4.11349715 -0.01160412 [39,] -1.67752042 4.11349715 [40,] 2.89558828 -1.67752042 [41,] 0.19763720 2.89558828 [42,] 4.24803613 0.19763720 [43,] 2.30961656 4.24803613 [44,] -2.97483407 2.30961656 [45,] 3.66083810 -2.97483407 [46,] 2.76588071 3.66083810 [47,] -0.09384952 2.76588071 [48,] 3.03199320 -0.09384952 [49,] 4.17736229 3.03199320 [50,] -5.46350571 4.17736229 [51,] 2.13532931 -5.46350571 [52,] -4.62220827 2.13532931 [53,] -3.05212314 -4.62220827 [54,] -2.03627115 -3.05212314 [55,] -4.82418292 -2.03627115 [56,] -0.44146265 -4.82418292 [57,] -2.13633265 -0.44146265 [58,] -6.79089222 -2.13633265 [59,] -4.90156880 -6.79089222 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.50404744 -4.35435572 2 1.22308173 -1.50404744 3 -0.91586272 1.22308173 4 -4.35589464 -0.91586272 5 -0.61089667 -4.35589464 6 -0.62411466 -0.61089667 7 0.62279193 -0.62411466 8 -0.07273932 0.62279193 9 -4.07574996 -0.07273932 10 -4.12673624 -4.07574996 11 1.73143626 -4.12673624 12 -3.03293266 1.73143626 13 -3.22037336 -3.03293266 14 -4.17435270 -3.22037336 15 2.21700002 -4.17435270 16 -0.84780575 2.21700002 17 3.86587049 -0.84780575 18 -2.21133095 3.86587049 19 1.78336973 -2.21133095 20 2.37997680 1.78336973 21 -1.32274269 2.37997680 22 3.88499142 -1.32274269 23 2.61800355 3.88499142 24 2.12735682 2.61800355 25 0.55866263 2.12735682 26 4.30127953 0.55866263 27 -1.75894619 4.30127953 28 6.93032037 -1.75894619 29 -0.40048788 6.93032037 30 0.62368063 -0.40048788 31 0.10840471 0.62368063 32 1.10905923 0.10840471 33 3.87398721 1.10905923 34 4.26675633 3.87398721 35 0.64597851 4.26675633 36 2.22793837 0.64597851 37 -0.01160412 2.22793837 38 4.11349715 -0.01160412 39 -1.67752042 4.11349715 40 2.89558828 -1.67752042 41 0.19763720 2.89558828 42 4.24803613 0.19763720 43 2.30961656 4.24803613 44 -2.97483407 2.30961656 45 3.66083810 -2.97483407 46 2.76588071 3.66083810 47 -0.09384952 2.76588071 48 3.03199320 -0.09384952 49 4.17736229 3.03199320 50 -5.46350571 4.17736229 51 2.13532931 -5.46350571 52 -4.62220827 2.13532931 53 -3.05212314 -4.62220827 54 -2.03627115 -3.05212314 55 -4.82418292 -2.03627115 56 -0.44146265 -4.82418292 57 -2.13633265 -0.44146265 58 -6.79089222 -2.13633265 59 -4.90156880 -6.79089222 > 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/7chso1258747802.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/8sqak1258747802.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/9g2j21258747802.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/10qm161258747802.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/11c0891258747802.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/12dmpm1258747802.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/13vw9e1258747802.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/14ya5y1258747802.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/15o8531258747802.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/16ykpn1258747802.tab") + } > > system("convert tmp/1r1eo1258747802.ps tmp/1r1eo1258747802.png") > system("convert tmp/2kdjo1258747802.ps tmp/2kdjo1258747802.png") > system("convert tmp/3qjl01258747802.ps tmp/3qjl01258747802.png") > system("convert tmp/497bw1258747802.ps tmp/497bw1258747802.png") > system("convert tmp/527hh1258747802.ps tmp/527hh1258747802.png") > system("convert tmp/6gt7b1258747802.ps tmp/6gt7b1258747802.png") > system("convert tmp/7chso1258747802.ps tmp/7chso1258747802.png") > system("convert tmp/8sqak1258747802.ps tmp/8sqak1258747802.png") > system("convert tmp/9g2j21258747802.ps tmp/9g2j21258747802.png") > system("convert tmp/10qm161258747802.ps tmp/10qm161258747802.png") > > > proc.time() user system elapsed 2.489 1.596 4.189