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(101.5,1,100.7,1,110.6,1,96.8,1,100.0,1,104.8,1,86.8,1,92.0,1,100.2,1,106.6,1,102.1,1,93.7,1,97.6,1,96.9,1,105.6,1,102.8,1,101.7,1,104.2,1,92.7,1,91.9,1,106.5,1,112.3,1,102.8,1,96.5,1,101.0,0,98.9,0,105.1,0,103.0,0,99.0,0,104.3,0,94.6,0,90.4,0,108.9,0,111.4,0,100.8,0,102.5,0,98.2,0,98.7,0,113.3,0,104.6,0,99.3,0,111.8,0,97.3,0,97.7,0,115.6,0,111.9,0,107.0,0,107.1,0,100.6,0,99.2,0,108.4,0,103.0,0,99.8,0,115.0,0,90.8,0,95.9,0,114.4,0,108.2,0,112.6,0,109.1,0,105.0,0,105.0,0,118.5,0,103.7,0,112.5,0,116.6,0,96.6,0,101.9,0,116.5,0,119.3,0,115.4,0,108.5,0,111.5,0,108.8,0,121.8,0,109.6,0,112.2,0,119.6,0,104.1,0,105.3,0,115.0,0,124.1,0,116.8,0,107.5,0,115.6,0,116.2,0,116.3,0,119.0,0,111.9,0,118.6,0,106.9,0,103.2,0),dim=c(2,92),dimnames=list(c('Y','X'),1:92)) > y <- array(NA,dim=c(2,92),dimnames=list(c('Y','X'),1:92)) > 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 = 'Do not include Seasonal 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 1 101.5 1 2 100.7 1 3 110.6 1 4 96.8 1 5 100.0 1 6 104.8 1 7 86.8 1 8 92.0 1 9 100.2 1 10 106.6 1 11 102.1 1 12 93.7 1 13 97.6 1 14 96.9 1 15 105.6 1 16 102.8 1 17 101.7 1 18 104.2 1 19 92.7 1 20 91.9 1 21 106.5 1 22 112.3 1 23 102.8 1 24 96.5 1 25 101.0 0 26 98.9 0 27 105.1 0 28 103.0 0 29 99.0 0 30 104.3 0 31 94.6 0 32 90.4 0 33 108.9 0 34 111.4 0 35 100.8 0 36 102.5 0 37 98.2 0 38 98.7 0 39 113.3 0 40 104.6 0 41 99.3 0 42 111.8 0 43 97.3 0 44 97.7 0 45 115.6 0 46 111.9 0 47 107.0 0 48 107.1 0 49 100.6 0 50 99.2 0 51 108.4 0 52 103.0 0 53 99.8 0 54 115.0 0 55 90.8 0 56 95.9 0 57 114.4 0 58 108.2 0 59 112.6 0 60 109.1 0 61 105.0 0 62 105.0 0 63 118.5 0 64 103.7 0 65 112.5 0 66 116.6 0 67 96.6 0 68 101.9 0 69 116.5 0 70 119.3 0 71 115.4 0 72 108.5 0 73 111.5 0 74 108.8 0 75 121.8 0 76 109.6 0 77 112.2 0 78 119.6 0 79 104.1 0 80 105.3 0 81 115.0 0 82 124.1 0 83 116.8 0 84 107.5 0 85 115.6 0 86 116.2 0 87 116.3 0 88 119.0 0 89 111.9 0 90 118.6 0 91 106.9 0 92 103.2 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X 107.690 -7.386 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -17.2897 -5.3397 0.4531 5.3744 16.4103 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 107.6897 0.9039 119.142 < 2e-16 *** X -7.3855 1.7697 -4.173 6.91e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 7.454 on 90 degrees of freedom Multiple R-squared: 0.1621, Adjusted R-squared: 0.1528 F-statistic: 17.42 on 1 and 90 DF, p-value: 6.912e-05 > 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.39675594 0.79351188 0.6032441 [2,] 0.25892995 0.51785991 0.7410700 [3,] 0.65624072 0.68751857 0.3437593 [4,] 0.64802509 0.70394981 0.3519749 [5,] 0.53393630 0.93212740 0.4660637 [6,] 0.51265456 0.97469089 0.4873454 [7,] 0.41371584 0.82743167 0.5862842 [8,] 0.38637118 0.77274236 0.6136288 [9,] 0.30370891 0.60741782 0.6962911 [10,] 0.23668796 0.47337592 0.7633120 [11,] 0.21573457 0.43146914 0.7842654 [12,] 0.16500975 0.33001951 0.8349902 [13,] 0.11875543 0.23751086 0.8812446 [14,] 0.09297541 0.18595083 0.9070246 [15,] 0.10002001 0.20004003 0.8999800 [16,] 0.11679315 0.23358630 0.8832069 [17,] 0.11138258 0.22276516 0.8886174 [18,] 0.19299615 0.38599230 0.8070039 [19,] 0.15274853 0.30549706 0.8472515 [20,] 0.12217698 0.24435396 0.8778230 [21,] 0.09386860 0.18773721 0.9061314 [22,] 0.07525182 0.15050365 0.9247482 [23,] 0.05975988 0.11951975 0.9402401 [24,] 0.04347571 0.08695143 0.9565243 [25,] 0.03545981 0.07091963 0.9645402 [26,] 0.02581395 0.05162789 0.9741861 [27,] 0.03291254 0.06582508 0.9670875 [28,] 0.07207111 0.14414222 0.9279289 [29,] 0.07853064 0.15706128 0.9214694 [30,] 0.09592387 0.19184774 0.9040761 [31,] 0.07982586 0.15965173 0.9201741 [32,] 0.06348727 0.12697454 0.9365127 [33,] 0.06130139 0.12260278 0.9386986 [34,] 0.05790145 0.11580290 0.9420986 [35,] 0.08205180 0.16410361 0.9179482 [36,] 0.06556846 0.13113691 0.9344315 [37,] 0.06240613 0.12481226 0.9375939 [38,] 0.06871220 0.13742440 0.9312878 [39,] 0.07964354 0.15928709 0.9203565 [40,] 0.09084882 0.18169765 0.9091512 [41,] 0.13590350 0.27180700 0.8640965 [42,] 0.13656659 0.27313319 0.8634334 [43,] 0.11295065 0.22590131 0.8870493 [44,] 0.09220489 0.18440978 0.9077951 [45,] 0.08939747 0.17879495 0.9106025 [46,] 0.09801079 0.19602158 0.9019892 [47,] 0.08190286 0.16380572 0.9180971 [48,] 0.07223116 0.14446232 0.9277688 [49,] 0.08016108 0.16032216 0.9198389 [50,] 0.09573866 0.19147732 0.9042613 [51,] 0.31422972 0.62845944 0.6857703 [52,] 0.48363878 0.96727756 0.5163612 [53,] 0.49726345 0.99452689 0.5027366 [54,] 0.45892159 0.91784317 0.5410784 [55,] 0.43848197 0.87696395 0.5615180 [56,] 0.39724485 0.79448971 0.6027551 [57,] 0.38066390 0.76132779 0.6193361 [58,] 0.36819978 0.73639956 0.6318002 [59,] 0.43512935 0.87025869 0.5648707 [60,] 0.44480146 0.88960292 0.5551985 [61,] 0.40741229 0.81482457 0.5925877 [62,] 0.41679831 0.83359661 0.5832017 [63,] 0.66146979 0.67706043 0.3385302 [64,] 0.75049936 0.49900129 0.2495006 [65,] 0.74263085 0.51473830 0.2573692 [66,] 0.77824200 0.44351601 0.2217580 [67,] 0.75047454 0.49905092 0.2495255 [68,] 0.71446595 0.57106810 0.2855341 [69,] 0.65822450 0.68355100 0.3417755 [70,] 0.61511138 0.76977725 0.3848886 [71,] 0.70249801 0.59500398 0.2975020 [72,] 0.64689036 0.70621927 0.3531096 [73,] 0.57412375 0.85175249 0.4258762 [74,] 0.59123302 0.81753397 0.4087670 [75,] 0.63796079 0.72407842 0.3620392 [76,] 0.67719105 0.64561789 0.3228089 [77,] 0.59482769 0.81034462 0.4051723 [78,] 0.75279099 0.49441802 0.2472090 [79,] 0.69502517 0.60994967 0.3049748 [80,] 0.65263581 0.69472839 0.3473642 [81,] 0.54315213 0.91369574 0.4568479 [82,] 0.43264649 0.86529298 0.5673535 [83,] 0.32240201 0.64480402 0.6775980 > postscript(file="/var/www/html/freestat/rcomp/tmp/1md8x1229008201.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/freestat/rcomp/tmp/2n1u01229008201.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/freestat/rcomp/tmp/33twi1229008202.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/freestat/rcomp/tmp/4pobd1229008202.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/freestat/rcomp/tmp/5k5v71229008202.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 = 92 Frequency = 1 1 2 3 4 5 6 1.1958333 0.3958333 10.2958333 -3.5041667 -0.3041667 4.4958333 7 8 9 10 11 12 -13.5041667 -8.3041667 -0.1041667 6.2958333 1.7958333 -6.6041667 13 14 15 16 17 18 -2.7041667 -3.4041667 5.2958333 2.4958333 1.3958333 3.8958333 19 20 21 22 23 24 -7.6041667 -8.4041667 6.1958333 11.9958333 2.4958333 -3.8041667 25 26 27 28 29 30 -6.6897059 -8.7897059 -2.5897059 -4.6897059 -8.6897059 -3.3897059 31 32 33 34 35 36 -13.0897059 -17.2897059 1.2102941 3.7102941 -6.8897059 -5.1897059 37 38 39 40 41 42 -9.4897059 -8.9897059 5.6102941 -3.0897059 -8.3897059 4.1102941 43 44 45 46 47 48 -10.3897059 -9.9897059 7.9102941 4.2102941 -0.6897059 -0.5897059 49 50 51 52 53 54 -7.0897059 -8.4897059 0.7102941 -4.6897059 -7.8897059 7.3102941 55 56 57 58 59 60 -16.8897059 -11.7897059 6.7102941 0.5102941 4.9102941 1.4102941 61 62 63 64 65 66 -2.6897059 -2.6897059 10.8102941 -3.9897059 4.8102941 8.9102941 67 68 69 70 71 72 -11.0897059 -5.7897059 8.8102941 11.6102941 7.7102941 0.8102941 73 74 75 76 77 78 3.8102941 1.1102941 14.1102941 1.9102941 4.5102941 11.9102941 79 80 81 82 83 84 -3.5897059 -2.3897059 7.3102941 16.4102941 9.1102941 -0.1897059 85 86 87 88 89 90 7.9102941 8.5102941 8.6102941 11.3102941 4.2102941 10.9102941 91 92 -0.7897059 -4.4897059 > postscript(file="/var/www/html/freestat/rcomp/tmp/64mfz1229008202.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 = 92 Frequency = 1 lag(myerror, k = 1) myerror 0 1.1958333 NA 1 0.3958333 1.1958333 2 10.2958333 0.3958333 3 -3.5041667 10.2958333 4 -0.3041667 -3.5041667 5 4.4958333 -0.3041667 6 -13.5041667 4.4958333 7 -8.3041667 -13.5041667 8 -0.1041667 -8.3041667 9 6.2958333 -0.1041667 10 1.7958333 6.2958333 11 -6.6041667 1.7958333 12 -2.7041667 -6.6041667 13 -3.4041667 -2.7041667 14 5.2958333 -3.4041667 15 2.4958333 5.2958333 16 1.3958333 2.4958333 17 3.8958333 1.3958333 18 -7.6041667 3.8958333 19 -8.4041667 -7.6041667 20 6.1958333 -8.4041667 21 11.9958333 6.1958333 22 2.4958333 11.9958333 23 -3.8041667 2.4958333 24 -6.6897059 -3.8041667 25 -8.7897059 -6.6897059 26 -2.5897059 -8.7897059 27 -4.6897059 -2.5897059 28 -8.6897059 -4.6897059 29 -3.3897059 -8.6897059 30 -13.0897059 -3.3897059 31 -17.2897059 -13.0897059 32 1.2102941 -17.2897059 33 3.7102941 1.2102941 34 -6.8897059 3.7102941 35 -5.1897059 -6.8897059 36 -9.4897059 -5.1897059 37 -8.9897059 -9.4897059 38 5.6102941 -8.9897059 39 -3.0897059 5.6102941 40 -8.3897059 -3.0897059 41 4.1102941 -8.3897059 42 -10.3897059 4.1102941 43 -9.9897059 -10.3897059 44 7.9102941 -9.9897059 45 4.2102941 7.9102941 46 -0.6897059 4.2102941 47 -0.5897059 -0.6897059 48 -7.0897059 -0.5897059 49 -8.4897059 -7.0897059 50 0.7102941 -8.4897059 51 -4.6897059 0.7102941 52 -7.8897059 -4.6897059 53 7.3102941 -7.8897059 54 -16.8897059 7.3102941 55 -11.7897059 -16.8897059 56 6.7102941 -11.7897059 57 0.5102941 6.7102941 58 4.9102941 0.5102941 59 1.4102941 4.9102941 60 -2.6897059 1.4102941 61 -2.6897059 -2.6897059 62 10.8102941 -2.6897059 63 -3.9897059 10.8102941 64 4.8102941 -3.9897059 65 8.9102941 4.8102941 66 -11.0897059 8.9102941 67 -5.7897059 -11.0897059 68 8.8102941 -5.7897059 69 11.6102941 8.8102941 70 7.7102941 11.6102941 71 0.8102941 7.7102941 72 3.8102941 0.8102941 73 1.1102941 3.8102941 74 14.1102941 1.1102941 75 1.9102941 14.1102941 76 4.5102941 1.9102941 77 11.9102941 4.5102941 78 -3.5897059 11.9102941 79 -2.3897059 -3.5897059 80 7.3102941 -2.3897059 81 16.4102941 7.3102941 82 9.1102941 16.4102941 83 -0.1897059 9.1102941 84 7.9102941 -0.1897059 85 8.5102941 7.9102941 86 8.6102941 8.5102941 87 11.3102941 8.6102941 88 4.2102941 11.3102941 89 10.9102941 4.2102941 90 -0.7897059 10.9102941 91 -4.4897059 -0.7897059 92 NA -4.4897059 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.3958333 1.1958333 [2,] 10.2958333 0.3958333 [3,] -3.5041667 10.2958333 [4,] -0.3041667 -3.5041667 [5,] 4.4958333 -0.3041667 [6,] -13.5041667 4.4958333 [7,] -8.3041667 -13.5041667 [8,] -0.1041667 -8.3041667 [9,] 6.2958333 -0.1041667 [10,] 1.7958333 6.2958333 [11,] -6.6041667 1.7958333 [12,] -2.7041667 -6.6041667 [13,] -3.4041667 -2.7041667 [14,] 5.2958333 -3.4041667 [15,] 2.4958333 5.2958333 [16,] 1.3958333 2.4958333 [17,] 3.8958333 1.3958333 [18,] -7.6041667 3.8958333 [19,] -8.4041667 -7.6041667 [20,] 6.1958333 -8.4041667 [21,] 11.9958333 6.1958333 [22,] 2.4958333 11.9958333 [23,] -3.8041667 2.4958333 [24,] -6.6897059 -3.8041667 [25,] -8.7897059 -6.6897059 [26,] -2.5897059 -8.7897059 [27,] -4.6897059 -2.5897059 [28,] -8.6897059 -4.6897059 [29,] -3.3897059 -8.6897059 [30,] -13.0897059 -3.3897059 [31,] -17.2897059 -13.0897059 [32,] 1.2102941 -17.2897059 [33,] 3.7102941 1.2102941 [34,] -6.8897059 3.7102941 [35,] -5.1897059 -6.8897059 [36,] -9.4897059 -5.1897059 [37,] -8.9897059 -9.4897059 [38,] 5.6102941 -8.9897059 [39,] -3.0897059 5.6102941 [40,] -8.3897059 -3.0897059 [41,] 4.1102941 -8.3897059 [42,] -10.3897059 4.1102941 [43,] -9.9897059 -10.3897059 [44,] 7.9102941 -9.9897059 [45,] 4.2102941 7.9102941 [46,] -0.6897059 4.2102941 [47,] -0.5897059 -0.6897059 [48,] -7.0897059 -0.5897059 [49,] -8.4897059 -7.0897059 [50,] 0.7102941 -8.4897059 [51,] -4.6897059 0.7102941 [52,] -7.8897059 -4.6897059 [53,] 7.3102941 -7.8897059 [54,] -16.8897059 7.3102941 [55,] -11.7897059 -16.8897059 [56,] 6.7102941 -11.7897059 [57,] 0.5102941 6.7102941 [58,] 4.9102941 0.5102941 [59,] 1.4102941 4.9102941 [60,] -2.6897059 1.4102941 [61,] -2.6897059 -2.6897059 [62,] 10.8102941 -2.6897059 [63,] -3.9897059 10.8102941 [64,] 4.8102941 -3.9897059 [65,] 8.9102941 4.8102941 [66,] -11.0897059 8.9102941 [67,] -5.7897059 -11.0897059 [68,] 8.8102941 -5.7897059 [69,] 11.6102941 8.8102941 [70,] 7.7102941 11.6102941 [71,] 0.8102941 7.7102941 [72,] 3.8102941 0.8102941 [73,] 1.1102941 3.8102941 [74,] 14.1102941 1.1102941 [75,] 1.9102941 14.1102941 [76,] 4.5102941 1.9102941 [77,] 11.9102941 4.5102941 [78,] -3.5897059 11.9102941 [79,] -2.3897059 -3.5897059 [80,] 7.3102941 -2.3897059 [81,] 16.4102941 7.3102941 [82,] 9.1102941 16.4102941 [83,] -0.1897059 9.1102941 [84,] 7.9102941 -0.1897059 [85,] 8.5102941 7.9102941 [86,] 8.6102941 8.5102941 [87,] 11.3102941 8.6102941 [88,] 4.2102941 11.3102941 [89,] 10.9102941 4.2102941 [90,] -0.7897059 10.9102941 [91,] -4.4897059 -0.7897059 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.3958333 1.1958333 2 10.2958333 0.3958333 3 -3.5041667 10.2958333 4 -0.3041667 -3.5041667 5 4.4958333 -0.3041667 6 -13.5041667 4.4958333 7 -8.3041667 -13.5041667 8 -0.1041667 -8.3041667 9 6.2958333 -0.1041667 10 1.7958333 6.2958333 11 -6.6041667 1.7958333 12 -2.7041667 -6.6041667 13 -3.4041667 -2.7041667 14 5.2958333 -3.4041667 15 2.4958333 5.2958333 16 1.3958333 2.4958333 17 3.8958333 1.3958333 18 -7.6041667 3.8958333 19 -8.4041667 -7.6041667 20 6.1958333 -8.4041667 21 11.9958333 6.1958333 22 2.4958333 11.9958333 23 -3.8041667 2.4958333 24 -6.6897059 -3.8041667 25 -8.7897059 -6.6897059 26 -2.5897059 -8.7897059 27 -4.6897059 -2.5897059 28 -8.6897059 -4.6897059 29 -3.3897059 -8.6897059 30 -13.0897059 -3.3897059 31 -17.2897059 -13.0897059 32 1.2102941 -17.2897059 33 3.7102941 1.2102941 34 -6.8897059 3.7102941 35 -5.1897059 -6.8897059 36 -9.4897059 -5.1897059 37 -8.9897059 -9.4897059 38 5.6102941 -8.9897059 39 -3.0897059 5.6102941 40 -8.3897059 -3.0897059 41 4.1102941 -8.3897059 42 -10.3897059 4.1102941 43 -9.9897059 -10.3897059 44 7.9102941 -9.9897059 45 4.2102941 7.9102941 46 -0.6897059 4.2102941 47 -0.5897059 -0.6897059 48 -7.0897059 -0.5897059 49 -8.4897059 -7.0897059 50 0.7102941 -8.4897059 51 -4.6897059 0.7102941 52 -7.8897059 -4.6897059 53 7.3102941 -7.8897059 54 -16.8897059 7.3102941 55 -11.7897059 -16.8897059 56 6.7102941 -11.7897059 57 0.5102941 6.7102941 58 4.9102941 0.5102941 59 1.4102941 4.9102941 60 -2.6897059 1.4102941 61 -2.6897059 -2.6897059 62 10.8102941 -2.6897059 63 -3.9897059 10.8102941 64 4.8102941 -3.9897059 65 8.9102941 4.8102941 66 -11.0897059 8.9102941 67 -5.7897059 -11.0897059 68 8.8102941 -5.7897059 69 11.6102941 8.8102941 70 7.7102941 11.6102941 71 0.8102941 7.7102941 72 3.8102941 0.8102941 73 1.1102941 3.8102941 74 14.1102941 1.1102941 75 1.9102941 14.1102941 76 4.5102941 1.9102941 77 11.9102941 4.5102941 78 -3.5897059 11.9102941 79 -2.3897059 -3.5897059 80 7.3102941 -2.3897059 81 16.4102941 7.3102941 82 9.1102941 16.4102941 83 -0.1897059 9.1102941 84 7.9102941 -0.1897059 85 8.5102941 7.9102941 86 8.6102941 8.5102941 87 11.3102941 8.6102941 88 4.2102941 11.3102941 89 10.9102941 4.2102941 90 -0.7897059 10.9102941 91 -4.4897059 -0.7897059 > 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/freestat/rcomp/tmp/7wjg21229008202.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/freestat/rcomp/tmp/85kdp1229008202.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/freestat/rcomp/tmp/9wfje1229008202.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/freestat/rcomp/tmp/10ylqw1229008202.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11mw311229008202.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/freestat/rcomp/tmp/12pl3y1229008202.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/freestat/rcomp/tmp/137wrc1229008202.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/freestat/rcomp/tmp/14d1t11229008202.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/freestat/rcomp/tmp/1588yo1229008202.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/freestat/rcomp/tmp/164v6q1229008202.tab") + } > > system("convert tmp/1md8x1229008201.ps tmp/1md8x1229008201.png") > system("convert tmp/2n1u01229008201.ps tmp/2n1u01229008201.png") > system("convert tmp/33twi1229008202.ps tmp/33twi1229008202.png") > system("convert tmp/4pobd1229008202.ps tmp/4pobd1229008202.png") > system("convert tmp/5k5v71229008202.ps tmp/5k5v71229008202.png") > system("convert tmp/64mfz1229008202.ps tmp/64mfz1229008202.png") > system("convert tmp/7wjg21229008202.ps tmp/7wjg21229008202.png") > system("convert tmp/85kdp1229008202.ps tmp/85kdp1229008202.png") > system("convert tmp/9wfje1229008202.ps tmp/9wfje1229008202.png") > system("convert tmp/10ylqw1229008202.ps tmp/10ylqw1229008202.png") > > > proc.time() user system elapsed 4.111 2.552 4.740