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(0.89,0,0.89,0,0.89,0,0.89,0,0.89,0,0.89,0,0.89,0,0.9,0,0.91,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,0.92,0,1.01,1,1.01,1,1.01,1,1.01,1,1.01,1,1.04,1,1.05,1,1.05,1,1.06,1,1.06,1,1.06,1,1.06,1,1.08,1,1.08,1,1.08,1,1.08,1,1.08,1,1.08,1,1.09,1,1.09,1,1.1,1,1.1,1,1.1,1),dim=c(2,61),dimnames=list(c('y','x'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('y','x'),1:61)) > 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 0.89 0 1 0 0 0 0 0 0 0 0 0 0 1 2 0.89 0 0 1 0 0 0 0 0 0 0 0 0 2 3 0.89 0 0 0 1 0 0 0 0 0 0 0 0 3 4 0.89 0 0 0 0 1 0 0 0 0 0 0 0 4 5 0.89 0 0 0 0 0 1 0 0 0 0 0 0 5 6 0.89 0 0 0 0 0 0 1 0 0 0 0 0 6 7 0.89 0 0 0 0 0 0 0 1 0 0 0 0 7 8 0.90 0 0 0 0 0 0 0 0 1 0 0 0 8 9 0.91 0 0 0 0 0 0 0 0 0 1 0 0 9 10 0.92 0 0 0 0 0 0 0 0 0 0 1 0 10 11 0.92 0 0 0 0 0 0 0 0 0 0 0 1 11 12 0.92 0 0 0 0 0 0 0 0 0 0 0 0 12 13 0.92 0 1 0 0 0 0 0 0 0 0 0 0 13 14 0.92 0 0 1 0 0 0 0 0 0 0 0 0 14 15 0.92 0 0 0 1 0 0 0 0 0 0 0 0 15 16 0.92 0 0 0 0 1 0 0 0 0 0 0 0 16 17 0.92 0 0 0 0 0 1 0 0 0 0 0 0 17 18 0.92 0 0 0 0 0 0 1 0 0 0 0 0 18 19 0.92 0 0 0 0 0 0 0 1 0 0 0 0 19 20 0.92 0 0 0 0 0 0 0 0 1 0 0 0 20 21 0.92 0 0 0 0 0 0 0 0 0 1 0 0 21 22 0.92 0 0 0 0 0 0 0 0 0 0 1 0 22 23 0.92 0 0 0 0 0 0 0 0 0 0 0 1 23 24 0.92 0 0 0 0 0 0 0 0 0 0 0 0 24 25 0.92 0 1 0 0 0 0 0 0 0 0 0 0 25 26 0.92 0 0 1 0 0 0 0 0 0 0 0 0 26 27 0.92 0 0 0 1 0 0 0 0 0 0 0 0 27 28 0.92 0 0 0 0 1 0 0 0 0 0 0 0 28 29 0.92 0 0 0 0 0 1 0 0 0 0 0 0 29 30 0.92 0 0 0 0 0 0 1 0 0 0 0 0 30 31 0.92 0 0 0 0 0 0 0 1 0 0 0 0 31 32 0.92 0 0 0 0 0 0 0 0 1 0 0 0 32 33 0.92 0 0 0 0 0 0 0 0 0 1 0 0 33 34 0.92 0 0 0 0 0 0 0 0 0 0 1 0 34 35 0.92 0 0 0 0 0 0 0 0 0 0 0 1 35 36 0.92 0 0 0 0 0 0 0 0 0 0 0 0 36 37 0.92 0 1 0 0 0 0 0 0 0 0 0 0 37 38 0.92 0 0 1 0 0 0 0 0 0 0 0 0 38 39 1.01 1 0 0 1 0 0 0 0 0 0 0 0 39 40 1.01 1 0 0 0 1 0 0 0 0 0 0 0 40 41 1.01 1 0 0 0 0 1 0 0 0 0 0 0 41 42 1.01 1 0 0 0 0 0 1 0 0 0 0 0 42 43 1.01 1 0 0 0 0 0 0 1 0 0 0 0 43 44 1.04 1 0 0 0 0 0 0 0 1 0 0 0 44 45 1.05 1 0 0 0 0 0 0 0 0 1 0 0 45 46 1.05 1 0 0 0 0 0 0 0 0 0 1 0 46 47 1.06 1 0 0 0 0 0 0 0 0 0 0 1 47 48 1.06 1 0 0 0 0 0 0 0 0 0 0 0 48 49 1.06 1 1 0 0 0 0 0 0 0 0 0 0 49 50 1.06 1 0 1 0 0 0 0 0 0 0 0 0 50 51 1.08 1 0 0 1 0 0 0 0 0 0 0 0 51 52 1.08 1 0 0 0 1 0 0 0 0 0 0 0 52 53 1.08 1 0 0 0 0 1 0 0 0 0 0 0 53 54 1.08 1 0 0 0 0 0 1 0 0 0 0 0 54 55 1.08 1 0 0 0 0 0 0 1 0 0 0 0 55 56 1.08 1 0 0 0 0 0 0 0 1 0 0 0 56 57 1.09 1 0 0 0 0 0 0 0 0 1 0 0 57 58 1.09 1 0 0 0 0 0 0 0 0 0 1 0 58 59 1.10 1 0 0 0 0 0 0 0 0 0 0 1 59 60 1.10 1 0 0 0 0 0 0 0 0 0 0 0 60 61 1.10 1 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x M1 M2 M3 M4 0.893237 0.105662 -0.001887 -0.007396 -0.007875 -0.009223 M5 M6 M7 M8 M9 M10 -0.010570 -0.011917 -0.013264 -0.006611 -0.001958 -0.001306 M11 t 0.001347 0.001347 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.0335632 -0.0055692 0.0005968 0.0144308 0.0208103 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.8932372 0.0098700 90.501 < 2e-16 *** x 0.1056621 0.0087454 12.082 5.09e-16 *** M1 -0.0018867 0.0105785 -0.178 0.859 M2 -0.0073959 0.0110977 -0.666 0.508 M3 -0.0078755 0.0112329 -0.701 0.487 M4 -0.0092227 0.0111883 -0.824 0.414 M5 -0.0105698 0.0111488 -0.948 0.348 M6 -0.0119170 0.0111144 -1.072 0.289 M7 -0.0132642 0.0110852 -1.197 0.237 M8 -0.0066113 0.0110613 -0.598 0.553 M9 -0.0019585 0.0110427 -0.177 0.860 M10 -0.0013057 0.0110293 -0.118 0.906 M11 0.0013472 0.0110213 0.122 0.903 t 0.0013472 0.0002426 5.552 1.27e-06 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.01742 on 47 degrees of freedom Multiple R-squared: 0.9575, Adjusted R-squared: 0.9458 F-statistic: 81.52 on 13 and 47 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.326611e-42 2.653221e-42 1.000000e+00 [2,] 2.629753e-55 5.259505e-55 1.000000e+00 [3,] 2.263400e-72 4.526801e-72 1.000000e+00 [4,] 9.936476e-05 1.987295e-04 9.999006e-01 [5,] 2.781471e-03 5.562941e-03 9.972185e-01 [6,] 2.770105e-02 5.540210e-02 9.722990e-01 [7,] 5.980414e-02 1.196083e-01 9.401959e-01 [8,] 9.752153e-02 1.950431e-01 9.024785e-01 [9,] 1.377518e-01 2.755035e-01 8.622482e-01 [10,] 2.231813e-01 4.463626e-01 7.768187e-01 [11,] 2.075338e-01 4.150677e-01 7.924662e-01 [12,] 1.992069e-01 3.984137e-01 8.007931e-01 [13,] 2.064851e-01 4.129703e-01 7.935149e-01 [14,] 2.464254e-01 4.928507e-01 7.535746e-01 [15,] 3.713288e-01 7.426577e-01 6.286712e-01 [16,] 4.017709e-01 8.035418e-01 5.982291e-01 [17,] 3.956303e-01 7.912607e-01 6.043697e-01 [18,] 4.329484e-01 8.658967e-01 5.670516e-01 [19,] 4.065093e-01 8.130186e-01 5.934907e-01 [20,] 3.649877e-01 7.299755e-01 6.350123e-01 [21,] 2.960545e-01 5.921091e-01 7.039455e-01 [22,] 2.218448e-01 4.436897e-01 7.781552e-01 [23,] 2.079860e-01 4.159719e-01 7.920140e-01 [24,] 2.166962e-01 4.333924e-01 7.833038e-01 [25,] 2.709078e-01 5.418156e-01 7.290922e-01 [26,] 4.596233e-01 9.192466e-01 5.403767e-01 [27,] 1.000000e+00 6.769592e-54 3.384796e-54 [28,] 1.000000e+00 3.577547e-40 1.788773e-40 > postscript(file="/var/www/html/rcomp/tmp/16xv51229681757.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/2u28m1229681757.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/3mo031229681757.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/4yvzd1229681757.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/52c6u1229681757.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 = 61 Frequency = 1 1 2 3 4 5 6 -0.002697628 0.001464427 0.000596838 0.000596838 0.000596838 0.000596838 7 8 9 10 11 12 0.000596838 0.002596838 0.006596838 0.014596838 0.010596838 0.010596838 13 14 15 16 17 18 0.011136364 0.015298419 0.014430830 0.014430830 0.014430830 0.014430830 19 20 21 22 23 24 0.014430830 0.006430830 0.000430830 -0.001569170 -0.005569170 -0.005569170 25 26 27 28 29 30 -0.005029644 -0.000867589 -0.001735178 -0.001735178 -0.001735178 -0.001735178 31 32 33 34 35 36 -0.001735178 -0.009735178 -0.015735178 -0.017735178 -0.021735178 -0.021735178 37 38 39 40 41 42 -0.021195652 -0.017033597 -0.033563241 -0.033563241 -0.033563241 -0.033563241 43 44 45 46 47 48 -0.033563241 -0.011563241 -0.007563241 -0.009563241 -0.003563241 -0.003563241 49 50 51 52 53 54 -0.003023715 0.001138340 0.020270751 0.020270751 0.020270751 0.020270751 55 56 57 58 59 60 0.020270751 0.012270751 0.016270751 0.014270751 0.020270751 0.020270751 61 0.020810277 > postscript(file="/var/www/html/rcomp/tmp/63okk1229681757.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.002697628 NA 1 0.001464427 -0.002697628 2 0.000596838 0.001464427 3 0.000596838 0.000596838 4 0.000596838 0.000596838 5 0.000596838 0.000596838 6 0.000596838 0.000596838 7 0.002596838 0.000596838 8 0.006596838 0.002596838 9 0.014596838 0.006596838 10 0.010596838 0.014596838 11 0.010596838 0.010596838 12 0.011136364 0.010596838 13 0.015298419 0.011136364 14 0.014430830 0.015298419 15 0.014430830 0.014430830 16 0.014430830 0.014430830 17 0.014430830 0.014430830 18 0.014430830 0.014430830 19 0.006430830 0.014430830 20 0.000430830 0.006430830 21 -0.001569170 0.000430830 22 -0.005569170 -0.001569170 23 -0.005569170 -0.005569170 24 -0.005029644 -0.005569170 25 -0.000867589 -0.005029644 26 -0.001735178 -0.000867589 27 -0.001735178 -0.001735178 28 -0.001735178 -0.001735178 29 -0.001735178 -0.001735178 30 -0.001735178 -0.001735178 31 -0.009735178 -0.001735178 32 -0.015735178 -0.009735178 33 -0.017735178 -0.015735178 34 -0.021735178 -0.017735178 35 -0.021735178 -0.021735178 36 -0.021195652 -0.021735178 37 -0.017033597 -0.021195652 38 -0.033563241 -0.017033597 39 -0.033563241 -0.033563241 40 -0.033563241 -0.033563241 41 -0.033563241 -0.033563241 42 -0.033563241 -0.033563241 43 -0.011563241 -0.033563241 44 -0.007563241 -0.011563241 45 -0.009563241 -0.007563241 46 -0.003563241 -0.009563241 47 -0.003563241 -0.003563241 48 -0.003023715 -0.003563241 49 0.001138340 -0.003023715 50 0.020270751 0.001138340 51 0.020270751 0.020270751 52 0.020270751 0.020270751 53 0.020270751 0.020270751 54 0.020270751 0.020270751 55 0.012270751 0.020270751 56 0.016270751 0.012270751 57 0.014270751 0.016270751 58 0.020270751 0.014270751 59 0.020270751 0.020270751 60 0.020810277 0.020270751 61 NA 0.020810277 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.001464427 -0.002697628 [2,] 0.000596838 0.001464427 [3,] 0.000596838 0.000596838 [4,] 0.000596838 0.000596838 [5,] 0.000596838 0.000596838 [6,] 0.000596838 0.000596838 [7,] 0.002596838 0.000596838 [8,] 0.006596838 0.002596838 [9,] 0.014596838 0.006596838 [10,] 0.010596838 0.014596838 [11,] 0.010596838 0.010596838 [12,] 0.011136364 0.010596838 [13,] 0.015298419 0.011136364 [14,] 0.014430830 0.015298419 [15,] 0.014430830 0.014430830 [16,] 0.014430830 0.014430830 [17,] 0.014430830 0.014430830 [18,] 0.014430830 0.014430830 [19,] 0.006430830 0.014430830 [20,] 0.000430830 0.006430830 [21,] -0.001569170 0.000430830 [22,] -0.005569170 -0.001569170 [23,] -0.005569170 -0.005569170 [24,] -0.005029644 -0.005569170 [25,] -0.000867589 -0.005029644 [26,] -0.001735178 -0.000867589 [27,] -0.001735178 -0.001735178 [28,] -0.001735178 -0.001735178 [29,] -0.001735178 -0.001735178 [30,] -0.001735178 -0.001735178 [31,] -0.009735178 -0.001735178 [32,] -0.015735178 -0.009735178 [33,] -0.017735178 -0.015735178 [34,] -0.021735178 -0.017735178 [35,] -0.021735178 -0.021735178 [36,] -0.021195652 -0.021735178 [37,] -0.017033597 -0.021195652 [38,] -0.033563241 -0.017033597 [39,] -0.033563241 -0.033563241 [40,] -0.033563241 -0.033563241 [41,] -0.033563241 -0.033563241 [42,] -0.033563241 -0.033563241 [43,] -0.011563241 -0.033563241 [44,] -0.007563241 -0.011563241 [45,] -0.009563241 -0.007563241 [46,] -0.003563241 -0.009563241 [47,] -0.003563241 -0.003563241 [48,] -0.003023715 -0.003563241 [49,] 0.001138340 -0.003023715 [50,] 0.020270751 0.001138340 [51,] 0.020270751 0.020270751 [52,] 0.020270751 0.020270751 [53,] 0.020270751 0.020270751 [54,] 0.020270751 0.020270751 [55,] 0.012270751 0.020270751 [56,] 0.016270751 0.012270751 [57,] 0.014270751 0.016270751 [58,] 0.020270751 0.014270751 [59,] 0.020270751 0.020270751 [60,] 0.020810277 0.020270751 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.001464427 -0.002697628 2 0.000596838 0.001464427 3 0.000596838 0.000596838 4 0.000596838 0.000596838 5 0.000596838 0.000596838 6 0.000596838 0.000596838 7 0.002596838 0.000596838 8 0.006596838 0.002596838 9 0.014596838 0.006596838 10 0.010596838 0.014596838 11 0.010596838 0.010596838 12 0.011136364 0.010596838 13 0.015298419 0.011136364 14 0.014430830 0.015298419 15 0.014430830 0.014430830 16 0.014430830 0.014430830 17 0.014430830 0.014430830 18 0.014430830 0.014430830 19 0.006430830 0.014430830 20 0.000430830 0.006430830 21 -0.001569170 0.000430830 22 -0.005569170 -0.001569170 23 -0.005569170 -0.005569170 24 -0.005029644 -0.005569170 25 -0.000867589 -0.005029644 26 -0.001735178 -0.000867589 27 -0.001735178 -0.001735178 28 -0.001735178 -0.001735178 29 -0.001735178 -0.001735178 30 -0.001735178 -0.001735178 31 -0.009735178 -0.001735178 32 -0.015735178 -0.009735178 33 -0.017735178 -0.015735178 34 -0.021735178 -0.017735178 35 -0.021735178 -0.021735178 36 -0.021195652 -0.021735178 37 -0.017033597 -0.021195652 38 -0.033563241 -0.017033597 39 -0.033563241 -0.033563241 40 -0.033563241 -0.033563241 41 -0.033563241 -0.033563241 42 -0.033563241 -0.033563241 43 -0.011563241 -0.033563241 44 -0.007563241 -0.011563241 45 -0.009563241 -0.007563241 46 -0.003563241 -0.009563241 47 -0.003563241 -0.003563241 48 -0.003023715 -0.003563241 49 0.001138340 -0.003023715 50 0.020270751 0.001138340 51 0.020270751 0.020270751 52 0.020270751 0.020270751 53 0.020270751 0.020270751 54 0.020270751 0.020270751 55 0.012270751 0.020270751 56 0.016270751 0.012270751 57 0.014270751 0.016270751 58 0.020270751 0.014270751 59 0.020270751 0.020270751 60 0.020810277 0.020270751 > 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/7vin41229681757.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/8v4ab1229681757.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/96z7f1229681757.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/108a8s1229681757.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/11ddht1229681757.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/12e49x1229681757.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/135cp31229681757.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/142qqf1229681757.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/15hfer1229681758.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/165q6v1229681758.tab") + } > > system("convert tmp/16xv51229681757.ps tmp/16xv51229681757.png") > system("convert tmp/2u28m1229681757.ps tmp/2u28m1229681757.png") > system("convert tmp/3mo031229681757.ps tmp/3mo031229681757.png") > system("convert tmp/4yvzd1229681757.ps tmp/4yvzd1229681757.png") > system("convert tmp/52c6u1229681757.ps tmp/52c6u1229681757.png") > system("convert tmp/63okk1229681757.ps tmp/63okk1229681757.png") > system("convert tmp/7vin41229681757.ps tmp/7vin41229681757.png") > system("convert tmp/8v4ab1229681757.ps tmp/8v4ab1229681757.png") > system("convert tmp/96z7f1229681757.ps tmp/96z7f1229681757.png") > system("convert tmp/108a8s1229681757.ps tmp/108a8s1229681757.png") > > > proc.time() user system elapsed 2.467 1.618 5.356