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(944.2 + ,0 + ,930.9 + ,874 + ,891.9 + ,902.2 + ,935.9 + ,0 + ,944.2 + ,930.9 + ,874 + ,891.9 + ,937.1 + ,0 + ,935.9 + ,944.2 + ,930.9 + ,874 + ,885.1 + ,0 + ,937.1 + ,935.9 + ,944.2 + ,930.9 + ,892.4 + ,0 + ,885.1 + ,937.1 + ,935.9 + ,944.2 + ,987.3 + ,0 + ,892.4 + ,885.1 + ,937.1 + ,935.9 + ,946.3 + ,0 + ,987.3 + ,892.4 + ,885.1 + ,937.1 + ,799.6 + ,0 + ,946.3 + ,987.3 + ,892.4 + ,885.1 + ,875.4 + ,0 + ,799.6 + ,946.3 + ,987.3 + ,892.4 + ,846.2 + ,0 + ,875.4 + ,799.6 + ,946.3 + ,987.3 + ,880.6 + ,0 + ,846.2 + ,875.4 + ,799.6 + ,946.3 + ,885.7 + ,0 + ,880.6 + ,846.2 + ,875.4 + ,799.6 + ,868.9 + ,0 + ,885.7 + ,880.6 + ,846.2 + ,875.4 + ,882.5 + ,0 + ,868.9 + ,885.7 + ,880.6 + ,846.2 + ,789.6 + ,0 + ,882.5 + ,868.9 + ,885.7 + ,880.6 + ,773.3 + ,0 + ,789.6 + ,882.5 + ,868.9 + ,885.7 + ,804.3 + ,0 + ,773.3 + ,789.6 + ,882.5 + ,868.9 + ,817.8 + ,0 + ,804.3 + ,773.3 + ,789.6 + ,882.5 + ,836.7 + ,0 + ,817.8 + ,804.3 + ,773.3 + ,789.6 + ,721.8 + ,0 + ,836.7 + ,817.8 + ,804.3 + ,773.3 + ,760.8 + ,0 + ,721.8 + ,836.7 + ,817.8 + ,804.3 + ,841.4 + ,0 + ,760.8 + ,721.8 + ,836.7 + ,817.8 + ,1045.6 + ,0 + ,841.4 + ,760.8 + ,721.8 + ,836.7 + ,949.2 + ,0 + ,1045.6 + ,841.4 + ,760.8 + ,721.8 + ,850.1 + ,0 + ,949.2 + ,1045.6 + ,841.4 + ,760.8 + ,957.4 + ,0 + ,850.1 + ,949.2 + ,1045.6 + ,841.4 + ,851.8 + ,0 + ,957.4 + ,850.1 + ,949.2 + ,1045.6 + ,913.9 + ,0 + ,851.8 + ,957.4 + ,850.1 + ,949.2 + ,888 + ,0 + ,913.9 + ,851.8 + ,957.4 + ,850.1 + ,973.8 + ,0 + ,888 + ,913.9 + ,851.8 + ,957.4 + ,927.6 + ,1 + ,973.8 + ,888 + ,913.9 + ,851.8 + ,833 + ,1 + ,927.6 + ,973.8 + ,888 + ,913.9 + ,879.5 + ,1 + ,833 + ,927.6 + ,973.8 + ,888 + ,797.3 + ,1 + ,879.5 + ,833 + ,927.6 + ,973.8 + ,834.5 + ,1 + ,797.3 + ,879.5 + ,833 + ,927.6 + ,735.1 + ,1 + ,834.5 + ,797.3 + ,879.5 + ,833 + ,835 + ,1 + ,735.1 + ,834.5 + ,797.3 + ,879.5 + ,892.8 + ,1 + ,835 + ,735.1 + ,834.5 + ,797.3 + ,697.2 + ,1 + ,892.8 + ,835 + ,735.1 + ,834.5 + ,821.1 + ,1 + ,697.2 + ,892.8 + ,835 + ,735.1 + ,732.7 + ,1 + ,821.1 + ,697.2 + ,892.8 + ,835 + ,797.6 + ,1 + ,732.7 + ,821.1 + ,697.2 + ,892.8 + ,866.3 + ,1 + ,797.6 + ,732.7 + ,821.1 + ,697.2 + ,826.3 + ,1 + ,866.3 + ,797.6 + ,732.7 + ,821.1 + ,778.6 + ,1 + ,826.3 + ,866.3 + ,797.6 + ,732.7 + ,779.2 + ,1 + ,778.6 + ,826.3 + ,866.3 + ,797.6 + ,951 + ,1 + ,779.2 + ,778.6 + ,826.3 + ,866.3 + ,692.3 + ,1 + ,951 + ,779.2 + ,778.6 + ,826.3 + ,841.4 + ,1 + ,692.3 + ,951 + ,779.2 + ,778.6 + ,857.3 + ,1 + ,841.4 + ,692.3 + ,951 + ,779.2 + ,760.7 + ,1 + ,857.3 + ,841.4 + ,692.3 + ,951 + ,841.2 + ,1 + ,760.7 + ,857.3 + ,841.4 + ,692.3 + ,810.3 + ,1 + ,841.2 + ,760.7 + ,857.3 + ,841.4 + ,1007.4 + ,1 + ,810.3 + ,841.2 + ,760.7 + ,857.3 + ,931.3 + ,1 + ,1007.4 + ,810.3 + ,841.2 + ,760.7 + ,931.2 + ,1 + ,931.3 + ,1007.4 + ,810.3 + ,841.2) + ,dim=c(6 + ,56) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4') + ,1:56)) > y <- array(NA,dim=c(6,56),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4'),1:56)) > 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 Y X Y1 Y2 Y3 Y4 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 944.2 0 930.9 874.0 891.9 902.2 1 0 0 0 0 0 0 0 0 0 0 1 2 935.9 0 944.2 930.9 874.0 891.9 0 1 0 0 0 0 0 0 0 0 0 2 3 937.1 0 935.9 944.2 930.9 874.0 0 0 1 0 0 0 0 0 0 0 0 3 4 885.1 0 937.1 935.9 944.2 930.9 0 0 0 1 0 0 0 0 0 0 0 4 5 892.4 0 885.1 937.1 935.9 944.2 0 0 0 0 1 0 0 0 0 0 0 5 6 987.3 0 892.4 885.1 937.1 935.9 0 0 0 0 0 1 0 0 0 0 0 6 7 946.3 0 987.3 892.4 885.1 937.1 0 0 0 0 0 0 1 0 0 0 0 7 8 799.6 0 946.3 987.3 892.4 885.1 0 0 0 0 0 0 0 1 0 0 0 8 9 875.4 0 799.6 946.3 987.3 892.4 0 0 0 0 0 0 0 0 1 0 0 9 10 846.2 0 875.4 799.6 946.3 987.3 0 0 0 0 0 0 0 0 0 1 0 10 11 880.6 0 846.2 875.4 799.6 946.3 0 0 0 0 0 0 0 0 0 0 1 11 12 885.7 0 880.6 846.2 875.4 799.6 0 0 0 0 0 0 0 0 0 0 0 12 13 868.9 0 885.7 880.6 846.2 875.4 1 0 0 0 0 0 0 0 0 0 0 13 14 882.5 0 868.9 885.7 880.6 846.2 0 1 0 0 0 0 0 0 0 0 0 14 15 789.6 0 882.5 868.9 885.7 880.6 0 0 1 0 0 0 0 0 0 0 0 15 16 773.3 0 789.6 882.5 868.9 885.7 0 0 0 1 0 0 0 0 0 0 0 16 17 804.3 0 773.3 789.6 882.5 868.9 0 0 0 0 1 0 0 0 0 0 0 17 18 817.8 0 804.3 773.3 789.6 882.5 0 0 0 0 0 1 0 0 0 0 0 18 19 836.7 0 817.8 804.3 773.3 789.6 0 0 0 0 0 0 1 0 0 0 0 19 20 721.8 0 836.7 817.8 804.3 773.3 0 0 0 0 0 0 0 1 0 0 0 20 21 760.8 0 721.8 836.7 817.8 804.3 0 0 0 0 0 0 0 0 1 0 0 21 22 841.4 0 760.8 721.8 836.7 817.8 0 0 0 0 0 0 0 0 0 1 0 22 23 1045.6 0 841.4 760.8 721.8 836.7 0 0 0 0 0 0 0 0 0 0 1 23 24 949.2 0 1045.6 841.4 760.8 721.8 0 0 0 0 0 0 0 0 0 0 0 24 25 850.1 0 949.2 1045.6 841.4 760.8 1 0 0 0 0 0 0 0 0 0 0 25 26 957.4 0 850.1 949.2 1045.6 841.4 0 1 0 0 0 0 0 0 0 0 0 26 27 851.8 0 957.4 850.1 949.2 1045.6 0 0 1 0 0 0 0 0 0 0 0 27 28 913.9 0 851.8 957.4 850.1 949.2 0 0 0 1 0 0 0 0 0 0 0 28 29 888.0 0 913.9 851.8 957.4 850.1 0 0 0 0 1 0 0 0 0 0 0 29 30 973.8 0 888.0 913.9 851.8 957.4 0 0 0 0 0 1 0 0 0 0 0 30 31 927.6 1 973.8 888.0 913.9 851.8 0 0 0 0 0 0 1 0 0 0 0 31 32 833.0 1 927.6 973.8 888.0 913.9 0 0 0 0 0 0 0 1 0 0 0 32 33 879.5 1 833.0 927.6 973.8 888.0 0 0 0 0 0 0 0 0 1 0 0 33 34 797.3 1 879.5 833.0 927.6 973.8 0 0 0 0 0 0 0 0 0 1 0 34 35 834.5 1 797.3 879.5 833.0 927.6 0 0 0 0 0 0 0 0 0 0 1 35 36 735.1 1 834.5 797.3 879.5 833.0 0 0 0 0 0 0 0 0 0 0 0 36 37 835.0 1 735.1 834.5 797.3 879.5 1 0 0 0 0 0 0 0 0 0 0 37 38 892.8 1 835.0 735.1 834.5 797.3 0 1 0 0 0 0 0 0 0 0 0 38 39 697.2 1 892.8 835.0 735.1 834.5 0 0 1 0 0 0 0 0 0 0 0 39 40 821.1 1 697.2 892.8 835.0 735.1 0 0 0 1 0 0 0 0 0 0 0 40 41 732.7 1 821.1 697.2 892.8 835.0 0 0 0 0 1 0 0 0 0 0 0 41 42 797.6 1 732.7 821.1 697.2 892.8 0 0 0 0 0 1 0 0 0 0 0 42 43 866.3 1 797.6 732.7 821.1 697.2 0 0 0 0 0 0 1 0 0 0 0 43 44 826.3 1 866.3 797.6 732.7 821.1 0 0 0 0 0 0 0 1 0 0 0 44 45 778.6 1 826.3 866.3 797.6 732.7 0 0 0 0 0 0 0 0 1 0 0 45 46 779.2 1 778.6 826.3 866.3 797.6 0 0 0 0 0 0 0 0 0 1 0 46 47 951.0 1 779.2 778.6 826.3 866.3 0 0 0 0 0 0 0 0 0 0 1 47 48 692.3 1 951.0 779.2 778.6 826.3 0 0 0 0 0 0 0 0 0 0 0 48 49 841.4 1 692.3 951.0 779.2 778.6 1 0 0 0 0 0 0 0 0 0 0 49 50 857.3 1 841.4 692.3 951.0 779.2 0 1 0 0 0 0 0 0 0 0 0 50 51 760.7 1 857.3 841.4 692.3 951.0 0 0 1 0 0 0 0 0 0 0 0 51 52 841.2 1 760.7 857.3 841.4 692.3 0 0 0 1 0 0 0 0 0 0 0 52 53 810.3 1 841.2 760.7 857.3 841.4 0 0 0 0 1 0 0 0 0 0 0 53 54 1007.4 1 810.3 841.2 760.7 857.3 0 0 0 0 0 1 0 0 0 0 0 54 55 931.3 1 1007.4 810.3 841.2 760.7 0 0 0 0 0 0 1 0 0 0 0 55 56 931.2 1 931.3 1007.4 810.3 841.2 0 0 0 0 0 0 0 1 0 0 0 56 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 Y4 216.2397 -49.0889 0.3713 0.1858 0.2358 -0.1300 M1 M2 M3 M4 M5 M6 71.8686 90.2999 1.5775 52.3107 28.1986 146.7128 M7 M8 M9 M10 M11 t 88.1854 6.5574 34.2453 41.7269 173.2959 1.2268 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -114.992 -29.606 3.101 37.370 112.562 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 216.2397 184.8020 1.170 0.24924 X -49.0889 34.9864 -1.403 0.16871 Y1 0.3713 0.1592 2.333 0.02504 * Y2 0.1858 0.1574 1.181 0.24510 Y3 0.2358 0.1645 1.433 0.16001 Y4 -0.1300 0.1648 -0.789 0.43530 M1 71.8686 48.5140 1.481 0.14675 M2 90.2999 45.6240 1.979 0.05507 . M3 1.5775 46.5904 0.034 0.97317 M4 52.3107 50.5451 1.035 0.30724 M5 28.1986 47.7328 0.591 0.55818 M6 146.7128 50.6136 2.899 0.00619 ** M7 88.1854 41.6530 2.117 0.04085 * M8 6.5574 45.6165 0.144 0.88646 M9 34.2453 52.8665 0.648 0.52103 M10 41.7269 51.3464 0.813 0.42148 M11 173.2959 51.4276 3.370 0.00174 ** t 1.2268 1.1594 1.058 0.29667 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 61.64 on 38 degrees of freedom Multiple R-squared: 0.5712, Adjusted R-squared: 0.3793 F-statistic: 2.977 on 17 and 38 DF, p-value: 0.002571 > 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.04794355 0.09588710 0.9520564 [2,] 0.01761473 0.03522946 0.9823853 [3,] 0.13669759 0.27339517 0.8633024 [4,] 0.46406889 0.92813779 0.5359311 [5,] 0.44508565 0.89017130 0.5549144 [6,] 0.34626581 0.69253162 0.6537342 [7,] 0.34485296 0.68970593 0.6551470 [8,] 0.71236450 0.57527100 0.2876355 [9,] 0.64873118 0.70253764 0.3512688 [10,] 0.56210091 0.87579818 0.4378991 [11,] 0.44765953 0.89531905 0.5523405 [12,] 0.36045627 0.72091254 0.6395437 [13,] 0.25077642 0.50155284 0.7492236 [14,] 0.17719923 0.35439846 0.8228008 [15,] 0.18050730 0.36101460 0.8194927 > postscript(file="/var/www/html/rcomp/tmp/1et441258575439.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/2e1mw1258575439.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/3f3wr1258575439.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/4sqfk1258575439.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/5r55x1258575439.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 = 56 Frequency = 1 1 2 3 4 5 6 53.7082888 13.1189898 86.6804206 -11.9233947 41.0336471 21.7844784 7 8 9 10 11 12 13.9080905 -63.2838168 24.2645383 7.4770491 -64.8985207 67.9817444 13 14 15 16 17 18 -13.4626591 -26.1377376 -30.2012950 -61.8684175 9.9442563 -81.1035089 19 20 21 22 23 24 -23.9080973 -77.3627659 -27.2791812 48.7827049 112.5617470 73.2961937 25 26 27 28 29 30 -114.9917351 -10.3131278 -0.5692174 39.6803466 -4.9512355 -1.9677848 31 32 33 34 35 36 2.8061869 3.9956438 41.6951985 -26.8518392 -84.2636797 -33.3919864 37 38 39 40 41 42 48.8363991 48.9002212 -70.9579631 26.3932592 -49.4216651 -40.8265172 43 44 45 46 47 48 22.8636761 62.6432417 -38.6805556 -29.4079148 36.6004533 -107.8859517 49 50 51 52 53 54 25.9097063 -25.5683456 15.0480550 7.7182064 3.3949973 102.1133325 55 56 -15.6698562 74.0076972 > postscript(file="/var/www/html/rcomp/tmp/6cowb1258575439.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 = 56 Frequency = 1 lag(myerror, k = 1) myerror 0 53.7082888 NA 1 13.1189898 53.7082888 2 86.6804206 13.1189898 3 -11.9233947 86.6804206 4 41.0336471 -11.9233947 5 21.7844784 41.0336471 6 13.9080905 21.7844784 7 -63.2838168 13.9080905 8 24.2645383 -63.2838168 9 7.4770491 24.2645383 10 -64.8985207 7.4770491 11 67.9817444 -64.8985207 12 -13.4626591 67.9817444 13 -26.1377376 -13.4626591 14 -30.2012950 -26.1377376 15 -61.8684175 -30.2012950 16 9.9442563 -61.8684175 17 -81.1035089 9.9442563 18 -23.9080973 -81.1035089 19 -77.3627659 -23.9080973 20 -27.2791812 -77.3627659 21 48.7827049 -27.2791812 22 112.5617470 48.7827049 23 73.2961937 112.5617470 24 -114.9917351 73.2961937 25 -10.3131278 -114.9917351 26 -0.5692174 -10.3131278 27 39.6803466 -0.5692174 28 -4.9512355 39.6803466 29 -1.9677848 -4.9512355 30 2.8061869 -1.9677848 31 3.9956438 2.8061869 32 41.6951985 3.9956438 33 -26.8518392 41.6951985 34 -84.2636797 -26.8518392 35 -33.3919864 -84.2636797 36 48.8363991 -33.3919864 37 48.9002212 48.8363991 38 -70.9579631 48.9002212 39 26.3932592 -70.9579631 40 -49.4216651 26.3932592 41 -40.8265172 -49.4216651 42 22.8636761 -40.8265172 43 62.6432417 22.8636761 44 -38.6805556 62.6432417 45 -29.4079148 -38.6805556 46 36.6004533 -29.4079148 47 -107.8859517 36.6004533 48 25.9097063 -107.8859517 49 -25.5683456 25.9097063 50 15.0480550 -25.5683456 51 7.7182064 15.0480550 52 3.3949973 7.7182064 53 102.1133325 3.3949973 54 -15.6698562 102.1133325 55 74.0076972 -15.6698562 56 NA 74.0076972 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 13.1189898 53.7082888 [2,] 86.6804206 13.1189898 [3,] -11.9233947 86.6804206 [4,] 41.0336471 -11.9233947 [5,] 21.7844784 41.0336471 [6,] 13.9080905 21.7844784 [7,] -63.2838168 13.9080905 [8,] 24.2645383 -63.2838168 [9,] 7.4770491 24.2645383 [10,] -64.8985207 7.4770491 [11,] 67.9817444 -64.8985207 [12,] -13.4626591 67.9817444 [13,] -26.1377376 -13.4626591 [14,] -30.2012950 -26.1377376 [15,] -61.8684175 -30.2012950 [16,] 9.9442563 -61.8684175 [17,] -81.1035089 9.9442563 [18,] -23.9080973 -81.1035089 [19,] -77.3627659 -23.9080973 [20,] -27.2791812 -77.3627659 [21,] 48.7827049 -27.2791812 [22,] 112.5617470 48.7827049 [23,] 73.2961937 112.5617470 [24,] -114.9917351 73.2961937 [25,] -10.3131278 -114.9917351 [26,] -0.5692174 -10.3131278 [27,] 39.6803466 -0.5692174 [28,] -4.9512355 39.6803466 [29,] -1.9677848 -4.9512355 [30,] 2.8061869 -1.9677848 [31,] 3.9956438 2.8061869 [32,] 41.6951985 3.9956438 [33,] -26.8518392 41.6951985 [34,] -84.2636797 -26.8518392 [35,] -33.3919864 -84.2636797 [36,] 48.8363991 -33.3919864 [37,] 48.9002212 48.8363991 [38,] -70.9579631 48.9002212 [39,] 26.3932592 -70.9579631 [40,] -49.4216651 26.3932592 [41,] -40.8265172 -49.4216651 [42,] 22.8636761 -40.8265172 [43,] 62.6432417 22.8636761 [44,] -38.6805556 62.6432417 [45,] -29.4079148 -38.6805556 [46,] 36.6004533 -29.4079148 [47,] -107.8859517 36.6004533 [48,] 25.9097063 -107.8859517 [49,] -25.5683456 25.9097063 [50,] 15.0480550 -25.5683456 [51,] 7.7182064 15.0480550 [52,] 3.3949973 7.7182064 [53,] 102.1133325 3.3949973 [54,] -15.6698562 102.1133325 [55,] 74.0076972 -15.6698562 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 13.1189898 53.7082888 2 86.6804206 13.1189898 3 -11.9233947 86.6804206 4 41.0336471 -11.9233947 5 21.7844784 41.0336471 6 13.9080905 21.7844784 7 -63.2838168 13.9080905 8 24.2645383 -63.2838168 9 7.4770491 24.2645383 10 -64.8985207 7.4770491 11 67.9817444 -64.8985207 12 -13.4626591 67.9817444 13 -26.1377376 -13.4626591 14 -30.2012950 -26.1377376 15 -61.8684175 -30.2012950 16 9.9442563 -61.8684175 17 -81.1035089 9.9442563 18 -23.9080973 -81.1035089 19 -77.3627659 -23.9080973 20 -27.2791812 -77.3627659 21 48.7827049 -27.2791812 22 112.5617470 48.7827049 23 73.2961937 112.5617470 24 -114.9917351 73.2961937 25 -10.3131278 -114.9917351 26 -0.5692174 -10.3131278 27 39.6803466 -0.5692174 28 -4.9512355 39.6803466 29 -1.9677848 -4.9512355 30 2.8061869 -1.9677848 31 3.9956438 2.8061869 32 41.6951985 3.9956438 33 -26.8518392 41.6951985 34 -84.2636797 -26.8518392 35 -33.3919864 -84.2636797 36 48.8363991 -33.3919864 37 48.9002212 48.8363991 38 -70.9579631 48.9002212 39 26.3932592 -70.9579631 40 -49.4216651 26.3932592 41 -40.8265172 -49.4216651 42 22.8636761 -40.8265172 43 62.6432417 22.8636761 44 -38.6805556 62.6432417 45 -29.4079148 -38.6805556 46 36.6004533 -29.4079148 47 -107.8859517 36.6004533 48 25.9097063 -107.8859517 49 -25.5683456 25.9097063 50 15.0480550 -25.5683456 51 7.7182064 15.0480550 52 3.3949973 7.7182064 53 102.1133325 3.3949973 54 -15.6698562 102.1133325 55 74.0076972 -15.6698562 > 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/7ue981258575439.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/8q1mv1258575439.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/91e6v1258575439.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/10fpwj1258575439.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/117hkc1258575439.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/12osei1258575439.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/13xq4u1258575439.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/1463hu1258575439.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/15s8rq1258575439.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/16illo1258575439.tab") + } > > system("convert tmp/1et441258575439.ps tmp/1et441258575439.png") > system("convert tmp/2e1mw1258575439.ps tmp/2e1mw1258575439.png") > system("convert tmp/3f3wr1258575439.ps tmp/3f3wr1258575439.png") > system("convert tmp/4sqfk1258575439.ps tmp/4sqfk1258575439.png") > system("convert tmp/5r55x1258575439.ps tmp/5r55x1258575439.png") > system("convert tmp/6cowb1258575439.ps tmp/6cowb1258575439.png") > system("convert tmp/7ue981258575439.ps tmp/7ue981258575439.png") > system("convert tmp/8q1mv1258575439.ps tmp/8q1mv1258575439.png") > system("convert tmp/91e6v1258575439.ps tmp/91e6v1258575439.png") > system("convert tmp/10fpwj1258575439.ps tmp/10fpwj1258575439.png") > > > proc.time() user system elapsed 2.399 1.595 2.763