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(104.89,124,105.15,118.63,105.24,121.86,105.57,119.97,105.62,125.03,106.17,130.09,106.27,126.65,106.41,121.7,106.94,119.24,107.16,122.63,107.32,116.66,107.32,114.12,107.35,113.11,107.55,112.61,107.87,113.4,108.37,115.18,108.38,121.01,107.92,119.44,108.03,116.68,108.14,117.07,108.3,117.41,108.64,119.58,108.66,120.92,109.04,117.09,109.03,116.77,109.03,119.39,109.54,122.49,109.75,124.08,109.83,118.29,109.65,112.94,109.82,113.79,109.95,114.43,110.12,118.7,110.15,120.36,110.21,118.27,109.99,118.34,110.14,117.82,110.14,117.65,110.81,118.18,110.97,121.02,110.99,124.78,109.73,131.16,109.81,130.14,110.02,131.75,110.18,134.73,110.21,135.35,110.25,140.32,110.36,136.35,110.51,131.6,110.6,128.9,110.95,133.89,111.18,138.25,111.19,146.23,111.69,144.76,111.7,149.3,111.83,156.8,111.77,159.08,111.73,165.12,112.01,163.14,111.86,153.43,112.04,151.01),dim=c(2,61),dimnames=list(c('AKW','AKB'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('AKW','AKB'),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 AKW AKB M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 104.89 124.00 1 0 0 0 0 0 0 0 0 0 0 1 2 105.15 118.63 0 1 0 0 0 0 0 0 0 0 0 2 3 105.24 121.86 0 0 1 0 0 0 0 0 0 0 0 3 4 105.57 119.97 0 0 0 1 0 0 0 0 0 0 0 4 5 105.62 125.03 0 0 0 0 1 0 0 0 0 0 0 5 6 106.17 130.09 0 0 0 0 0 1 0 0 0 0 0 6 7 106.27 126.65 0 0 0 0 0 0 1 0 0 0 0 7 8 106.41 121.70 0 0 0 0 0 0 0 1 0 0 0 8 9 106.94 119.24 0 0 0 0 0 0 0 0 1 0 0 9 10 107.16 122.63 0 0 0 0 0 0 0 0 0 1 0 10 11 107.32 116.66 0 0 0 0 0 0 0 0 0 0 1 11 12 107.32 114.12 0 0 0 0 0 0 0 0 0 0 0 12 13 107.35 113.11 1 0 0 0 0 0 0 0 0 0 0 13 14 107.55 112.61 0 1 0 0 0 0 0 0 0 0 0 14 15 107.87 113.40 0 0 1 0 0 0 0 0 0 0 0 15 16 108.37 115.18 0 0 0 1 0 0 0 0 0 0 0 16 17 108.38 121.01 0 0 0 0 1 0 0 0 0 0 0 17 18 107.92 119.44 0 0 0 0 0 1 0 0 0 0 0 18 19 108.03 116.68 0 0 0 0 0 0 1 0 0 0 0 19 20 108.14 117.07 0 0 0 0 0 0 0 1 0 0 0 20 21 108.30 117.41 0 0 0 0 0 0 0 0 1 0 0 21 22 108.64 119.58 0 0 0 0 0 0 0 0 0 1 0 22 23 108.66 120.92 0 0 0 0 0 0 0 0 0 0 1 23 24 109.04 117.09 0 0 0 0 0 0 0 0 0 0 0 24 25 109.03 116.77 1 0 0 0 0 0 0 0 0 0 0 25 26 109.03 119.39 0 1 0 0 0 0 0 0 0 0 0 26 27 109.54 122.49 0 0 1 0 0 0 0 0 0 0 0 27 28 109.75 124.08 0 0 0 1 0 0 0 0 0 0 0 28 29 109.83 118.29 0 0 0 0 1 0 0 0 0 0 0 29 30 109.65 112.94 0 0 0 0 0 1 0 0 0 0 0 30 31 109.82 113.79 0 0 0 0 0 0 1 0 0 0 0 31 32 109.95 114.43 0 0 0 0 0 0 0 1 0 0 0 32 33 110.12 118.70 0 0 0 0 0 0 0 0 1 0 0 33 34 110.15 120.36 0 0 0 0 0 0 0 0 0 1 0 34 35 110.21 118.27 0 0 0 0 0 0 0 0 0 0 1 35 36 109.99 118.34 0 0 0 0 0 0 0 0 0 0 0 36 37 110.14 117.82 1 0 0 0 0 0 0 0 0 0 0 37 38 110.14 117.65 0 1 0 0 0 0 0 0 0 0 0 38 39 110.81 118.18 0 0 1 0 0 0 0 0 0 0 0 39 40 110.97 121.02 0 0 0 1 0 0 0 0 0 0 0 40 41 110.99 124.78 0 0 0 0 1 0 0 0 0 0 0 41 42 109.73 131.16 0 0 0 0 0 1 0 0 0 0 0 42 43 109.81 130.14 0 0 0 0 0 0 1 0 0 0 0 43 44 110.02 131.75 0 0 0 0 0 0 0 1 0 0 0 44 45 110.18 134.73 0 0 0 0 0 0 0 0 1 0 0 45 46 110.21 135.35 0 0 0 0 0 0 0 0 0 1 0 46 47 110.25 140.32 0 0 0 0 0 0 0 0 0 0 1 47 48 110.36 136.35 0 0 0 0 0 0 0 0 0 0 0 48 49 110.51 131.60 1 0 0 0 0 0 0 0 0 0 0 49 50 110.60 128.90 0 1 0 0 0 0 0 0 0 0 0 50 51 110.95 133.89 0 0 1 0 0 0 0 0 0 0 0 51 52 111.18 138.25 0 0 0 1 0 0 0 0 0 0 0 52 53 111.19 146.23 0 0 0 0 1 0 0 0 0 0 0 53 54 111.69 144.76 0 0 0 0 0 1 0 0 0 0 0 54 55 111.70 149.30 0 0 0 0 0 0 1 0 0 0 0 55 56 111.83 156.80 0 0 0 0 0 0 0 1 0 0 0 56 57 111.77 159.08 0 0 0 0 0 0 0 0 1 0 0 57 58 111.73 165.12 0 0 0 0 0 0 0 0 0 1 0 58 59 112.01 163.14 0 0 0 0 0 0 0 0 0 0 1 59 60 111.86 153.43 0 0 0 0 0 0 0 0 0 0 0 60 61 112.04 151.01 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) AKB M1 M2 M3 M4 110.05590 -0.03801 -0.17477 -0.28536 0.07322 0.29970 M5 M6 M7 M8 M9 M10 0.33621 0.06389 0.01847 0.07642 0.19924 0.29525 M11 t 0.25339 0.12551 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.76984 -0.36250 0.09342 0.27811 0.67799 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 110.055899 0.745913 147.545 < 2e-16 *** AKB -0.038009 0.006538 -5.813 5.15e-07 *** M1 -0.174771 0.273445 -0.639 0.526 M2 -0.285363 0.287650 -0.992 0.326 M3 0.073219 0.286692 0.255 0.800 M4 0.299697 0.286290 1.047 0.301 M5 0.336207 0.286672 1.173 0.247 M6 0.063887 0.286451 0.223 0.824 M7 0.018470 0.285883 0.065 0.949 M8 0.076418 0.285887 0.267 0.790 M9 0.199243 0.286190 0.696 0.490 M10 0.295251 0.287662 1.026 0.310 M11 0.253391 0.286609 0.884 0.381 t 0.125505 0.004867 25.786 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4507 on 47 degrees of freedom Multiple R-squared: 0.9576, Adjusted R-squared: 0.9459 F-statistic: 81.69 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.02707354 0.05414708 0.97292646 [2,] 0.10665877 0.21331754 0.89334123 [3,] 0.10146153 0.20292305 0.89853847 [4,] 0.28248881 0.56497763 0.71751119 [5,] 0.50911365 0.98177269 0.49088635 [6,] 0.48893537 0.97787074 0.51106463 [7,] 0.41540262 0.83080524 0.58459738 [8,] 0.31118424 0.62236848 0.68881576 [9,] 0.22893360 0.45786721 0.77106640 [10,] 0.16006727 0.32013454 0.83993273 [11,] 0.13090605 0.26181211 0.86909395 [12,] 0.09897910 0.19795820 0.90102090 [13,] 0.07121116 0.14242232 0.92878884 [14,] 0.06664768 0.13329536 0.93335232 [15,] 0.04711736 0.09423472 0.95288264 [16,] 0.03268339 0.06536678 0.96731661 [17,] 0.02509756 0.05019512 0.97490244 [18,] 0.03128580 0.06257159 0.96871420 [19,] 0.05273021 0.10546041 0.94726979 [20,] 0.07126537 0.14253074 0.92873463 [21,] 0.05641139 0.11282278 0.94358861 [22,] 0.04693778 0.09387556 0.95306222 [23,] 0.07658122 0.15316244 0.92341878 [24,] 0.23941780 0.47883560 0.76058220 [25,] 0.98665570 0.02668859 0.01334430 [26,] 0.98687586 0.02624829 0.01312414 [27,] 0.98864830 0.02270340 0.01135170 [28,] 0.98276149 0.03447702 0.01723851 > postscript(file="/var/www/html/rcomp/tmp/138mz1258915493.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/2jvsx1258915493.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/3bq9o1258915493.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/47bw61258915493.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/5z69v1258915493.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 -0.403481248 -0.362503711 -0.633821184 -0.727642899 -0.647331167 0.241810211 7 8 9 10 11 12 0.130969628 -0.100630050 0.087537296 0.214875005 0.064314431 0.095655969 13 14 15 16 17 18 0.136531602 0.302614422 0.168554261 0.384226670 0.453805563 0.080945293 19 20 21 22 23 24 0.005951032 -0.052678993 -0.128085611 0.072880754 0.060168150 0.422477693 25 26 27 28 29 30 0.449579742 0.534251572 0.677992891 0.596443533 0.294354380 0.057818962 31 32 33 34 35 36 0.180038269 0.150910568 0.234880492 0.106462115 0.003377618 -0.086076575 37 38 39 40 41 42 0.093423613 0.072049502 0.278106924 0.194069189 0.194968834 -0.675717515 43 44 45 46 47 48 -0.714575596 -0.626834278 -0.601896349 -0.769844396 -0.624583247 -0.537595005 49 50 51 52 53 54 -0.518874148 -0.546411784 -0.490832892 -0.447096493 -0.295797610 0.295143050 55 56 57 58 59 60 0.397616667 0.629232752 0.407564172 0.375626522 0.496723048 0.105537918 61 0.242820440 > postscript(file="/var/www/html/rcomp/tmp/6ak5l1258915493.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 -0.403481248 NA 1 -0.362503711 -0.403481248 2 -0.633821184 -0.362503711 3 -0.727642899 -0.633821184 4 -0.647331167 -0.727642899 5 0.241810211 -0.647331167 6 0.130969628 0.241810211 7 -0.100630050 0.130969628 8 0.087537296 -0.100630050 9 0.214875005 0.087537296 10 0.064314431 0.214875005 11 0.095655969 0.064314431 12 0.136531602 0.095655969 13 0.302614422 0.136531602 14 0.168554261 0.302614422 15 0.384226670 0.168554261 16 0.453805563 0.384226670 17 0.080945293 0.453805563 18 0.005951032 0.080945293 19 -0.052678993 0.005951032 20 -0.128085611 -0.052678993 21 0.072880754 -0.128085611 22 0.060168150 0.072880754 23 0.422477693 0.060168150 24 0.449579742 0.422477693 25 0.534251572 0.449579742 26 0.677992891 0.534251572 27 0.596443533 0.677992891 28 0.294354380 0.596443533 29 0.057818962 0.294354380 30 0.180038269 0.057818962 31 0.150910568 0.180038269 32 0.234880492 0.150910568 33 0.106462115 0.234880492 34 0.003377618 0.106462115 35 -0.086076575 0.003377618 36 0.093423613 -0.086076575 37 0.072049502 0.093423613 38 0.278106924 0.072049502 39 0.194069189 0.278106924 40 0.194968834 0.194069189 41 -0.675717515 0.194968834 42 -0.714575596 -0.675717515 43 -0.626834278 -0.714575596 44 -0.601896349 -0.626834278 45 -0.769844396 -0.601896349 46 -0.624583247 -0.769844396 47 -0.537595005 -0.624583247 48 -0.518874148 -0.537595005 49 -0.546411784 -0.518874148 50 -0.490832892 -0.546411784 51 -0.447096493 -0.490832892 52 -0.295797610 -0.447096493 53 0.295143050 -0.295797610 54 0.397616667 0.295143050 55 0.629232752 0.397616667 56 0.407564172 0.629232752 57 0.375626522 0.407564172 58 0.496723048 0.375626522 59 0.105537918 0.496723048 60 0.242820440 0.105537918 61 NA 0.242820440 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.362503711 -0.403481248 [2,] -0.633821184 -0.362503711 [3,] -0.727642899 -0.633821184 [4,] -0.647331167 -0.727642899 [5,] 0.241810211 -0.647331167 [6,] 0.130969628 0.241810211 [7,] -0.100630050 0.130969628 [8,] 0.087537296 -0.100630050 [9,] 0.214875005 0.087537296 [10,] 0.064314431 0.214875005 [11,] 0.095655969 0.064314431 [12,] 0.136531602 0.095655969 [13,] 0.302614422 0.136531602 [14,] 0.168554261 0.302614422 [15,] 0.384226670 0.168554261 [16,] 0.453805563 0.384226670 [17,] 0.080945293 0.453805563 [18,] 0.005951032 0.080945293 [19,] -0.052678993 0.005951032 [20,] -0.128085611 -0.052678993 [21,] 0.072880754 -0.128085611 [22,] 0.060168150 0.072880754 [23,] 0.422477693 0.060168150 [24,] 0.449579742 0.422477693 [25,] 0.534251572 0.449579742 [26,] 0.677992891 0.534251572 [27,] 0.596443533 0.677992891 [28,] 0.294354380 0.596443533 [29,] 0.057818962 0.294354380 [30,] 0.180038269 0.057818962 [31,] 0.150910568 0.180038269 [32,] 0.234880492 0.150910568 [33,] 0.106462115 0.234880492 [34,] 0.003377618 0.106462115 [35,] -0.086076575 0.003377618 [36,] 0.093423613 -0.086076575 [37,] 0.072049502 0.093423613 [38,] 0.278106924 0.072049502 [39,] 0.194069189 0.278106924 [40,] 0.194968834 0.194069189 [41,] -0.675717515 0.194968834 [42,] -0.714575596 -0.675717515 [43,] -0.626834278 -0.714575596 [44,] -0.601896349 -0.626834278 [45,] -0.769844396 -0.601896349 [46,] -0.624583247 -0.769844396 [47,] -0.537595005 -0.624583247 [48,] -0.518874148 -0.537595005 [49,] -0.546411784 -0.518874148 [50,] -0.490832892 -0.546411784 [51,] -0.447096493 -0.490832892 [52,] -0.295797610 -0.447096493 [53,] 0.295143050 -0.295797610 [54,] 0.397616667 0.295143050 [55,] 0.629232752 0.397616667 [56,] 0.407564172 0.629232752 [57,] 0.375626522 0.407564172 [58,] 0.496723048 0.375626522 [59,] 0.105537918 0.496723048 [60,] 0.242820440 0.105537918 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.362503711 -0.403481248 2 -0.633821184 -0.362503711 3 -0.727642899 -0.633821184 4 -0.647331167 -0.727642899 5 0.241810211 -0.647331167 6 0.130969628 0.241810211 7 -0.100630050 0.130969628 8 0.087537296 -0.100630050 9 0.214875005 0.087537296 10 0.064314431 0.214875005 11 0.095655969 0.064314431 12 0.136531602 0.095655969 13 0.302614422 0.136531602 14 0.168554261 0.302614422 15 0.384226670 0.168554261 16 0.453805563 0.384226670 17 0.080945293 0.453805563 18 0.005951032 0.080945293 19 -0.052678993 0.005951032 20 -0.128085611 -0.052678993 21 0.072880754 -0.128085611 22 0.060168150 0.072880754 23 0.422477693 0.060168150 24 0.449579742 0.422477693 25 0.534251572 0.449579742 26 0.677992891 0.534251572 27 0.596443533 0.677992891 28 0.294354380 0.596443533 29 0.057818962 0.294354380 30 0.180038269 0.057818962 31 0.150910568 0.180038269 32 0.234880492 0.150910568 33 0.106462115 0.234880492 34 0.003377618 0.106462115 35 -0.086076575 0.003377618 36 0.093423613 -0.086076575 37 0.072049502 0.093423613 38 0.278106924 0.072049502 39 0.194069189 0.278106924 40 0.194968834 0.194069189 41 -0.675717515 0.194968834 42 -0.714575596 -0.675717515 43 -0.626834278 -0.714575596 44 -0.601896349 -0.626834278 45 -0.769844396 -0.601896349 46 -0.624583247 -0.769844396 47 -0.537595005 -0.624583247 48 -0.518874148 -0.537595005 49 -0.546411784 -0.518874148 50 -0.490832892 -0.546411784 51 -0.447096493 -0.490832892 52 -0.295797610 -0.447096493 53 0.295143050 -0.295797610 54 0.397616667 0.295143050 55 0.629232752 0.397616667 56 0.407564172 0.629232752 57 0.375626522 0.407564172 58 0.496723048 0.375626522 59 0.105537918 0.496723048 60 0.242820440 0.105537918 > 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/7726t1258915493.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/8jevc1258915493.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/914lc1258915493.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/10bg651258915493.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/11r51w1258915493.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/125fao1258915493.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/13jj5r1258915493.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/146fft1258915493.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/155f171258915493.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/16fm6y1258915493.tab") + } > > system("convert tmp/138mz1258915493.ps tmp/138mz1258915493.png") > system("convert tmp/2jvsx1258915493.ps tmp/2jvsx1258915493.png") > system("convert tmp/3bq9o1258915493.ps tmp/3bq9o1258915493.png") > system("convert tmp/47bw61258915493.ps tmp/47bw61258915493.png") > system("convert tmp/5z69v1258915493.ps tmp/5z69v1258915493.png") > system("convert tmp/6ak5l1258915493.ps tmp/6ak5l1258915493.png") > system("convert tmp/7726t1258915493.ps tmp/7726t1258915493.png") > system("convert tmp/8jevc1258915493.ps tmp/8jevc1258915493.png") > system("convert tmp/914lc1258915493.ps tmp/914lc1258915493.png") > system("convert tmp/10bg651258915493.ps tmp/10bg651258915493.png") > > > proc.time() user system elapsed 2.361 1.519 2.745