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(99.9,98.8,98.6,100.5,107.2,110.4,95.7,96.4,93.7,101.9,106.7,106.2,86.7,81,95.3,94.7,99.3,101,101.8,109.4,96,102.3,91.7,90.7,95.3,96.2,96.6,96.1,107.2,106,108,103.1,98.4,102,103.1,104.7,81.1,86,96.6,92.1,103.7,106.9,106.6,112.6,97.6,101.7,87.6,92,99.4,97.4,98.5,97,105.2,105.4,104.6,102.7,97.5,98.1,108.9,104.5,86.8,87.4,88.9,89.9,110.3,109.8,114.8,111.7,94.6,98.6,92,96.9,93.8,95.1,93.8,97,107.6,112.7,101,102.9,95.4,97.4,96.5,111.4,89.2,87.4,87.1,96.8,110.5,114.1,110.8,110.3,104.2,103.9,88.9,101.6,89.8,94.6,90,95.9,93.9,104.7,91.3,102.8,87.8,98.1,99.7,113.9,73.5,80.9,79.2,95.7,96.9,113.2,95.2,105.9,95.6,108.8,89.7,102.3),dim=c(2,60),dimnames=list(c('ProdMetal','TotProd'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('ProdMetal','TotProd'),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 = '2' > #'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 TotProd ProdMetal M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 98.8 99.9 1 0 0 0 0 0 0 0 0 0 0 1 2 100.5 98.6 0 1 0 0 0 0 0 0 0 0 0 2 3 110.4 107.2 0 0 1 0 0 0 0 0 0 0 0 3 4 96.4 95.7 0 0 0 1 0 0 0 0 0 0 0 4 5 101.9 93.7 0 0 0 0 1 0 0 0 0 0 0 5 6 106.2 106.7 0 0 0 0 0 1 0 0 0 0 0 6 7 81.0 86.7 0 0 0 0 0 0 1 0 0 0 0 7 8 94.7 95.3 0 0 0 0 0 0 0 1 0 0 0 8 9 101.0 99.3 0 0 0 0 0 0 0 0 1 0 0 9 10 109.4 101.8 0 0 0 0 0 0 0 0 0 1 0 10 11 102.3 96.0 0 0 0 0 0 0 0 0 0 0 1 11 12 90.7 91.7 0 0 0 0 0 0 0 0 0 0 0 12 13 96.2 95.3 1 0 0 0 0 0 0 0 0 0 0 13 14 96.1 96.6 0 1 0 0 0 0 0 0 0 0 0 14 15 106.0 107.2 0 0 1 0 0 0 0 0 0 0 0 15 16 103.1 108.0 0 0 0 1 0 0 0 0 0 0 0 16 17 102.0 98.4 0 0 0 0 1 0 0 0 0 0 0 17 18 104.7 103.1 0 0 0 0 0 1 0 0 0 0 0 18 19 86.0 81.1 0 0 0 0 0 0 1 0 0 0 0 19 20 92.1 96.6 0 0 0 0 0 0 0 1 0 0 0 20 21 106.9 103.7 0 0 0 0 0 0 0 0 1 0 0 21 22 112.6 106.6 0 0 0 0 0 0 0 0 0 1 0 22 23 101.7 97.6 0 0 0 0 0 0 0 0 0 0 1 23 24 92.0 87.6 0 0 0 0 0 0 0 0 0 0 0 24 25 97.4 99.4 1 0 0 0 0 0 0 0 0 0 0 25 26 97.0 98.5 0 1 0 0 0 0 0 0 0 0 0 26 27 105.4 105.2 0 0 1 0 0 0 0 0 0 0 0 27 28 102.7 104.6 0 0 0 1 0 0 0 0 0 0 0 28 29 98.1 97.5 0 0 0 0 1 0 0 0 0 0 0 29 30 104.5 108.9 0 0 0 0 0 1 0 0 0 0 0 30 31 87.4 86.8 0 0 0 0 0 0 1 0 0 0 0 31 32 89.9 88.9 0 0 0 0 0 0 0 1 0 0 0 32 33 109.8 110.3 0 0 0 0 0 0 0 0 1 0 0 33 34 111.7 114.8 0 0 0 0 0 0 0 0 0 1 0 34 35 98.6 94.6 0 0 0 0 0 0 0 0 0 0 1 35 36 96.9 92.0 0 0 0 0 0 0 0 0 0 0 0 36 37 95.1 93.8 1 0 0 0 0 0 0 0 0 0 0 37 38 97.0 93.8 0 1 0 0 0 0 0 0 0 0 0 38 39 112.7 107.6 0 0 1 0 0 0 0 0 0 0 0 39 40 102.9 101.0 0 0 0 1 0 0 0 0 0 0 0 40 41 97.4 95.4 0 0 0 0 1 0 0 0 0 0 0 41 42 111.4 96.5 0 0 0 0 0 1 0 0 0 0 0 42 43 87.4 89.2 0 0 0 0 0 0 1 0 0 0 0 43 44 96.8 87.1 0 0 0 0 0 0 0 1 0 0 0 44 45 114.1 110.5 0 0 0 0 0 0 0 0 1 0 0 45 46 110.3 110.8 0 0 0 0 0 0 0 0 0 1 0 46 47 103.9 104.2 0 0 0 0 0 0 0 0 0 0 1 47 48 101.6 88.9 0 0 0 0 0 0 0 0 0 0 0 48 49 94.6 89.8 1 0 0 0 0 0 0 0 0 0 0 49 50 95.9 90.0 0 1 0 0 0 0 0 0 0 0 0 50 51 104.7 93.9 0 0 1 0 0 0 0 0 0 0 0 51 52 102.8 91.3 0 0 0 1 0 0 0 0 0 0 0 52 53 98.1 87.8 0 0 0 0 1 0 0 0 0 0 0 53 54 113.9 99.7 0 0 0 0 0 1 0 0 0 0 0 54 55 80.9 73.5 0 0 0 0 0 0 1 0 0 0 0 55 56 95.7 79.2 0 0 0 0 0 0 0 1 0 0 0 56 57 113.2 96.9 0 0 0 0 0 0 0 0 1 0 0 57 58 105.9 95.2 0 0 0 0 0 0 0 0 0 1 0 58 59 108.8 95.6 0 0 0 0 0 0 0 0 0 0 1 59 60 102.3 89.7 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) ProdMetal M1 M2 M3 M4 68.99987 0.27228 -0.84311 -0.01389 8.06295 2.83037 M5 M6 M7 M8 M9 M10 2.17532 8.43385 -9.94022 -2.35190 8.71128 9.13951 M11 t 4.37416 0.08891 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -5.2519 -2.2225 -0.3913 2.5222 4.7679 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 68.99987 8.87139 7.778 6.30e-10 *** ProdMetal 0.27228 0.09220 2.953 0.004944 ** M1 -0.84311 2.03397 -0.415 0.680425 M2 -0.01389 2.03081 -0.007 0.994571 M3 8.06295 2.32768 3.464 0.001163 ** M4 2.83037 2.15823 1.311 0.196220 M5 2.17532 2.01435 1.080 0.285810 M6 8.43385 2.28202 3.696 0.000582 *** M7 -9.94022 2.08890 -4.759 1.97e-05 *** M8 -2.35190 1.98314 -1.186 0.241733 M9 8.71128 2.35228 3.703 0.000569 *** M10 9.13951 2.44680 3.735 0.000516 *** M11 4.37416 2.09570 2.087 0.042438 * t 0.08891 0.02652 3.352 0.001613 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.128 on 46 degrees of freedom Multiple R-squared: 0.8784, Adjusted R-squared: 0.8441 F-statistic: 25.57 on 13 and 46 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.1579669 0.3159337 0.8420331 [2,] 0.1261745 0.2523489 0.8738255 [3,] 0.6308980 0.7382040 0.3691020 [4,] 0.5452802 0.9094396 0.4547198 [5,] 0.5406471 0.9187057 0.4593529 [6,] 0.6007877 0.7984246 0.3992123 [7,] 0.5439438 0.9121125 0.4560562 [8,] 0.4796128 0.9592257 0.5203872 [9,] 0.4216590 0.8433180 0.5783410 [10,] 0.3543926 0.7087852 0.6456074 [11,] 0.2802862 0.5605723 0.7197138 [12,] 0.2257361 0.4514723 0.7742639 [13,] 0.2477925 0.4955851 0.7522075 [14,] 0.4770925 0.9541850 0.5229075 [15,] 0.6440802 0.7118397 0.3559198 [16,] 0.6857903 0.6284193 0.3142097 [17,] 0.6788238 0.6423524 0.3211762 [18,] 0.6826839 0.6346323 0.3173161 [19,] 0.6072250 0.7855499 0.3927750 [20,] 0.6738931 0.6522138 0.3261069 [21,] 0.5718394 0.8563212 0.4281606 [22,] 0.4869593 0.9739187 0.5130407 [23,] 0.7081829 0.5836343 0.2918171 [24,] 0.6113612 0.7772777 0.3886388 [25,] 0.5095565 0.9808869 0.4904435 [26,] 0.5251239 0.9497521 0.4748761 [27,] 0.5052147 0.9895706 0.4947853 > postscript(file="/var/www/html/rcomp/tmp/1suz51260712375.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/28eyn1260712375.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/35cka1260712375.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/4q9mv1260712375.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/52nhh1260712375.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 = 60 Frequency = 1 1 2 3 4 5 6 3.35387848 4.48971950 3.88239271 -1.84275941 4.76793539 -0.81909208 7 8 9 10 11 12 -2.28839925 1.39279015 -4.54840317 2.65377543 1.80942018 -4.33453860 13 14 15 16 17 18 0.93946279 -0.43261572 -1.58449599 0.44134797 2.52134601 -2.40578451 19 20 21 22 23 24 3.16946181 -2.62805831 -0.91330954 3.47995837 -0.29311130 -2.98509266 25 26 27 28 29 30 -0.04376055 -1.11683023 -2.70683121 -0.09979980 -2.20049362 -5.25187831 31 32 33 34 35 36 1.95059568 -3.79841609 -0.87722473 -0.71959961 -3.64316977 -0.34999902 37 38 39 40 41 42 -1.88589949 -0.90401824 2.87281592 0.01350777 -3.39560116 3.95746459 43 44 45 46 47 48 0.23024280 2.52479334 2.30143123 -2.09738134 -2.02391519 4.12717018 49 50 51 52 53 54 -2.36368122 -2.03625532 -2.46388142 1.48770347 -1.69318662 4.51929032 55 56 57 58 59 60 -3.06190105 2.50889090 4.03750621 -3.31675286 4.15077609 3.54246009 > postscript(file="/var/www/html/rcomp/tmp/6cc141260712375.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 3.35387848 NA 1 4.48971950 3.35387848 2 3.88239271 4.48971950 3 -1.84275941 3.88239271 4 4.76793539 -1.84275941 5 -0.81909208 4.76793539 6 -2.28839925 -0.81909208 7 1.39279015 -2.28839925 8 -4.54840317 1.39279015 9 2.65377543 -4.54840317 10 1.80942018 2.65377543 11 -4.33453860 1.80942018 12 0.93946279 -4.33453860 13 -0.43261572 0.93946279 14 -1.58449599 -0.43261572 15 0.44134797 -1.58449599 16 2.52134601 0.44134797 17 -2.40578451 2.52134601 18 3.16946181 -2.40578451 19 -2.62805831 3.16946181 20 -0.91330954 -2.62805831 21 3.47995837 -0.91330954 22 -0.29311130 3.47995837 23 -2.98509266 -0.29311130 24 -0.04376055 -2.98509266 25 -1.11683023 -0.04376055 26 -2.70683121 -1.11683023 27 -0.09979980 -2.70683121 28 -2.20049362 -0.09979980 29 -5.25187831 -2.20049362 30 1.95059568 -5.25187831 31 -3.79841609 1.95059568 32 -0.87722473 -3.79841609 33 -0.71959961 -0.87722473 34 -3.64316977 -0.71959961 35 -0.34999902 -3.64316977 36 -1.88589949 -0.34999902 37 -0.90401824 -1.88589949 38 2.87281592 -0.90401824 39 0.01350777 2.87281592 40 -3.39560116 0.01350777 41 3.95746459 -3.39560116 42 0.23024280 3.95746459 43 2.52479334 0.23024280 44 2.30143123 2.52479334 45 -2.09738134 2.30143123 46 -2.02391519 -2.09738134 47 4.12717018 -2.02391519 48 -2.36368122 4.12717018 49 -2.03625532 -2.36368122 50 -2.46388142 -2.03625532 51 1.48770347 -2.46388142 52 -1.69318662 1.48770347 53 4.51929032 -1.69318662 54 -3.06190105 4.51929032 55 2.50889090 -3.06190105 56 4.03750621 2.50889090 57 -3.31675286 4.03750621 58 4.15077609 -3.31675286 59 3.54246009 4.15077609 60 NA 3.54246009 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 4.48971950 3.35387848 [2,] 3.88239271 4.48971950 [3,] -1.84275941 3.88239271 [4,] 4.76793539 -1.84275941 [5,] -0.81909208 4.76793539 [6,] -2.28839925 -0.81909208 [7,] 1.39279015 -2.28839925 [8,] -4.54840317 1.39279015 [9,] 2.65377543 -4.54840317 [10,] 1.80942018 2.65377543 [11,] -4.33453860 1.80942018 [12,] 0.93946279 -4.33453860 [13,] -0.43261572 0.93946279 [14,] -1.58449599 -0.43261572 [15,] 0.44134797 -1.58449599 [16,] 2.52134601 0.44134797 [17,] -2.40578451 2.52134601 [18,] 3.16946181 -2.40578451 [19,] -2.62805831 3.16946181 [20,] -0.91330954 -2.62805831 [21,] 3.47995837 -0.91330954 [22,] -0.29311130 3.47995837 [23,] -2.98509266 -0.29311130 [24,] -0.04376055 -2.98509266 [25,] -1.11683023 -0.04376055 [26,] -2.70683121 -1.11683023 [27,] -0.09979980 -2.70683121 [28,] -2.20049362 -0.09979980 [29,] -5.25187831 -2.20049362 [30,] 1.95059568 -5.25187831 [31,] -3.79841609 1.95059568 [32,] -0.87722473 -3.79841609 [33,] -0.71959961 -0.87722473 [34,] -3.64316977 -0.71959961 [35,] -0.34999902 -3.64316977 [36,] -1.88589949 -0.34999902 [37,] -0.90401824 -1.88589949 [38,] 2.87281592 -0.90401824 [39,] 0.01350777 2.87281592 [40,] -3.39560116 0.01350777 [41,] 3.95746459 -3.39560116 [42,] 0.23024280 3.95746459 [43,] 2.52479334 0.23024280 [44,] 2.30143123 2.52479334 [45,] -2.09738134 2.30143123 [46,] -2.02391519 -2.09738134 [47,] 4.12717018 -2.02391519 [48,] -2.36368122 4.12717018 [49,] -2.03625532 -2.36368122 [50,] -2.46388142 -2.03625532 [51,] 1.48770347 -2.46388142 [52,] -1.69318662 1.48770347 [53,] 4.51929032 -1.69318662 [54,] -3.06190105 4.51929032 [55,] 2.50889090 -3.06190105 [56,] 4.03750621 2.50889090 [57,] -3.31675286 4.03750621 [58,] 4.15077609 -3.31675286 [59,] 3.54246009 4.15077609 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 4.48971950 3.35387848 2 3.88239271 4.48971950 3 -1.84275941 3.88239271 4 4.76793539 -1.84275941 5 -0.81909208 4.76793539 6 -2.28839925 -0.81909208 7 1.39279015 -2.28839925 8 -4.54840317 1.39279015 9 2.65377543 -4.54840317 10 1.80942018 2.65377543 11 -4.33453860 1.80942018 12 0.93946279 -4.33453860 13 -0.43261572 0.93946279 14 -1.58449599 -0.43261572 15 0.44134797 -1.58449599 16 2.52134601 0.44134797 17 -2.40578451 2.52134601 18 3.16946181 -2.40578451 19 -2.62805831 3.16946181 20 -0.91330954 -2.62805831 21 3.47995837 -0.91330954 22 -0.29311130 3.47995837 23 -2.98509266 -0.29311130 24 -0.04376055 -2.98509266 25 -1.11683023 -0.04376055 26 -2.70683121 -1.11683023 27 -0.09979980 -2.70683121 28 -2.20049362 -0.09979980 29 -5.25187831 -2.20049362 30 1.95059568 -5.25187831 31 -3.79841609 1.95059568 32 -0.87722473 -3.79841609 33 -0.71959961 -0.87722473 34 -3.64316977 -0.71959961 35 -0.34999902 -3.64316977 36 -1.88589949 -0.34999902 37 -0.90401824 -1.88589949 38 2.87281592 -0.90401824 39 0.01350777 2.87281592 40 -3.39560116 0.01350777 41 3.95746459 -3.39560116 42 0.23024280 3.95746459 43 2.52479334 0.23024280 44 2.30143123 2.52479334 45 -2.09738134 2.30143123 46 -2.02391519 -2.09738134 47 4.12717018 -2.02391519 48 -2.36368122 4.12717018 49 -2.03625532 -2.36368122 50 -2.46388142 -2.03625532 51 1.48770347 -2.46388142 52 -1.69318662 1.48770347 53 4.51929032 -1.69318662 54 -3.06190105 4.51929032 55 2.50889090 -3.06190105 56 4.03750621 2.50889090 57 -3.31675286 4.03750621 58 4.15077609 -3.31675286 59 3.54246009 4.15077609 > 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/7eugo1260712375.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/851261260712375.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/9va9s1260712375.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/10fq011260712375.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/11184h1260712375.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/121z4n1260712376.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/13dk1g1260712376.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/14cx1z1260712376.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/150qig1260712376.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/16rpf31260712376.tab") + } > try(system("convert tmp/1suz51260712375.ps tmp/1suz51260712375.png",intern=TRUE)) character(0) > try(system("convert tmp/28eyn1260712375.ps tmp/28eyn1260712375.png",intern=TRUE)) character(0) > try(system("convert tmp/35cka1260712375.ps tmp/35cka1260712375.png",intern=TRUE)) character(0) > try(system("convert tmp/4q9mv1260712375.ps tmp/4q9mv1260712375.png",intern=TRUE)) character(0) > try(system("convert tmp/52nhh1260712375.ps tmp/52nhh1260712375.png",intern=TRUE)) character(0) > try(system("convert tmp/6cc141260712375.ps tmp/6cc141260712375.png",intern=TRUE)) character(0) > try(system("convert tmp/7eugo1260712375.ps tmp/7eugo1260712375.png",intern=TRUE)) character(0) > try(system("convert tmp/851261260712375.ps tmp/851261260712375.png",intern=TRUE)) character(0) > try(system("convert tmp/9va9s1260712375.ps tmp/9va9s1260712375.png",intern=TRUE)) character(0) > try(system("convert tmp/10fq011260712375.ps tmp/10fq011260712375.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.384 1.560 3.105