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(21,2472.81,19,2407.6,25,2454.62,21,2448.05,23,2497.84,23,2645.64,19,2756.76,18,2849.27,19,2921.44,19,2981.85,22,3080.58,23,3106.22,20,3119.31,14,3061.26,14,3097.31,14,3161.69,15,3257.16,11,3277.01,17,3295.32,16,3363.99,20,3494.17,24,3667.03,23,3813.06,20,3917.96,21,3895.51,19,3801.06,23,3570.12,23,3701.61,23,3862.27,23,3970.1,27,4138.52,26,4199.75,17,4290.89,24,4443.91,26,4502.64,24,4356.98,27,4591.27,27,4696.96,26,4621.4,24,4562.84,23,4202.52,23,4296.49,24,4435.23,17,4105.18,21,4116.68,19,3844.49,22,3720.98,22,3674.4,18,3857.62,16,3801.06,14,3504.37,12,3032.6,14,3047.03,16,2962.34,8,2197.82,3,2014.45,0,1862.83,5,1905.41,1,1810.99,1,1670.07,3,1864.44),dim=c(2,61),dimnames=list(c('Consvertr','Aand'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('Consvertr','Aand'),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 = 'No 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 Consvertr Aand M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 21 2472.81 1 0 0 0 0 0 0 0 0 0 0 2 19 2407.60 0 1 0 0 0 0 0 0 0 0 0 3 25 2454.62 0 0 1 0 0 0 0 0 0 0 0 4 21 2448.05 0 0 0 1 0 0 0 0 0 0 0 5 23 2497.84 0 0 0 0 1 0 0 0 0 0 0 6 23 2645.64 0 0 0 0 0 1 0 0 0 0 0 7 19 2756.76 0 0 0 0 0 0 1 0 0 0 0 8 18 2849.27 0 0 0 0 0 0 0 1 0 0 0 9 19 2921.44 0 0 0 0 0 0 0 0 1 0 0 10 19 2981.85 0 0 0 0 0 0 0 0 0 1 0 11 22 3080.58 0 0 0 0 0 0 0 0 0 0 1 12 23 3106.22 0 0 0 0 0 0 0 0 0 0 0 13 20 3119.31 1 0 0 0 0 0 0 0 0 0 0 14 14 3061.26 0 1 0 0 0 0 0 0 0 0 0 15 14 3097.31 0 0 1 0 0 0 0 0 0 0 0 16 14 3161.69 0 0 0 1 0 0 0 0 0 0 0 17 15 3257.16 0 0 0 0 1 0 0 0 0 0 0 18 11 3277.01 0 0 0 0 0 1 0 0 0 0 0 19 17 3295.32 0 0 0 0 0 0 1 0 0 0 0 20 16 3363.99 0 0 0 0 0 0 0 1 0 0 0 21 20 3494.17 0 0 0 0 0 0 0 0 1 0 0 22 24 3667.03 0 0 0 0 0 0 0 0 0 1 0 23 23 3813.06 0 0 0 0 0 0 0 0 0 0 1 24 20 3917.96 0 0 0 0 0 0 0 0 0 0 0 25 21 3895.51 1 0 0 0 0 0 0 0 0 0 0 26 19 3801.06 0 1 0 0 0 0 0 0 0 0 0 27 23 3570.12 0 0 1 0 0 0 0 0 0 0 0 28 23 3701.61 0 0 0 1 0 0 0 0 0 0 0 29 23 3862.27 0 0 0 0 1 0 0 0 0 0 0 30 23 3970.10 0 0 0 0 0 1 0 0 0 0 0 31 27 4138.52 0 0 0 0 0 0 1 0 0 0 0 32 26 4199.75 0 0 0 0 0 0 0 1 0 0 0 33 17 4290.89 0 0 0 0 0 0 0 0 1 0 0 34 24 4443.91 0 0 0 0 0 0 0 0 0 1 0 35 26 4502.64 0 0 0 0 0 0 0 0 0 0 1 36 24 4356.98 0 0 0 0 0 0 0 0 0 0 0 37 27 4591.27 1 0 0 0 0 0 0 0 0 0 0 38 27 4696.96 0 1 0 0 0 0 0 0 0 0 0 39 26 4621.40 0 0 1 0 0 0 0 0 0 0 0 40 24 4562.84 0 0 0 1 0 0 0 0 0 0 0 41 23 4202.52 0 0 0 0 1 0 0 0 0 0 0 42 23 4296.49 0 0 0 0 0 1 0 0 0 0 0 43 24 4435.23 0 0 0 0 0 0 1 0 0 0 0 44 17 4105.18 0 0 0 0 0 0 0 1 0 0 0 45 21 4116.68 0 0 0 0 0 0 0 0 1 0 0 46 19 3844.49 0 0 0 0 0 0 0 0 0 1 0 47 22 3720.98 0 0 0 0 0 0 0 0 0 0 1 48 22 3674.40 0 0 0 0 0 0 0 0 0 0 0 49 18 3857.62 1 0 0 0 0 0 0 0 0 0 0 50 16 3801.06 0 1 0 0 0 0 0 0 0 0 0 51 14 3504.37 0 0 1 0 0 0 0 0 0 0 0 52 12 3032.60 0 0 0 1 0 0 0 0 0 0 0 53 14 3047.03 0 0 0 0 1 0 0 0 0 0 0 54 16 2962.34 0 0 0 0 0 1 0 0 0 0 0 55 8 2197.82 0 0 0 0 0 0 1 0 0 0 0 56 3 2014.45 0 0 0 0 0 0 0 1 0 0 0 57 0 1862.83 0 0 0 0 0 0 0 0 1 0 0 58 5 1905.41 0 0 0 0 0 0 0 0 0 1 0 59 1 1810.99 0 0 0 0 0 0 0 0 0 0 1 60 1 1670.07 0 0 0 0 0 0 0 0 0 0 0 61 3 1864.44 1 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Aand M1 M2 M3 M4 -2.546239 0.006142 0.609521 -0.280403 1.758527 0.577458 M5 M6 M7 M8 M9 M10 1.426558 0.676751 0.879589 -1.762926 -2.551330 0.056200 M11 0.551096 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -8.1282 -3.7573 -0.3529 3.1751 10.7111 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -2.5462390 3.4796775 -0.732 0.468 Aand 0.0061421 0.0007954 7.722 5.81e-10 *** M1 0.6095209 3.0365131 0.201 0.842 M2 -0.2804032 3.1756463 -0.088 0.930 M3 1.7585270 3.1724023 0.554 0.582 M4 0.5774579 3.1714454 0.182 0.856 M5 1.4265582 3.1713940 0.450 0.655 M6 0.6767509 3.1720383 0.213 0.832 M7 0.8795894 3.1713528 0.277 0.783 M8 -1.7629256 3.1714631 -0.556 0.581 M9 -2.5513297 3.1713208 -0.805 0.425 M10 0.0562002 3.1713692 0.018 0.986 M11 0.5510958 3.1714783 0.174 0.863 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.014 on 48 degrees of freedom Multiple R-squared: 0.5715, Adjusted R-squared: 0.4644 F-statistic: 5.335 on 12 and 48 DF, p-value: 1.242e-05 > 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.6038017 0.792396683 0.396198341 [2,] 0.4400812 0.880162377 0.559918812 [3,] 0.5837742 0.832451522 0.416225761 [4,] 0.5329312 0.934137569 0.467068784 [5,] 0.4651765 0.930352952 0.534823524 [6,] 0.6510357 0.697928661 0.348964331 [7,] 0.9141561 0.171687795 0.085843898 [8,] 0.9189126 0.162174729 0.081087365 [9,] 0.8797356 0.240528803 0.120264402 [10,] 0.8901270 0.219746036 0.109873018 [11,] 0.9018919 0.196216153 0.098108076 [12,] 0.9559274 0.088145147 0.044072574 [13,] 0.9829878 0.034024366 0.017012183 [14,] 0.9812708 0.037458382 0.018729191 [15,] 0.9791283 0.041743323 0.020871661 [16,] 0.9888570 0.022286049 0.011143024 [17,] 0.9976648 0.004670346 0.002335173 [18,] 0.9982718 0.003456328 0.001728164 [19,] 0.9963383 0.007323408 0.003661704 [20,] 0.9922436 0.015512854 0.007756427 [21,] 0.9860806 0.027838743 0.013919371 [22,] 0.9786250 0.042749933 0.021374967 [23,] 0.9779911 0.044017750 0.022008875 [24,] 0.9661984 0.067603193 0.033801596 [25,] 0.9349864 0.130027181 0.065013590 [26,] 0.8818388 0.236322406 0.118161203 [27,] 0.8650825 0.269835075 0.134917537 [28,] 0.8140252 0.371949683 0.185974841 [29,] 0.8248188 0.350362415 0.175181207 [30,] 0.6770847 0.645830598 0.322915299 > postscript(file="/var/www/html/rcomp/tmp/103lw1258616066.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/2ulic1258616066.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/3g2y51258616066.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/488tg1258616066.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/5oobi1258616066.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 7 7.7483679 7.0388211 10.7110874 7.9325103 8.7775928 8.6195914 3.7342381 8 9 10 11 12 13 14 4.8085436 6.1536693 3.1750926 5.0737833 6.4673946 2.7774731 -1.9760515 15 16 17 18 19 20 21 -4.2364059 -3.4507679 -3.8862585 -7.2583728 -1.5736739 -0.3529398 3.6358802 22 23 24 25 26 27 28 3.9666197 1.5747871 -1.5184278 -0.9900576 -1.5200082 1.8595279 2.2329667 29 30 31 32 33 34 35 0.3970699 0.4845700 3.2472719 4.5137036 -4.2576872 -0.8050876 0.3392888 36 37 38 39 40 41 42 -0.2149510 0.7364857 0.9772468 -1.5975832 -2.0568303 -1.6927939 -1.5201637 43 44 45 46 47 48 49 -1.5751631 -3.9054340 0.8123354 -2.1233648 1.1403555 1.9775523 -3.7573318 50 51 52 53 54 55 56 -4.5200082 -6.7366262 -4.6578788 -3.5956102 -0.3256249 -3.8326730 -5.0638734 57 58 59 60 61 -6.3441978 -4.2132600 -8.1282146 -6.7115681 -6.5149372 > postscript(file="/var/www/html/rcomp/tmp/6xvap1258616066.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 7.7483679 NA 1 7.0388211 7.7483679 2 10.7110874 7.0388211 3 7.9325103 10.7110874 4 8.7775928 7.9325103 5 8.6195914 8.7775928 6 3.7342381 8.6195914 7 4.8085436 3.7342381 8 6.1536693 4.8085436 9 3.1750926 6.1536693 10 5.0737833 3.1750926 11 6.4673946 5.0737833 12 2.7774731 6.4673946 13 -1.9760515 2.7774731 14 -4.2364059 -1.9760515 15 -3.4507679 -4.2364059 16 -3.8862585 -3.4507679 17 -7.2583728 -3.8862585 18 -1.5736739 -7.2583728 19 -0.3529398 -1.5736739 20 3.6358802 -0.3529398 21 3.9666197 3.6358802 22 1.5747871 3.9666197 23 -1.5184278 1.5747871 24 -0.9900576 -1.5184278 25 -1.5200082 -0.9900576 26 1.8595279 -1.5200082 27 2.2329667 1.8595279 28 0.3970699 2.2329667 29 0.4845700 0.3970699 30 3.2472719 0.4845700 31 4.5137036 3.2472719 32 -4.2576872 4.5137036 33 -0.8050876 -4.2576872 34 0.3392888 -0.8050876 35 -0.2149510 0.3392888 36 0.7364857 -0.2149510 37 0.9772468 0.7364857 38 -1.5975832 0.9772468 39 -2.0568303 -1.5975832 40 -1.6927939 -2.0568303 41 -1.5201637 -1.6927939 42 -1.5751631 -1.5201637 43 -3.9054340 -1.5751631 44 0.8123354 -3.9054340 45 -2.1233648 0.8123354 46 1.1403555 -2.1233648 47 1.9775523 1.1403555 48 -3.7573318 1.9775523 49 -4.5200082 -3.7573318 50 -6.7366262 -4.5200082 51 -4.6578788 -6.7366262 52 -3.5956102 -4.6578788 53 -0.3256249 -3.5956102 54 -3.8326730 -0.3256249 55 -5.0638734 -3.8326730 56 -6.3441978 -5.0638734 57 -4.2132600 -6.3441978 58 -8.1282146 -4.2132600 59 -6.7115681 -8.1282146 60 -6.5149372 -6.7115681 61 NA -6.5149372 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 7.0388211 7.7483679 [2,] 10.7110874 7.0388211 [3,] 7.9325103 10.7110874 [4,] 8.7775928 7.9325103 [5,] 8.6195914 8.7775928 [6,] 3.7342381 8.6195914 [7,] 4.8085436 3.7342381 [8,] 6.1536693 4.8085436 [9,] 3.1750926 6.1536693 [10,] 5.0737833 3.1750926 [11,] 6.4673946 5.0737833 [12,] 2.7774731 6.4673946 [13,] -1.9760515 2.7774731 [14,] -4.2364059 -1.9760515 [15,] -3.4507679 -4.2364059 [16,] -3.8862585 -3.4507679 [17,] -7.2583728 -3.8862585 [18,] -1.5736739 -7.2583728 [19,] -0.3529398 -1.5736739 [20,] 3.6358802 -0.3529398 [21,] 3.9666197 3.6358802 [22,] 1.5747871 3.9666197 [23,] -1.5184278 1.5747871 [24,] -0.9900576 -1.5184278 [25,] -1.5200082 -0.9900576 [26,] 1.8595279 -1.5200082 [27,] 2.2329667 1.8595279 [28,] 0.3970699 2.2329667 [29,] 0.4845700 0.3970699 [30,] 3.2472719 0.4845700 [31,] 4.5137036 3.2472719 [32,] -4.2576872 4.5137036 [33,] -0.8050876 -4.2576872 [34,] 0.3392888 -0.8050876 [35,] -0.2149510 0.3392888 [36,] 0.7364857 -0.2149510 [37,] 0.9772468 0.7364857 [38,] -1.5975832 0.9772468 [39,] -2.0568303 -1.5975832 [40,] -1.6927939 -2.0568303 [41,] -1.5201637 -1.6927939 [42,] -1.5751631 -1.5201637 [43,] -3.9054340 -1.5751631 [44,] 0.8123354 -3.9054340 [45,] -2.1233648 0.8123354 [46,] 1.1403555 -2.1233648 [47,] 1.9775523 1.1403555 [48,] -3.7573318 1.9775523 [49,] -4.5200082 -3.7573318 [50,] -6.7366262 -4.5200082 [51,] -4.6578788 -6.7366262 [52,] -3.5956102 -4.6578788 [53,] -0.3256249 -3.5956102 [54,] -3.8326730 -0.3256249 [55,] -5.0638734 -3.8326730 [56,] -6.3441978 -5.0638734 [57,] -4.2132600 -6.3441978 [58,] -8.1282146 -4.2132600 [59,] -6.7115681 -8.1282146 [60,] -6.5149372 -6.7115681 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 7.0388211 7.7483679 2 10.7110874 7.0388211 3 7.9325103 10.7110874 4 8.7775928 7.9325103 5 8.6195914 8.7775928 6 3.7342381 8.6195914 7 4.8085436 3.7342381 8 6.1536693 4.8085436 9 3.1750926 6.1536693 10 5.0737833 3.1750926 11 6.4673946 5.0737833 12 2.7774731 6.4673946 13 -1.9760515 2.7774731 14 -4.2364059 -1.9760515 15 -3.4507679 -4.2364059 16 -3.8862585 -3.4507679 17 -7.2583728 -3.8862585 18 -1.5736739 -7.2583728 19 -0.3529398 -1.5736739 20 3.6358802 -0.3529398 21 3.9666197 3.6358802 22 1.5747871 3.9666197 23 -1.5184278 1.5747871 24 -0.9900576 -1.5184278 25 -1.5200082 -0.9900576 26 1.8595279 -1.5200082 27 2.2329667 1.8595279 28 0.3970699 2.2329667 29 0.4845700 0.3970699 30 3.2472719 0.4845700 31 4.5137036 3.2472719 32 -4.2576872 4.5137036 33 -0.8050876 -4.2576872 34 0.3392888 -0.8050876 35 -0.2149510 0.3392888 36 0.7364857 -0.2149510 37 0.9772468 0.7364857 38 -1.5975832 0.9772468 39 -2.0568303 -1.5975832 40 -1.6927939 -2.0568303 41 -1.5201637 -1.6927939 42 -1.5751631 -1.5201637 43 -3.9054340 -1.5751631 44 0.8123354 -3.9054340 45 -2.1233648 0.8123354 46 1.1403555 -2.1233648 47 1.9775523 1.1403555 48 -3.7573318 1.9775523 49 -4.5200082 -3.7573318 50 -6.7366262 -4.5200082 51 -4.6578788 -6.7366262 52 -3.5956102 -4.6578788 53 -0.3256249 -3.5956102 54 -3.8326730 -0.3256249 55 -5.0638734 -3.8326730 56 -6.3441978 -5.0638734 57 -4.2132600 -6.3441978 58 -8.1282146 -4.2132600 59 -6.7115681 -8.1282146 60 -6.5149372 -6.7115681 > 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/709fw1258616066.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/8xd1e1258616066.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/9qxiy1258616066.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/10h6001258616066.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/11eazu1258616066.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/12fvxq1258616067.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/13k1sa1258616067.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/14qqj31258616067.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/15jgej1258616067.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/1675mx1258616067.tab") + } > > system("convert tmp/103lw1258616066.ps tmp/103lw1258616066.png") > system("convert tmp/2ulic1258616066.ps tmp/2ulic1258616066.png") > system("convert tmp/3g2y51258616066.ps tmp/3g2y51258616066.png") > system("convert tmp/488tg1258616066.ps tmp/488tg1258616066.png") > system("convert tmp/5oobi1258616066.ps tmp/5oobi1258616066.png") > system("convert tmp/6xvap1258616066.ps tmp/6xvap1258616066.png") > system("convert tmp/709fw1258616066.ps tmp/709fw1258616066.png") > system("convert tmp/8xd1e1258616066.ps tmp/8xd1e1258616066.png") > system("convert tmp/9qxiy1258616066.ps tmp/9qxiy1258616066.png") > system("convert tmp/10h6001258616066.ps tmp/10h6001258616066.png") > > > proc.time() user system elapsed 2.392 1.530 3.634