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(112.3,0,117.3,0,111.1,1,102.2,1,104.3,1,122.9,1,107.6,1,121.3,1,131.5,1,89,1,104.4,1,128.9,1,135.9,1,133.3,1,121.3,1,120.5,0,120.4,0,137.9,0,126.1,0,133.2,0,151.1,0,105,0,119,0,140.4,0,156.6,0,137.1,0,122.7,0,125.8,0,139.3,0,134.9,0,149.2,0,132.3,0,149,0,117.2,0,119.6,0,152,0,149.4,0,127.3,0,114.1,0,102.1,0,107.7,0,104.4,0,102.1,0,96,1,109.3,0,90,1,83.9,1,112,1,114.3,1,103.6,1,91.7,1,80.8,1,87.2,1,109.2,1,102.7,1,95.1,1,117.5,1,85.1,1,92.1,1,113.5,1),dim=c(2,60),dimnames=list(c('Promet','Dummy'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Promet','Dummy'),1:60)) > 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 Promet Dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 112.3 0 1 0 0 0 0 0 0 0 0 0 0 1 2 117.3 0 0 1 0 0 0 0 0 0 0 0 0 2 3 111.1 1 0 0 1 0 0 0 0 0 0 0 0 3 4 102.2 1 0 0 0 1 0 0 0 0 0 0 0 4 5 104.3 1 0 0 0 0 1 0 0 0 0 0 0 5 6 122.9 1 0 0 0 0 0 1 0 0 0 0 0 6 7 107.6 1 0 0 0 0 0 0 1 0 0 0 0 7 8 121.3 1 0 0 0 0 0 0 0 1 0 0 0 8 9 131.5 1 0 0 0 0 0 0 0 0 1 0 0 9 10 89.0 1 0 0 0 0 0 0 0 0 0 1 0 10 11 104.4 1 0 0 0 0 0 0 0 0 0 0 1 11 12 128.9 1 0 0 0 0 0 0 0 0 0 0 0 12 13 135.9 1 1 0 0 0 0 0 0 0 0 0 0 13 14 133.3 1 0 1 0 0 0 0 0 0 0 0 0 14 15 121.3 1 0 0 1 0 0 0 0 0 0 0 0 15 16 120.5 0 0 0 0 1 0 0 0 0 0 0 0 16 17 120.4 0 0 0 0 0 1 0 0 0 0 0 0 17 18 137.9 0 0 0 0 0 0 1 0 0 0 0 0 18 19 126.1 0 0 0 0 0 0 0 1 0 0 0 0 19 20 133.2 0 0 0 0 0 0 0 0 1 0 0 0 20 21 151.1 0 0 0 0 0 0 0 0 0 1 0 0 21 22 105.0 0 0 0 0 0 0 0 0 0 0 1 0 22 23 119.0 0 0 0 0 0 0 0 0 0 0 0 1 23 24 140.4 0 0 0 0 0 0 0 0 0 0 0 0 24 25 156.6 0 1 0 0 0 0 0 0 0 0 0 0 25 26 137.1 0 0 1 0 0 0 0 0 0 0 0 0 26 27 122.7 0 0 0 1 0 0 0 0 0 0 0 0 27 28 125.8 0 0 0 0 1 0 0 0 0 0 0 0 28 29 139.3 0 0 0 0 0 1 0 0 0 0 0 0 29 30 134.9 0 0 0 0 0 0 1 0 0 0 0 0 30 31 149.2 0 0 0 0 0 0 0 1 0 0 0 0 31 32 132.3 0 0 0 0 0 0 0 0 1 0 0 0 32 33 149.0 0 0 0 0 0 0 0 0 0 1 0 0 33 34 117.2 0 0 0 0 0 0 0 0 0 0 1 0 34 35 119.6 0 0 0 0 0 0 0 0 0 0 0 1 35 36 152.0 0 0 0 0 0 0 0 0 0 0 0 0 36 37 149.4 0 1 0 0 0 0 0 0 0 0 0 0 37 38 127.3 0 0 1 0 0 0 0 0 0 0 0 0 38 39 114.1 0 0 0 1 0 0 0 0 0 0 0 0 39 40 102.1 0 0 0 0 1 0 0 0 0 0 0 0 40 41 107.7 0 0 0 0 0 1 0 0 0 0 0 0 41 42 104.4 0 0 0 0 0 0 1 0 0 0 0 0 42 43 102.1 0 0 0 0 0 0 0 1 0 0 0 0 43 44 96.0 1 0 0 0 0 0 0 0 1 0 0 0 44 45 109.3 0 0 0 0 0 0 0 0 0 1 0 0 45 46 90.0 1 0 0 0 0 0 0 0 0 0 1 0 46 47 83.9 1 0 0 0 0 0 0 0 0 0 0 1 47 48 112.0 1 0 0 0 0 0 0 0 0 0 0 0 48 49 114.3 1 1 0 0 0 0 0 0 0 0 0 0 49 50 103.6 1 0 1 0 0 0 0 0 0 0 0 0 50 51 91.7 1 0 0 1 0 0 0 0 0 0 0 0 51 52 80.8 1 0 0 0 1 0 0 0 0 0 0 0 52 53 87.2 1 0 0 0 0 1 0 0 0 0 0 0 53 54 109.2 1 0 0 0 0 0 1 0 0 0 0 0 54 55 102.7 1 0 0 0 0 0 0 1 0 0 0 0 55 56 95.1 1 0 0 0 0 0 0 0 1 0 0 0 56 57 117.5 1 0 0 0 0 0 0 0 0 1 0 0 57 58 85.1 1 0 0 0 0 0 0 0 0 0 1 0 58 59 92.1 1 0 0 0 0 0 0 0 0 0 0 1 59 60 113.5 1 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Dummy M1 M2 M3 M4 152.0629 -18.0166 -2.8973 -12.5469 -20.1532 -29.3262 M5 M6 M7 M8 M9 M10 -23.4958 -13.0855 -17.0751 -15.1014 -2.2744 -32.7607 M11 t -25.8904 -0.3304 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -36.5352 -5.4689 0.1078 5.8525 24.4534 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 152.0629 6.5178 23.331 < 2e-16 *** Dummy -18.0166 3.2078 -5.616 1.08e-06 *** M1 -2.8973 7.7270 -0.375 0.709417 M2 -12.5469 7.7162 -1.626 0.110773 M3 -20.1532 7.6882 -2.621 0.011833 * M4 -29.3262 7.6980 -3.810 0.000411 *** M5 -23.4958 7.6906 -3.055 0.003736 ** M6 -13.0855 7.6843 -1.703 0.095338 . M7 -17.0751 7.6791 -2.224 0.031128 * M8 -15.1014 7.6519 -1.974 0.054456 . M9 -2.2744 7.6720 -0.296 0.768219 M10 -32.7607 7.6451 -4.285 9.23e-05 *** M11 -25.8904 7.6434 -3.387 0.001455 ** t -0.3304 0.0926 -3.568 0.000855 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 12.08 on 46 degrees of freedom Multiple R-squared: 0.6836, Adjusted R-squared: 0.5941 F-statistic: 7.644 on 13 and 46 DF, p-value: 9.702e-08 > 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,] 5.555878e-02 1.111176e-01 0.94444122 [2,] 1.543921e-02 3.087842e-02 0.98456079 [3,] 5.283868e-03 1.056774e-02 0.99471613 [4,] 1.897092e-03 3.794185e-03 0.99810291 [5,] 6.909051e-04 1.381810e-03 0.99930909 [6,] 2.532100e-04 5.064200e-04 0.99974679 [7,] 7.066492e-05 1.413298e-04 0.99992934 [8,] 4.577111e-05 9.154222e-05 0.99995423 [9,] 7.456359e-05 1.491272e-04 0.99992544 [10,] 8.899209e-04 1.779842e-03 0.99911008 [11,] 4.967729e-03 9.935459e-03 0.99503227 [12,] 3.274111e-03 6.548222e-03 0.99672589 [13,] 2.776067e-03 5.552134e-03 0.99722393 [14,] 7.016934e-03 1.403387e-02 0.99298307 [15,] 1.957598e-02 3.915196e-02 0.98042402 [16,] 3.234037e-02 6.468074e-02 0.96765963 [17,] 5.141607e-02 1.028321e-01 0.94858393 [18,] 3.429051e-02 6.858102e-02 0.96570949 [19,] 3.607855e-02 7.215709e-02 0.96392145 [20,] 7.779659e-02 1.555932e-01 0.92220341 [21,] 1.702635e-01 3.405270e-01 0.82973648 [22,] 3.540613e-01 7.081225e-01 0.64593874 [23,] 5.448586e-01 9.102829e-01 0.45514143 [24,] 7.932891e-01 4.134218e-01 0.20671092 [25,] 9.896964e-01 2.060722e-02 0.01030361 [26,] 9.801715e-01 3.965697e-02 0.01982848 [27,] 9.641246e-01 7.175081e-02 0.03587541 > postscript(file="/var/www/html/rcomp/tmp/12hpj1291725674.ps",horizontal=F,onefile=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/22hpj1291725674.ps",horizontal=F,onefile=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/32hpj1291725674.ps",horizontal=F,onefile=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/4dqom1291725674.ps",horizontal=F,onefile=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/5dqom1291725674.ps",horizontal=F,onefile=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 = 60 Frequency = 1 1 2 3 4 5 6 -36.5352437 -21.5552437 -1.8019965 -1.1986847 -4.5986847 3.9213153 7 8 9 10 11 12 -7.0586847 4.9980035 2.7013153 -8.9819965 -0.1219965 -1.1819965 13 14 15 16 17 18 9.0456254 16.4256254 12.3623136 3.0490664 -2.5509336 4.8690664 19 20 21 22 23 24 -2.6109336 2.8457546 8.2490664 -7.0342454 0.4257546 -3.7342454 25 26 27 28 29 30 15.6933764 6.1733764 -0.2899354 12.3133764 20.3133764 5.8333764 31 32 33 34 35 36 24.4533764 5.9100646 10.1133764 9.1300646 4.9900646 11.8300646 37 38 39 40 41 42 12.4576864 0.3376864 -4.9256254 -7.4223136 -7.3223136 -20.7023136 43 44 45 46 47 48 -18.6823136 -8.4090664 -25.6223136 3.9109336 -8.7290664 -6.1890664 49 50 51 52 53 54 -0.6614445 -1.3814445 -5.3447563 -6.7414445 -5.8414445 6.0785555 55 56 57 58 59 60 3.8985555 -5.3447563 4.5585555 2.9752437 3.4352437 -0.7247563 > postscript(file="/var/www/html/rcomp/tmp/6dqom1291725674.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -36.5352437 NA 1 -21.5552437 -36.5352437 2 -1.8019965 -21.5552437 3 -1.1986847 -1.8019965 4 -4.5986847 -1.1986847 5 3.9213153 -4.5986847 6 -7.0586847 3.9213153 7 4.9980035 -7.0586847 8 2.7013153 4.9980035 9 -8.9819965 2.7013153 10 -0.1219965 -8.9819965 11 -1.1819965 -0.1219965 12 9.0456254 -1.1819965 13 16.4256254 9.0456254 14 12.3623136 16.4256254 15 3.0490664 12.3623136 16 -2.5509336 3.0490664 17 4.8690664 -2.5509336 18 -2.6109336 4.8690664 19 2.8457546 -2.6109336 20 8.2490664 2.8457546 21 -7.0342454 8.2490664 22 0.4257546 -7.0342454 23 -3.7342454 0.4257546 24 15.6933764 -3.7342454 25 6.1733764 15.6933764 26 -0.2899354 6.1733764 27 12.3133764 -0.2899354 28 20.3133764 12.3133764 29 5.8333764 20.3133764 30 24.4533764 5.8333764 31 5.9100646 24.4533764 32 10.1133764 5.9100646 33 9.1300646 10.1133764 34 4.9900646 9.1300646 35 11.8300646 4.9900646 36 12.4576864 11.8300646 37 0.3376864 12.4576864 38 -4.9256254 0.3376864 39 -7.4223136 -4.9256254 40 -7.3223136 -7.4223136 41 -20.7023136 -7.3223136 42 -18.6823136 -20.7023136 43 -8.4090664 -18.6823136 44 -25.6223136 -8.4090664 45 3.9109336 -25.6223136 46 -8.7290664 3.9109336 47 -6.1890664 -8.7290664 48 -0.6614445 -6.1890664 49 -1.3814445 -0.6614445 50 -5.3447563 -1.3814445 51 -6.7414445 -5.3447563 52 -5.8414445 -6.7414445 53 6.0785555 -5.8414445 54 3.8985555 6.0785555 55 -5.3447563 3.8985555 56 4.5585555 -5.3447563 57 2.9752437 4.5585555 58 3.4352437 2.9752437 59 -0.7247563 3.4352437 60 NA -0.7247563 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -21.5552437 -36.5352437 [2,] -1.8019965 -21.5552437 [3,] -1.1986847 -1.8019965 [4,] -4.5986847 -1.1986847 [5,] 3.9213153 -4.5986847 [6,] -7.0586847 3.9213153 [7,] 4.9980035 -7.0586847 [8,] 2.7013153 4.9980035 [9,] -8.9819965 2.7013153 [10,] -0.1219965 -8.9819965 [11,] -1.1819965 -0.1219965 [12,] 9.0456254 -1.1819965 [13,] 16.4256254 9.0456254 [14,] 12.3623136 16.4256254 [15,] 3.0490664 12.3623136 [16,] -2.5509336 3.0490664 [17,] 4.8690664 -2.5509336 [18,] -2.6109336 4.8690664 [19,] 2.8457546 -2.6109336 [20,] 8.2490664 2.8457546 [21,] -7.0342454 8.2490664 [22,] 0.4257546 -7.0342454 [23,] -3.7342454 0.4257546 [24,] 15.6933764 -3.7342454 [25,] 6.1733764 15.6933764 [26,] -0.2899354 6.1733764 [27,] 12.3133764 -0.2899354 [28,] 20.3133764 12.3133764 [29,] 5.8333764 20.3133764 [30,] 24.4533764 5.8333764 [31,] 5.9100646 24.4533764 [32,] 10.1133764 5.9100646 [33,] 9.1300646 10.1133764 [34,] 4.9900646 9.1300646 [35,] 11.8300646 4.9900646 [36,] 12.4576864 11.8300646 [37,] 0.3376864 12.4576864 [38,] -4.9256254 0.3376864 [39,] -7.4223136 -4.9256254 [40,] -7.3223136 -7.4223136 [41,] -20.7023136 -7.3223136 [42,] -18.6823136 -20.7023136 [43,] -8.4090664 -18.6823136 [44,] -25.6223136 -8.4090664 [45,] 3.9109336 -25.6223136 [46,] -8.7290664 3.9109336 [47,] -6.1890664 -8.7290664 [48,] -0.6614445 -6.1890664 [49,] -1.3814445 -0.6614445 [50,] -5.3447563 -1.3814445 [51,] -6.7414445 -5.3447563 [52,] -5.8414445 -6.7414445 [53,] 6.0785555 -5.8414445 [54,] 3.8985555 6.0785555 [55,] -5.3447563 3.8985555 [56,] 4.5585555 -5.3447563 [57,] 2.9752437 4.5585555 [58,] 3.4352437 2.9752437 [59,] -0.7247563 3.4352437 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -21.5552437 -36.5352437 2 -1.8019965 -21.5552437 3 -1.1986847 -1.8019965 4 -4.5986847 -1.1986847 5 3.9213153 -4.5986847 6 -7.0586847 3.9213153 7 4.9980035 -7.0586847 8 2.7013153 4.9980035 9 -8.9819965 2.7013153 10 -0.1219965 -8.9819965 11 -1.1819965 -0.1219965 12 9.0456254 -1.1819965 13 16.4256254 9.0456254 14 12.3623136 16.4256254 15 3.0490664 12.3623136 16 -2.5509336 3.0490664 17 4.8690664 -2.5509336 18 -2.6109336 4.8690664 19 2.8457546 -2.6109336 20 8.2490664 2.8457546 21 -7.0342454 8.2490664 22 0.4257546 -7.0342454 23 -3.7342454 0.4257546 24 15.6933764 -3.7342454 25 6.1733764 15.6933764 26 -0.2899354 6.1733764 27 12.3133764 -0.2899354 28 20.3133764 12.3133764 29 5.8333764 20.3133764 30 24.4533764 5.8333764 31 5.9100646 24.4533764 32 10.1133764 5.9100646 33 9.1300646 10.1133764 34 4.9900646 9.1300646 35 11.8300646 4.9900646 36 12.4576864 11.8300646 37 0.3376864 12.4576864 38 -4.9256254 0.3376864 39 -7.4223136 -4.9256254 40 -7.3223136 -7.4223136 41 -20.7023136 -7.3223136 42 -18.6823136 -20.7023136 43 -8.4090664 -18.6823136 44 -25.6223136 -8.4090664 45 3.9109336 -25.6223136 46 -8.7290664 3.9109336 47 -6.1890664 -8.7290664 48 -0.6614445 -6.1890664 49 -1.3814445 -0.6614445 50 -5.3447563 -1.3814445 51 -6.7414445 -5.3447563 52 -5.8414445 -6.7414445 53 6.0785555 -5.8414445 54 3.8985555 6.0785555 55 -5.3447563 3.8985555 56 4.5585555 -5.3447563 57 2.9752437 4.5585555 58 3.4352437 2.9752437 59 -0.7247563 3.4352437 > 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/75z561291725674.ps",horizontal=F,onefile=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/8g9nr1291725674.ps",horizontal=F,onefile=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/9g9nr1291725674.ps",horizontal=F,onefile=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/10g9nr1291725674.ps",horizontal=F,onefile=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/117dbm1291725674.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/125s2l1291725674.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/13cthx1291725674.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/1442g01291725674.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/15q3fo1291725674.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/164cce1291725674.tab") + } > > try(system("convert tmp/12hpj1291725674.ps tmp/12hpj1291725674.png",intern=TRUE)) character(0) > try(system("convert tmp/22hpj1291725674.ps tmp/22hpj1291725674.png",intern=TRUE)) character(0) > try(system("convert tmp/32hpj1291725674.ps tmp/32hpj1291725674.png",intern=TRUE)) character(0) > try(system("convert tmp/4dqom1291725674.ps tmp/4dqom1291725674.png",intern=TRUE)) character(0) > try(system("convert tmp/5dqom1291725674.ps tmp/5dqom1291725674.png",intern=TRUE)) character(0) > try(system("convert tmp/6dqom1291725674.ps tmp/6dqom1291725674.png",intern=TRUE)) character(0) > try(system("convert tmp/75z561291725674.ps tmp/75z561291725674.png",intern=TRUE)) character(0) > try(system("convert tmp/8g9nr1291725674.ps tmp/8g9nr1291725674.png",intern=TRUE)) character(0) > try(system("convert tmp/9g9nr1291725674.ps tmp/9g9nr1291725674.png",intern=TRUE)) character(0) > try(system("convert tmp/10g9nr1291725674.ps tmp/10g9nr1291725674.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.444 1.645 6.429