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(7.59,43.14,7.59,7.57,43.39,7.59,7.57,43.46,7.57,7.59,43.54,7.57,7.6,43.62,7.59,7.64,44.01,7.6,7.64,44.5,7.64,7.76,44.73,7.64,7.76,44.89,7.76,7.76,45.09,7.76,7.77,45.17,7.76,7.83,45.24,7.77,7.94,45.42,7.83,7.94,45.67,7.94,7.94,45.68,7.94,8.09,46.56,7.94,8.18,46.72,8.09,8.26,47.01,8.18,8.28,47.26,8.26,8.28,47.49,8.28,8.28,47.51,8.28,8.29,47.52,8.28,8.3,47.66,8.29,8.3,47.71,8.3,8.31,47.87,8.3,8.33,48,8.31,8.33,48,8.33,8.34,48.05,8.33,8.48,48.25,8.34,8.59,48.72,8.48,8.67,48.94,8.59,8.67,49.16,8.67,8.67,49.18,8.67,8.71,49.25,8.67,8.72,49.34,8.71,8.72,49.49,8.72,8.72,49.57,8.72,8.74,49.63,8.72,8.74,49.67,8.74,8.74,49.7,8.74,8.74,49.8,8.74,8.79,50.09,8.74,8.85,50.49,8.79,8.86,50.73,8.85,8.87,51.12,8.86,8.92,51.15,8.87,8.96,51.41,8.92,8.97,51.61,8.96,8.99,52.06,8.97,8.98,52.17,8.99,8.98,52.18,8.98,9.01,52.19,8.98,9.01,52.74,9.01,9.03,53.05,9.01,9.05,53.38,9.03,9.05,53.78,9.05),dim=c(3,56),dimnames=list(c('Y','X','Y1'),1:56)) > y <- array(NA,dim=c(3,56),dimnames=list(c('Y','X','Y1'),1:56)) > 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 Y1 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 7.59 43.14 7.59 1 0 0 0 0 0 0 0 0 0 0 1 2 7.57 43.39 7.59 0 1 0 0 0 0 0 0 0 0 0 2 3 7.57 43.46 7.57 0 0 1 0 0 0 0 0 0 0 0 3 4 7.59 43.54 7.57 0 0 0 1 0 0 0 0 0 0 0 4 5 7.60 43.62 7.59 0 0 0 0 1 0 0 0 0 0 0 5 6 7.64 44.01 7.60 0 0 0 0 0 1 0 0 0 0 0 6 7 7.64 44.50 7.64 0 0 0 0 0 0 1 0 0 0 0 7 8 7.76 44.73 7.64 0 0 0 0 0 0 0 1 0 0 0 8 9 7.76 44.89 7.76 0 0 0 0 0 0 0 0 1 0 0 9 10 7.76 45.09 7.76 0 0 0 0 0 0 0 0 0 1 0 10 11 7.77 45.17 7.76 0 0 0 0 0 0 0 0 0 0 1 11 12 7.83 45.24 7.77 0 0 0 0 0 0 0 0 0 0 0 12 13 7.94 45.42 7.83 1 0 0 0 0 0 0 0 0 0 0 13 14 7.94 45.67 7.94 0 1 0 0 0 0 0 0 0 0 0 14 15 7.94 45.68 7.94 0 0 1 0 0 0 0 0 0 0 0 15 16 8.09 46.56 7.94 0 0 0 1 0 0 0 0 0 0 0 16 17 8.18 46.72 8.09 0 0 0 0 1 0 0 0 0 0 0 17 18 8.26 47.01 8.18 0 0 0 0 0 1 0 0 0 0 0 18 19 8.28 47.26 8.26 0 0 0 0 0 0 1 0 0 0 0 19 20 8.28 47.49 8.28 0 0 0 0 0 0 0 1 0 0 0 20 21 8.28 47.51 8.28 0 0 0 0 0 0 0 0 1 0 0 21 22 8.29 47.52 8.28 0 0 0 0 0 0 0 0 0 1 0 22 23 8.30 47.66 8.29 0 0 0 0 0 0 0 0 0 0 1 23 24 8.30 47.71 8.30 0 0 0 0 0 0 0 0 0 0 0 24 25 8.31 47.87 8.30 1 0 0 0 0 0 0 0 0 0 0 25 26 8.33 48.00 8.31 0 1 0 0 0 0 0 0 0 0 0 26 27 8.33 48.00 8.33 0 0 1 0 0 0 0 0 0 0 0 27 28 8.34 48.05 8.33 0 0 0 1 0 0 0 0 0 0 0 28 29 8.48 48.25 8.34 0 0 0 0 1 0 0 0 0 0 0 29 30 8.59 48.72 8.48 0 0 0 0 0 1 0 0 0 0 0 30 31 8.67 48.94 8.59 0 0 0 0 0 0 1 0 0 0 0 31 32 8.67 49.16 8.67 0 0 0 0 0 0 0 1 0 0 0 32 33 8.67 49.18 8.67 0 0 0 0 0 0 0 0 1 0 0 33 34 8.71 49.25 8.67 0 0 0 0 0 0 0 0 0 1 0 34 35 8.72 49.34 8.71 0 0 0 0 0 0 0 0 0 0 1 35 36 8.72 49.49 8.72 0 0 0 0 0 0 0 0 0 0 0 36 37 8.72 49.57 8.72 1 0 0 0 0 0 0 0 0 0 0 37 38 8.74 49.63 8.72 0 1 0 0 0 0 0 0 0 0 0 38 39 8.74 49.67 8.74 0 0 1 0 0 0 0 0 0 0 0 39 40 8.74 49.70 8.74 0 0 0 1 0 0 0 0 0 0 0 40 41 8.74 49.80 8.74 0 0 0 0 1 0 0 0 0 0 0 41 42 8.79 50.09 8.74 0 0 0 0 0 1 0 0 0 0 0 42 43 8.85 50.49 8.79 0 0 0 0 0 0 1 0 0 0 0 43 44 8.86 50.73 8.85 0 0 0 0 0 0 0 1 0 0 0 44 45 8.87 51.12 8.86 0 0 0 0 0 0 0 0 1 0 0 45 46 8.92 51.15 8.87 0 0 0 0 0 0 0 0 0 1 0 46 47 8.96 51.41 8.92 0 0 0 0 0 0 0 0 0 0 1 47 48 8.97 51.61 8.96 0 0 0 0 0 0 0 0 0 0 0 48 49 8.99 52.06 8.97 1 0 0 0 0 0 0 0 0 0 0 49 50 8.98 52.17 8.99 0 1 0 0 0 0 0 0 0 0 0 50 51 8.98 52.18 8.98 0 0 1 0 0 0 0 0 0 0 0 51 52 9.01 52.19 8.98 0 0 0 1 0 0 0 0 0 0 0 52 53 9.01 52.74 9.01 0 0 0 0 1 0 0 0 0 0 0 53 54 9.03 53.05 9.01 0 0 0 0 0 1 0 0 0 0 0 54 55 9.05 53.38 9.03 0 0 0 0 0 0 1 0 0 0 0 55 56 9.05 53.78 9.05 0 0 0 0 0 0 0 1 0 0 0 56 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 M1 M2 M3 -0.561884 0.021662 0.954028 0.008923 -0.016468 -0.016153 M4 M5 M6 M7 M8 M9 0.024085 0.030081 0.039492 0.013716 0.002439 -0.018119 M10 M11 t 0.005604 -0.001046 -0.002787 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.048739 -0.023581 -0.006973 0.013636 0.090837 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.561884 0.832539 -0.675 0.504 X 0.021662 0.018110 1.196 0.239 Y1 0.954028 0.064319 14.833 <2e-16 *** M1 0.008923 0.026233 0.340 0.735 M2 -0.016468 0.026221 -0.628 0.533 M3 -0.016153 0.026455 -0.611 0.545 M4 0.024085 0.026581 0.906 0.370 M5 0.030081 0.026429 1.138 0.262 M6 0.039492 0.026322 1.500 0.141 M7 0.013716 0.026509 0.517 0.608 M8 0.002439 0.026793 0.091 0.928 M9 -0.018119 0.027897 -0.649 0.520 M10 0.005604 0.027659 0.203 0.840 M11 -0.001046 0.027620 -0.038 0.970 t -0.002787 0.003377 -0.825 0.414 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.03902 on 41 degrees of freedom Multiple R-squared: 0.9953, Adjusted R-squared: 0.9936 F-statistic: 614.4 on 14 and 41 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,] 0.09294438 0.185888752 0.907055624 [2,] 0.13621576 0.272431528 0.863784236 [3,] 0.55092628 0.898147433 0.449073716 [4,] 0.41571121 0.831422421 0.584288789 [5,] 0.44114431 0.882288620 0.558855690 [6,] 0.37523114 0.750462289 0.624768855 [7,] 0.34110014 0.682200278 0.658899861 [8,] 0.57512139 0.849757224 0.424878612 [9,] 0.49581040 0.991620791 0.504189604 [10,] 0.50793780 0.984124390 0.492062195 [11,] 0.89756685 0.204866305 0.102433152 [12,] 0.96456883 0.070862334 0.035431167 [13,] 0.98688697 0.026226061 0.013113031 [14,] 0.99922249 0.001555026 0.000777513 [15,] 0.99822839 0.003543227 0.001771613 [16,] 0.99596583 0.008068341 0.004034170 [17,] 0.99440042 0.011199163 0.005599582 [18,] 0.98446294 0.031074129 0.015537064 [19,] 0.96404341 0.071913190 0.035956595 [20,] 0.92859115 0.142817692 0.071408846 [21,] 0.89637678 0.207246447 0.103623223 > postscript(file="/var/www/html/rcomp/tmp/1rppp1258561897.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/2pcbw1258561897.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/31rxn1258561897.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/4jlxl1258561897.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/52n4w1258561897.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 = 56 Frequency = 1 1 2 3 4 5 -2.982599e-02 -2.706278e-02 -7.027289e-03 -2.621123e-02 -4.023325e-02 6 7 8 9 10 -2.484666e-02 -4.505872e-02 8.402280e-02 -1.058197e-02 -3.585050e-02 11 12 13 14 15 -1.814592e-02 3.253824e-02 7.526087e-02 -6.919028e-03 -4.664379e-03 16 17 18 19 20 8.882206e-02 2.904342e-02 1.027395e-02 -2.290035e-02 -3.289939e-02 21 22 23 24 25 -9.988100e-03 -2.114084e-02 -1.427626e-02 -2.315887e-02 -2.276131e-02 26 27 28 29 30 1.306106e-02 -3.548236e-03 -3.208231e-02 9.083651e-02 5.046647e-02 31 32 33 34 35 4.932118e-02 -1.770293e-02 5.208359e-03 2.275589e-02 2.082728e-03 36 37 38 39 40 -8.966076e-03 -1.683556e-02 3.004343e-02 1.256766e-02 -2.553318e-02 41 42 43 44 45 -3.090787e-02 6.185201e-03 3.838244e-02 5.649046e-06 1.536171e-02 46 47 48 49 50 3.423545e-02 3.033945e-02 -4.132990e-04 -5.838011e-03 -9.122685e-03 51 52 53 54 55 2.672246e-03 -4.995349e-03 -4.873880e-02 -4.207897e-02 -1.974454e-02 56 -3.342613e-02 > postscript(file="/var/www/html/rcomp/tmp/6z41q1258561897.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 = 56 Frequency = 1 lag(myerror, k = 1) myerror 0 -2.982599e-02 NA 1 -2.706278e-02 -2.982599e-02 2 -7.027289e-03 -2.706278e-02 3 -2.621123e-02 -7.027289e-03 4 -4.023325e-02 -2.621123e-02 5 -2.484666e-02 -4.023325e-02 6 -4.505872e-02 -2.484666e-02 7 8.402280e-02 -4.505872e-02 8 -1.058197e-02 8.402280e-02 9 -3.585050e-02 -1.058197e-02 10 -1.814592e-02 -3.585050e-02 11 3.253824e-02 -1.814592e-02 12 7.526087e-02 3.253824e-02 13 -6.919028e-03 7.526087e-02 14 -4.664379e-03 -6.919028e-03 15 8.882206e-02 -4.664379e-03 16 2.904342e-02 8.882206e-02 17 1.027395e-02 2.904342e-02 18 -2.290035e-02 1.027395e-02 19 -3.289939e-02 -2.290035e-02 20 -9.988100e-03 -3.289939e-02 21 -2.114084e-02 -9.988100e-03 22 -1.427626e-02 -2.114084e-02 23 -2.315887e-02 -1.427626e-02 24 -2.276131e-02 -2.315887e-02 25 1.306106e-02 -2.276131e-02 26 -3.548236e-03 1.306106e-02 27 -3.208231e-02 -3.548236e-03 28 9.083651e-02 -3.208231e-02 29 5.046647e-02 9.083651e-02 30 4.932118e-02 5.046647e-02 31 -1.770293e-02 4.932118e-02 32 5.208359e-03 -1.770293e-02 33 2.275589e-02 5.208359e-03 34 2.082728e-03 2.275589e-02 35 -8.966076e-03 2.082728e-03 36 -1.683556e-02 -8.966076e-03 37 3.004343e-02 -1.683556e-02 38 1.256766e-02 3.004343e-02 39 -2.553318e-02 1.256766e-02 40 -3.090787e-02 -2.553318e-02 41 6.185201e-03 -3.090787e-02 42 3.838244e-02 6.185201e-03 43 5.649046e-06 3.838244e-02 44 1.536171e-02 5.649046e-06 45 3.423545e-02 1.536171e-02 46 3.033945e-02 3.423545e-02 47 -4.132990e-04 3.033945e-02 48 -5.838011e-03 -4.132990e-04 49 -9.122685e-03 -5.838011e-03 50 2.672246e-03 -9.122685e-03 51 -4.995349e-03 2.672246e-03 52 -4.873880e-02 -4.995349e-03 53 -4.207897e-02 -4.873880e-02 54 -1.974454e-02 -4.207897e-02 55 -3.342613e-02 -1.974454e-02 56 NA -3.342613e-02 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.706278e-02 -2.982599e-02 [2,] -7.027289e-03 -2.706278e-02 [3,] -2.621123e-02 -7.027289e-03 [4,] -4.023325e-02 -2.621123e-02 [5,] -2.484666e-02 -4.023325e-02 [6,] -4.505872e-02 -2.484666e-02 [7,] 8.402280e-02 -4.505872e-02 [8,] -1.058197e-02 8.402280e-02 [9,] -3.585050e-02 -1.058197e-02 [10,] -1.814592e-02 -3.585050e-02 [11,] 3.253824e-02 -1.814592e-02 [12,] 7.526087e-02 3.253824e-02 [13,] -6.919028e-03 7.526087e-02 [14,] -4.664379e-03 -6.919028e-03 [15,] 8.882206e-02 -4.664379e-03 [16,] 2.904342e-02 8.882206e-02 [17,] 1.027395e-02 2.904342e-02 [18,] -2.290035e-02 1.027395e-02 [19,] -3.289939e-02 -2.290035e-02 [20,] -9.988100e-03 -3.289939e-02 [21,] -2.114084e-02 -9.988100e-03 [22,] -1.427626e-02 -2.114084e-02 [23,] -2.315887e-02 -1.427626e-02 [24,] -2.276131e-02 -2.315887e-02 [25,] 1.306106e-02 -2.276131e-02 [26,] -3.548236e-03 1.306106e-02 [27,] -3.208231e-02 -3.548236e-03 [28,] 9.083651e-02 -3.208231e-02 [29,] 5.046647e-02 9.083651e-02 [30,] 4.932118e-02 5.046647e-02 [31,] -1.770293e-02 4.932118e-02 [32,] 5.208359e-03 -1.770293e-02 [33,] 2.275589e-02 5.208359e-03 [34,] 2.082728e-03 2.275589e-02 [35,] -8.966076e-03 2.082728e-03 [36,] -1.683556e-02 -8.966076e-03 [37,] 3.004343e-02 -1.683556e-02 [38,] 1.256766e-02 3.004343e-02 [39,] -2.553318e-02 1.256766e-02 [40,] -3.090787e-02 -2.553318e-02 [41,] 6.185201e-03 -3.090787e-02 [42,] 3.838244e-02 6.185201e-03 [43,] 5.649046e-06 3.838244e-02 [44,] 1.536171e-02 5.649046e-06 [45,] 3.423545e-02 1.536171e-02 [46,] 3.033945e-02 3.423545e-02 [47,] -4.132990e-04 3.033945e-02 [48,] -5.838011e-03 -4.132990e-04 [49,] -9.122685e-03 -5.838011e-03 [50,] 2.672246e-03 -9.122685e-03 [51,] -4.995349e-03 2.672246e-03 [52,] -4.873880e-02 -4.995349e-03 [53,] -4.207897e-02 -4.873880e-02 [54,] -1.974454e-02 -4.207897e-02 [55,] -3.342613e-02 -1.974454e-02 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.706278e-02 -2.982599e-02 2 -7.027289e-03 -2.706278e-02 3 -2.621123e-02 -7.027289e-03 4 -4.023325e-02 -2.621123e-02 5 -2.484666e-02 -4.023325e-02 6 -4.505872e-02 -2.484666e-02 7 8.402280e-02 -4.505872e-02 8 -1.058197e-02 8.402280e-02 9 -3.585050e-02 -1.058197e-02 10 -1.814592e-02 -3.585050e-02 11 3.253824e-02 -1.814592e-02 12 7.526087e-02 3.253824e-02 13 -6.919028e-03 7.526087e-02 14 -4.664379e-03 -6.919028e-03 15 8.882206e-02 -4.664379e-03 16 2.904342e-02 8.882206e-02 17 1.027395e-02 2.904342e-02 18 -2.290035e-02 1.027395e-02 19 -3.289939e-02 -2.290035e-02 20 -9.988100e-03 -3.289939e-02 21 -2.114084e-02 -9.988100e-03 22 -1.427626e-02 -2.114084e-02 23 -2.315887e-02 -1.427626e-02 24 -2.276131e-02 -2.315887e-02 25 1.306106e-02 -2.276131e-02 26 -3.548236e-03 1.306106e-02 27 -3.208231e-02 -3.548236e-03 28 9.083651e-02 -3.208231e-02 29 5.046647e-02 9.083651e-02 30 4.932118e-02 5.046647e-02 31 -1.770293e-02 4.932118e-02 32 5.208359e-03 -1.770293e-02 33 2.275589e-02 5.208359e-03 34 2.082728e-03 2.275589e-02 35 -8.966076e-03 2.082728e-03 36 -1.683556e-02 -8.966076e-03 37 3.004343e-02 -1.683556e-02 38 1.256766e-02 3.004343e-02 39 -2.553318e-02 1.256766e-02 40 -3.090787e-02 -2.553318e-02 41 6.185201e-03 -3.090787e-02 42 3.838244e-02 6.185201e-03 43 5.649046e-06 3.838244e-02 44 1.536171e-02 5.649046e-06 45 3.423545e-02 1.536171e-02 46 3.033945e-02 3.423545e-02 47 -4.132990e-04 3.033945e-02 48 -5.838011e-03 -4.132990e-04 49 -9.122685e-03 -5.838011e-03 50 2.672246e-03 -9.122685e-03 51 -4.995349e-03 2.672246e-03 52 -4.873880e-02 -4.995349e-03 53 -4.207897e-02 -4.873880e-02 54 -1.974454e-02 -4.207897e-02 55 -3.342613e-02 -1.974454e-02 > 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/7hexs1258561897.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/8xkiq1258561897.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/9qa6h1258561897.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/101wwz1258561897.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/11l8pw1258561897.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/12tlkq1258561897.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/134e8j1258561897.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/14rwwq1258561897.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/15gq4i1258561897.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/1685ca1258561897.tab") + } > > system("convert tmp/1rppp1258561897.ps tmp/1rppp1258561897.png") > system("convert tmp/2pcbw1258561897.ps tmp/2pcbw1258561897.png") > system("convert tmp/31rxn1258561897.ps tmp/31rxn1258561897.png") > system("convert tmp/4jlxl1258561897.ps tmp/4jlxl1258561897.png") > system("convert tmp/52n4w1258561897.ps tmp/52n4w1258561897.png") > system("convert tmp/6z41q1258561897.ps tmp/6z41q1258561897.png") > system("convert tmp/7hexs1258561897.ps tmp/7hexs1258561897.png") > system("convert tmp/8xkiq1258561897.ps tmp/8xkiq1258561897.png") > system("convert tmp/9qa6h1258561897.ps tmp/9qa6h1258561897.png") > system("convert tmp/101wwz1258561897.ps tmp/101wwz1258561897.png") > > > proc.time() user system elapsed 2.358 1.561 2.733