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(3499 + ,1 + ,4164 + ,3186 + ,4145 + ,1 + ,3499 + ,3902 + ,3796 + ,1 + ,4145 + ,4164 + ,3711 + ,1 + ,3796 + ,3499 + ,3949 + ,1 + ,3711 + ,4145 + ,3740 + ,1 + ,3949 + ,3796 + ,3243 + ,1 + ,3740 + ,3711 + ,4407 + ,1 + ,3243 + ,3949 + ,4814 + ,1 + ,4407 + ,3740 + ,3908 + ,1 + ,4814 + ,3243 + ,5250 + ,1 + ,3908 + ,4407 + ,3937 + ,1 + ,5250 + ,4814 + ,4004 + ,1 + ,3937 + ,3908 + ,5560 + ,1 + ,4004 + ,5250 + ,3922 + ,1 + ,5560 + ,3937 + ,3759 + ,1 + ,3922 + ,4004 + ,4138 + ,1 + ,3759 + ,5560 + ,4634 + ,1 + ,4138 + ,3922 + ,3996 + ,1 + ,4634 + ,3759 + ,4308 + ,1 + ,3996 + ,4138 + ,4143 + ,0 + ,4308 + ,4634 + ,4429 + ,0 + ,4143 + ,3996 + ,5219 + ,0 + ,4429 + ,4308 + ,4929 + ,0 + ,5219 + ,4143 + ,5755 + ,0 + ,4929 + ,4429 + ,5592 + ,0 + ,5755 + ,5219 + ,4163 + ,0 + ,5592 + ,4929 + ,4962 + ,0 + ,4163 + ,5755 + ,5208 + ,0 + ,4962 + ,5592 + ,4755 + ,0 + ,5208 + ,4163 + ,4491 + ,0 + ,4755 + ,4962 + ,5732 + ,0 + ,4491 + ,5208 + ,5731 + ,0 + ,5732 + ,4755 + ,5040 + ,0 + ,5731 + ,4491 + ,6102 + ,0 + ,5040 + ,5732 + ,4904 + ,0 + ,6102 + ,5731 + ,5369 + ,0 + ,4904 + ,5040 + ,5578 + ,0 + ,5369 + ,6102 + ,4619 + ,0 + ,5578 + ,4904 + ,4731 + ,0 + ,4619 + ,5369 + ,5011 + ,0 + ,4731 + ,5578 + ,5299 + ,0 + ,5011 + ,4619 + ,4146 + ,0 + ,5299 + ,4731 + ,4625 + ,0 + ,4146 + ,5011 + ,4736 + ,0 + ,4625 + ,5299 + ,4219 + ,0 + ,4736 + ,4146 + ,5116 + ,0 + ,4219 + ,4625 + ,4205 + ,0 + ,5116 + ,4736 + ,4121 + ,0 + ,4205 + ,4219 + ,5103 + ,1 + ,4121 + ,5116 + ,4300 + ,1 + ,5103 + ,4205 + ,4578 + ,1 + ,4300 + ,4121 + ,3809 + ,1 + ,4578 + ,5103 + ,5526 + ,1 + ,3809 + ,4300 + ,4247 + ,1 + ,5526 + ,4578 + ,3830 + ,1 + ,4247 + ,3809 + ,4394 + ,1 + ,3830 + ,5526) + ,dim=c(4 + ,57) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y3') + ,1:57)) > y <- array(NA,dim=c(4,57),dimnames=list(c('Y','X','Y1','Y3'),1:57)) > 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 Y3 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 3499 1 4164 3186 1 0 0 0 0 0 0 0 0 0 0 1 2 4145 1 3499 3902 0 1 0 0 0 0 0 0 0 0 0 2 3 3796 1 4145 4164 0 0 1 0 0 0 0 0 0 0 0 3 4 3711 1 3796 3499 0 0 0 1 0 0 0 0 0 0 0 4 5 3949 1 3711 4145 0 0 0 0 1 0 0 0 0 0 0 5 6 3740 1 3949 3796 0 0 0 0 0 1 0 0 0 0 0 6 7 3243 1 3740 3711 0 0 0 0 0 0 1 0 0 0 0 7 8 4407 1 3243 3949 0 0 0 0 0 0 0 1 0 0 0 8 9 4814 1 4407 3740 0 0 0 0 0 0 0 0 1 0 0 9 10 3908 1 4814 3243 0 0 0 0 0 0 0 0 0 1 0 10 11 5250 1 3908 4407 0 0 0 0 0 0 0 0 0 0 1 11 12 3937 1 5250 4814 0 0 0 0 0 0 0 0 0 0 0 12 13 4004 1 3937 3908 1 0 0 0 0 0 0 0 0 0 0 13 14 5560 1 4004 5250 0 1 0 0 0 0 0 0 0 0 0 14 15 3922 1 5560 3937 0 0 1 0 0 0 0 0 0 0 0 15 16 3759 1 3922 4004 0 0 0 1 0 0 0 0 0 0 0 16 17 4138 1 3759 5560 0 0 0 0 1 0 0 0 0 0 0 17 18 4634 1 4138 3922 0 0 0 0 0 1 0 0 0 0 0 18 19 3996 1 4634 3759 0 0 0 0 0 0 1 0 0 0 0 19 20 4308 1 3996 4138 0 0 0 0 0 0 0 1 0 0 0 20 21 4143 0 4308 4634 0 0 0 0 0 0 0 0 1 0 0 21 22 4429 0 4143 3996 0 0 0 0 0 0 0 0 0 1 0 22 23 5219 0 4429 4308 0 0 0 0 0 0 0 0 0 0 1 23 24 4929 0 5219 4143 0 0 0 0 0 0 0 0 0 0 0 24 25 5755 0 4929 4429 1 0 0 0 0 0 0 0 0 0 0 25 26 5592 0 5755 5219 0 1 0 0 0 0 0 0 0 0 0 26 27 4163 0 5592 4929 0 0 1 0 0 0 0 0 0 0 0 27 28 4962 0 4163 5755 0 0 0 1 0 0 0 0 0 0 0 28 29 5208 0 4962 5592 0 0 0 0 1 0 0 0 0 0 0 29 30 4755 0 5208 4163 0 0 0 0 0 1 0 0 0 0 0 30 31 4491 0 4755 4962 0 0 0 0 0 0 1 0 0 0 0 31 32 5732 0 4491 5208 0 0 0 0 0 0 0 1 0 0 0 32 33 5731 0 5732 4755 0 0 0 0 0 0 0 0 1 0 0 33 34 5040 0 5731 4491 0 0 0 0 0 0 0 0 0 1 0 34 35 6102 0 5040 5732 0 0 0 0 0 0 0 0 0 0 1 35 36 4904 0 6102 5731 0 0 0 0 0 0 0 0 0 0 0 36 37 5369 0 4904 5040 1 0 0 0 0 0 0 0 0 0 0 37 38 5578 0 5369 6102 0 1 0 0 0 0 0 0 0 0 0 38 39 4619 0 5578 4904 0 0 1 0 0 0 0 0 0 0 0 39 40 4731 0 4619 5369 0 0 0 1 0 0 0 0 0 0 0 40 41 5011 0 4731 5578 0 0 0 0 1 0 0 0 0 0 0 41 42 5299 0 5011 4619 0 0 0 0 0 1 0 0 0 0 0 42 43 4146 0 5299 4731 0 0 0 0 0 0 1 0 0 0 0 43 44 4625 0 4146 5011 0 0 0 0 0 0 0 1 0 0 0 44 45 4736 0 4625 5299 0 0 0 0 0 0 0 0 1 0 0 45 46 4219 0 4736 4146 0 0 0 0 0 0 0 0 0 1 0 46 47 5116 0 4219 4625 0 0 0 0 0 0 0 0 0 0 1 47 48 4205 0 5116 4736 0 0 0 0 0 0 0 0 0 0 0 48 49 4121 0 4205 4219 1 0 0 0 0 0 0 0 0 0 0 49 50 5103 1 4121 5116 0 1 0 0 0 0 0 0 0 0 0 50 51 4300 1 5103 4205 0 0 1 0 0 0 0 0 0 0 0 51 52 4578 1 4300 4121 0 0 0 1 0 0 0 0 0 0 0 52 53 3809 1 4578 5103 0 0 0 0 1 0 0 0 0 0 0 53 54 5526 1 3809 4300 0 0 0 0 0 1 0 0 0 0 0 54 55 4247 1 5526 4578 0 0 0 0 0 0 1 0 0 0 0 55 56 3830 1 4247 3809 0 0 0 0 0 0 0 1 0 0 0 56 57 4394 1 3830 5526 0 0 0 0 0 0 0 0 1 0 0 57 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y3 M1 M2 873.5520 -166.5097 0.3365 0.3866 679.0994 947.0511 M3 M4 M5 M6 M7 M8 -37.8229 453.0974 216.1444 960.4946 -0.8976 785.1415 M9 M10 M11 t 607.1484 435.8897 1304.8417 -1.3340 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -715.98 -247.58 -84.63 227.45 986.30 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 873.5520 990.0459 0.882 0.382740 X -166.5097 175.6586 -0.948 0.348726 Y1 0.3365 0.1379 2.441 0.019051 * Y3 0.3866 0.1447 2.673 0.010747 * M1 679.0994 322.0127 2.109 0.041104 * M2 947.0511 317.2347 2.985 0.004760 ** M3 -37.8229 294.3958 -0.128 0.898400 M4 453.0974 326.2729 1.389 0.172420 M5 216.1444 329.5252 0.656 0.515536 M6 960.4946 318.8983 3.012 0.004433 ** M7 -0.8976 302.3943 -0.003 0.997646 M8 785.1415 338.2139 2.321 0.025312 * M9 607.1484 310.3111 1.957 0.057231 . M10 435.8897 336.8809 1.294 0.202942 M11 1304.8417 336.3071 3.880 0.000371 *** t -1.3340 4.3023 -0.310 0.758085 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 432.7 on 41 degrees of freedom Multiple R-squared: 0.6941, Adjusted R-squared: 0.5821 F-statistic: 6.201 on 15 and 41 DF, p-value: 1.604e-06 > 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.6216030 0.7567941 0.37839705 [2,] 0.5804285 0.8391429 0.41957145 [3,] 0.5006035 0.9987929 0.49939646 [4,] 0.5733220 0.8533561 0.42667803 [5,] 0.4961340 0.9922681 0.50386595 [6,] 0.5314902 0.9370196 0.46850979 [7,] 0.7911493 0.4177014 0.20885072 [8,] 0.7153929 0.5692141 0.28460706 [9,] 0.7494804 0.5010393 0.25051965 [10,] 0.7065689 0.5868621 0.29343105 [11,] 0.6141123 0.7717754 0.38588768 [12,] 0.8724651 0.2550699 0.12753495 [13,] 0.9450838 0.1098325 0.05491623 [14,] 0.9123285 0.1753431 0.08767154 [15,] 0.8735029 0.2529941 0.12649707 [16,] 0.7899137 0.4201726 0.21008632 [17,] 0.6765582 0.6468836 0.32344181 [18,] 0.6062704 0.7874591 0.39372956 [19,] 0.4490041 0.8980083 0.55099586 [20,] 0.3395778 0.6791555 0.66042224 > postscript(file="/var/www/html/rcomp/tmp/1iekg1258624682.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/256xl1258624682.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/3qv851258624682.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/4hlu81258624682.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/55c681258624682.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 = 57 Frequency = 1 1 2 3 4 5 6 7 -518.76308 -192.43156 126.10379 -73.94083 181.19031 -715.98113 -147.06405 8 9 10 11 12 13 14 307.45400 582.90199 -95.30847 233.91171 -381.84772 -200.51187 547.47772 15 16 17 18 19 20 21 -120.26923 -247.57618 -177.02474 81.71412 302.55696 -101.99260 -550.92724 22 23 24 25 26 27 28 209.85268 -84.62984 729.50547 864.75025 -148.24618 -424.06866 46.84990 29 30 31 32 33 34 35 325.29481 -401.01627 141.23190 591.25304 527.12662 111.12411 58.22738 36 37 38 39 40 41 42 -190.57074 266.94404 -357.73809 62.31560 -172.34897 227.44619 48.98160 43 44 45 46 47 48 49 -281.50525 -307.48294 -289.68551 -225.66831 -207.50925 -157.08700 -412.41933 50 51 52 53 54 55 56 150.93810 355.91849 447.01608 -556.90658 986.30167 -15.21955 -489.23151 57 -269.41586 > postscript(file="/var/www/html/rcomp/tmp/652lb1258624682.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 = 57 Frequency = 1 lag(myerror, k = 1) myerror 0 -518.76308 NA 1 -192.43156 -518.76308 2 126.10379 -192.43156 3 -73.94083 126.10379 4 181.19031 -73.94083 5 -715.98113 181.19031 6 -147.06405 -715.98113 7 307.45400 -147.06405 8 582.90199 307.45400 9 -95.30847 582.90199 10 233.91171 -95.30847 11 -381.84772 233.91171 12 -200.51187 -381.84772 13 547.47772 -200.51187 14 -120.26923 547.47772 15 -247.57618 -120.26923 16 -177.02474 -247.57618 17 81.71412 -177.02474 18 302.55696 81.71412 19 -101.99260 302.55696 20 -550.92724 -101.99260 21 209.85268 -550.92724 22 -84.62984 209.85268 23 729.50547 -84.62984 24 864.75025 729.50547 25 -148.24618 864.75025 26 -424.06866 -148.24618 27 46.84990 -424.06866 28 325.29481 46.84990 29 -401.01627 325.29481 30 141.23190 -401.01627 31 591.25304 141.23190 32 527.12662 591.25304 33 111.12411 527.12662 34 58.22738 111.12411 35 -190.57074 58.22738 36 266.94404 -190.57074 37 -357.73809 266.94404 38 62.31560 -357.73809 39 -172.34897 62.31560 40 227.44619 -172.34897 41 48.98160 227.44619 42 -281.50525 48.98160 43 -307.48294 -281.50525 44 -289.68551 -307.48294 45 -225.66831 -289.68551 46 -207.50925 -225.66831 47 -157.08700 -207.50925 48 -412.41933 -157.08700 49 150.93810 -412.41933 50 355.91849 150.93810 51 447.01608 355.91849 52 -556.90658 447.01608 53 986.30167 -556.90658 54 -15.21955 986.30167 55 -489.23151 -15.21955 56 -269.41586 -489.23151 57 NA -269.41586 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -192.43156 -518.76308 [2,] 126.10379 -192.43156 [3,] -73.94083 126.10379 [4,] 181.19031 -73.94083 [5,] -715.98113 181.19031 [6,] -147.06405 -715.98113 [7,] 307.45400 -147.06405 [8,] 582.90199 307.45400 [9,] -95.30847 582.90199 [10,] 233.91171 -95.30847 [11,] -381.84772 233.91171 [12,] -200.51187 -381.84772 [13,] 547.47772 -200.51187 [14,] -120.26923 547.47772 [15,] -247.57618 -120.26923 [16,] -177.02474 -247.57618 [17,] 81.71412 -177.02474 [18,] 302.55696 81.71412 [19,] -101.99260 302.55696 [20,] -550.92724 -101.99260 [21,] 209.85268 -550.92724 [22,] -84.62984 209.85268 [23,] 729.50547 -84.62984 [24,] 864.75025 729.50547 [25,] -148.24618 864.75025 [26,] -424.06866 -148.24618 [27,] 46.84990 -424.06866 [28,] 325.29481 46.84990 [29,] -401.01627 325.29481 [30,] 141.23190 -401.01627 [31,] 591.25304 141.23190 [32,] 527.12662 591.25304 [33,] 111.12411 527.12662 [34,] 58.22738 111.12411 [35,] -190.57074 58.22738 [36,] 266.94404 -190.57074 [37,] -357.73809 266.94404 [38,] 62.31560 -357.73809 [39,] -172.34897 62.31560 [40,] 227.44619 -172.34897 [41,] 48.98160 227.44619 [42,] -281.50525 48.98160 [43,] -307.48294 -281.50525 [44,] -289.68551 -307.48294 [45,] -225.66831 -289.68551 [46,] -207.50925 -225.66831 [47,] -157.08700 -207.50925 [48,] -412.41933 -157.08700 [49,] 150.93810 -412.41933 [50,] 355.91849 150.93810 [51,] 447.01608 355.91849 [52,] -556.90658 447.01608 [53,] 986.30167 -556.90658 [54,] -15.21955 986.30167 [55,] -489.23151 -15.21955 [56,] -269.41586 -489.23151 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -192.43156 -518.76308 2 126.10379 -192.43156 3 -73.94083 126.10379 4 181.19031 -73.94083 5 -715.98113 181.19031 6 -147.06405 -715.98113 7 307.45400 -147.06405 8 582.90199 307.45400 9 -95.30847 582.90199 10 233.91171 -95.30847 11 -381.84772 233.91171 12 -200.51187 -381.84772 13 547.47772 -200.51187 14 -120.26923 547.47772 15 -247.57618 -120.26923 16 -177.02474 -247.57618 17 81.71412 -177.02474 18 302.55696 81.71412 19 -101.99260 302.55696 20 -550.92724 -101.99260 21 209.85268 -550.92724 22 -84.62984 209.85268 23 729.50547 -84.62984 24 864.75025 729.50547 25 -148.24618 864.75025 26 -424.06866 -148.24618 27 46.84990 -424.06866 28 325.29481 46.84990 29 -401.01627 325.29481 30 141.23190 -401.01627 31 591.25304 141.23190 32 527.12662 591.25304 33 111.12411 527.12662 34 58.22738 111.12411 35 -190.57074 58.22738 36 266.94404 -190.57074 37 -357.73809 266.94404 38 62.31560 -357.73809 39 -172.34897 62.31560 40 227.44619 -172.34897 41 48.98160 227.44619 42 -281.50525 48.98160 43 -307.48294 -281.50525 44 -289.68551 -307.48294 45 -225.66831 -289.68551 46 -207.50925 -225.66831 47 -157.08700 -207.50925 48 -412.41933 -157.08700 49 150.93810 -412.41933 50 355.91849 150.93810 51 447.01608 355.91849 52 -556.90658 447.01608 53 986.30167 -556.90658 54 -15.21955 986.30167 55 -489.23151 -15.21955 56 -269.41586 -489.23151 > 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/76j4d1258624682.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/8dc1w1258624682.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/9vnz11258624682.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/102rqd1258624682.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/11ck3g1258624682.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/12wg371258624682.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/13wq3n1258624682.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/14xnx51258624682.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/15u8fq1258624682.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/16oqkr1258624682.tab") + } > > system("convert tmp/1iekg1258624682.ps tmp/1iekg1258624682.png") > system("convert tmp/256xl1258624682.ps tmp/256xl1258624682.png") > system("convert tmp/3qv851258624682.ps tmp/3qv851258624682.png") > system("convert tmp/4hlu81258624682.ps tmp/4hlu81258624682.png") > system("convert tmp/55c681258624682.ps tmp/55c681258624682.png") > system("convert tmp/652lb1258624682.ps tmp/652lb1258624682.png") > system("convert tmp/76j4d1258624682.ps tmp/76j4d1258624682.png") > system("convert tmp/8dc1w1258624682.ps tmp/8dc1w1258624682.png") > system("convert tmp/9vnz11258624682.ps tmp/9vnz11258624682.png") > system("convert tmp/102rqd1258624682.ps tmp/102rqd1258624682.png") > > > proc.time() user system elapsed 2.338 1.553 3.329