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(103.52,0,103.5,0,103.52,0,103.53,0,103.53,0,103.53,0,103.52,0,103.54,0,103.59,0,103.59,0,103.59,0,103.59,0,103.63,0,103.74,0,103.7,0,103.72,0,103.81,0,103.8,0,104.22,0,106.91,1,107.06,1,107.17,1,107.25,1,107.28,1,107.24,1,107.23,1,107.34,1,107.34,1,107.3,1,107.24,1,107.3,1,107.32,1,107.28,1,107.33,1,107.33,1,107.33,1,107.28,1,107.28,1,107.29,1,107.29,1,107.23,1,107.24,1,107.24,1,107.2,1,107.23,1,107.2,1,107.21,1,107.24,1,107.21,1,113.89,1,114.05,1,114.05,1,114.05,1,114.05,1,115.12,1,115.68,1,116.05,1,116.18,1,116.35,1,116.44,1,117,1,117.61,1,118.17,1,118.33,1,118.33,1,118.42,1,118.5,1,118.67,1,119.09,1,119.14,1,119.23,1,119.33,1),dim=c(2,72),dimnames=list(c('Y','X'),1:72)) > y <- array(NA,dim=c(2,72),dimnames=list(c('Y','X'),1:72)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 103.52 0 1 0 0 0 0 0 0 0 0 0 0 1 2 103.50 0 0 1 0 0 0 0 0 0 0 0 0 2 3 103.52 0 0 0 1 0 0 0 0 0 0 0 0 3 4 103.53 0 0 0 0 1 0 0 0 0 0 0 0 4 5 103.53 0 0 0 0 0 1 0 0 0 0 0 0 5 6 103.53 0 0 0 0 0 0 1 0 0 0 0 0 6 7 103.52 0 0 0 0 0 0 0 1 0 0 0 0 7 8 103.54 0 0 0 0 0 0 0 0 1 0 0 0 8 9 103.59 0 0 0 0 0 0 0 0 0 1 0 0 9 10 103.59 0 0 0 0 0 0 0 0 0 0 1 0 10 11 103.59 0 0 0 0 0 0 0 0 0 0 0 1 11 12 103.59 0 0 0 0 0 0 0 0 0 0 0 0 12 13 103.63 0 1 0 0 0 0 0 0 0 0 0 0 13 14 103.74 0 0 1 0 0 0 0 0 0 0 0 0 14 15 103.70 0 0 0 1 0 0 0 0 0 0 0 0 15 16 103.72 0 0 0 0 1 0 0 0 0 0 0 0 16 17 103.81 0 0 0 0 0 1 0 0 0 0 0 0 17 18 103.80 0 0 0 0 0 0 1 0 0 0 0 0 18 19 104.22 0 0 0 0 0 0 0 1 0 0 0 0 19 20 106.91 1 0 0 0 0 0 0 0 1 0 0 0 20 21 107.06 1 0 0 0 0 0 0 0 0 1 0 0 21 22 107.17 1 0 0 0 0 0 0 0 0 0 1 0 22 23 107.25 1 0 0 0 0 0 0 0 0 0 0 1 23 24 107.28 1 0 0 0 0 0 0 0 0 0 0 0 24 25 107.24 1 1 0 0 0 0 0 0 0 0 0 0 25 26 107.23 1 0 1 0 0 0 0 0 0 0 0 0 26 27 107.34 1 0 0 1 0 0 0 0 0 0 0 0 27 28 107.34 1 0 0 0 1 0 0 0 0 0 0 0 28 29 107.30 1 0 0 0 0 1 0 0 0 0 0 0 29 30 107.24 1 0 0 0 0 0 1 0 0 0 0 0 30 31 107.30 1 0 0 0 0 0 0 1 0 0 0 0 31 32 107.32 1 0 0 0 0 0 0 0 1 0 0 0 32 33 107.28 1 0 0 0 0 0 0 0 0 1 0 0 33 34 107.33 1 0 0 0 0 0 0 0 0 0 1 0 34 35 107.33 1 0 0 0 0 0 0 0 0 0 0 1 35 36 107.33 1 0 0 0 0 0 0 0 0 0 0 0 36 37 107.28 1 1 0 0 0 0 0 0 0 0 0 0 37 38 107.28 1 0 1 0 0 0 0 0 0 0 0 0 38 39 107.29 1 0 0 1 0 0 0 0 0 0 0 0 39 40 107.29 1 0 0 0 1 0 0 0 0 0 0 0 40 41 107.23 1 0 0 0 0 1 0 0 0 0 0 0 41 42 107.24 1 0 0 0 0 0 1 0 0 0 0 0 42 43 107.24 1 0 0 0 0 0 0 1 0 0 0 0 43 44 107.20 1 0 0 0 0 0 0 0 1 0 0 0 44 45 107.23 1 0 0 0 0 0 0 0 0 1 0 0 45 46 107.20 1 0 0 0 0 0 0 0 0 0 1 0 46 47 107.21 1 0 0 0 0 0 0 0 0 0 0 1 47 48 107.24 1 0 0 0 0 0 0 0 0 0 0 0 48 49 107.21 1 1 0 0 0 0 0 0 0 0 0 0 49 50 113.89 1 0 1 0 0 0 0 0 0 0 0 0 50 51 114.05 1 0 0 1 0 0 0 0 0 0 0 0 51 52 114.05 1 0 0 0 1 0 0 0 0 0 0 0 52 53 114.05 1 0 0 0 0 1 0 0 0 0 0 0 53 54 114.05 1 0 0 0 0 0 1 0 0 0 0 0 54 55 115.12 1 0 0 0 0 0 0 1 0 0 0 0 55 56 115.68 1 0 0 0 0 0 0 0 1 0 0 0 56 57 116.05 1 0 0 0 0 0 0 0 0 1 0 0 57 58 116.18 1 0 0 0 0 0 0 0 0 0 1 0 58 59 116.35 1 0 0 0 0 0 0 0 0 0 0 1 59 60 116.44 1 0 0 0 0 0 0 0 0 0 0 0 60 61 117.00 1 1 0 0 0 0 0 0 0 0 0 0 61 62 117.61 1 0 1 0 0 0 0 0 0 0 0 0 62 63 118.17 1 0 0 1 0 0 0 0 0 0 0 0 63 64 118.33 1 0 0 0 1 0 0 0 0 0 0 0 64 65 118.33 1 0 0 0 0 1 0 0 0 0 0 0 65 66 118.42 1 0 0 0 0 0 1 0 0 0 0 0 66 67 118.50 1 0 0 0 0 0 0 1 0 0 0 0 67 68 118.67 1 0 0 0 0 0 0 0 1 0 0 0 68 69 119.09 1 0 0 0 0 0 0 0 0 1 0 0 69 70 119.14 1 0 0 0 0 0 0 0 0 0 1 0 70 71 119.23 1 0 0 0 0 0 0 0 0 0 0 1 71 72 119.33 1 0 0 0 0 0 0 0 0 0 0 0 72 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 100.3352 -2.3271 0.1491 1.0964 0.9519 0.7025 M5 M6 M7 M8 M9 M10 0.4198 0.1437 0.1326 0.8094 0.6916 0.4622 M11 t 0.2394 0.2811 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -4.7206 -1.3552 0.7278 1.3938 2.7546 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 100.33520 1.03062 97.355 <2e-16 *** X -2.32705 0.90212 -2.580 0.0124 * M1 0.14912 1.24979 0.119 0.9054 M2 1.09637 1.24848 0.878 0.3835 M3 0.95195 1.24746 0.763 0.4485 M4 0.70252 1.24673 0.563 0.5753 M5 0.41977 1.24629 0.337 0.7375 M6 0.14368 1.24615 0.115 0.9086 M7 0.13260 1.24629 0.106 0.9156 M8 0.80935 1.24466 0.650 0.5181 M9 0.69160 1.24363 0.556 0.5803 M10 0.46218 1.24290 0.372 0.7114 M11 0.23942 1.24247 0.193 0.8479 t 0.28109 0.01906 14.747 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.152 on 58 degrees of freedom Multiple R-squared: 0.8741, Adjusted R-squared: 0.8459 F-statistic: 30.97 on 13 and 58 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 1.549551e-05 3.099102e-05 9.999845e-01 [2,] 4.276739e-07 8.553477e-07 9.999996e-01 [3,] 2.943408e-06 5.886817e-06 9.999971e-01 [4,] 1.789544e-07 3.579087e-07 9.999998e-01 [5,] 1.157896e-08 2.315791e-08 1.000000e+00 [6,] 9.598692e-10 1.919738e-09 1.000000e+00 [7,] 1.042059e-10 2.084119e-10 1.000000e+00 [8,] 1.286381e-11 2.572761e-11 1.000000e+00 [9,] 1.312427e-12 2.624854e-12 1.000000e+00 [10,] 9.787482e-14 1.957496e-13 1.000000e+00 [11,] 7.033015e-15 1.406603e-14 1.000000e+00 [12,] 5.002421e-16 1.000484e-15 1.000000e+00 [13,] 4.053958e-17 8.107916e-17 1.000000e+00 [14,] 4.525018e-18 9.050036e-18 1.000000e+00 [15,] 1.909040e-18 3.818081e-18 1.000000e+00 [16,] 2.199609e-19 4.399218e-19 1.000000e+00 [17,] 2.765678e-20 5.531357e-20 1.000000e+00 [18,] 4.575964e-21 9.151929e-21 1.000000e+00 [19,] 1.338917e-21 2.677835e-21 1.000000e+00 [20,] 8.239918e-22 1.647984e-21 1.000000e+00 [21,] 9.596463e-22 1.919293e-21 1.000000e+00 [22,] 1.658645e-22 3.317290e-22 1.000000e+00 [23,] 2.703040e-23 5.406079e-23 1.000000e+00 [24,] 3.907073e-24 7.814146e-24 1.000000e+00 [25,] 1.065470e-24 2.130940e-24 1.000000e+00 [26,] 1.539726e-25 3.079453e-25 1.000000e+00 [27,] 1.433117e-25 2.866233e-25 1.000000e+00 [28,] 2.061712e-26 4.123424e-26 1.000000e+00 [29,] 5.379407e-27 1.075881e-26 1.000000e+00 [30,] 4.792894e-27 9.585787e-27 1.000000e+00 [31,] 1.934967e-26 3.869935e-26 1.000000e+00 [32,] 3.331309e-24 6.662619e-24 1.000000e+00 [33,] 1.993617e-09 3.987234e-09 1.000000e+00 [34,] 9.686142e-01 6.277170e-02 3.138585e-02 [35,] 9.915089e-01 1.698216e-02 8.491079e-03 [36,] 9.949997e-01 1.000062e-02 5.000308e-03 [37,] 9.965051e-01 6.989834e-03 3.494917e-03 [38,] 9.998838e-01 2.323197e-04 1.161599e-04 [39,] 9.999604e-01 7.912178e-05 3.956089e-05 > postscript(file="/var/www/html/rcomp/tmp/1h0kf1259058875.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/2hkoe1259058875.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/39i1v1259058875.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/4y3kc1259058875.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/5ce0m1259058875.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 = 72 Frequency = 1 1 2 3 4 5 6 2.75459127 1.50625793 1.38959127 1.36792460 1.36959127 1.36459127 7 8 9 10 11 12 1.08459127 0.14674897 0.03341564 -0.01825103 -0.07658436 -0.11825103 13 14 15 16 17 18 -0.50845958 -1.62679291 -1.80345958 -1.81512625 -1.72345958 -1.73845958 19 20 21 22 23 24 -1.58845958 2.47075190 2.45741857 2.51575190 2.53741857 2.52575190 25 26 27 28 29 30 2.05554335 0.81721002 0.79054335 0.75887668 0.72054335 0.65554335 31 32 33 34 35 36 0.44554335 -0.49229895 -0.69563228 -0.69729895 -0.75563228 -0.79729895 37 38 39 40 41 42 -1.27750750 -2.50584083 -2.63250750 -2.66417416 -2.72250750 -2.71750750 43 44 45 46 47 48 -2.98750750 -3.98534979 -4.11868313 -4.20034979 -4.24868313 -4.26034979 49 50 51 52 53 54 -4.72055835 0.73110832 0.75444165 0.72277499 0.72444165 0.71944165 55 56 57 58 59 60 1.51944165 1.12159936 1.32826602 1.40659936 1.51826602 1.56659936 61 62 63 64 65 66 1.69639081 1.07805747 1.50139081 1.62972414 1.63139081 1.71639081 67 68 69 70 71 72 1.52639081 0.73854851 0.99521518 0.99354851 1.02521518 1.08354851 > postscript(file="/var/www/html/rcomp/tmp/6e3ke1259058875.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 = 72 Frequency = 1 lag(myerror, k = 1) myerror 0 2.75459127 NA 1 1.50625793 2.75459127 2 1.38959127 1.50625793 3 1.36792460 1.38959127 4 1.36959127 1.36792460 5 1.36459127 1.36959127 6 1.08459127 1.36459127 7 0.14674897 1.08459127 8 0.03341564 0.14674897 9 -0.01825103 0.03341564 10 -0.07658436 -0.01825103 11 -0.11825103 -0.07658436 12 -0.50845958 -0.11825103 13 -1.62679291 -0.50845958 14 -1.80345958 -1.62679291 15 -1.81512625 -1.80345958 16 -1.72345958 -1.81512625 17 -1.73845958 -1.72345958 18 -1.58845958 -1.73845958 19 2.47075190 -1.58845958 20 2.45741857 2.47075190 21 2.51575190 2.45741857 22 2.53741857 2.51575190 23 2.52575190 2.53741857 24 2.05554335 2.52575190 25 0.81721002 2.05554335 26 0.79054335 0.81721002 27 0.75887668 0.79054335 28 0.72054335 0.75887668 29 0.65554335 0.72054335 30 0.44554335 0.65554335 31 -0.49229895 0.44554335 32 -0.69563228 -0.49229895 33 -0.69729895 -0.69563228 34 -0.75563228 -0.69729895 35 -0.79729895 -0.75563228 36 -1.27750750 -0.79729895 37 -2.50584083 -1.27750750 38 -2.63250750 -2.50584083 39 -2.66417416 -2.63250750 40 -2.72250750 -2.66417416 41 -2.71750750 -2.72250750 42 -2.98750750 -2.71750750 43 -3.98534979 -2.98750750 44 -4.11868313 -3.98534979 45 -4.20034979 -4.11868313 46 -4.24868313 -4.20034979 47 -4.26034979 -4.24868313 48 -4.72055835 -4.26034979 49 0.73110832 -4.72055835 50 0.75444165 0.73110832 51 0.72277499 0.75444165 52 0.72444165 0.72277499 53 0.71944165 0.72444165 54 1.51944165 0.71944165 55 1.12159936 1.51944165 56 1.32826602 1.12159936 57 1.40659936 1.32826602 58 1.51826602 1.40659936 59 1.56659936 1.51826602 60 1.69639081 1.56659936 61 1.07805747 1.69639081 62 1.50139081 1.07805747 63 1.62972414 1.50139081 64 1.63139081 1.62972414 65 1.71639081 1.63139081 66 1.52639081 1.71639081 67 0.73854851 1.52639081 68 0.99521518 0.73854851 69 0.99354851 0.99521518 70 1.02521518 0.99354851 71 1.08354851 1.02521518 72 NA 1.08354851 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.50625793 2.75459127 [2,] 1.38959127 1.50625793 [3,] 1.36792460 1.38959127 [4,] 1.36959127 1.36792460 [5,] 1.36459127 1.36959127 [6,] 1.08459127 1.36459127 [7,] 0.14674897 1.08459127 [8,] 0.03341564 0.14674897 [9,] -0.01825103 0.03341564 [10,] -0.07658436 -0.01825103 [11,] -0.11825103 -0.07658436 [12,] -0.50845958 -0.11825103 [13,] -1.62679291 -0.50845958 [14,] -1.80345958 -1.62679291 [15,] -1.81512625 -1.80345958 [16,] -1.72345958 -1.81512625 [17,] -1.73845958 -1.72345958 [18,] -1.58845958 -1.73845958 [19,] 2.47075190 -1.58845958 [20,] 2.45741857 2.47075190 [21,] 2.51575190 2.45741857 [22,] 2.53741857 2.51575190 [23,] 2.52575190 2.53741857 [24,] 2.05554335 2.52575190 [25,] 0.81721002 2.05554335 [26,] 0.79054335 0.81721002 [27,] 0.75887668 0.79054335 [28,] 0.72054335 0.75887668 [29,] 0.65554335 0.72054335 [30,] 0.44554335 0.65554335 [31,] -0.49229895 0.44554335 [32,] -0.69563228 -0.49229895 [33,] -0.69729895 -0.69563228 [34,] -0.75563228 -0.69729895 [35,] -0.79729895 -0.75563228 [36,] -1.27750750 -0.79729895 [37,] -2.50584083 -1.27750750 [38,] -2.63250750 -2.50584083 [39,] -2.66417416 -2.63250750 [40,] -2.72250750 -2.66417416 [41,] -2.71750750 -2.72250750 [42,] -2.98750750 -2.71750750 [43,] -3.98534979 -2.98750750 [44,] -4.11868313 -3.98534979 [45,] -4.20034979 -4.11868313 [46,] -4.24868313 -4.20034979 [47,] -4.26034979 -4.24868313 [48,] -4.72055835 -4.26034979 [49,] 0.73110832 -4.72055835 [50,] 0.75444165 0.73110832 [51,] 0.72277499 0.75444165 [52,] 0.72444165 0.72277499 [53,] 0.71944165 0.72444165 [54,] 1.51944165 0.71944165 [55,] 1.12159936 1.51944165 [56,] 1.32826602 1.12159936 [57,] 1.40659936 1.32826602 [58,] 1.51826602 1.40659936 [59,] 1.56659936 1.51826602 [60,] 1.69639081 1.56659936 [61,] 1.07805747 1.69639081 [62,] 1.50139081 1.07805747 [63,] 1.62972414 1.50139081 [64,] 1.63139081 1.62972414 [65,] 1.71639081 1.63139081 [66,] 1.52639081 1.71639081 [67,] 0.73854851 1.52639081 [68,] 0.99521518 0.73854851 [69,] 0.99354851 0.99521518 [70,] 1.02521518 0.99354851 [71,] 1.08354851 1.02521518 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.50625793 2.75459127 2 1.38959127 1.50625793 3 1.36792460 1.38959127 4 1.36959127 1.36792460 5 1.36459127 1.36959127 6 1.08459127 1.36459127 7 0.14674897 1.08459127 8 0.03341564 0.14674897 9 -0.01825103 0.03341564 10 -0.07658436 -0.01825103 11 -0.11825103 -0.07658436 12 -0.50845958 -0.11825103 13 -1.62679291 -0.50845958 14 -1.80345958 -1.62679291 15 -1.81512625 -1.80345958 16 -1.72345958 -1.81512625 17 -1.73845958 -1.72345958 18 -1.58845958 -1.73845958 19 2.47075190 -1.58845958 20 2.45741857 2.47075190 21 2.51575190 2.45741857 22 2.53741857 2.51575190 23 2.52575190 2.53741857 24 2.05554335 2.52575190 25 0.81721002 2.05554335 26 0.79054335 0.81721002 27 0.75887668 0.79054335 28 0.72054335 0.75887668 29 0.65554335 0.72054335 30 0.44554335 0.65554335 31 -0.49229895 0.44554335 32 -0.69563228 -0.49229895 33 -0.69729895 -0.69563228 34 -0.75563228 -0.69729895 35 -0.79729895 -0.75563228 36 -1.27750750 -0.79729895 37 -2.50584083 -1.27750750 38 -2.63250750 -2.50584083 39 -2.66417416 -2.63250750 40 -2.72250750 -2.66417416 41 -2.71750750 -2.72250750 42 -2.98750750 -2.71750750 43 -3.98534979 -2.98750750 44 -4.11868313 -3.98534979 45 -4.20034979 -4.11868313 46 -4.24868313 -4.20034979 47 -4.26034979 -4.24868313 48 -4.72055835 -4.26034979 49 0.73110832 -4.72055835 50 0.75444165 0.73110832 51 0.72277499 0.75444165 52 0.72444165 0.72277499 53 0.71944165 0.72444165 54 1.51944165 0.71944165 55 1.12159936 1.51944165 56 1.32826602 1.12159936 57 1.40659936 1.32826602 58 1.51826602 1.40659936 59 1.56659936 1.51826602 60 1.69639081 1.56659936 61 1.07805747 1.69639081 62 1.50139081 1.07805747 63 1.62972414 1.50139081 64 1.63139081 1.62972414 65 1.71639081 1.63139081 66 1.52639081 1.71639081 67 0.73854851 1.52639081 68 0.99521518 0.73854851 69 0.99354851 0.99521518 70 1.02521518 0.99354851 71 1.08354851 1.02521518 > 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/7hx9c1259058875.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/8jsoy1259058875.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/9ldbc1259058875.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/108gyf1259058875.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/11anqr1259058875.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/12oull1259058875.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/13bsqm1259058876.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/14n8b61259058876.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/15ghvf1259058876.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/16ib3h1259058876.tab") + } > > system("convert tmp/1h0kf1259058875.ps tmp/1h0kf1259058875.png") > system("convert tmp/2hkoe1259058875.ps tmp/2hkoe1259058875.png") > system("convert tmp/39i1v1259058875.ps tmp/39i1v1259058875.png") > system("convert tmp/4y3kc1259058875.ps tmp/4y3kc1259058875.png") > system("convert tmp/5ce0m1259058875.ps tmp/5ce0m1259058875.png") > system("convert tmp/6e3ke1259058875.ps tmp/6e3ke1259058875.png") > system("convert tmp/7hx9c1259058875.ps tmp/7hx9c1259058875.png") > system("convert tmp/8jsoy1259058875.ps tmp/8jsoy1259058875.png") > system("convert tmp/9ldbc1259058875.ps tmp/9ldbc1259058875.png") > system("convert tmp/108gyf1259058875.ps tmp/108gyf1259058875.png") > > > proc.time() user system elapsed 2.488 1.572 3.625