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(19,2407.6,21,25,2454.62,19,21,2448.05,25,23,2497.84,21,23,2645.64,23,19,2756.76,23,18,2849.27,19,19,2921.44,18,19,2981.85,19,22,3080.58,19,23,3106.22,22,20,3119.31,23,14,3061.26,20,14,3097.31,14,14,3161.69,14,15,3257.16,14,11,3277.01,15,17,3295.32,11,16,3363.99,17,20,3494.17,16,24,3667.03,20,23,3813.06,24,20,3917.96,23,21,3895.51,20,19,3801.06,21,23,3570.12,19,23,3701.61,23,23,3862.27,23,23,3970.1,23,27,4138.52,23,26,4199.75,27,17,4290.89,26,24,4443.91,17,26,4502.64,24,24,4356.98,26,27,4591.27,24,27,4696.96,27,26,4621.4,27,24,4562.84,26,23,4202.52,24,23,4296.49,23,24,4435.23,23,17,4105.18,24,21,4116.68,17,19,3844.49,21,22,3720.98,19,22,3674.4,22,18,3857.62,22,16,3801.06,18,14,3504.37,16,12,3032.6,14,14,3047.03,12,16,2962.34,14,8,2197.82,16,3,2014.45,8,0,1862.83,3,5,1905.41,0,1,1810.99,5,1,1670.07,1,3,1864.44,1),dim=c(3,60),dimnames=list(c('Consvertr','Aand','Y1'),1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('Consvertr','Aand','Y1'),1:60)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Consvertr Aand Y1 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 19 2407.60 21 1 0 0 0 0 0 0 0 0 0 0 1 2 25 2454.62 19 0 1 0 0 0 0 0 0 0 0 0 2 3 21 2448.05 25 0 0 1 0 0 0 0 0 0 0 0 3 4 23 2497.84 21 0 0 0 1 0 0 0 0 0 0 0 4 5 23 2645.64 23 0 0 0 0 1 0 0 0 0 0 0 5 6 19 2756.76 23 0 0 0 0 0 1 0 0 0 0 0 6 7 18 2849.27 19 0 0 0 0 0 0 1 0 0 0 0 7 8 19 2921.44 18 0 0 0 0 0 0 0 1 0 0 0 8 9 19 2981.85 19 0 0 0 0 0 0 0 0 1 0 0 9 10 22 3080.58 19 0 0 0 0 0 0 0 0 0 1 0 10 11 23 3106.22 22 0 0 0 0 0 0 0 0 0 0 1 11 12 20 3119.31 23 0 0 0 0 0 0 0 0 0 0 0 12 13 14 3061.26 20 1 0 0 0 0 0 0 0 0 0 0 13 14 14 3097.31 14 0 1 0 0 0 0 0 0 0 0 0 14 15 14 3161.69 14 0 0 1 0 0 0 0 0 0 0 0 15 16 15 3257.16 14 0 0 0 1 0 0 0 0 0 0 0 16 17 11 3277.01 15 0 0 0 0 1 0 0 0 0 0 0 17 18 17 3295.32 11 0 0 0 0 0 1 0 0 0 0 0 18 19 16 3363.99 17 0 0 0 0 0 0 1 0 0 0 0 19 20 20 3494.17 16 0 0 0 0 0 0 0 1 0 0 0 20 21 24 3667.03 20 0 0 0 0 0 0 0 0 1 0 0 21 22 23 3813.06 24 0 0 0 0 0 0 0 0 0 1 0 22 23 20 3917.96 23 0 0 0 0 0 0 0 0 0 0 1 23 24 21 3895.51 20 0 0 0 0 0 0 0 0 0 0 0 24 25 19 3801.06 21 1 0 0 0 0 0 0 0 0 0 0 25 26 23 3570.12 19 0 1 0 0 0 0 0 0 0 0 0 26 27 23 3701.61 23 0 0 1 0 0 0 0 0 0 0 0 27 28 23 3862.27 23 0 0 0 1 0 0 0 0 0 0 0 28 29 23 3970.10 23 0 0 0 0 1 0 0 0 0 0 0 29 30 27 4138.52 23 0 0 0 0 0 1 0 0 0 0 0 30 31 26 4199.75 27 0 0 0 0 0 0 1 0 0 0 0 31 32 17 4290.89 26 0 0 0 0 0 0 0 1 0 0 0 32 33 24 4443.91 17 0 0 0 0 0 0 0 0 1 0 0 33 34 26 4502.64 24 0 0 0 0 0 0 0 0 0 1 0 34 35 24 4356.98 26 0 0 0 0 0 0 0 0 0 0 1 35 36 27 4591.27 24 0 0 0 0 0 0 0 0 0 0 0 36 37 27 4696.96 27 1 0 0 0 0 0 0 0 0 0 0 37 38 26 4621.40 27 0 1 0 0 0 0 0 0 0 0 0 38 39 24 4562.84 26 0 0 1 0 0 0 0 0 0 0 0 39 40 23 4202.52 24 0 0 0 1 0 0 0 0 0 0 0 40 41 23 4296.49 23 0 0 0 0 1 0 0 0 0 0 0 41 42 24 4435.23 23 0 0 0 0 0 1 0 0 0 0 0 42 43 17 4105.18 24 0 0 0 0 0 0 1 0 0 0 0 43 44 21 4116.68 17 0 0 0 0 0 0 0 1 0 0 0 44 45 19 3844.49 21 0 0 0 0 0 0 0 0 1 0 0 45 46 22 3720.98 19 0 0 0 0 0 0 0 0 0 1 0 46 47 22 3674.40 22 0 0 0 0 0 0 0 0 0 0 1 47 48 18 3857.62 22 0 0 0 0 0 0 0 0 0 0 0 48 49 16 3801.06 18 1 0 0 0 0 0 0 0 0 0 0 49 50 14 3504.37 16 0 1 0 0 0 0 0 0 0 0 0 50 51 12 3032.60 14 0 0 1 0 0 0 0 0 0 0 0 51 52 14 3047.03 12 0 0 0 1 0 0 0 0 0 0 0 52 53 16 2962.34 14 0 0 0 0 1 0 0 0 0 0 0 53 54 8 2197.82 16 0 0 0 0 0 1 0 0 0 0 0 54 55 3 2014.45 8 0 0 0 0 0 0 1 0 0 0 0 55 56 0 1862.83 3 0 0 0 0 0 0 0 1 0 0 0 56 57 5 1905.41 0 0 0 0 0 0 0 0 0 1 0 0 57 58 1 1810.99 5 0 0 0 0 0 0 0 0 0 1 0 58 59 1 1670.07 1 0 0 0 0 0 0 0 0 0 0 1 59 60 3 1864.44 1 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Aand Y1 M1 M2 M3 0.743430 0.003348 0.512904 -1.992936 1.091268 -0.893483 M4 M5 M6 M7 M8 M9 0.858889 -0.037148 0.292557 -2.305040 -1.364062 1.743730 M10 M11 t 0.955268 0.088162 -0.104962 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.7220 -1.7692 0.3363 1.7955 5.4120 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.743430 2.197679 0.338 0.736726 Aand 0.003348 0.000835 4.010 0.000226 *** Y1 0.512904 0.115951 4.423 6.1e-05 *** M1 -1.992936 1.829644 -1.089 0.281844 M2 1.091268 1.822776 0.599 0.552385 M3 -0.893483 1.827577 -0.489 0.627294 M4 0.858889 1.817565 0.473 0.638819 M5 -0.037148 1.816997 -0.020 0.983779 M6 0.292557 1.816653 0.161 0.872781 M7 -2.305040 1.818369 -1.268 0.211446 M8 -1.364062 1.824681 -0.748 0.458613 M9 1.743730 1.833477 0.951 0.346659 M10 0.955268 1.810148 0.528 0.600280 M11 0.088162 1.816656 0.049 0.961509 t -0.104962 0.028622 -3.667 0.000646 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.86 on 45 degrees of freedom Multiple R-squared: 0.869, Adjusted R-squared: 0.8282 F-statistic: 21.32 on 14 and 45 DF, p-value: 2.61e-15 > 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.8060609 0.38787819 0.19393910 [2,] 0.7334788 0.53304235 0.26652117 [3,] 0.7953852 0.40922966 0.20461483 [4,] 0.9392543 0.12149146 0.06074573 [5,] 0.8939618 0.21207646 0.10603823 [6,] 0.8689804 0.26203925 0.13101963 [7,] 0.8878824 0.22423529 0.11211765 [8,] 0.8869123 0.22617536 0.11308768 [9,] 0.8464804 0.30703928 0.15351964 [10,] 0.8149302 0.37013968 0.18506984 [11,] 0.7364571 0.52708588 0.26354294 [12,] 0.6846156 0.63076888 0.31538444 [13,] 0.6875001 0.62499990 0.31249995 [14,] 0.7991650 0.40166993 0.20083497 [15,] 0.9503530 0.09929404 0.04964702 [16,] 0.9330913 0.13381734 0.06690867 [17,] 0.8896179 0.22076426 0.11038213 [18,] 0.8583421 0.28331570 0.14165785 [19,] 0.8118778 0.37624450 0.18812225 [20,] 0.7899117 0.42017666 0.21008833 [21,] 0.7739154 0.45216930 0.22608465 [22,] 0.6600076 0.67998483 0.33999242 [23,] 0.5433284 0.91334316 0.45667158 [24,] 0.4643571 0.92871426 0.53564287 [25,] 0.4006628 0.80132553 0.59933724 > postscript(file="/var/www/html/rcomp/tmp/14r561258620290.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/21r7f1258620290.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/3kzx81258620290.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/4a6441258620290.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/5qccs1258620290.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 60 Frequency = 1 1 2 3 4 5 6 7 1.5228436 5.4119873 0.4462702 2.6837801 2.1641363 -2.4326363 1.0118173 8 9 10 11 12 13 14 1.4470802 -2.2709064 1.2919692 1.6394820 -1.7241244 -3.8931623 -3.9156736 15 16 17 18 19 20 21 -2.0415047 -3.0085487 -6.5869122 1.1786601 -0.4261138 2.8149319 1.1817502 22 23 24 25 26 27 28 -1.4653519 -3.3315837 -0.5245848 -0.6233732 2.1963791 1.7942466 -0.3910531 29 30 31 32 33 34 35 0.2489311 3.4603185 2.9062624 -6.7219862 1.3790131 0.4854779 -1.0805935 36 37 38 39 40 41 42 2.3539368 2.5592720 -1.1669958 -0.3683201 -0.7835727 0.4157191 0.7264749 43 44 45 46 47 48 49 -2.9788646 3.7369473 -2.4062093 2.9265334 2.5158384 -1.9044579 0.4344200 50 51 52 53 54 55 56 -2.5256970 0.1693080 1.4993944 3.7581258 -2.9328173 -0.5131013 -1.2769732 57 58 59 60 2.1163524 -3.2386286 0.2568568 1.7992303 > postscript(file="/var/www/html/rcomp/tmp/6iak01258620290.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 1.5228436 NA 1 5.4119873 1.5228436 2 0.4462702 5.4119873 3 2.6837801 0.4462702 4 2.1641363 2.6837801 5 -2.4326363 2.1641363 6 1.0118173 -2.4326363 7 1.4470802 1.0118173 8 -2.2709064 1.4470802 9 1.2919692 -2.2709064 10 1.6394820 1.2919692 11 -1.7241244 1.6394820 12 -3.8931623 -1.7241244 13 -3.9156736 -3.8931623 14 -2.0415047 -3.9156736 15 -3.0085487 -2.0415047 16 -6.5869122 -3.0085487 17 1.1786601 -6.5869122 18 -0.4261138 1.1786601 19 2.8149319 -0.4261138 20 1.1817502 2.8149319 21 -1.4653519 1.1817502 22 -3.3315837 -1.4653519 23 -0.5245848 -3.3315837 24 -0.6233732 -0.5245848 25 2.1963791 -0.6233732 26 1.7942466 2.1963791 27 -0.3910531 1.7942466 28 0.2489311 -0.3910531 29 3.4603185 0.2489311 30 2.9062624 3.4603185 31 -6.7219862 2.9062624 32 1.3790131 -6.7219862 33 0.4854779 1.3790131 34 -1.0805935 0.4854779 35 2.3539368 -1.0805935 36 2.5592720 2.3539368 37 -1.1669958 2.5592720 38 -0.3683201 -1.1669958 39 -0.7835727 -0.3683201 40 0.4157191 -0.7835727 41 0.7264749 0.4157191 42 -2.9788646 0.7264749 43 3.7369473 -2.9788646 44 -2.4062093 3.7369473 45 2.9265334 -2.4062093 46 2.5158384 2.9265334 47 -1.9044579 2.5158384 48 0.4344200 -1.9044579 49 -2.5256970 0.4344200 50 0.1693080 -2.5256970 51 1.4993944 0.1693080 52 3.7581258 1.4993944 53 -2.9328173 3.7581258 54 -0.5131013 -2.9328173 55 -1.2769732 -0.5131013 56 2.1163524 -1.2769732 57 -3.2386286 2.1163524 58 0.2568568 -3.2386286 59 1.7992303 0.2568568 60 NA 1.7992303 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 5.4119873 1.5228436 [2,] 0.4462702 5.4119873 [3,] 2.6837801 0.4462702 [4,] 2.1641363 2.6837801 [5,] -2.4326363 2.1641363 [6,] 1.0118173 -2.4326363 [7,] 1.4470802 1.0118173 [8,] -2.2709064 1.4470802 [9,] 1.2919692 -2.2709064 [10,] 1.6394820 1.2919692 [11,] -1.7241244 1.6394820 [12,] -3.8931623 -1.7241244 [13,] -3.9156736 -3.8931623 [14,] -2.0415047 -3.9156736 [15,] -3.0085487 -2.0415047 [16,] -6.5869122 -3.0085487 [17,] 1.1786601 -6.5869122 [18,] -0.4261138 1.1786601 [19,] 2.8149319 -0.4261138 [20,] 1.1817502 2.8149319 [21,] -1.4653519 1.1817502 [22,] -3.3315837 -1.4653519 [23,] -0.5245848 -3.3315837 [24,] -0.6233732 -0.5245848 [25,] 2.1963791 -0.6233732 [26,] 1.7942466 2.1963791 [27,] -0.3910531 1.7942466 [28,] 0.2489311 -0.3910531 [29,] 3.4603185 0.2489311 [30,] 2.9062624 3.4603185 [31,] -6.7219862 2.9062624 [32,] 1.3790131 -6.7219862 [33,] 0.4854779 1.3790131 [34,] -1.0805935 0.4854779 [35,] 2.3539368 -1.0805935 [36,] 2.5592720 2.3539368 [37,] -1.1669958 2.5592720 [38,] -0.3683201 -1.1669958 [39,] -0.7835727 -0.3683201 [40,] 0.4157191 -0.7835727 [41,] 0.7264749 0.4157191 [42,] -2.9788646 0.7264749 [43,] 3.7369473 -2.9788646 [44,] -2.4062093 3.7369473 [45,] 2.9265334 -2.4062093 [46,] 2.5158384 2.9265334 [47,] -1.9044579 2.5158384 [48,] 0.4344200 -1.9044579 [49,] -2.5256970 0.4344200 [50,] 0.1693080 -2.5256970 [51,] 1.4993944 0.1693080 [52,] 3.7581258 1.4993944 [53,] -2.9328173 3.7581258 [54,] -0.5131013 -2.9328173 [55,] -1.2769732 -0.5131013 [56,] 2.1163524 -1.2769732 [57,] -3.2386286 2.1163524 [58,] 0.2568568 -3.2386286 [59,] 1.7992303 0.2568568 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 5.4119873 1.5228436 2 0.4462702 5.4119873 3 2.6837801 0.4462702 4 2.1641363 2.6837801 5 -2.4326363 2.1641363 6 1.0118173 -2.4326363 7 1.4470802 1.0118173 8 -2.2709064 1.4470802 9 1.2919692 -2.2709064 10 1.6394820 1.2919692 11 -1.7241244 1.6394820 12 -3.8931623 -1.7241244 13 -3.9156736 -3.8931623 14 -2.0415047 -3.9156736 15 -3.0085487 -2.0415047 16 -6.5869122 -3.0085487 17 1.1786601 -6.5869122 18 -0.4261138 1.1786601 19 2.8149319 -0.4261138 20 1.1817502 2.8149319 21 -1.4653519 1.1817502 22 -3.3315837 -1.4653519 23 -0.5245848 -3.3315837 24 -0.6233732 -0.5245848 25 2.1963791 -0.6233732 26 1.7942466 2.1963791 27 -0.3910531 1.7942466 28 0.2489311 -0.3910531 29 3.4603185 0.2489311 30 2.9062624 3.4603185 31 -6.7219862 2.9062624 32 1.3790131 -6.7219862 33 0.4854779 1.3790131 34 -1.0805935 0.4854779 35 2.3539368 -1.0805935 36 2.5592720 2.3539368 37 -1.1669958 2.5592720 38 -0.3683201 -1.1669958 39 -0.7835727 -0.3683201 40 0.4157191 -0.7835727 41 0.7264749 0.4157191 42 -2.9788646 0.7264749 43 3.7369473 -2.9788646 44 -2.4062093 3.7369473 45 2.9265334 -2.4062093 46 2.5158384 2.9265334 47 -1.9044579 2.5158384 48 0.4344200 -1.9044579 49 -2.5256970 0.4344200 50 0.1693080 -2.5256970 51 1.4993944 0.1693080 52 3.7581258 1.4993944 53 -2.9328173 3.7581258 54 -0.5131013 -2.9328173 55 -1.2769732 -0.5131013 56 2.1163524 -1.2769732 57 -3.2386286 2.1163524 58 0.2568568 -3.2386286 59 1.7992303 0.2568568 > 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/7f6u81258620290.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/8gi8h1258620290.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/9nmpy1258620290.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/10rufi1258620290.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/11u4b61258620290.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/12zqyr1258620290.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/13dn9u1258620290.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/142ci51258620290.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/15r29e1258620290.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/1604lu1258620290.tab") + } > > system("convert tmp/14r561258620290.ps tmp/14r561258620290.png") > system("convert tmp/21r7f1258620290.ps tmp/21r7f1258620290.png") > system("convert tmp/3kzx81258620290.ps tmp/3kzx81258620290.png") > system("convert tmp/4a6441258620290.ps tmp/4a6441258620290.png") > system("convert tmp/5qccs1258620290.ps tmp/5qccs1258620290.png") > system("convert tmp/6iak01258620290.ps tmp/6iak01258620290.png") > system("convert tmp/7f6u81258620290.ps tmp/7f6u81258620290.png") > system("convert tmp/8gi8h1258620290.ps tmp/8gi8h1258620290.png") > system("convert tmp/9nmpy1258620290.ps tmp/9nmpy1258620290.png") > system("convert tmp/10rufi1258620290.ps tmp/10rufi1258620290.png") > > > proc.time() user system elapsed 2.288 1.689 3.354