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(110.5,55,110.8,48.7,104.2,70.3,88.9,94.8,89.8,58.5,90,62.4,93.9,56.7,91.3,65.1,87.8,114.4,99.7,50.7,73.5,44.5,79.2,72,96.9,61.2,95.2,68.4,95.6,78.7,89.7,64.1,92.8,64.6,88,71.9,101.1,71,92.7,76.4,95.8,117.3,103.8,66.1,81.8,57.3,87.1,75,105.9,63.8,108.1,62.2,102.6,75.4,93.7,58,103.5,62.1,100.6,99.2,113.3,70.7,102.4,73.3,102.1,111.2,106.9,68.9,87.3,57.6,93.1,72.9,109.1,75.9,120.3,79.4,104.9,96.9,92.6,75.2,109.8,60.3,111.4,88.9,117.9,90.5,121.6,79.9,117.8,116.3,124.2,95.2,106.8,81.5,102.7,89.1,116.8,76,113.6,100.5,96.1,83.9,85,75.1,83.2,69.5,84.9,95.1,83,90.1,79.6,78.4,83.2,113.8,83.8,73.6,82.8,56.5,71.4,97.7),dim=c(2,60),dimnames=list(c('prod','inv '),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('prod','inv '),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 prod inv\r M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 110.5 55.0 1 0 0 0 0 0 0 0 0 0 0 1 2 110.8 48.7 0 1 0 0 0 0 0 0 0 0 0 2 3 104.2 70.3 0 0 1 0 0 0 0 0 0 0 0 3 4 88.9 94.8 0 0 0 1 0 0 0 0 0 0 0 4 5 89.8 58.5 0 0 0 0 1 0 0 0 0 0 0 5 6 90.0 62.4 0 0 0 0 0 1 0 0 0 0 0 6 7 93.9 56.7 0 0 0 0 0 0 1 0 0 0 0 7 8 91.3 65.1 0 0 0 0 0 0 0 1 0 0 0 8 9 87.8 114.4 0 0 0 0 0 0 0 0 1 0 0 9 10 99.7 50.7 0 0 0 0 0 0 0 0 0 1 0 10 11 73.5 44.5 0 0 0 0 0 0 0 0 0 0 1 11 12 79.2 72.0 0 0 0 0 0 0 0 0 0 0 0 12 13 96.9 61.2 1 0 0 0 0 0 0 0 0 0 0 13 14 95.2 68.4 0 1 0 0 0 0 0 0 0 0 0 14 15 95.6 78.7 0 0 1 0 0 0 0 0 0 0 0 15 16 89.7 64.1 0 0 0 1 0 0 0 0 0 0 0 16 17 92.8 64.6 0 0 0 0 1 0 0 0 0 0 0 17 18 88.0 71.9 0 0 0 0 0 1 0 0 0 0 0 18 19 101.1 71.0 0 0 0 0 0 0 1 0 0 0 0 19 20 92.7 76.4 0 0 0 0 0 0 0 1 0 0 0 20 21 95.8 117.3 0 0 0 0 0 0 0 0 1 0 0 21 22 103.8 66.1 0 0 0 0 0 0 0 0 0 1 0 22 23 81.8 57.3 0 0 0 0 0 0 0 0 0 0 1 23 24 87.1 75.0 0 0 0 0 0 0 0 0 0 0 0 24 25 105.9 63.8 1 0 0 0 0 0 0 0 0 0 0 25 26 108.1 62.2 0 1 0 0 0 0 0 0 0 0 0 26 27 102.6 75.4 0 0 1 0 0 0 0 0 0 0 0 27 28 93.7 58.0 0 0 0 1 0 0 0 0 0 0 0 28 29 103.5 62.1 0 0 0 0 1 0 0 0 0 0 0 29 30 100.6 99.2 0 0 0 0 0 1 0 0 0 0 0 30 31 113.3 70.7 0 0 0 0 0 0 1 0 0 0 0 31 32 102.4 73.3 0 0 0 0 0 0 0 1 0 0 0 32 33 102.1 111.2 0 0 0 0 0 0 0 0 1 0 0 33 34 106.9 68.9 0 0 0 0 0 0 0 0 0 1 0 34 35 87.3 57.6 0 0 0 0 0 0 0 0 0 0 1 35 36 93.1 72.9 0 0 0 0 0 0 0 0 0 0 0 36 37 109.1 75.9 1 0 0 0 0 0 0 0 0 0 0 37 38 120.3 79.4 0 1 0 0 0 0 0 0 0 0 0 38 39 104.9 96.9 0 0 1 0 0 0 0 0 0 0 0 39 40 92.6 75.2 0 0 0 1 0 0 0 0 0 0 0 40 41 109.8 60.3 0 0 0 0 1 0 0 0 0 0 0 41 42 111.4 88.9 0 0 0 0 0 1 0 0 0 0 0 42 43 117.9 90.5 0 0 0 0 0 0 1 0 0 0 0 43 44 121.6 79.9 0 0 0 0 0 0 0 1 0 0 0 44 45 117.8 116.3 0 0 0 0 0 0 0 0 1 0 0 45 46 124.2 95.2 0 0 0 0 0 0 0 0 0 1 0 46 47 106.8 81.5 0 0 0 0 0 0 0 0 0 0 1 47 48 102.7 89.1 0 0 0 0 0 0 0 0 0 0 0 48 49 116.8 76.0 1 0 0 0 0 0 0 0 0 0 0 49 50 113.6 100.5 0 1 0 0 0 0 0 0 0 0 0 50 51 96.1 83.9 0 0 1 0 0 0 0 0 0 0 0 51 52 85.0 75.1 0 0 0 1 0 0 0 0 0 0 0 52 53 83.2 69.5 0 0 0 0 1 0 0 0 0 0 0 53 54 84.9 95.1 0 0 0 0 0 1 0 0 0 0 0 54 55 83.0 90.1 0 0 0 0 0 0 1 0 0 0 0 55 56 79.6 78.4 0 0 0 0 0 0 0 1 0 0 0 56 57 83.2 113.8 0 0 0 0 0 0 0 0 1 0 0 57 58 83.8 73.6 0 0 0 0 0 0 0 0 0 1 0 58 59 82.8 56.5 0 0 0 0 0 0 0 0 0 0 1 59 60 71.4 97.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) `inv\r` M1 M2 M3 M4 66.61584 0.26187 24.68595 25.04994 13.75455 5.07851 M5 M6 M7 M8 M9 M10 13.68618 7.51170 16.42184 12.44463 1.82899 19.64633 M11 t 5.43062 -0.03378 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -21.7740 -5.0675 0.2919 5.8500 23.1027 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 66.61584 12.59727 5.288 3.32e-06 *** `inv\r` 0.26187 0.16735 1.565 0.12450 M1 24.68595 7.36838 3.350 0.00162 ** M2 25.04994 7.20419 3.477 0.00112 ** M3 13.75455 7.16031 1.921 0.06095 . M4 5.07851 7.17076 0.708 0.48238 M5 13.68618 7.57714 1.806 0.07742 . M6 7.51170 7.15668 1.050 0.29938 M7 16.42184 7.13300 2.302 0.02590 * M8 12.44463 7.15511 1.739 0.08868 . M9 1.82899 9.15111 0.200 0.84247 M10 19.64633 7.27856 2.699 0.00969 ** M11 5.43062 7.95298 0.683 0.49813 t -0.03378 0.10958 -0.308 0.75928 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 11.22 on 46 degrees of freedom Multiple R-squared: 0.3784, Adjusted R-squared: 0.2028 F-statistic: 2.154 on 13 and 46 DF, p-value: 0.0283 > 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.0964755949 0.192951190 0.9035244 [2,] 0.0481627202 0.096325440 0.9518373 [3,] 0.0707887892 0.141577578 0.9292112 [4,] 0.0433551546 0.086710309 0.9566448 [5,] 0.0416281728 0.083256346 0.9583718 [6,] 0.0255625175 0.051125035 0.9744375 [7,] 0.0272918534 0.054583707 0.9727081 [8,] 0.0203029136 0.040605827 0.9796971 [9,] 0.0116444021 0.023288804 0.9883556 [10,] 0.0062086626 0.012417325 0.9937913 [11,] 0.0027695198 0.005539040 0.9972305 [12,] 0.0011271627 0.002254325 0.9988728 [13,] 0.0010412217 0.002082443 0.9989588 [14,] 0.0015771580 0.003154316 0.9984228 [15,] 0.0016866650 0.003373330 0.9983133 [16,] 0.0011924449 0.002384890 0.9988076 [17,] 0.0010337907 0.002067581 0.9989662 [18,] 0.0005474077 0.001094815 0.9994526 [19,] 0.0018083412 0.003616682 0.9981917 [20,] 0.0021270269 0.004254054 0.9978730 [21,] 0.0162280587 0.032456117 0.9837719 [22,] 0.0299430891 0.059886178 0.9700569 [23,] 0.0823794601 0.164758920 0.9176205 [24,] 0.5266375782 0.946724844 0.4733624 [25,] 0.4779728608 0.955945722 0.5220271 [26,] 0.5197850357 0.960429929 0.4802150 [27,] 0.3640932816 0.728186563 0.6359067 > postscript(file="/var/www/html/rcomp/tmp/1d2qa1258638968.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/2yk7v1258638968.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/3geao1258638968.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/4qp721258638968.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/5dokr1258638968.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 4.8293461 6.4488934 5.5217516 -7.4841556 -5.6522939 -0.2653138 7 8 9 10 11 12 -3.7490463 -4.5377252 -10.2983188 0.4990066 -9.8279354 -5.8648611 13 14 15 16 17 18 -9.9888788 -13.9045261 -4.8725790 1.7604849 -3.8443321 -4.3476973 19 20 21 22 23 24 0.1116121 -5.6914680 -2.6523850 0.9716121 -4.4744776 1.6548861 25 26 27 28 29 30 -1.2643850 1.0243908 3.3969258 7.7632152 7.9156796 1.5086996 31 32 33 34 35 36 12.7955180 5.2256635 5.6503453 3.7437325 1.3523086 8.6101513 37 38 39 40 41 42 -0.8276208 9.1256370 0.4721470 2.5644614 15.0923850 15.4112682 43 44 45 46 47 48 12.6159119 23.1026921 20.4201734 14.5619957 14.9990508 14.3732638 49 50 51 52 53 54 7.2515386 -2.6943952 -4.5182454 -4.6040059 -13.5114387 -12.3069566 55 56 57 58 59 60 -21.7739956 -18.0991624 -13.1198149 -19.7763468 -2.0489464 -18.7734401 > postscript(file="/var/www/html/rcomp/tmp/6q5sy1258638968.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 4.8293461 NA 1 6.4488934 4.8293461 2 5.5217516 6.4488934 3 -7.4841556 5.5217516 4 -5.6522939 -7.4841556 5 -0.2653138 -5.6522939 6 -3.7490463 -0.2653138 7 -4.5377252 -3.7490463 8 -10.2983188 -4.5377252 9 0.4990066 -10.2983188 10 -9.8279354 0.4990066 11 -5.8648611 -9.8279354 12 -9.9888788 -5.8648611 13 -13.9045261 -9.9888788 14 -4.8725790 -13.9045261 15 1.7604849 -4.8725790 16 -3.8443321 1.7604849 17 -4.3476973 -3.8443321 18 0.1116121 -4.3476973 19 -5.6914680 0.1116121 20 -2.6523850 -5.6914680 21 0.9716121 -2.6523850 22 -4.4744776 0.9716121 23 1.6548861 -4.4744776 24 -1.2643850 1.6548861 25 1.0243908 -1.2643850 26 3.3969258 1.0243908 27 7.7632152 3.3969258 28 7.9156796 7.7632152 29 1.5086996 7.9156796 30 12.7955180 1.5086996 31 5.2256635 12.7955180 32 5.6503453 5.2256635 33 3.7437325 5.6503453 34 1.3523086 3.7437325 35 8.6101513 1.3523086 36 -0.8276208 8.6101513 37 9.1256370 -0.8276208 38 0.4721470 9.1256370 39 2.5644614 0.4721470 40 15.0923850 2.5644614 41 15.4112682 15.0923850 42 12.6159119 15.4112682 43 23.1026921 12.6159119 44 20.4201734 23.1026921 45 14.5619957 20.4201734 46 14.9990508 14.5619957 47 14.3732638 14.9990508 48 7.2515386 14.3732638 49 -2.6943952 7.2515386 50 -4.5182454 -2.6943952 51 -4.6040059 -4.5182454 52 -13.5114387 -4.6040059 53 -12.3069566 -13.5114387 54 -21.7739956 -12.3069566 55 -18.0991624 -21.7739956 56 -13.1198149 -18.0991624 57 -19.7763468 -13.1198149 58 -2.0489464 -19.7763468 59 -18.7734401 -2.0489464 60 NA -18.7734401 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 6.4488934 4.8293461 [2,] 5.5217516 6.4488934 [3,] -7.4841556 5.5217516 [4,] -5.6522939 -7.4841556 [5,] -0.2653138 -5.6522939 [6,] -3.7490463 -0.2653138 [7,] -4.5377252 -3.7490463 [8,] -10.2983188 -4.5377252 [9,] 0.4990066 -10.2983188 [10,] -9.8279354 0.4990066 [11,] -5.8648611 -9.8279354 [12,] -9.9888788 -5.8648611 [13,] -13.9045261 -9.9888788 [14,] -4.8725790 -13.9045261 [15,] 1.7604849 -4.8725790 [16,] -3.8443321 1.7604849 [17,] -4.3476973 -3.8443321 [18,] 0.1116121 -4.3476973 [19,] -5.6914680 0.1116121 [20,] -2.6523850 -5.6914680 [21,] 0.9716121 -2.6523850 [22,] -4.4744776 0.9716121 [23,] 1.6548861 -4.4744776 [24,] -1.2643850 1.6548861 [25,] 1.0243908 -1.2643850 [26,] 3.3969258 1.0243908 [27,] 7.7632152 3.3969258 [28,] 7.9156796 7.7632152 [29,] 1.5086996 7.9156796 [30,] 12.7955180 1.5086996 [31,] 5.2256635 12.7955180 [32,] 5.6503453 5.2256635 [33,] 3.7437325 5.6503453 [34,] 1.3523086 3.7437325 [35,] 8.6101513 1.3523086 [36,] -0.8276208 8.6101513 [37,] 9.1256370 -0.8276208 [38,] 0.4721470 9.1256370 [39,] 2.5644614 0.4721470 [40,] 15.0923850 2.5644614 [41,] 15.4112682 15.0923850 [42,] 12.6159119 15.4112682 [43,] 23.1026921 12.6159119 [44,] 20.4201734 23.1026921 [45,] 14.5619957 20.4201734 [46,] 14.9990508 14.5619957 [47,] 14.3732638 14.9990508 [48,] 7.2515386 14.3732638 [49,] -2.6943952 7.2515386 [50,] -4.5182454 -2.6943952 [51,] -4.6040059 -4.5182454 [52,] -13.5114387 -4.6040059 [53,] -12.3069566 -13.5114387 [54,] -21.7739956 -12.3069566 [55,] -18.0991624 -21.7739956 [56,] -13.1198149 -18.0991624 [57,] -19.7763468 -13.1198149 [58,] -2.0489464 -19.7763468 [59,] -18.7734401 -2.0489464 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 6.4488934 4.8293461 2 5.5217516 6.4488934 3 -7.4841556 5.5217516 4 -5.6522939 -7.4841556 5 -0.2653138 -5.6522939 6 -3.7490463 -0.2653138 7 -4.5377252 -3.7490463 8 -10.2983188 -4.5377252 9 0.4990066 -10.2983188 10 -9.8279354 0.4990066 11 -5.8648611 -9.8279354 12 -9.9888788 -5.8648611 13 -13.9045261 -9.9888788 14 -4.8725790 -13.9045261 15 1.7604849 -4.8725790 16 -3.8443321 1.7604849 17 -4.3476973 -3.8443321 18 0.1116121 -4.3476973 19 -5.6914680 0.1116121 20 -2.6523850 -5.6914680 21 0.9716121 -2.6523850 22 -4.4744776 0.9716121 23 1.6548861 -4.4744776 24 -1.2643850 1.6548861 25 1.0243908 -1.2643850 26 3.3969258 1.0243908 27 7.7632152 3.3969258 28 7.9156796 7.7632152 29 1.5086996 7.9156796 30 12.7955180 1.5086996 31 5.2256635 12.7955180 32 5.6503453 5.2256635 33 3.7437325 5.6503453 34 1.3523086 3.7437325 35 8.6101513 1.3523086 36 -0.8276208 8.6101513 37 9.1256370 -0.8276208 38 0.4721470 9.1256370 39 2.5644614 0.4721470 40 15.0923850 2.5644614 41 15.4112682 15.0923850 42 12.6159119 15.4112682 43 23.1026921 12.6159119 44 20.4201734 23.1026921 45 14.5619957 20.4201734 46 14.9990508 14.5619957 47 14.3732638 14.9990508 48 7.2515386 14.3732638 49 -2.6943952 7.2515386 50 -4.5182454 -2.6943952 51 -4.6040059 -4.5182454 52 -13.5114387 -4.6040059 53 -12.3069566 -13.5114387 54 -21.7739956 -12.3069566 55 -18.0991624 -21.7739956 56 -13.1198149 -18.0991624 57 -19.7763468 -13.1198149 58 -2.0489464 -19.7763468 59 -18.7734401 -2.0489464 > 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/717id1258638968.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/89b251258638968.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/9dtm71258638968.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/10wwpa1258638968.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/11n3to1258638968.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/12eecz1258638968.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/13c29h1258638968.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/14t2ys1258638968.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/15l3fw1258638968.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/16n66z1258638968.tab") + } > > system("convert tmp/1d2qa1258638968.ps tmp/1d2qa1258638968.png") > system("convert tmp/2yk7v1258638968.ps tmp/2yk7v1258638968.png") > system("convert tmp/3geao1258638968.ps tmp/3geao1258638968.png") > system("convert tmp/4qp721258638968.ps tmp/4qp721258638968.png") > system("convert tmp/5dokr1258638968.ps tmp/5dokr1258638968.png") > system("convert tmp/6q5sy1258638968.ps tmp/6q5sy1258638968.png") > system("convert tmp/717id1258638968.ps tmp/717id1258638968.png") > system("convert tmp/89b251258638968.ps tmp/89b251258638968.png") > system("convert tmp/9dtm71258638968.ps tmp/9dtm71258638968.png") > system("convert tmp/10wwpa1258638968.ps tmp/10wwpa1258638968.png") > > > proc.time() user system elapsed 2.417 1.569 3.463