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 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Yt Xt 1 3.75 0 2 3.75 0 3 3.55 0 4 3.50 0 5 3.50 0 6 3.10 0 7 3.00 0 8 3.00 0 9 3.00 0 10 3.00 0 11 3.00 0 12 3.00 0 13 3.00 0 14 3.00 0 15 3.00 0 16 3.00 0 17 3.00 0 18 3.00 0 19 3.00 0 20 3.00 0 21 3.00 0 22 3.00 0 23 3.00 0 24 3.00 0 25 3.00 0 26 3.00 0 27 3.00 0 28 3.00 0 29 3.00 0 30 3.00 0 31 3.00 0 32 3.00 0 33 3.00 0 34 3.00 0 35 3.00 0 36 3.21 0 37 3.25 0 38 3.25 0 39 3.45 0 40 3.50 0 41 3.50 0 42 3.64 0 43 3.75 0 44 3.93 0 45 4.00 0 46 4.17 0 47 4.25 0 48 4.39 0 49 4.50 0 50 4.50 0 51 4.65 0 52 4.75 0 53 4.75 0 54 4.90 0 55 5.00 0 56 5.00 0 57 5.00 0 58 5.00 0 59 5.00 0 60 5.00 0 61 5.00 1 62 5.00 1 63 5.00 1 64 5.00 1 65 5.00 1 66 5.00 1 67 5.18 1 68 5.25 1 69 5.25 1 70 4.49 1 71 3.92 1 72 3.25 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Xt 3.575 1.204 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.5283 -0.5748 -0.2066 0.4075 1.4252 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.57483 0.09219 38.776 < 2e-16 *** Xt 1.20350 0.22583 5.329 1.14e-06 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.7141 on 70 degrees of freedom Multiple R-squared: 0.2886, Adjusted R-squared: 0.2785 F-statistic: 28.4 on 1 and 70 DF, p-value: 1.141e-06 > 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.106763e-02 2.213525e-02 0.9889324 [2,] 2.836501e-02 5.673002e-02 0.9716350 [3,] 3.346821e-02 6.693642e-02 0.9665318 [4,] 2.685959e-02 5.371918e-02 0.9731404 [5,] 1.857862e-02 3.715723e-02 0.9814214 [6,] 1.178153e-02 2.356306e-02 0.9882185 [7,] 7.025965e-03 1.405193e-02 0.9929740 [8,] 3.993927e-03 7.987853e-03 0.9960061 [9,] 2.182841e-03 4.365682e-03 0.9978172 [10,] 1.154225e-03 2.308449e-03 0.9988458 [11,] 5.934585e-04 1.186917e-03 0.9994065 [12,] 2.980018e-04 5.960037e-04 0.9997020 [13,] 1.467304e-04 2.934607e-04 0.9998533 [14,] 7.111672e-05 1.422334e-04 0.9999289 [15,] 3.406028e-05 6.812057e-05 0.9999659 [16,] 1.618343e-05 3.236686e-05 0.9999838 [17,] 7.660430e-06 1.532086e-05 0.9999923 [18,] 3.628699e-06 7.257398e-06 0.9999964 [19,] 1.728671e-06 3.457341e-06 0.9999983 [20,] 8.327971e-07 1.665594e-06 0.9999992 [21,] 4.082838e-07 8.165677e-07 0.9999996 [22,] 2.051788e-07 4.103577e-07 0.9999998 [23,] 1.065963e-07 2.131927e-07 0.9999999 [24,] 5.783370e-08 1.156674e-07 0.9999999 [25,] 3.317013e-08 6.634027e-08 1.0000000 [26,] 2.041449e-08 4.082897e-08 1.0000000 [27,] 1.373594e-08 2.747189e-08 1.0000000 [28,] 1.034677e-08 2.069355e-08 1.0000000 [29,] 8.997908e-09 1.799582e-08 1.0000000 [30,] 9.411032e-09 1.882206e-08 1.0000000 [31,] 1.252001e-08 2.504002e-08 1.0000000 [32,] 1.432396e-08 2.864792e-08 1.0000000 [33,] 2.052461e-08 4.104922e-08 1.0000000 [34,] 3.886986e-08 7.773971e-08 1.0000000 [35,] 1.209759e-07 2.419518e-07 0.9999999 [36,] 4.941282e-07 9.882564e-07 0.9999995 [37,] 2.403250e-06 4.806501e-06 0.9999976 [38,] 1.754827e-05 3.509655e-05 0.9999825 [39,] 1.509986e-04 3.019972e-04 0.9998490 [40,] 1.385420e-03 2.770840e-03 0.9986146 [41,] 8.495543e-03 1.699109e-02 0.9915045 [42,] 3.815038e-02 7.630076e-02 0.9618496 [43,] 1.093101e-01 2.186202e-01 0.8906899 [44,] 2.285294e-01 4.570588e-01 0.7714706 [45,] 3.685995e-01 7.371990e-01 0.6314005 [46,] 4.900268e-01 9.800536e-01 0.5099732 [47,] 5.940455e-01 8.119089e-01 0.4059545 [48,] 6.710302e-01 6.579396e-01 0.3289698 [49,] 7.178227e-01 5.643547e-01 0.2821773 [50,] 7.527844e-01 4.944311e-01 0.2472156 [51,] 7.757456e-01 4.485087e-01 0.2242544 [52,] 7.811844e-01 4.376311e-01 0.2188156 [53,] 7.733618e-01 4.532763e-01 0.2266382 [54,] 7.539531e-01 4.920938e-01 0.2460469 [55,] 7.232319e-01 5.535362e-01 0.2767681 [56,] 6.807754e-01 6.384491e-01 0.3192246 [57,] 5.918798e-01 8.162405e-01 0.4081202 [58,] 4.958889e-01 9.917779e-01 0.5041111 [59,] 3.979765e-01 7.959530e-01 0.6020235 [60,] 3.040428e-01 6.080857e-01 0.6959572 [61,] 2.197168e-01 4.394337e-01 0.7802832 [62,] 1.493052e-01 2.986104e-01 0.8506948 [63,] 1.151007e-01 2.302015e-01 0.8848993 > postscript(file="/var/www/html/rcomp/tmp/1mshj1258654141.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/23pb81258654141.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/3anmj1258654141.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/4j41v1258654141.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/5fd6o1258654141.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.17516667 0.17516667 -0.02483333 -0.07483333 -0.07483333 -0.47483333 7 8 9 10 11 12 -0.57483333 -0.57483333 -0.57483333 -0.57483333 -0.57483333 -0.57483333 13 14 15 16 17 18 -0.57483333 -0.57483333 -0.57483333 -0.57483333 -0.57483333 -0.57483333 19 20 21 22 23 24 -0.57483333 -0.57483333 -0.57483333 -0.57483333 -0.57483333 -0.57483333 25 26 27 28 29 30 -0.57483333 -0.57483333 -0.57483333 -0.57483333 -0.57483333 -0.57483333 31 32 33 34 35 36 -0.57483333 -0.57483333 -0.57483333 -0.57483333 -0.57483333 -0.36483333 37 38 39 40 41 42 -0.32483333 -0.32483333 -0.12483333 -0.07483333 -0.07483333 0.06516667 43 44 45 46 47 48 0.17516667 0.35516667 0.42516667 0.59516667 0.67516667 0.81516667 49 50 51 52 53 54 0.92516667 0.92516667 1.07516667 1.17516667 1.17516667 1.32516667 55 56 57 58 59 60 1.42516667 1.42516667 1.42516667 1.42516667 1.42516667 1.42516667 61 62 63 64 65 66 0.22166667 0.22166667 0.22166667 0.22166667 0.22166667 0.22166667 67 68 69 70 71 72 0.40166667 0.47166667 0.47166667 -0.28833333 -0.85833333 -1.52833333 > postscript(file="/var/www/html/rcomp/tmp/6abz01258654141.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.17516667 NA 1 0.17516667 0.17516667 2 -0.02483333 0.17516667 3 -0.07483333 -0.02483333 4 -0.07483333 -0.07483333 5 -0.47483333 -0.07483333 6 -0.57483333 -0.47483333 7 -0.57483333 -0.57483333 8 -0.57483333 -0.57483333 9 -0.57483333 -0.57483333 10 -0.57483333 -0.57483333 11 -0.57483333 -0.57483333 12 -0.57483333 -0.57483333 13 -0.57483333 -0.57483333 14 -0.57483333 -0.57483333 15 -0.57483333 -0.57483333 16 -0.57483333 -0.57483333 17 -0.57483333 -0.57483333 18 -0.57483333 -0.57483333 19 -0.57483333 -0.57483333 20 -0.57483333 -0.57483333 21 -0.57483333 -0.57483333 22 -0.57483333 -0.57483333 23 -0.57483333 -0.57483333 24 -0.57483333 -0.57483333 25 -0.57483333 -0.57483333 26 -0.57483333 -0.57483333 27 -0.57483333 -0.57483333 28 -0.57483333 -0.57483333 29 -0.57483333 -0.57483333 30 -0.57483333 -0.57483333 31 -0.57483333 -0.57483333 32 -0.57483333 -0.57483333 33 -0.57483333 -0.57483333 34 -0.57483333 -0.57483333 35 -0.36483333 -0.57483333 36 -0.32483333 -0.36483333 37 -0.32483333 -0.32483333 38 -0.12483333 -0.32483333 39 -0.07483333 -0.12483333 40 -0.07483333 -0.07483333 41 0.06516667 -0.07483333 42 0.17516667 0.06516667 43 0.35516667 0.17516667 44 0.42516667 0.35516667 45 0.59516667 0.42516667 46 0.67516667 0.59516667 47 0.81516667 0.67516667 48 0.92516667 0.81516667 49 0.92516667 0.92516667 50 1.07516667 0.92516667 51 1.17516667 1.07516667 52 1.17516667 1.17516667 53 1.32516667 1.17516667 54 1.42516667 1.32516667 55 1.42516667 1.42516667 56 1.42516667 1.42516667 57 1.42516667 1.42516667 58 1.42516667 1.42516667 59 1.42516667 1.42516667 60 0.22166667 1.42516667 61 0.22166667 0.22166667 62 0.22166667 0.22166667 63 0.22166667 0.22166667 64 0.22166667 0.22166667 65 0.22166667 0.22166667 66 0.40166667 0.22166667 67 0.47166667 0.40166667 68 0.47166667 0.47166667 69 -0.28833333 0.47166667 70 -0.85833333 -0.28833333 71 -1.52833333 -0.85833333 72 NA -1.52833333 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.17516667 0.17516667 [2,] -0.02483333 0.17516667 [3,] -0.07483333 -0.02483333 [4,] -0.07483333 -0.07483333 [5,] -0.47483333 -0.07483333 [6,] -0.57483333 -0.47483333 [7,] -0.57483333 -0.57483333 [8,] -0.57483333 -0.57483333 [9,] -0.57483333 -0.57483333 [10,] -0.57483333 -0.57483333 [11,] -0.57483333 -0.57483333 [12,] -0.57483333 -0.57483333 [13,] -0.57483333 -0.57483333 [14,] -0.57483333 -0.57483333 [15,] -0.57483333 -0.57483333 [16,] -0.57483333 -0.57483333 [17,] -0.57483333 -0.57483333 [18,] -0.57483333 -0.57483333 [19,] -0.57483333 -0.57483333 [20,] -0.57483333 -0.57483333 [21,] -0.57483333 -0.57483333 [22,] -0.57483333 -0.57483333 [23,] -0.57483333 -0.57483333 [24,] -0.57483333 -0.57483333 [25,] -0.57483333 -0.57483333 [26,] -0.57483333 -0.57483333 [27,] -0.57483333 -0.57483333 [28,] -0.57483333 -0.57483333 [29,] -0.57483333 -0.57483333 [30,] -0.57483333 -0.57483333 [31,] -0.57483333 -0.57483333 [32,] -0.57483333 -0.57483333 [33,] -0.57483333 -0.57483333 [34,] -0.57483333 -0.57483333 [35,] -0.36483333 -0.57483333 [36,] -0.32483333 -0.36483333 [37,] -0.32483333 -0.32483333 [38,] -0.12483333 -0.32483333 [39,] -0.07483333 -0.12483333 [40,] -0.07483333 -0.07483333 [41,] 0.06516667 -0.07483333 [42,] 0.17516667 0.06516667 [43,] 0.35516667 0.17516667 [44,] 0.42516667 0.35516667 [45,] 0.59516667 0.42516667 [46,] 0.67516667 0.59516667 [47,] 0.81516667 0.67516667 [48,] 0.92516667 0.81516667 [49,] 0.92516667 0.92516667 [50,] 1.07516667 0.92516667 [51,] 1.17516667 1.07516667 [52,] 1.17516667 1.17516667 [53,] 1.32516667 1.17516667 [54,] 1.42516667 1.32516667 [55,] 1.42516667 1.42516667 [56,] 1.42516667 1.42516667 [57,] 1.42516667 1.42516667 [58,] 1.42516667 1.42516667 [59,] 1.42516667 1.42516667 [60,] 0.22166667 1.42516667 [61,] 0.22166667 0.22166667 [62,] 0.22166667 0.22166667 [63,] 0.22166667 0.22166667 [64,] 0.22166667 0.22166667 [65,] 0.22166667 0.22166667 [66,] 0.40166667 0.22166667 [67,] 0.47166667 0.40166667 [68,] 0.47166667 0.47166667 [69,] -0.28833333 0.47166667 [70,] -0.85833333 -0.28833333 [71,] -1.52833333 -0.85833333 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.17516667 0.17516667 2 -0.02483333 0.17516667 3 -0.07483333 -0.02483333 4 -0.07483333 -0.07483333 5 -0.47483333 -0.07483333 6 -0.57483333 -0.47483333 7 -0.57483333 -0.57483333 8 -0.57483333 -0.57483333 9 -0.57483333 -0.57483333 10 -0.57483333 -0.57483333 11 -0.57483333 -0.57483333 12 -0.57483333 -0.57483333 13 -0.57483333 -0.57483333 14 -0.57483333 -0.57483333 15 -0.57483333 -0.57483333 16 -0.57483333 -0.57483333 17 -0.57483333 -0.57483333 18 -0.57483333 -0.57483333 19 -0.57483333 -0.57483333 20 -0.57483333 -0.57483333 21 -0.57483333 -0.57483333 22 -0.57483333 -0.57483333 23 -0.57483333 -0.57483333 24 -0.57483333 -0.57483333 25 -0.57483333 -0.57483333 26 -0.57483333 -0.57483333 27 -0.57483333 -0.57483333 28 -0.57483333 -0.57483333 29 -0.57483333 -0.57483333 30 -0.57483333 -0.57483333 31 -0.57483333 -0.57483333 32 -0.57483333 -0.57483333 33 -0.57483333 -0.57483333 34 -0.57483333 -0.57483333 35 -0.36483333 -0.57483333 36 -0.32483333 -0.36483333 37 -0.32483333 -0.32483333 38 -0.12483333 -0.32483333 39 -0.07483333 -0.12483333 40 -0.07483333 -0.07483333 41 0.06516667 -0.07483333 42 0.17516667 0.06516667 43 0.35516667 0.17516667 44 0.42516667 0.35516667 45 0.59516667 0.42516667 46 0.67516667 0.59516667 47 0.81516667 0.67516667 48 0.92516667 0.81516667 49 0.92516667 0.92516667 50 1.07516667 0.92516667 51 1.17516667 1.07516667 52 1.17516667 1.17516667 53 1.32516667 1.17516667 54 1.42516667 1.32516667 55 1.42516667 1.42516667 56 1.42516667 1.42516667 57 1.42516667 1.42516667 58 1.42516667 1.42516667 59 1.42516667 1.42516667 60 0.22166667 1.42516667 61 0.22166667 0.22166667 62 0.22166667 0.22166667 63 0.22166667 0.22166667 64 0.22166667 0.22166667 65 0.22166667 0.22166667 66 0.40166667 0.22166667 67 0.47166667 0.40166667 68 0.47166667 0.47166667 69 -0.28833333 0.47166667 70 -0.85833333 -0.28833333 71 -1.52833333 -0.85833333 > 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/79p4d1258654141.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/8luzm1258654141.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/9skxn1258654141.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/10vsb31258654141.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/11q2ym1258654141.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/12fdi81258654141.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/13t9el1258654142.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/14oedj1258654142.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/15e2qh1258654142.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/16y0w41258654142.tab") + } > > system("convert tmp/1mshj1258654141.ps tmp/1mshj1258654141.png") > system("convert tmp/23pb81258654141.ps tmp/23pb81258654141.png") > system("convert tmp/3anmj1258654141.ps tmp/3anmj1258654141.png") > system("convert tmp/4j41v1258654141.ps tmp/4j41v1258654141.png") > system("convert tmp/5fd6o1258654141.ps tmp/5fd6o1258654141.png") > system("convert tmp/6abz01258654141.ps tmp/6abz01258654141.png") > system("convert tmp/79p4d1258654141.ps tmp/79p4d1258654141.png") > system("convert tmp/8luzm1258654141.ps tmp/8luzm1258654141.png") > system("convert tmp/9skxn1258654141.ps tmp/9skxn1258654141.png") > system("convert tmp/10vsb31258654141.ps tmp/10vsb31258654141.png") > > > proc.time() user system elapsed 2.600 1.542 3.082