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(3.75,0,3.75,0,3.55,0,3.5,0,3.5,0,3.1,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3.21,0,3.25,0,3.25,0,3.45,0,3.5,0,3.5,0,3.64,0,3.75,0,3.93,0,4,0,4.17,0,4.25,0,4.39,0,4.5,0,4.5,0,4.65,0,4.75,0,4.75,0,4.9,0,5,0,5,0,5,0,5,0,5,0,5,0,5,1,5,1,5,1,5,1,5,1,5,1,5.18,1,5.25,1,5.25,1,4.49,1,3.92,1,3.25,1),dim=c(2,72),dimnames=list(c('Yt','Xt'),1:72)) > y <- array(NA,dim=c(2,72),dimnames=list(c('Yt','Xt'),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 = 'No 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 Yt Xt M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 3.75 0 1 0 0 0 0 0 0 0 0 0 0 2 3.75 0 0 1 0 0 0 0 0 0 0 0 0 3 3.55 0 0 0 1 0 0 0 0 0 0 0 0 4 3.50 0 0 0 0 1 0 0 0 0 0 0 0 5 3.50 0 0 0 0 0 1 0 0 0 0 0 0 6 3.10 0 0 0 0 0 0 1 0 0 0 0 0 7 3.00 0 0 0 0 0 0 0 1 0 0 0 0 8 3.00 0 0 0 0 0 0 0 0 1 0 0 0 9 3.00 0 0 0 0 0 0 0 0 0 1 0 0 10 3.00 0 0 0 0 0 0 0 0 0 0 1 0 11 3.00 0 0 0 0 0 0 0 0 0 0 0 1 12 3.00 0 0 0 0 0 0 0 0 0 0 0 0 13 3.00 0 1 0 0 0 0 0 0 0 0 0 0 14 3.00 0 0 1 0 0 0 0 0 0 0 0 0 15 3.00 0 0 0 1 0 0 0 0 0 0 0 0 16 3.00 0 0 0 0 1 0 0 0 0 0 0 0 17 3.00 0 0 0 0 0 1 0 0 0 0 0 0 18 3.00 0 0 0 0 0 0 1 0 0 0 0 0 19 3.00 0 0 0 0 0 0 0 1 0 0 0 0 20 3.00 0 0 0 0 0 0 0 0 1 0 0 0 21 3.00 0 0 0 0 0 0 0 0 0 1 0 0 22 3.00 0 0 0 0 0 0 0 0 0 0 1 0 23 3.00 0 0 0 0 0 0 0 0 0 0 0 1 24 3.00 0 0 0 0 0 0 0 0 0 0 0 0 25 3.00 0 1 0 0 0 0 0 0 0 0 0 0 26 3.00 0 0 1 0 0 0 0 0 0 0 0 0 27 3.00 0 0 0 1 0 0 0 0 0 0 0 0 28 3.00 0 0 0 0 1 0 0 0 0 0 0 0 29 3.00 0 0 0 0 0 1 0 0 0 0 0 0 30 3.00 0 0 0 0 0 0 1 0 0 0 0 0 31 3.00 0 0 0 0 0 0 0 1 0 0 0 0 32 3.00 0 0 0 0 0 0 0 0 1 0 0 0 33 3.00 0 0 0 0 0 0 0 0 0 1 0 0 34 3.00 0 0 0 0 0 0 0 0 0 0 1 0 35 3.00 0 0 0 0 0 0 0 0 0 0 0 1 36 3.21 0 0 0 0 0 0 0 0 0 0 0 0 37 3.25 0 1 0 0 0 0 0 0 0 0 0 0 38 3.25 0 0 1 0 0 0 0 0 0 0 0 0 39 3.45 0 0 0 1 0 0 0 0 0 0 0 0 40 3.50 0 0 0 0 1 0 0 0 0 0 0 0 41 3.50 0 0 0 0 0 1 0 0 0 0 0 0 42 3.64 0 0 0 0 0 0 1 0 0 0 0 0 43 3.75 0 0 0 0 0 0 0 1 0 0 0 0 44 3.93 0 0 0 0 0 0 0 0 1 0 0 0 45 4.00 0 0 0 0 0 0 0 0 0 1 0 0 46 4.17 0 0 0 0 0 0 0 0 0 0 1 0 47 4.25 0 0 0 0 0 0 0 0 0 0 0 1 48 4.39 0 0 0 0 0 0 0 0 0 0 0 0 49 4.50 0 1 0 0 0 0 0 0 0 0 0 0 50 4.50 0 0 1 0 0 0 0 0 0 0 0 0 51 4.65 0 0 0 1 0 0 0 0 0 0 0 0 52 4.75 0 0 0 0 1 0 0 0 0 0 0 0 53 4.75 0 0 0 0 0 1 0 0 0 0 0 0 54 4.90 0 0 0 0 0 0 1 0 0 0 0 0 55 5.00 0 0 0 0 0 0 0 1 0 0 0 0 56 5.00 0 0 0 0 0 0 0 0 1 0 0 0 57 5.00 0 0 0 0 0 0 0 0 0 1 0 0 58 5.00 0 0 0 0 0 0 0 0 0 0 1 0 59 5.00 0 0 0 0 0 0 0 0 0 0 0 1 60 5.00 0 0 0 0 0 0 0 0 0 0 0 0 61 5.00 1 1 0 0 0 0 0 0 0 0 0 0 62 5.00 1 0 1 0 0 0 0 0 0 0 0 0 63 5.00 1 0 0 1 0 0 0 0 0 0 0 0 64 5.00 1 0 0 0 1 0 0 0 0 0 0 0 65 5.00 1 0 0 0 0 1 0 0 0 0 0 0 66 5.00 1 0 0 0 0 0 1 0 0 0 0 0 67 5.18 1 0 0 0 0 0 0 1 0 0 0 0 68 5.25 1 0 0 0 0 0 0 0 1 0 0 0 69 5.25 1 0 0 0 0 0 0 0 0 1 0 0 70 4.49 1 0 0 0 0 0 0 0 0 0 1 0 71 3.92 1 0 0 0 0 0 0 0 0 0 0 1 72 3.25 1 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Xt M1 M2 M3 M4 3.44108 1.20350 0.10833 0.10833 0.13333 0.15000 M5 M6 M7 M8 M9 M10 0.15000 0.13167 0.18000 0.22167 0.23333 0.13500 M11 0.05333 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.3946 -0.5748 -0.1777 0.3330 1.5589 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.44108 0.31895 10.789 1.39e-15 *** Xt 1.20350 0.24503 4.912 7.50e-06 *** M1 0.10833 0.44735 0.242 0.809 M2 0.10833 0.44735 0.242 0.809 M3 0.13333 0.44735 0.298 0.767 M4 0.15000 0.44735 0.335 0.739 M5 0.15000 0.44735 0.335 0.739 M6 0.13167 0.44735 0.294 0.770 M7 0.18000 0.44735 0.402 0.689 M8 0.22167 0.44735 0.496 0.622 M9 0.23333 0.44735 0.522 0.604 M10 0.13500 0.44735 0.302 0.764 M11 0.05333 0.44735 0.119 0.906 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.7748 on 59 degrees of freedom Multiple R-squared: 0.2941, Adjusted R-squared: 0.1506 F-statistic: 2.049 on 12 and 59 DF, p-value: 0.03523 > 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,] 2.388826e-01 4.777652e-01 0.7611174 [2,] 1.460649e-01 2.921298e-01 0.8539351 [3,] 7.152206e-02 1.430441e-01 0.9284779 [4,] 3.293611e-02 6.587222e-02 0.9670639 [5,] 1.457584e-02 2.915168e-02 0.9854242 [6,] 6.236036e-03 1.247207e-02 0.9937640 [7,] 2.505364e-03 5.010729e-03 0.9974946 [8,] 9.469596e-04 1.893919e-03 0.9990530 [9,] 3.391189e-04 6.782378e-04 0.9996609 [10,] 2.000821e-04 4.001642e-04 0.9997999 [11,] 1.201077e-04 2.402155e-04 0.9998799 [12,] 6.224029e-05 1.244806e-04 0.9999378 [13,] 3.247031e-05 6.494062e-05 0.9999675 [14,] 1.754359e-05 3.508719e-05 0.9999825 [15,] 8.436398e-06 1.687280e-05 0.9999916 [16,] 4.690987e-06 9.381973e-06 0.9999953 [17,] 3.115942e-06 6.231885e-06 0.9999969 [18,] 2.461835e-06 4.923670e-06 0.9999975 [19,] 1.788839e-06 3.577678e-06 0.9999982 [20,] 1.200728e-06 2.401456e-06 0.9999988 [21,] 6.932683e-07 1.386537e-06 0.9999993 [22,] 5.357305e-07 1.071461e-06 0.9999995 [23,] 4.937570e-07 9.875140e-07 0.9999995 [24,] 6.695297e-07 1.339059e-06 0.9999993 [25,] 1.382969e-06 2.765938e-06 0.9999986 [26,] 3.644340e-06 7.288681e-06 0.9999964 [27,] 3.226867e-05 6.453733e-05 0.9999677 [28,] 5.531305e-04 1.106261e-03 0.9994469 [29,] 8.503876e-03 1.700775e-02 0.9914961 [30,] 6.872543e-02 1.374509e-01 0.9312746 [31,] 1.695015e-01 3.390029e-01 0.8304985 [32,] 2.532289e-01 5.064577e-01 0.7467711 [33,] 3.265012e-01 6.530024e-01 0.6734988 [34,] 4.046157e-01 8.092314e-01 0.5953843 [35,] 4.699462e-01 9.398923e-01 0.5300538 [36,] 5.162858e-01 9.674285e-01 0.4837142 [37,] 5.403610e-01 9.192780e-01 0.4596390 [38,] 5.485998e-01 9.028004e-01 0.4514002 [39,] 5.370771e-01 9.258459e-01 0.4629229 [40,] 5.345320e-01 9.309360e-01 0.4654680 [41,] 5.596540e-01 8.806920e-01 0.4403460 > postscript(file="/var/www/html/rcomp/tmp/1q8i01258656577.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/24omg1258656577.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/3vnyf1258656577.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/4u54a1258656577.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/55dmo1258656577.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 0.20058333 0.20058333 -0.02441667 -0.09108333 -0.09108333 -0.47275000 7 8 9 10 11 12 -0.62108333 -0.66275000 -0.67441667 -0.57608333 -0.49441667 -0.44108333 13 14 15 16 17 18 -0.54941667 -0.54941667 -0.57441667 -0.59108333 -0.59108333 -0.57275000 19 20 21 22 23 24 -0.62108333 -0.66275000 -0.67441667 -0.57608333 -0.49441667 -0.44108333 25 26 27 28 29 30 -0.54941667 -0.54941667 -0.57441667 -0.59108333 -0.59108333 -0.57275000 31 32 33 34 35 36 -0.62108333 -0.66275000 -0.67441667 -0.57608333 -0.49441667 -0.23108333 37 38 39 40 41 42 -0.29941667 -0.29941667 -0.12441667 -0.09108333 -0.09108333 0.06725000 43 44 45 46 47 48 0.12891667 0.26725000 0.32558333 0.59391667 0.75558333 0.94891667 49 50 51 52 53 54 0.95058333 0.95058333 1.07558333 1.15891667 1.15891667 1.32725000 55 56 57 58 59 60 1.37891667 1.33725000 1.32558333 1.42391667 1.50558333 1.55891667 61 62 63 64 65 66 0.24708333 0.24708333 0.22208333 0.20541667 0.20541667 0.22375000 67 68 69 70 71 72 0.35541667 0.38375000 0.37208333 -0.28958333 -0.77791667 -1.39458333 > postscript(file="/var/www/html/rcomp/tmp/6v1rp1258656577.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 0.20058333 NA 1 0.20058333 0.20058333 2 -0.02441667 0.20058333 3 -0.09108333 -0.02441667 4 -0.09108333 -0.09108333 5 -0.47275000 -0.09108333 6 -0.62108333 -0.47275000 7 -0.66275000 -0.62108333 8 -0.67441667 -0.66275000 9 -0.57608333 -0.67441667 10 -0.49441667 -0.57608333 11 -0.44108333 -0.49441667 12 -0.54941667 -0.44108333 13 -0.54941667 -0.54941667 14 -0.57441667 -0.54941667 15 -0.59108333 -0.57441667 16 -0.59108333 -0.59108333 17 -0.57275000 -0.59108333 18 -0.62108333 -0.57275000 19 -0.66275000 -0.62108333 20 -0.67441667 -0.66275000 21 -0.57608333 -0.67441667 22 -0.49441667 -0.57608333 23 -0.44108333 -0.49441667 24 -0.54941667 -0.44108333 25 -0.54941667 -0.54941667 26 -0.57441667 -0.54941667 27 -0.59108333 -0.57441667 28 -0.59108333 -0.59108333 29 -0.57275000 -0.59108333 30 -0.62108333 -0.57275000 31 -0.66275000 -0.62108333 32 -0.67441667 -0.66275000 33 -0.57608333 -0.67441667 34 -0.49441667 -0.57608333 35 -0.23108333 -0.49441667 36 -0.29941667 -0.23108333 37 -0.29941667 -0.29941667 38 -0.12441667 -0.29941667 39 -0.09108333 -0.12441667 40 -0.09108333 -0.09108333 41 0.06725000 -0.09108333 42 0.12891667 0.06725000 43 0.26725000 0.12891667 44 0.32558333 0.26725000 45 0.59391667 0.32558333 46 0.75558333 0.59391667 47 0.94891667 0.75558333 48 0.95058333 0.94891667 49 0.95058333 0.95058333 50 1.07558333 0.95058333 51 1.15891667 1.07558333 52 1.15891667 1.15891667 53 1.32725000 1.15891667 54 1.37891667 1.32725000 55 1.33725000 1.37891667 56 1.32558333 1.33725000 57 1.42391667 1.32558333 58 1.50558333 1.42391667 59 1.55891667 1.50558333 60 0.24708333 1.55891667 61 0.24708333 0.24708333 62 0.22208333 0.24708333 63 0.20541667 0.22208333 64 0.20541667 0.20541667 65 0.22375000 0.20541667 66 0.35541667 0.22375000 67 0.38375000 0.35541667 68 0.37208333 0.38375000 69 -0.28958333 0.37208333 70 -0.77791667 -0.28958333 71 -1.39458333 -0.77791667 72 NA -1.39458333 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.20058333 0.20058333 [2,] -0.02441667 0.20058333 [3,] -0.09108333 -0.02441667 [4,] -0.09108333 -0.09108333 [5,] -0.47275000 -0.09108333 [6,] -0.62108333 -0.47275000 [7,] -0.66275000 -0.62108333 [8,] -0.67441667 -0.66275000 [9,] -0.57608333 -0.67441667 [10,] -0.49441667 -0.57608333 [11,] -0.44108333 -0.49441667 [12,] -0.54941667 -0.44108333 [13,] -0.54941667 -0.54941667 [14,] -0.57441667 -0.54941667 [15,] -0.59108333 -0.57441667 [16,] -0.59108333 -0.59108333 [17,] -0.57275000 -0.59108333 [18,] -0.62108333 -0.57275000 [19,] -0.66275000 -0.62108333 [20,] -0.67441667 -0.66275000 [21,] -0.57608333 -0.67441667 [22,] -0.49441667 -0.57608333 [23,] -0.44108333 -0.49441667 [24,] -0.54941667 -0.44108333 [25,] -0.54941667 -0.54941667 [26,] -0.57441667 -0.54941667 [27,] -0.59108333 -0.57441667 [28,] -0.59108333 -0.59108333 [29,] -0.57275000 -0.59108333 [30,] -0.62108333 -0.57275000 [31,] -0.66275000 -0.62108333 [32,] -0.67441667 -0.66275000 [33,] -0.57608333 -0.67441667 [34,] -0.49441667 -0.57608333 [35,] -0.23108333 -0.49441667 [36,] -0.29941667 -0.23108333 [37,] -0.29941667 -0.29941667 [38,] -0.12441667 -0.29941667 [39,] -0.09108333 -0.12441667 [40,] -0.09108333 -0.09108333 [41,] 0.06725000 -0.09108333 [42,] 0.12891667 0.06725000 [43,] 0.26725000 0.12891667 [44,] 0.32558333 0.26725000 [45,] 0.59391667 0.32558333 [46,] 0.75558333 0.59391667 [47,] 0.94891667 0.75558333 [48,] 0.95058333 0.94891667 [49,] 0.95058333 0.95058333 [50,] 1.07558333 0.95058333 [51,] 1.15891667 1.07558333 [52,] 1.15891667 1.15891667 [53,] 1.32725000 1.15891667 [54,] 1.37891667 1.32725000 [55,] 1.33725000 1.37891667 [56,] 1.32558333 1.33725000 [57,] 1.42391667 1.32558333 [58,] 1.50558333 1.42391667 [59,] 1.55891667 1.50558333 [60,] 0.24708333 1.55891667 [61,] 0.24708333 0.24708333 [62,] 0.22208333 0.24708333 [63,] 0.20541667 0.22208333 [64,] 0.20541667 0.20541667 [65,] 0.22375000 0.20541667 [66,] 0.35541667 0.22375000 [67,] 0.38375000 0.35541667 [68,] 0.37208333 0.38375000 [69,] -0.28958333 0.37208333 [70,] -0.77791667 -0.28958333 [71,] -1.39458333 -0.77791667 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.20058333 0.20058333 2 -0.02441667 0.20058333 3 -0.09108333 -0.02441667 4 -0.09108333 -0.09108333 5 -0.47275000 -0.09108333 6 -0.62108333 -0.47275000 7 -0.66275000 -0.62108333 8 -0.67441667 -0.66275000 9 -0.57608333 -0.67441667 10 -0.49441667 -0.57608333 11 -0.44108333 -0.49441667 12 -0.54941667 -0.44108333 13 -0.54941667 -0.54941667 14 -0.57441667 -0.54941667 15 -0.59108333 -0.57441667 16 -0.59108333 -0.59108333 17 -0.57275000 -0.59108333 18 -0.62108333 -0.57275000 19 -0.66275000 -0.62108333 20 -0.67441667 -0.66275000 21 -0.57608333 -0.67441667 22 -0.49441667 -0.57608333 23 -0.44108333 -0.49441667 24 -0.54941667 -0.44108333 25 -0.54941667 -0.54941667 26 -0.57441667 -0.54941667 27 -0.59108333 -0.57441667 28 -0.59108333 -0.59108333 29 -0.57275000 -0.59108333 30 -0.62108333 -0.57275000 31 -0.66275000 -0.62108333 32 -0.67441667 -0.66275000 33 -0.57608333 -0.67441667 34 -0.49441667 -0.57608333 35 -0.23108333 -0.49441667 36 -0.29941667 -0.23108333 37 -0.29941667 -0.29941667 38 -0.12441667 -0.29941667 39 -0.09108333 -0.12441667 40 -0.09108333 -0.09108333 41 0.06725000 -0.09108333 42 0.12891667 0.06725000 43 0.26725000 0.12891667 44 0.32558333 0.26725000 45 0.59391667 0.32558333 46 0.75558333 0.59391667 47 0.94891667 0.75558333 48 0.95058333 0.94891667 49 0.95058333 0.95058333 50 1.07558333 0.95058333 51 1.15891667 1.07558333 52 1.15891667 1.15891667 53 1.32725000 1.15891667 54 1.37891667 1.32725000 55 1.33725000 1.37891667 56 1.32558333 1.33725000 57 1.42391667 1.32558333 58 1.50558333 1.42391667 59 1.55891667 1.50558333 60 0.24708333 1.55891667 61 0.24708333 0.24708333 62 0.22208333 0.24708333 63 0.20541667 0.22208333 64 0.20541667 0.20541667 65 0.22375000 0.20541667 66 0.35541667 0.22375000 67 0.38375000 0.35541667 68 0.37208333 0.38375000 69 -0.28958333 0.37208333 70 -0.77791667 -0.28958333 71 -1.39458333 -0.77791667 > 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/7ihb01258656577.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/8lawg1258656577.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/967yk1258656577.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/10emk01258656577.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/11dd0n1258656577.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/12re5k1258656577.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/13yxlk1258656577.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/14pi8c1258656577.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/150sli1258656577.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/1604zb1258656578.tab") + } > > system("convert tmp/1q8i01258656577.ps tmp/1q8i01258656577.png") > system("convert tmp/24omg1258656577.ps tmp/24omg1258656577.png") > system("convert tmp/3vnyf1258656577.ps tmp/3vnyf1258656577.png") > system("convert tmp/4u54a1258656577.ps tmp/4u54a1258656577.png") > system("convert tmp/55dmo1258656577.ps tmp/55dmo1258656577.png") > system("convert tmp/6v1rp1258656577.ps tmp/6v1rp1258656577.png") > system("convert tmp/7ihb01258656577.ps tmp/7ihb01258656577.png") > system("convert tmp/8lawg1258656577.ps tmp/8lawg1258656577.png") > system("convert tmp/967yk1258656577.ps tmp/967yk1258656577.png") > system("convert tmp/10emk01258656577.ps tmp/10emk01258656577.png") > > > proc.time() user system elapsed 2.646 1.628 5.987