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(23 + ,2497.84 + ,21 + ,25 + ,19 + ,21 + ,23 + ,2645.64 + ,23 + ,21 + ,25 + ,19 + ,19 + ,2756.76 + ,23 + ,23 + ,21 + ,25 + ,18 + ,2849.27 + ,19 + ,23 + ,23 + ,21 + ,19 + ,2921.44 + ,18 + ,19 + ,23 + ,23 + ,19 + ,2981.85 + ,19 + ,18 + ,19 + ,23 + ,22 + ,3080.58 + ,19 + ,19 + ,18 + ,19 + ,23 + ,3106.22 + ,22 + ,19 + ,19 + ,18 + ,20 + ,3119.31 + ,23 + ,22 + ,19 + ,19 + ,14 + ,3061.26 + ,20 + ,23 + ,22 + ,19 + ,14 + ,3097.31 + ,14 + ,20 + ,23 + ,22 + ,14 + ,3161.69 + ,14 + ,14 + ,20 + ,23 + ,15 + ,3257.16 + ,14 + ,14 + ,14 + ,20 + ,11 + ,3277.01 + ,15 + ,14 + ,14 + ,14 + ,17 + ,3295.32 + ,11 + ,15 + ,14 + ,14 + ,16 + ,3363.99 + ,17 + ,11 + ,15 + ,14 + ,20 + ,3494.17 + ,16 + ,17 + ,11 + ,15 + ,24 + ,3667.03 + ,20 + ,16 + ,17 + ,11 + ,23 + ,3813.06 + ,24 + ,20 + ,16 + ,17 + ,20 + ,3917.96 + ,23 + ,24 + ,20 + ,16 + ,21 + ,3895.51 + ,20 + ,23 + ,24 + ,20 + ,19 + ,3801.06 + ,21 + ,20 + ,23 + ,24 + ,23 + ,3570.12 + ,19 + ,21 + ,20 + ,23 + ,23 + ,3701.61 + ,23 + ,19 + ,21 + ,20 + ,23 + ,3862.27 + ,23 + ,23 + ,19 + ,21 + ,23 + ,3970.1 + ,23 + ,23 + ,23 + ,19 + ,27 + ,4138.52 + ,23 + ,23 + ,23 + ,23 + ,26 + ,4199.75 + ,27 + ,23 + ,23 + ,23 + ,17 + ,4290.89 + ,26 + ,27 + ,23 + ,23 + ,24 + ,4443.91 + ,17 + ,26 + ,27 + ,23 + ,26 + ,4502.64 + ,24 + ,17 + ,26 + ,27 + ,24 + ,4356.98 + ,26 + ,24 + ,17 + ,26 + ,27 + ,4591.27 + ,24 + ,26 + ,24 + ,17 + ,27 + ,4696.96 + ,27 + ,24 + ,26 + ,24 + ,26 + ,4621.4 + ,27 + ,27 + ,24 + ,26 + ,24 + ,4562.84 + ,26 + ,27 + ,27 + ,24 + ,23 + ,4202.52 + ,24 + ,26 + ,27 + ,27 + ,23 + ,4296.49 + ,23 + ,24 + ,26 + ,27 + ,24 + ,4435.23 + ,23 + ,23 + ,24 + ,26 + ,17 + ,4105.18 + ,24 + ,23 + ,23 + ,24 + ,21 + ,4116.68 + ,17 + ,24 + ,23 + ,23 + ,19 + ,3844.49 + ,21 + ,17 + ,24 + ,23 + ,22 + ,3720.98 + ,19 + ,21 + ,17 + ,24 + ,22 + ,3674.4 + ,22 + ,19 + ,21 + ,17 + ,18 + ,3857.62 + ,22 + ,22 + ,19 + ,21 + ,16 + ,3801.06 + ,18 + ,22 + ,22 + ,19 + ,14 + ,3504.37 + ,16 + ,18 + ,22 + ,22 + ,12 + ,3032.6 + ,14 + ,16 + ,18 + ,22 + ,14 + ,3047.03 + ,12 + ,14 + ,16 + ,18 + ,16 + ,2962.34 + ,14 + ,12 + ,14 + ,16 + ,8 + ,2197.82 + ,16 + ,14 + ,12 + ,14 + ,3 + ,2014.45 + ,8 + ,16 + ,14 + ,12 + ,0 + ,1862.83 + ,3 + ,8 + ,16 + ,14 + ,5 + ,1905.41 + ,0 + ,3 + ,8 + ,16 + ,1 + ,1810.99 + ,5 + ,0 + ,3 + ,8 + ,1 + ,1670.07 + ,1 + ,5 + ,0 + ,3 + ,3 + ,1864.44 + ,1 + ,1 + ,5 + ,0) + ,dim=c(6 + ,57) + ,dimnames=list(c('Consvertr' + ,'Aand' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4') + ,1:57)) > y <- array(NA,dim=c(6,57),dimnames=list(c('Consvertr','Aand','Y1','Y2','Y3','Y4'),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 = 'Do not include Seasonal 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 Y1 Y2 Y3 Y4 t 1 23 2497.84 21 25 19 21 1 2 23 2645.64 23 21 25 19 2 3 19 2756.76 23 23 21 25 3 4 18 2849.27 19 23 23 21 4 5 19 2921.44 18 19 23 23 5 6 19 2981.85 19 18 19 23 6 7 22 3080.58 19 19 18 19 7 8 23 3106.22 22 19 19 18 8 9 20 3119.31 23 22 19 19 9 10 14 3061.26 20 23 22 19 10 11 14 3097.31 14 20 23 22 11 12 14 3161.69 14 14 20 23 12 13 15 3257.16 14 14 14 20 13 14 11 3277.01 15 14 14 14 14 15 17 3295.32 11 15 14 14 15 16 16 3363.99 17 11 15 14 16 17 20 3494.17 16 17 11 15 17 18 24 3667.03 20 16 17 11 18 19 23 3813.06 24 20 16 17 19 20 20 3917.96 23 24 20 16 20 21 21 3895.51 20 23 24 20 21 22 19 3801.06 21 20 23 24 22 23 23 3570.12 19 21 20 23 23 24 23 3701.61 23 19 21 20 24 25 23 3862.27 23 23 19 21 25 26 23 3970.10 23 23 23 19 26 27 27 4138.52 23 23 23 23 27 28 26 4199.75 27 23 23 23 28 29 17 4290.89 26 27 23 23 29 30 24 4443.91 17 26 27 23 30 31 26 4502.64 24 17 26 27 31 32 24 4356.98 26 24 17 26 32 33 27 4591.27 24 26 24 17 33 34 27 4696.96 27 24 26 24 34 35 26 4621.40 27 27 24 26 35 36 24 4562.84 26 27 27 24 36 37 23 4202.52 24 26 27 27 37 38 23 4296.49 23 24 26 27 38 39 24 4435.23 23 23 24 26 39 40 17 4105.18 24 23 23 24 40 41 21 4116.68 17 24 23 23 41 42 19 3844.49 21 17 24 23 42 43 22 3720.98 19 21 17 24 43 44 22 3674.40 22 19 21 17 44 45 18 3857.62 22 22 19 21 45 46 16 3801.06 18 22 22 19 46 47 14 3504.37 16 18 22 22 47 48 12 3032.60 14 16 18 22 48 49 14 3047.03 12 14 16 18 49 50 16 2962.34 14 12 14 16 50 51 8 2197.82 16 14 12 14 51 52 3 2014.45 8 16 14 12 52 53 0 1862.83 3 8 16 14 53 54 5 1905.41 0 3 8 16 54 55 1 1810.99 5 0 3 8 55 56 1 1670.07 1 5 0 3 56 57 3 1864.44 1 1 5 0 57 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Aand Y1 Y2 Y3 Y4 -0.872484 0.004138 0.437428 -0.016178 -0.011072 0.007874 t -0.101399 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7.8056 -1.7500 0.2428 2.0204 4.9012 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.8724842 1.9510287 -0.447 0.656668 Aand 0.0041380 0.0009408 4.398 5.71e-05 *** Y1 0.4374277 0.1385624 3.157 0.002702 ** Y2 -0.0161778 0.1453937 -0.111 0.911848 Y3 -0.0110721 0.1455645 -0.076 0.939672 Y4 0.0078737 0.1231817 0.064 0.949289 t -0.1013992 0.0283598 -3.575 0.000787 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.836 on 50 degrees of freedom Multiple R-squared: 0.8541, Adjusted R-squared: 0.8366 F-statistic: 48.8 on 6 and 50 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.08722176 0.17444352 0.91277824 [2,] 0.12500664 0.25001329 0.87499336 [3,] 0.08831645 0.17663289 0.91168355 [4,] 0.10489420 0.20978841 0.89510580 [5,] 0.55588962 0.88822075 0.44411038 [6,] 0.65153280 0.69693439 0.34846720 [7,] 0.62059169 0.75881663 0.37940831 [8,] 0.69990431 0.60019138 0.30009569 [9,] 0.76828515 0.46342970 0.23171485 [10,] 0.69598658 0.60802684 0.30401342 [11,] 0.66395808 0.67208384 0.33604192 [12,] 0.69518792 0.60962416 0.30481208 [13,] 0.72917737 0.54164527 0.27082263 [14,] 0.84219866 0.31560269 0.15780134 [15,] 0.79025407 0.41949185 0.20974593 [16,] 0.72514722 0.54970556 0.27485278 [17,] 0.65252170 0.69495661 0.34747830 [18,] 0.76322197 0.47355607 0.23677803 [19,] 0.76650028 0.46699945 0.23349972 [20,] 0.96780913 0.06438174 0.03219087 [21,] 0.96887392 0.06225217 0.03112608 [22,] 0.95392565 0.09214870 0.04607435 [23,] 0.93856878 0.12286245 0.06143122 [24,] 0.92057537 0.15884926 0.07942463 [25,] 0.88151107 0.23697787 0.11848893 [26,] 0.82853616 0.34292767 0.17146384 [27,] 0.77183555 0.45632890 0.22816445 [28,] 0.70252707 0.59494586 0.29747293 [29,] 0.61457471 0.77085057 0.38542529 [30,] 0.51796595 0.96406809 0.48203405 [31,] 0.76219562 0.47560877 0.23780438 [32,] 0.69257195 0.61485610 0.30742805 [33,] 0.68653670 0.62692661 0.31346330 [34,] 0.61394044 0.77211911 0.38605956 [35,] 0.90318490 0.19363020 0.09681510 [36,] 0.83368716 0.33262567 0.16631284 [37,] 0.71857699 0.56284603 0.28142301 [38,] 0.88413274 0.23173451 0.11586726 > postscript(file="/var/www/html/rcomp/tmp/1kijy1258648015.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/2uel91258648015.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/35t1y1258648015.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/44qyo1258648015.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/54oln1258648015.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 4.90121331 3.53362406 -0.88397077 -0.36203117 0.79769478 0.15122100 7 8 9 10 11 12 2.88067244 2.58263502 -0.76690062 -5.06361081 -2.54790396 -2.85106881 13 14 15 16 17 18 -2.18753967 -6.55846580 1.23305478 -2.62791073 1.41713125 3.13526830 19 20 21 22 23 24 -0.11092429 -2.88930378 -0.38610660 -2.42239810 3.50033016 1.31024553 25 26 27 28 29 30 0.78152098 0.49675167 3.86972765 0.96804386 -7.80555855 2.62759861 31 32 33 34 35 36 1.23580900 -0.91343137 2.27404687 0.56048609 -0.01480280 -1.18468844 37 38 39 40 41 42 0.24278491 0.34933266 0.84617217 -5.11942172 2.02043587 -0.60371619 43 44 45 46 47 48 3.86296017 2.91187501 -1.75000272 -1.61588120 -1.50024470 -0.64843227 49 50 51 52 53 54 2.24510555 3.78334720 -1.80053772 -2.37067713 -2.57775585 3.47451514 55 56 57 -2.26141519 0.25986875 1.57122818 > postscript(file="/var/www/html/rcomp/tmp/63je81258648015.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 4.90121331 NA 1 3.53362406 4.90121331 2 -0.88397077 3.53362406 3 -0.36203117 -0.88397077 4 0.79769478 -0.36203117 5 0.15122100 0.79769478 6 2.88067244 0.15122100 7 2.58263502 2.88067244 8 -0.76690062 2.58263502 9 -5.06361081 -0.76690062 10 -2.54790396 -5.06361081 11 -2.85106881 -2.54790396 12 -2.18753967 -2.85106881 13 -6.55846580 -2.18753967 14 1.23305478 -6.55846580 15 -2.62791073 1.23305478 16 1.41713125 -2.62791073 17 3.13526830 1.41713125 18 -0.11092429 3.13526830 19 -2.88930378 -0.11092429 20 -0.38610660 -2.88930378 21 -2.42239810 -0.38610660 22 3.50033016 -2.42239810 23 1.31024553 3.50033016 24 0.78152098 1.31024553 25 0.49675167 0.78152098 26 3.86972765 0.49675167 27 0.96804386 3.86972765 28 -7.80555855 0.96804386 29 2.62759861 -7.80555855 30 1.23580900 2.62759861 31 -0.91343137 1.23580900 32 2.27404687 -0.91343137 33 0.56048609 2.27404687 34 -0.01480280 0.56048609 35 -1.18468844 -0.01480280 36 0.24278491 -1.18468844 37 0.34933266 0.24278491 38 0.84617217 0.34933266 39 -5.11942172 0.84617217 40 2.02043587 -5.11942172 41 -0.60371619 2.02043587 42 3.86296017 -0.60371619 43 2.91187501 3.86296017 44 -1.75000272 2.91187501 45 -1.61588120 -1.75000272 46 -1.50024470 -1.61588120 47 -0.64843227 -1.50024470 48 2.24510555 -0.64843227 49 3.78334720 2.24510555 50 -1.80053772 3.78334720 51 -2.37067713 -1.80053772 52 -2.57775585 -2.37067713 53 3.47451514 -2.57775585 54 -2.26141519 3.47451514 55 0.25986875 -2.26141519 56 1.57122818 0.25986875 57 NA 1.57122818 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3.53362406 4.90121331 [2,] -0.88397077 3.53362406 [3,] -0.36203117 -0.88397077 [4,] 0.79769478 -0.36203117 [5,] 0.15122100 0.79769478 [6,] 2.88067244 0.15122100 [7,] 2.58263502 2.88067244 [8,] -0.76690062 2.58263502 [9,] -5.06361081 -0.76690062 [10,] -2.54790396 -5.06361081 [11,] -2.85106881 -2.54790396 [12,] -2.18753967 -2.85106881 [13,] -6.55846580 -2.18753967 [14,] 1.23305478 -6.55846580 [15,] -2.62791073 1.23305478 [16,] 1.41713125 -2.62791073 [17,] 3.13526830 1.41713125 [18,] -0.11092429 3.13526830 [19,] -2.88930378 -0.11092429 [20,] -0.38610660 -2.88930378 [21,] -2.42239810 -0.38610660 [22,] 3.50033016 -2.42239810 [23,] 1.31024553 3.50033016 [24,] 0.78152098 1.31024553 [25,] 0.49675167 0.78152098 [26,] 3.86972765 0.49675167 [27,] 0.96804386 3.86972765 [28,] -7.80555855 0.96804386 [29,] 2.62759861 -7.80555855 [30,] 1.23580900 2.62759861 [31,] -0.91343137 1.23580900 [32,] 2.27404687 -0.91343137 [33,] 0.56048609 2.27404687 [34,] -0.01480280 0.56048609 [35,] -1.18468844 -0.01480280 [36,] 0.24278491 -1.18468844 [37,] 0.34933266 0.24278491 [38,] 0.84617217 0.34933266 [39,] -5.11942172 0.84617217 [40,] 2.02043587 -5.11942172 [41,] -0.60371619 2.02043587 [42,] 3.86296017 -0.60371619 [43,] 2.91187501 3.86296017 [44,] -1.75000272 2.91187501 [45,] -1.61588120 -1.75000272 [46,] -1.50024470 -1.61588120 [47,] -0.64843227 -1.50024470 [48,] 2.24510555 -0.64843227 [49,] 3.78334720 2.24510555 [50,] -1.80053772 3.78334720 [51,] -2.37067713 -1.80053772 [52,] -2.57775585 -2.37067713 [53,] 3.47451514 -2.57775585 [54,] -2.26141519 3.47451514 [55,] 0.25986875 -2.26141519 [56,] 1.57122818 0.25986875 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3.53362406 4.90121331 2 -0.88397077 3.53362406 3 -0.36203117 -0.88397077 4 0.79769478 -0.36203117 5 0.15122100 0.79769478 6 2.88067244 0.15122100 7 2.58263502 2.88067244 8 -0.76690062 2.58263502 9 -5.06361081 -0.76690062 10 -2.54790396 -5.06361081 11 -2.85106881 -2.54790396 12 -2.18753967 -2.85106881 13 -6.55846580 -2.18753967 14 1.23305478 -6.55846580 15 -2.62791073 1.23305478 16 1.41713125 -2.62791073 17 3.13526830 1.41713125 18 -0.11092429 3.13526830 19 -2.88930378 -0.11092429 20 -0.38610660 -2.88930378 21 -2.42239810 -0.38610660 22 3.50033016 -2.42239810 23 1.31024553 3.50033016 24 0.78152098 1.31024553 25 0.49675167 0.78152098 26 3.86972765 0.49675167 27 0.96804386 3.86972765 28 -7.80555855 0.96804386 29 2.62759861 -7.80555855 30 1.23580900 2.62759861 31 -0.91343137 1.23580900 32 2.27404687 -0.91343137 33 0.56048609 2.27404687 34 -0.01480280 0.56048609 35 -1.18468844 -0.01480280 36 0.24278491 -1.18468844 37 0.34933266 0.24278491 38 0.84617217 0.34933266 39 -5.11942172 0.84617217 40 2.02043587 -5.11942172 41 -0.60371619 2.02043587 42 3.86296017 -0.60371619 43 2.91187501 3.86296017 44 -1.75000272 2.91187501 45 -1.61588120 -1.75000272 46 -1.50024470 -1.61588120 47 -0.64843227 -1.50024470 48 2.24510555 -0.64843227 49 3.78334720 2.24510555 50 -1.80053772 3.78334720 51 -2.37067713 -1.80053772 52 -2.57775585 -2.37067713 53 3.47451514 -2.57775585 54 -2.26141519 3.47451514 55 0.25986875 -2.26141519 56 1.57122818 0.25986875 > 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/73bip1258648015.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/8sc6s1258648015.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/9z6021258648015.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/10ajbx1258648015.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/117td21258648015.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/12jt361258648015.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/1393nn1258648015.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/141q6y1258648015.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/15vs5g1258648015.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/16gdmv1258648015.tab") + } > > system("convert tmp/1kijy1258648015.ps tmp/1kijy1258648015.png") > system("convert tmp/2uel91258648015.ps tmp/2uel91258648015.png") > system("convert tmp/35t1y1258648015.ps tmp/35t1y1258648015.png") > system("convert tmp/44qyo1258648015.ps tmp/44qyo1258648015.png") > system("convert tmp/54oln1258648015.ps tmp/54oln1258648015.png") > system("convert tmp/63je81258648015.ps tmp/63je81258648015.png") > system("convert tmp/73bip1258648015.ps tmp/73bip1258648015.png") > system("convert tmp/8sc6s1258648015.ps tmp/8sc6s1258648015.png") > system("convert tmp/9z6021258648015.ps tmp/9z6021258648015.png") > system("convert tmp/10ajbx1258648015.ps tmp/10ajbx1258648015.png") > > > proc.time() user system elapsed 2.415 1.544 2.845