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(1.4,8.2,1.2,8.0,1.0,7.5,1.7,6.8,2.4,6.5,2.0,6.6,2.1,7.6,2.0,8.0,1.8,8.1,2.7,7.7,2.3,7.5,1.9,7.6,2.0,7.8,2.3,7.8,2.8,7.8,2.4,7.5,2.3,7.5,2.7,7.1,2.7,7.5,2.9,7.5,3.0,7.6,2.2,7.7,2.3,7.7,2.8,7.9,2.8,8.1,2.8,8.2,2.2,8.2,2.6,8.2,2.8,7.9,2.5,7.3,2.4,6.9,2.3,6.6,1.9,6.7,1.7,6.9,2.0,7.0,2.1,7.1,1.7,7.2,1.8,7.1,1.8,6.9,1.8,7.0,1.3,6.8,1.3,6.4,1.3,6.7,1.2,6.6,1.4,6.4,2.2,6.3,2.9,6.2,3.1,6.5,3.5,6.8,3.6,6.8,4.4,6.4,4.1,6.1,5.1,5.8,5.8,6.1,5.9,7.2,5.4,7.3,5.5,6.9,4.8,6.1,3.2,5.8,2.7,6.2,2.1,7.1,1.9,7.7,0.6,7.9,0.7,7.7),dim=c(2,64),dimnames=list(c('Y','X'),1:64)) > y <- array(NA,dim=c(2,64),dimnames=list(c('Y','X'),1:64)) > 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 1.4 8.2 1 0 0 0 0 0 0 0 0 0 0 1 2 1.2 8.0 0 1 0 0 0 0 0 0 0 0 0 2 3 1.0 7.5 0 0 1 0 0 0 0 0 0 0 0 3 4 1.7 6.8 0 0 0 1 0 0 0 0 0 0 0 4 5 2.4 6.5 0 0 0 0 1 0 0 0 0 0 0 5 6 2.0 6.6 0 0 0 0 0 1 0 0 0 0 0 6 7 2.1 7.6 0 0 0 0 0 0 1 0 0 0 0 7 8 2.0 8.0 0 0 0 0 0 0 0 1 0 0 0 8 9 1.8 8.1 0 0 0 0 0 0 0 0 1 0 0 9 10 2.7 7.7 0 0 0 0 0 0 0 0 0 1 0 10 11 2.3 7.5 0 0 0 0 0 0 0 0 0 0 1 11 12 1.9 7.6 0 0 0 0 0 0 0 0 0 0 0 12 13 2.0 7.8 1 0 0 0 0 0 0 0 0 0 0 13 14 2.3 7.8 0 1 0 0 0 0 0 0 0 0 0 14 15 2.8 7.8 0 0 1 0 0 0 0 0 0 0 0 15 16 2.4 7.5 0 0 0 1 0 0 0 0 0 0 0 16 17 2.3 7.5 0 0 0 0 1 0 0 0 0 0 0 17 18 2.7 7.1 0 0 0 0 0 1 0 0 0 0 0 18 19 2.7 7.5 0 0 0 0 0 0 1 0 0 0 0 19 20 2.9 7.5 0 0 0 0 0 0 0 1 0 0 0 20 21 3.0 7.6 0 0 0 0 0 0 0 0 1 0 0 21 22 2.2 7.7 0 0 0 0 0 0 0 0 0 1 0 22 23 2.3 7.7 0 0 0 0 0 0 0 0 0 0 1 23 24 2.8 7.9 0 0 0 0 0 0 0 0 0 0 0 24 25 2.8 8.1 1 0 0 0 0 0 0 0 0 0 0 25 26 2.8 8.2 0 1 0 0 0 0 0 0 0 0 0 26 27 2.2 8.2 0 0 1 0 0 0 0 0 0 0 0 27 28 2.6 8.2 0 0 0 1 0 0 0 0 0 0 0 28 29 2.8 7.9 0 0 0 0 1 0 0 0 0 0 0 29 30 2.5 7.3 0 0 0 0 0 1 0 0 0 0 0 30 31 2.4 6.9 0 0 0 0 0 0 1 0 0 0 0 31 32 2.3 6.6 0 0 0 0 0 0 0 1 0 0 0 32 33 1.9 6.7 0 0 0 0 0 0 0 0 1 0 0 33 34 1.7 6.9 0 0 0 0 0 0 0 0 0 1 0 34 35 2.0 7.0 0 0 0 0 0 0 0 0 0 0 1 35 36 2.1 7.1 0 0 0 0 0 0 0 0 0 0 0 36 37 1.7 7.2 1 0 0 0 0 0 0 0 0 0 0 37 38 1.8 7.1 0 1 0 0 0 0 0 0 0 0 0 38 39 1.8 6.9 0 0 1 0 0 0 0 0 0 0 0 39 40 1.8 7.0 0 0 0 1 0 0 0 0 0 0 0 40 41 1.3 6.8 0 0 0 0 1 0 0 0 0 0 0 41 42 1.3 6.4 0 0 0 0 0 1 0 0 0 0 0 42 43 1.3 6.7 0 0 0 0 0 0 1 0 0 0 0 43 44 1.2 6.6 0 0 0 0 0 0 0 1 0 0 0 44 45 1.4 6.4 0 0 0 0 0 0 0 0 1 0 0 45 46 2.2 6.3 0 0 0 0 0 0 0 0 0 1 0 46 47 2.9 6.2 0 0 0 0 0 0 0 0 0 0 1 47 48 3.1 6.5 0 0 0 0 0 0 0 0 0 0 0 48 49 3.5 6.8 1 0 0 0 0 0 0 0 0 0 0 49 50 3.6 6.8 0 1 0 0 0 0 0 0 0 0 0 50 51 4.4 6.4 0 0 1 0 0 0 0 0 0 0 0 51 52 4.1 6.1 0 0 0 1 0 0 0 0 0 0 0 52 53 5.1 5.8 0 0 0 0 1 0 0 0 0 0 0 53 54 5.8 6.1 0 0 0 0 0 1 0 0 0 0 0 54 55 5.9 7.2 0 0 0 0 0 0 1 0 0 0 0 55 56 5.4 7.3 0 0 0 0 0 0 0 1 0 0 0 56 57 5.5 6.9 0 0 0 0 0 0 0 0 1 0 0 57 58 4.8 6.1 0 0 0 0 0 0 0 0 0 1 0 58 59 3.2 5.8 0 0 0 0 0 0 0 0 0 0 1 59 60 2.7 6.2 0 0 0 0 0 0 0 0 0 0 0 60 61 2.1 7.1 1 0 0 0 0 0 0 0 0 0 0 61 62 1.9 7.7 0 1 0 0 0 0 0 0 0 0 0 62 63 0.6 7.9 0 0 1 0 0 0 0 0 0 0 0 63 64 0.7 7.7 0 0 0 1 0 0 0 0 0 0 0 64 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 3.198532 -0.200223 -0.073138 -0.063541 -0.247326 -0.231129 M5 M6 M7 M8 M9 M10 0.370890 0.390427 0.486116 0.349703 0.277272 0.216809 M11 t -0.003631 0.020418 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.05577 -0.56951 -0.03006 0.61839 2.53397 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.198532 2.465007 1.298 0.2004 X -0.200223 0.308151 -0.650 0.5188 M1 -0.073138 0.729866 -0.100 0.9206 M2 -0.063541 0.734145 -0.087 0.9314 M3 -0.247326 0.727078 -0.340 0.7352 M4 -0.231129 0.720530 -0.321 0.7497 M5 0.370890 0.759008 0.489 0.6272 M6 0.390427 0.767117 0.509 0.6130 M7 0.486116 0.752540 0.646 0.5213 M8 0.349703 0.752364 0.465 0.6441 M9 0.277272 0.751841 0.369 0.7138 M10 0.216809 0.753179 0.288 0.7746 M11 -0.003631 0.755071 -0.005 0.9962 t 0.020418 0.010032 2.035 0.0471 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.188 on 50 degrees of freedom Multiple R-squared: 0.2018, Adjusted R-squared: -0.005747 F-statistic: 0.9723 on 13 and 50 DF, p-value: 0.4905 > 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,] 6.003732e-02 1.200746e-01 0.9399627 [2,] 1.714960e-02 3.429920e-02 0.9828504 [3,] 5.233328e-03 1.046666e-02 0.9947667 [4,] 1.319566e-03 2.639131e-03 0.9986804 [5,] 3.178798e-04 6.357597e-04 0.9996821 [6,] 7.837367e-04 1.567473e-03 0.9992163 [7,] 3.328175e-04 6.656349e-04 0.9996672 [8,] 1.090579e-04 2.181157e-04 0.9998909 [9,] 3.265110e-05 6.530221e-05 0.9999673 [10,] 9.923243e-06 1.984649e-05 0.9999901 [11,] 4.831465e-06 9.662930e-06 0.9999952 [12,] 1.992543e-06 3.985085e-06 0.9999980 [13,] 7.595292e-07 1.519058e-06 0.9999992 [14,] 4.625141e-07 9.250282e-07 0.9999995 [15,] 7.479019e-07 1.495804e-06 0.9999993 [16,] 5.749440e-07 1.149888e-06 0.9999994 [17,] 4.202067e-07 8.404135e-07 0.9999996 [18,] 3.747344e-07 7.494689e-07 0.9999996 [19,] 1.903176e-07 3.806352e-07 0.9999998 [20,] 1.046339e-07 2.092678e-07 0.9999999 [21,] 4.489205e-08 8.978410e-08 1.0000000 [22,] 1.346173e-08 2.692347e-08 1.0000000 [23,] 3.637973e-09 7.275946e-09 1.0000000 [24,] 2.817279e-09 5.634558e-09 1.0000000 [25,] 5.317208e-09 1.063442e-08 1.0000000 [26,] 7.496510e-09 1.499302e-08 1.0000000 [27,] 1.010254e-07 2.020508e-07 0.9999999 [28,] 1.290356e-05 2.580712e-05 0.9999871 [29,] 5.399559e-02 1.079912e-01 0.9460044 [30,] 8.615717e-01 2.768566e-01 0.1384283 [31,] 7.952049e-01 4.095901e-01 0.2047951 > postscript(file="/var/www/html/rcomp/tmp/1k6rs1258664835.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/2b8fz1258664835.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/3t0w31258664835.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/4bsi91258664835.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/5c2yk1258664835.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 = 64 Frequency = 1 1 2 3 4 5 6 -0.10398027 -0.37403983 -0.51078466 0.01244445 0.02994067 -0.38999233 7 8 9 10 11 12 -0.20587620 -0.10979133 -0.23775559 0.62219974 0.38217741 -0.02184940 13 14 15 16 17 18 0.17091539 0.44090050 1.10426734 0.60758578 -0.11485100 0.16510434 19 20 21 22 23 24 0.12908647 0.44508200 0.61711774 -0.12281526 0.17720707 0.69320260 25 26 27 28 29 30 0.78596739 0.77597484 0.33934167 0.70272712 0.22022334 -0.23986600 31 32 33 34 35 36 -0.53606253 -0.58013400 -0.90809827 -1.02800893 -0.50796427 -0.41199107 37 38 39 40 41 42 -0.73924861 -0.68928584 -0.56596367 -0.58255589 -1.74503734 -1.86508200 43 44 45 46 47 48 -1.92112220 -1.92514900 -1.71318027 -0.89315794 -0.01315794 0.22285993 49 50 51 52 53 54 0.73564705 0.80563216 1.68890966 1.29222810 1.60972433 2.32983599 55 56 57 58 59 60 2.53397446 2.16999233 2.24191640 1.42178239 -0.03826227 -0.48222207 61 62 63 64 -0.84930095 -0.95918184 -2.05577033 -2.03242956 > postscript(file="/var/www/html/rcomp/tmp/6lrws1258664835.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 = 64 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.10398027 NA 1 -0.37403983 -0.10398027 2 -0.51078466 -0.37403983 3 0.01244445 -0.51078466 4 0.02994067 0.01244445 5 -0.38999233 0.02994067 6 -0.20587620 -0.38999233 7 -0.10979133 -0.20587620 8 -0.23775559 -0.10979133 9 0.62219974 -0.23775559 10 0.38217741 0.62219974 11 -0.02184940 0.38217741 12 0.17091539 -0.02184940 13 0.44090050 0.17091539 14 1.10426734 0.44090050 15 0.60758578 1.10426734 16 -0.11485100 0.60758578 17 0.16510434 -0.11485100 18 0.12908647 0.16510434 19 0.44508200 0.12908647 20 0.61711774 0.44508200 21 -0.12281526 0.61711774 22 0.17720707 -0.12281526 23 0.69320260 0.17720707 24 0.78596739 0.69320260 25 0.77597484 0.78596739 26 0.33934167 0.77597484 27 0.70272712 0.33934167 28 0.22022334 0.70272712 29 -0.23986600 0.22022334 30 -0.53606253 -0.23986600 31 -0.58013400 -0.53606253 32 -0.90809827 -0.58013400 33 -1.02800893 -0.90809827 34 -0.50796427 -1.02800893 35 -0.41199107 -0.50796427 36 -0.73924861 -0.41199107 37 -0.68928584 -0.73924861 38 -0.56596367 -0.68928584 39 -0.58255589 -0.56596367 40 -1.74503734 -0.58255589 41 -1.86508200 -1.74503734 42 -1.92112220 -1.86508200 43 -1.92514900 -1.92112220 44 -1.71318027 -1.92514900 45 -0.89315794 -1.71318027 46 -0.01315794 -0.89315794 47 0.22285993 -0.01315794 48 0.73564705 0.22285993 49 0.80563216 0.73564705 50 1.68890966 0.80563216 51 1.29222810 1.68890966 52 1.60972433 1.29222810 53 2.32983599 1.60972433 54 2.53397446 2.32983599 55 2.16999233 2.53397446 56 2.24191640 2.16999233 57 1.42178239 2.24191640 58 -0.03826227 1.42178239 59 -0.48222207 -0.03826227 60 -0.84930095 -0.48222207 61 -0.95918184 -0.84930095 62 -2.05577033 -0.95918184 63 -2.03242956 -2.05577033 64 NA -2.03242956 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.37403983 -0.10398027 [2,] -0.51078466 -0.37403983 [3,] 0.01244445 -0.51078466 [4,] 0.02994067 0.01244445 [5,] -0.38999233 0.02994067 [6,] -0.20587620 -0.38999233 [7,] -0.10979133 -0.20587620 [8,] -0.23775559 -0.10979133 [9,] 0.62219974 -0.23775559 [10,] 0.38217741 0.62219974 [11,] -0.02184940 0.38217741 [12,] 0.17091539 -0.02184940 [13,] 0.44090050 0.17091539 [14,] 1.10426734 0.44090050 [15,] 0.60758578 1.10426734 [16,] -0.11485100 0.60758578 [17,] 0.16510434 -0.11485100 [18,] 0.12908647 0.16510434 [19,] 0.44508200 0.12908647 [20,] 0.61711774 0.44508200 [21,] -0.12281526 0.61711774 [22,] 0.17720707 -0.12281526 [23,] 0.69320260 0.17720707 [24,] 0.78596739 0.69320260 [25,] 0.77597484 0.78596739 [26,] 0.33934167 0.77597484 [27,] 0.70272712 0.33934167 [28,] 0.22022334 0.70272712 [29,] -0.23986600 0.22022334 [30,] -0.53606253 -0.23986600 [31,] -0.58013400 -0.53606253 [32,] -0.90809827 -0.58013400 [33,] -1.02800893 -0.90809827 [34,] -0.50796427 -1.02800893 [35,] -0.41199107 -0.50796427 [36,] -0.73924861 -0.41199107 [37,] -0.68928584 -0.73924861 [38,] -0.56596367 -0.68928584 [39,] -0.58255589 -0.56596367 [40,] -1.74503734 -0.58255589 [41,] -1.86508200 -1.74503734 [42,] -1.92112220 -1.86508200 [43,] -1.92514900 -1.92112220 [44,] -1.71318027 -1.92514900 [45,] -0.89315794 -1.71318027 [46,] -0.01315794 -0.89315794 [47,] 0.22285993 -0.01315794 [48,] 0.73564705 0.22285993 [49,] 0.80563216 0.73564705 [50,] 1.68890966 0.80563216 [51,] 1.29222810 1.68890966 [52,] 1.60972433 1.29222810 [53,] 2.32983599 1.60972433 [54,] 2.53397446 2.32983599 [55,] 2.16999233 2.53397446 [56,] 2.24191640 2.16999233 [57,] 1.42178239 2.24191640 [58,] -0.03826227 1.42178239 [59,] -0.48222207 -0.03826227 [60,] -0.84930095 -0.48222207 [61,] -0.95918184 -0.84930095 [62,] -2.05577033 -0.95918184 [63,] -2.03242956 -2.05577033 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.37403983 -0.10398027 2 -0.51078466 -0.37403983 3 0.01244445 -0.51078466 4 0.02994067 0.01244445 5 -0.38999233 0.02994067 6 -0.20587620 -0.38999233 7 -0.10979133 -0.20587620 8 -0.23775559 -0.10979133 9 0.62219974 -0.23775559 10 0.38217741 0.62219974 11 -0.02184940 0.38217741 12 0.17091539 -0.02184940 13 0.44090050 0.17091539 14 1.10426734 0.44090050 15 0.60758578 1.10426734 16 -0.11485100 0.60758578 17 0.16510434 -0.11485100 18 0.12908647 0.16510434 19 0.44508200 0.12908647 20 0.61711774 0.44508200 21 -0.12281526 0.61711774 22 0.17720707 -0.12281526 23 0.69320260 0.17720707 24 0.78596739 0.69320260 25 0.77597484 0.78596739 26 0.33934167 0.77597484 27 0.70272712 0.33934167 28 0.22022334 0.70272712 29 -0.23986600 0.22022334 30 -0.53606253 -0.23986600 31 -0.58013400 -0.53606253 32 -0.90809827 -0.58013400 33 -1.02800893 -0.90809827 34 -0.50796427 -1.02800893 35 -0.41199107 -0.50796427 36 -0.73924861 -0.41199107 37 -0.68928584 -0.73924861 38 -0.56596367 -0.68928584 39 -0.58255589 -0.56596367 40 -1.74503734 -0.58255589 41 -1.86508200 -1.74503734 42 -1.92112220 -1.86508200 43 -1.92514900 -1.92112220 44 -1.71318027 -1.92514900 45 -0.89315794 -1.71318027 46 -0.01315794 -0.89315794 47 0.22285993 -0.01315794 48 0.73564705 0.22285993 49 0.80563216 0.73564705 50 1.68890966 0.80563216 51 1.29222810 1.68890966 52 1.60972433 1.29222810 53 2.32983599 1.60972433 54 2.53397446 2.32983599 55 2.16999233 2.53397446 56 2.24191640 2.16999233 57 1.42178239 2.24191640 58 -0.03826227 1.42178239 59 -0.48222207 -0.03826227 60 -0.84930095 -0.48222207 61 -0.95918184 -0.84930095 62 -2.05577033 -0.95918184 63 -2.03242956 -2.05577033 > 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/7h1ta1258664835.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/8wv1n1258664835.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/9m2i31258664835.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/10n4g21258664835.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/11hk9n1258664835.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/12cnll1258664835.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/13zs0h1258664835.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/14ivww1258664835.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/1547j91258664835.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/16xt091258664835.tab") + } > > system("convert tmp/1k6rs1258664835.ps tmp/1k6rs1258664835.png") > system("convert tmp/2b8fz1258664835.ps tmp/2b8fz1258664835.png") > system("convert tmp/3t0w31258664835.ps tmp/3t0w31258664835.png") > system("convert tmp/4bsi91258664835.ps tmp/4bsi91258664835.png") > system("convert tmp/5c2yk1258664835.ps tmp/5c2yk1258664835.png") > system("convert tmp/6lrws1258664835.ps tmp/6lrws1258664835.png") > system("convert tmp/7h1ta1258664835.ps tmp/7h1ta1258664835.png") > system("convert tmp/8wv1n1258664835.ps tmp/8wv1n1258664835.png") > system("convert tmp/9m2i31258664835.ps tmp/9m2i31258664835.png") > system("convert tmp/10n4g21258664835.ps tmp/10n4g21258664835.png") > > > proc.time() user system elapsed 2.460 1.557 2.840