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(115.6,0,111.3,0,114.6,0,137.5,0,83.7,0,106.0,0,123.4,0,126.5,0,120.0,0,141.6,0,90.5,0,96.5,0,113.5,0,120.1,0,123.9,0,144.4,0,90.8,0,114.2,0,138.1,0,135.0,0,131.3,0,144.6,0,101.7,0,108.7,0,135.3,0,124.3,0,138.3,0,158.2,0,93.5,0,124.8,0,154.4,0,152.8,0,148.9,0,170.3,0,124.8,0,134.4,0,154.0,0,147.9,0,168.1,0,175.7,0,116.7,0,140.8,0,164.2,0,173.8,0,167.8,0,166.6,0,135.1,1,158.1,1,151.8,1,166.7,1,165.3,1,187.0,1,125.2,1,144.4,1,181.7,1,175.9,1,166.3,1,181.5,1,121.8,1,134.8,1,162.9,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 115.6 0 1 0 0 0 0 0 0 0 0 0 0 1 2 111.3 0 0 1 0 0 0 0 0 0 0 0 0 2 3 114.6 0 0 0 1 0 0 0 0 0 0 0 0 3 4 137.5 0 0 0 0 1 0 0 0 0 0 0 0 4 5 83.7 0 0 0 0 0 1 0 0 0 0 0 0 5 6 106.0 0 0 0 0 0 0 1 0 0 0 0 0 6 7 123.4 0 0 0 0 0 0 0 1 0 0 0 0 7 8 126.5 0 0 0 0 0 0 0 0 1 0 0 0 8 9 120.0 0 0 0 0 0 0 0 0 0 1 0 0 9 10 141.6 0 0 0 0 0 0 0 0 0 0 1 0 10 11 90.5 0 0 0 0 0 0 0 0 0 0 0 1 11 12 96.5 0 0 0 0 0 0 0 0 0 0 0 0 12 13 113.5 0 1 0 0 0 0 0 0 0 0 0 0 13 14 120.1 0 0 1 0 0 0 0 0 0 0 0 0 14 15 123.9 0 0 0 1 0 0 0 0 0 0 0 0 15 16 144.4 0 0 0 0 1 0 0 0 0 0 0 0 16 17 90.8 0 0 0 0 0 1 0 0 0 0 0 0 17 18 114.2 0 0 0 0 0 0 1 0 0 0 0 0 18 19 138.1 0 0 0 0 0 0 0 1 0 0 0 0 19 20 135.0 0 0 0 0 0 0 0 0 1 0 0 0 20 21 131.3 0 0 0 0 0 0 0 0 0 1 0 0 21 22 144.6 0 0 0 0 0 0 0 0 0 0 1 0 22 23 101.7 0 0 0 0 0 0 0 0 0 0 0 1 23 24 108.7 0 0 0 0 0 0 0 0 0 0 0 0 24 25 135.3 0 1 0 0 0 0 0 0 0 0 0 0 25 26 124.3 0 0 1 0 0 0 0 0 0 0 0 0 26 27 138.3 0 0 0 1 0 0 0 0 0 0 0 0 27 28 158.2 0 0 0 0 1 0 0 0 0 0 0 0 28 29 93.5 0 0 0 0 0 1 0 0 0 0 0 0 29 30 124.8 0 0 0 0 0 0 1 0 0 0 0 0 30 31 154.4 0 0 0 0 0 0 0 1 0 0 0 0 31 32 152.8 0 0 0 0 0 0 0 0 1 0 0 0 32 33 148.9 0 0 0 0 0 0 0 0 0 1 0 0 33 34 170.3 0 0 0 0 0 0 0 0 0 0 1 0 34 35 124.8 0 0 0 0 0 0 0 0 0 0 0 1 35 36 134.4 0 0 0 0 0 0 0 0 0 0 0 0 36 37 154.0 0 1 0 0 0 0 0 0 0 0 0 0 37 38 147.9 0 0 1 0 0 0 0 0 0 0 0 0 38 39 168.1 0 0 0 1 0 0 0 0 0 0 0 0 39 40 175.7 0 0 0 0 1 0 0 0 0 0 0 0 40 41 116.7 0 0 0 0 0 1 0 0 0 0 0 0 41 42 140.8 0 0 0 0 0 0 1 0 0 0 0 0 42 43 164.2 0 0 0 0 0 0 0 1 0 0 0 0 43 44 173.8 0 0 0 0 0 0 0 0 1 0 0 0 44 45 167.8 0 0 0 0 0 0 0 0 0 1 0 0 45 46 166.6 0 0 0 0 0 0 0 0 0 0 1 0 46 47 135.1 1 0 0 0 0 0 0 0 0 0 0 1 47 48 158.1 1 0 0 0 0 0 0 0 0 0 0 0 48 49 151.8 1 1 0 0 0 0 0 0 0 0 0 0 49 50 166.7 1 0 1 0 0 0 0 0 0 0 0 0 50 51 165.3 1 0 0 1 0 0 0 0 0 0 0 0 51 52 187.0 1 0 0 0 1 0 0 0 0 0 0 0 52 53 125.2 1 0 0 0 0 1 0 0 0 0 0 0 53 54 144.4 1 0 0 0 0 0 1 0 0 0 0 0 54 55 181.7 1 0 0 0 0 0 0 1 0 0 0 0 55 56 175.9 1 0 0 0 0 0 0 0 1 0 0 0 56 57 166.3 1 0 0 0 0 0 0 0 0 1 0 0 57 58 181.5 1 0 0 0 0 0 0 0 0 0 1 0 58 59 121.8 1 0 0 0 0 0 0 0 0 0 0 1 59 60 134.8 1 0 0 0 0 0 0 0 0 0 0 0 60 61 162.9 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 89.135 -3.905 17.496 17.592 24.491 41.929 M5 M6 M7 M8 M9 M10 -17.732 5.247 30.485 29.844 22.823 35.802 M11 t -10.639 1.081 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -16.58814 -3.90991 0.08319 3.61296 20.96758 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 89.13505 3.91895 22.745 < 2e-16 *** X -3.90549 3.35854 -1.163 0.250759 M1 17.49618 4.45735 3.925 0.000282 *** M2 17.59200 4.67799 3.761 0.000469 *** M3 24.49069 4.67317 5.241 3.71e-06 *** M4 41.92938 4.66979 8.979 9.19e-12 *** M5 -17.73193 4.66784 -3.799 0.000417 *** M6 5.24676 4.66733 1.124 0.266660 M7 30.48545 4.66826 6.530 4.22e-08 *** M8 29.84414 4.67063 6.390 6.90e-08 *** M9 22.82283 4.67443 4.882 1.25e-05 *** M10 35.80152 4.67967 7.650 8.51e-10 *** M11 -10.63869 4.64684 -2.289 0.026590 * t 1.08131 0.08196 13.193 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 7.346 on 47 degrees of freedom Multiple R-squared: 0.9362, Adjusted R-squared: 0.9185 F-statistic: 53.04 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,] 0.1080333452 0.216066690 0.8919667 [2,] 0.0415320794 0.083064159 0.9584679 [3,] 0.0406147034 0.081229407 0.9593853 [4,] 0.0160532538 0.032106508 0.9839467 [5,] 0.0071637913 0.014327583 0.9928362 [6,] 0.0038794074 0.007758815 0.9961206 [7,] 0.0016678804 0.003335761 0.9983321 [8,] 0.0009850352 0.001970070 0.9990150 [9,] 0.0012665690 0.002533138 0.9987334 [10,] 0.0014105182 0.002821036 0.9985895 [11,] 0.0015809567 0.003161913 0.9984190 [12,] 0.0010161590 0.002032318 0.9989838 [13,] 0.0026476998 0.005295400 0.9973523 [14,] 0.0015338502 0.003067700 0.9984661 [15,] 0.0040364514 0.008072903 0.9959635 [16,] 0.0114573151 0.022914630 0.9885427 [17,] 0.0391291026 0.078258205 0.9608709 [18,] 0.0616888056 0.123377611 0.9383112 [19,] 0.0777238753 0.155447751 0.9222761 [20,] 0.1308935386 0.261787077 0.8691065 [21,] 0.1037624201 0.207524840 0.8962376 [22,] 0.1021934681 0.204386936 0.8978065 [23,] 0.1826544110 0.365308822 0.8173456 [24,] 0.1212498025 0.242499605 0.8787502 [25,] 0.0708575389 0.141715078 0.9291425 [26,] 0.0401345948 0.080269190 0.9598654 [27,] 0.0321948031 0.064389606 0.9678052 [28,] 0.0178383598 0.035676720 0.9821616 > postscript(file="/var/www/html/rcomp/tmp/1xjr01258578617.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/2te1g1258578617.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/3jm281258578617.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/43ynv1258578617.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/5r31u1258578617.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 7.8874590 2.4103333 -2.2696667 2.1103333 6.8903333 5.1303333 7 8 9 10 11 12 -3.7896667 -1.1296667 -1.6896667 5.8503333 0.1092350 -5.6107650 13 14 15 16 17 18 -7.1882568 -1.7653825 -5.9453825 -3.9653825 1.0146175 0.3546175 19 20 21 22 23 24 -2.0653825 -5.6053825 -3.3653825 -4.1253825 -1.6664809 -6.3864809 25 26 27 28 29 30 1.6360273 -10.5410984 -4.5210984 -3.1410984 -9.2610984 -2.0210984 31 32 33 34 35 36 1.2589016 -0.7810984 1.2589016 8.5989016 8.4578033 6.3378033 37 38 39 40 41 42 7.3603115 0.0831858 12.3031858 1.3831858 0.9631858 1.0031858 43 44 45 46 47 48 -1.9168142 7.2431858 7.1831858 -8.0768142 9.6875792 20.9675792 49 50 51 52 53 54 -3.9099126 9.8129617 0.4329617 3.6129617 0.3929617 -4.4670383 55 56 57 58 59 60 6.5129617 0.2729617 -3.3870383 -2.2470383 -16.5881366 -15.3081366 61 -5.7856284 > postscript(file="/var/www/html/rcomp/tmp/6a3oe1258578617.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 7.8874590 NA 1 2.4103333 7.8874590 2 -2.2696667 2.4103333 3 2.1103333 -2.2696667 4 6.8903333 2.1103333 5 5.1303333 6.8903333 6 -3.7896667 5.1303333 7 -1.1296667 -3.7896667 8 -1.6896667 -1.1296667 9 5.8503333 -1.6896667 10 0.1092350 5.8503333 11 -5.6107650 0.1092350 12 -7.1882568 -5.6107650 13 -1.7653825 -7.1882568 14 -5.9453825 -1.7653825 15 -3.9653825 -5.9453825 16 1.0146175 -3.9653825 17 0.3546175 1.0146175 18 -2.0653825 0.3546175 19 -5.6053825 -2.0653825 20 -3.3653825 -5.6053825 21 -4.1253825 -3.3653825 22 -1.6664809 -4.1253825 23 -6.3864809 -1.6664809 24 1.6360273 -6.3864809 25 -10.5410984 1.6360273 26 -4.5210984 -10.5410984 27 -3.1410984 -4.5210984 28 -9.2610984 -3.1410984 29 -2.0210984 -9.2610984 30 1.2589016 -2.0210984 31 -0.7810984 1.2589016 32 1.2589016 -0.7810984 33 8.5989016 1.2589016 34 8.4578033 8.5989016 35 6.3378033 8.4578033 36 7.3603115 6.3378033 37 0.0831858 7.3603115 38 12.3031858 0.0831858 39 1.3831858 12.3031858 40 0.9631858 1.3831858 41 1.0031858 0.9631858 42 -1.9168142 1.0031858 43 7.2431858 -1.9168142 44 7.1831858 7.2431858 45 -8.0768142 7.1831858 46 9.6875792 -8.0768142 47 20.9675792 9.6875792 48 -3.9099126 20.9675792 49 9.8129617 -3.9099126 50 0.4329617 9.8129617 51 3.6129617 0.4329617 52 0.3929617 3.6129617 53 -4.4670383 0.3929617 54 6.5129617 -4.4670383 55 0.2729617 6.5129617 56 -3.3870383 0.2729617 57 -2.2470383 -3.3870383 58 -16.5881366 -2.2470383 59 -15.3081366 -16.5881366 60 -5.7856284 -15.3081366 61 NA -5.7856284 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 2.4103333 7.8874590 [2,] -2.2696667 2.4103333 [3,] 2.1103333 -2.2696667 [4,] 6.8903333 2.1103333 [5,] 5.1303333 6.8903333 [6,] -3.7896667 5.1303333 [7,] -1.1296667 -3.7896667 [8,] -1.6896667 -1.1296667 [9,] 5.8503333 -1.6896667 [10,] 0.1092350 5.8503333 [11,] -5.6107650 0.1092350 [12,] -7.1882568 -5.6107650 [13,] -1.7653825 -7.1882568 [14,] -5.9453825 -1.7653825 [15,] -3.9653825 -5.9453825 [16,] 1.0146175 -3.9653825 [17,] 0.3546175 1.0146175 [18,] -2.0653825 0.3546175 [19,] -5.6053825 -2.0653825 [20,] -3.3653825 -5.6053825 [21,] -4.1253825 -3.3653825 [22,] -1.6664809 -4.1253825 [23,] -6.3864809 -1.6664809 [24,] 1.6360273 -6.3864809 [25,] -10.5410984 1.6360273 [26,] -4.5210984 -10.5410984 [27,] -3.1410984 -4.5210984 [28,] -9.2610984 -3.1410984 [29,] -2.0210984 -9.2610984 [30,] 1.2589016 -2.0210984 [31,] -0.7810984 1.2589016 [32,] 1.2589016 -0.7810984 [33,] 8.5989016 1.2589016 [34,] 8.4578033 8.5989016 [35,] 6.3378033 8.4578033 [36,] 7.3603115 6.3378033 [37,] 0.0831858 7.3603115 [38,] 12.3031858 0.0831858 [39,] 1.3831858 12.3031858 [40,] 0.9631858 1.3831858 [41,] 1.0031858 0.9631858 [42,] -1.9168142 1.0031858 [43,] 7.2431858 -1.9168142 [44,] 7.1831858 7.2431858 [45,] -8.0768142 7.1831858 [46,] 9.6875792 -8.0768142 [47,] 20.9675792 9.6875792 [48,] -3.9099126 20.9675792 [49,] 9.8129617 -3.9099126 [50,] 0.4329617 9.8129617 [51,] 3.6129617 0.4329617 [52,] 0.3929617 3.6129617 [53,] -4.4670383 0.3929617 [54,] 6.5129617 -4.4670383 [55,] 0.2729617 6.5129617 [56,] -3.3870383 0.2729617 [57,] -2.2470383 -3.3870383 [58,] -16.5881366 -2.2470383 [59,] -15.3081366 -16.5881366 [60,] -5.7856284 -15.3081366 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 2.4103333 7.8874590 2 -2.2696667 2.4103333 3 2.1103333 -2.2696667 4 6.8903333 2.1103333 5 5.1303333 6.8903333 6 -3.7896667 5.1303333 7 -1.1296667 -3.7896667 8 -1.6896667 -1.1296667 9 5.8503333 -1.6896667 10 0.1092350 5.8503333 11 -5.6107650 0.1092350 12 -7.1882568 -5.6107650 13 -1.7653825 -7.1882568 14 -5.9453825 -1.7653825 15 -3.9653825 -5.9453825 16 1.0146175 -3.9653825 17 0.3546175 1.0146175 18 -2.0653825 0.3546175 19 -5.6053825 -2.0653825 20 -3.3653825 -5.6053825 21 -4.1253825 -3.3653825 22 -1.6664809 -4.1253825 23 -6.3864809 -1.6664809 24 1.6360273 -6.3864809 25 -10.5410984 1.6360273 26 -4.5210984 -10.5410984 27 -3.1410984 -4.5210984 28 -9.2610984 -3.1410984 29 -2.0210984 -9.2610984 30 1.2589016 -2.0210984 31 -0.7810984 1.2589016 32 1.2589016 -0.7810984 33 8.5989016 1.2589016 34 8.4578033 8.5989016 35 6.3378033 8.4578033 36 7.3603115 6.3378033 37 0.0831858 7.3603115 38 12.3031858 0.0831858 39 1.3831858 12.3031858 40 0.9631858 1.3831858 41 1.0031858 0.9631858 42 -1.9168142 1.0031858 43 7.2431858 -1.9168142 44 7.1831858 7.2431858 45 -8.0768142 7.1831858 46 9.6875792 -8.0768142 47 20.9675792 9.6875792 48 -3.9099126 20.9675792 49 9.8129617 -3.9099126 50 0.4329617 9.8129617 51 3.6129617 0.4329617 52 0.3929617 3.6129617 53 -4.4670383 0.3929617 54 6.5129617 -4.4670383 55 0.2729617 6.5129617 56 -3.3870383 0.2729617 57 -2.2470383 -3.3870383 58 -16.5881366 -2.2470383 59 -15.3081366 -16.5881366 60 -5.7856284 -15.3081366 > 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/77c5x1258578617.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/8u7ei1258578617.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/9v67d1258578617.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/104apj1258578617.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/1114oy1258578617.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/128vg41258578617.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/13p1er1258578617.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/14fxo21258578617.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/15svwv1258578617.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/165ni51258578617.tab") + } > system("convert tmp/1xjr01258578617.ps tmp/1xjr01258578617.png") > system("convert tmp/2te1g1258578617.ps tmp/2te1g1258578617.png") > system("convert tmp/3jm281258578617.ps tmp/3jm281258578617.png") > system("convert tmp/43ynv1258578617.ps tmp/43ynv1258578617.png") > system("convert tmp/5r31u1258578617.ps tmp/5r31u1258578617.png") > system("convert tmp/6a3oe1258578617.ps tmp/6a3oe1258578617.png") > system("convert tmp/77c5x1258578617.ps tmp/77c5x1258578617.png") > system("convert tmp/8u7ei1258578617.ps tmp/8u7ei1258578617.png") > system("convert tmp/9v67d1258578617.ps tmp/9v67d1258578617.png") > system("convert tmp/104apj1258578617.ps tmp/104apj1258578617.png") > > > proc.time() user system elapsed 2.398 1.550 3.449