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(12.6,18,15.7,16,13.2,19,20.3,18,12.8,23,8,20,0.9,20,3.6,15,14.1,17,21.7,16,24.5,15,18.9,10,13.9,13,11,10,5.8,19,15.5,21,22.4,17,31.7,16,30.3,17,31.4,14,20.2,18,19.7,17,10.8,14,13.2,15,15.1,16,15.6,11,15.5,15,12.7,13,10.9,17,10,16,9.1,9,10.3,17,16.9,15,22,12,27.6,12,28.9,12,31,12,32.9,4,38.1,7,28.8,4,29,3,21.8,3,28.8,0,25.6,5,28.2,3,20.2,4,17.9,3,16.3,10,13.2,4,8.1,1,4.5,1,-0.1,8,0,5,2.3,4,2.8,0,2.9,2,0.1,7,3.5,6,8.6,9,13.8,10),dim=c(2,60),dimnames=list(c('Rvnp','Svdg'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Rvnp','Svdg'),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 = 'No Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Rvnp Svdg M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 12.6 18 1 0 0 0 0 0 0 0 0 0 0 2 15.7 16 0 1 0 0 0 0 0 0 0 0 0 3 13.2 19 0 0 1 0 0 0 0 0 0 0 0 4 20.3 18 0 0 0 1 0 0 0 0 0 0 0 5 12.8 23 0 0 0 0 1 0 0 0 0 0 0 6 8.0 20 0 0 0 0 0 1 0 0 0 0 0 7 0.9 20 0 0 0 0 0 0 1 0 0 0 0 8 3.6 15 0 0 0 0 0 0 0 1 0 0 0 9 14.1 17 0 0 0 0 0 0 0 0 1 0 0 10 21.7 16 0 0 0 0 0 0 0 0 0 1 0 11 24.5 15 0 0 0 0 0 0 0 0 0 0 1 12 18.9 10 0 0 0 0 0 0 0 0 0 0 0 13 13.9 13 1 0 0 0 0 0 0 0 0 0 0 14 11.0 10 0 1 0 0 0 0 0 0 0 0 0 15 5.8 19 0 0 1 0 0 0 0 0 0 0 0 16 15.5 21 0 0 0 1 0 0 0 0 0 0 0 17 22.4 17 0 0 0 0 1 0 0 0 0 0 0 18 31.7 16 0 0 0 0 0 1 0 0 0 0 0 19 30.3 17 0 0 0 0 0 0 1 0 0 0 0 20 31.4 14 0 0 0 0 0 0 0 1 0 0 0 21 20.2 18 0 0 0 0 0 0 0 0 1 0 0 22 19.7 17 0 0 0 0 0 0 0 0 0 1 0 23 10.8 14 0 0 0 0 0 0 0 0 0 0 1 24 13.2 15 0 0 0 0 0 0 0 0 0 0 0 25 15.1 16 1 0 0 0 0 0 0 0 0 0 0 26 15.6 11 0 1 0 0 0 0 0 0 0 0 0 27 15.5 15 0 0 1 0 0 0 0 0 0 0 0 28 12.7 13 0 0 0 1 0 0 0 0 0 0 0 29 10.9 17 0 0 0 0 1 0 0 0 0 0 0 30 10.0 16 0 0 0 0 0 1 0 0 0 0 0 31 9.1 9 0 0 0 0 0 0 1 0 0 0 0 32 10.3 17 0 0 0 0 0 0 0 1 0 0 0 33 16.9 15 0 0 0 0 0 0 0 0 1 0 0 34 22.0 12 0 0 0 0 0 0 0 0 0 1 0 35 27.6 12 0 0 0 0 0 0 0 0 0 0 1 36 28.9 12 0 0 0 0 0 0 0 0 0 0 0 37 31.0 12 1 0 0 0 0 0 0 0 0 0 0 38 32.9 4 0 1 0 0 0 0 0 0 0 0 0 39 38.1 7 0 0 1 0 0 0 0 0 0 0 0 40 28.8 4 0 0 0 1 0 0 0 0 0 0 0 41 29.0 3 0 0 0 0 1 0 0 0 0 0 0 42 21.8 3 0 0 0 0 0 1 0 0 0 0 0 43 28.8 0 0 0 0 0 0 0 1 0 0 0 0 44 25.6 5 0 0 0 0 0 0 0 1 0 0 0 45 28.2 3 0 0 0 0 0 0 0 0 1 0 0 46 20.2 4 0 0 0 0 0 0 0 0 0 1 0 47 17.9 3 0 0 0 0 0 0 0 0 0 0 1 48 16.3 10 0 0 0 0 0 0 0 0 0 0 0 49 13.2 4 1 0 0 0 0 0 0 0 0 0 0 50 8.1 1 0 1 0 0 0 0 0 0 0 0 0 51 4.5 1 0 0 1 0 0 0 0 0 0 0 0 52 -0.1 8 0 0 0 1 0 0 0 0 0 0 0 53 0.0 5 0 0 0 0 1 0 0 0 0 0 0 54 2.3 4 0 0 0 0 0 1 0 0 0 0 0 55 2.8 0 0 0 0 0 0 0 1 0 0 0 0 56 2.9 2 0 0 0 0 0 0 0 1 0 0 0 57 0.1 7 0 0 0 0 0 0 0 0 1 0 0 58 3.5 6 0 0 0 0 0 0 0 0 0 1 0 59 8.6 9 0 0 0 0 0 0 0 0 0 0 1 60 13.8 10 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Svdg M1 M2 M3 M4 18.4526 -0.0204 -1.0355 -1.6212 -2.7837 -2.7514 M5 M6 M7 M8 M9 M10 -3.1674 -3.4518 -3.8849 -3.4763 -2.3078 -0.8082 M11 -0.3563 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -15.902 -5.869 -1.823 6.747 22.574 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 18.4526 5.4813 3.366 0.00153 ** Svdg -0.0204 0.2300 -0.089 0.92971 M1 -1.0355 6.8127 -0.152 0.87984 M2 -1.6212 6.8420 -0.237 0.81373 M3 -2.7837 6.8096 -0.409 0.68455 M4 -2.7514 6.8147 -0.404 0.68823 M5 -3.1674 6.8170 -0.465 0.64435 M6 -3.4518 6.8077 -0.507 0.61449 M7 -3.8849 6.8259 -0.569 0.57197 M8 -3.4763 6.8096 -0.511 0.61209 M9 -2.3078 6.8085 -0.339 0.73615 M10 -0.8082 6.8077 -0.119 0.90601 M11 -0.3563 6.8096 -0.052 0.95849 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 10.76 on 47 degrees of freedom Multiple R-squared: 0.01775, Adjusted R-squared: -0.233 F-statistic: 0.07077 on 12 and 47 DF, p-value: 1 > 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.049623355 0.099246710 0.9503766 [2,] 0.034947407 0.069894815 0.9650526 [3,] 0.155143790 0.310287580 0.8448562 [4,] 0.342525595 0.685051189 0.6574744 [5,] 0.515116605 0.969766790 0.4848834 [6,] 0.419313392 0.838626784 0.5806866 [7,] 0.311839550 0.623679100 0.6881605 [8,] 0.287761689 0.575523378 0.7122383 [9,] 0.206790358 0.413580715 0.7932096 [10,] 0.142739350 0.285478700 0.8572606 [11,] 0.092278597 0.184557194 0.9077214 [12,] 0.057409140 0.114818279 0.9425909 [13,] 0.051748971 0.103497943 0.9482510 [14,] 0.037524381 0.075048762 0.9624756 [15,] 0.028871691 0.057743382 0.9711283 [16,] 0.023306966 0.046613932 0.9766930 [17,] 0.015806818 0.031613635 0.9841932 [18,] 0.008624663 0.017249327 0.9913753 [19,] 0.004279806 0.008559613 0.9957202 [20,] 0.002738177 0.005476355 0.9972618 [21,] 0.002297875 0.004595750 0.9977021 [22,] 0.002542412 0.005084823 0.9974576 [23,] 0.003521854 0.007043707 0.9964781 [24,] 0.039802499 0.079604997 0.9601975 [25,] 0.030227320 0.060454640 0.9697727 [26,] 0.039128699 0.078257398 0.9608713 [27,] 0.038083501 0.076167002 0.9619165 [28,] 0.072929673 0.145859345 0.9270703 [29,] 0.396013244 0.792026488 0.6039868 > postscript(file="/var/www/html/rcomp/tmp/1b17v1258740233.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/2gvde1258740233.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/303vd1258740233.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/41w8m1258740233.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/52cvl1258740233.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 -4.4498392 -0.8049589 -2.0812790 4.9660808 -2.0159985 -6.5927188 7 8 9 10 11 12 -13.2596784 -11.0702394 -1.6979993 4.3820007 6.7097606 0.6514398 13 14 15 16 17 18 -3.2518399 -5.6273598 -9.4812790 0.2272812 7.4616006 17.0256806 19 20 21 22 23 24 16.0791211 16.7093605 4.4224009 2.4024009 -7.0106395 -4.9465595 25 26 27 28 29 30 -1.9906395 -1.0069596 0.1371204 -2.7359200 -4.0383994 -4.6743194 31 32 33 34 35 36 -5.2840800 -4.3294391 1.0612004 4.6004001 9.7485602 10.6922401 37 38 39 40 41 42 13.8277599 16.1502394 22.5739192 13.1804787 13.7759985 6.8604787 43 44 45 46 47 48 14.2323187 10.7257592 12.1163987 2.6371990 -0.1350411 -1.9485602 49 50 51 52 53 54 -4.1354413 -8.7109611 -11.1484816 -15.6379207 -15.1832012 -12.6191211 55 56 57 58 59 60 -11.7676813 -12.0354413 -15.9020007 -14.0220007 -9.3126402 -4.4485602 > postscript(file="/var/www/html/rcomp/tmp/6aqy71258740233.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 -4.4498392 NA 1 -0.8049589 -4.4498392 2 -2.0812790 -0.8049589 3 4.9660808 -2.0812790 4 -2.0159985 4.9660808 5 -6.5927188 -2.0159985 6 -13.2596784 -6.5927188 7 -11.0702394 -13.2596784 8 -1.6979993 -11.0702394 9 4.3820007 -1.6979993 10 6.7097606 4.3820007 11 0.6514398 6.7097606 12 -3.2518399 0.6514398 13 -5.6273598 -3.2518399 14 -9.4812790 -5.6273598 15 0.2272812 -9.4812790 16 7.4616006 0.2272812 17 17.0256806 7.4616006 18 16.0791211 17.0256806 19 16.7093605 16.0791211 20 4.4224009 16.7093605 21 2.4024009 4.4224009 22 -7.0106395 2.4024009 23 -4.9465595 -7.0106395 24 -1.9906395 -4.9465595 25 -1.0069596 -1.9906395 26 0.1371204 -1.0069596 27 -2.7359200 0.1371204 28 -4.0383994 -2.7359200 29 -4.6743194 -4.0383994 30 -5.2840800 -4.6743194 31 -4.3294391 -5.2840800 32 1.0612004 -4.3294391 33 4.6004001 1.0612004 34 9.7485602 4.6004001 35 10.6922401 9.7485602 36 13.8277599 10.6922401 37 16.1502394 13.8277599 38 22.5739192 16.1502394 39 13.1804787 22.5739192 40 13.7759985 13.1804787 41 6.8604787 13.7759985 42 14.2323187 6.8604787 43 10.7257592 14.2323187 44 12.1163987 10.7257592 45 2.6371990 12.1163987 46 -0.1350411 2.6371990 47 -1.9485602 -0.1350411 48 -4.1354413 -1.9485602 49 -8.7109611 -4.1354413 50 -11.1484816 -8.7109611 51 -15.6379207 -11.1484816 52 -15.1832012 -15.6379207 53 -12.6191211 -15.1832012 54 -11.7676813 -12.6191211 55 -12.0354413 -11.7676813 56 -15.9020007 -12.0354413 57 -14.0220007 -15.9020007 58 -9.3126402 -14.0220007 59 -4.4485602 -9.3126402 60 NA -4.4485602 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.8049589 -4.4498392 [2,] -2.0812790 -0.8049589 [3,] 4.9660808 -2.0812790 [4,] -2.0159985 4.9660808 [5,] -6.5927188 -2.0159985 [6,] -13.2596784 -6.5927188 [7,] -11.0702394 -13.2596784 [8,] -1.6979993 -11.0702394 [9,] 4.3820007 -1.6979993 [10,] 6.7097606 4.3820007 [11,] 0.6514398 6.7097606 [12,] -3.2518399 0.6514398 [13,] -5.6273598 -3.2518399 [14,] -9.4812790 -5.6273598 [15,] 0.2272812 -9.4812790 [16,] 7.4616006 0.2272812 [17,] 17.0256806 7.4616006 [18,] 16.0791211 17.0256806 [19,] 16.7093605 16.0791211 [20,] 4.4224009 16.7093605 [21,] 2.4024009 4.4224009 [22,] -7.0106395 2.4024009 [23,] -4.9465595 -7.0106395 [24,] -1.9906395 -4.9465595 [25,] -1.0069596 -1.9906395 [26,] 0.1371204 -1.0069596 [27,] -2.7359200 0.1371204 [28,] -4.0383994 -2.7359200 [29,] -4.6743194 -4.0383994 [30,] -5.2840800 -4.6743194 [31,] -4.3294391 -5.2840800 [32,] 1.0612004 -4.3294391 [33,] 4.6004001 1.0612004 [34,] 9.7485602 4.6004001 [35,] 10.6922401 9.7485602 [36,] 13.8277599 10.6922401 [37,] 16.1502394 13.8277599 [38,] 22.5739192 16.1502394 [39,] 13.1804787 22.5739192 [40,] 13.7759985 13.1804787 [41,] 6.8604787 13.7759985 [42,] 14.2323187 6.8604787 [43,] 10.7257592 14.2323187 [44,] 12.1163987 10.7257592 [45,] 2.6371990 12.1163987 [46,] -0.1350411 2.6371990 [47,] -1.9485602 -0.1350411 [48,] -4.1354413 -1.9485602 [49,] -8.7109611 -4.1354413 [50,] -11.1484816 -8.7109611 [51,] -15.6379207 -11.1484816 [52,] -15.1832012 -15.6379207 [53,] -12.6191211 -15.1832012 [54,] -11.7676813 -12.6191211 [55,] -12.0354413 -11.7676813 [56,] -15.9020007 -12.0354413 [57,] -14.0220007 -15.9020007 [58,] -9.3126402 -14.0220007 [59,] -4.4485602 -9.3126402 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.8049589 -4.4498392 2 -2.0812790 -0.8049589 3 4.9660808 -2.0812790 4 -2.0159985 4.9660808 5 -6.5927188 -2.0159985 6 -13.2596784 -6.5927188 7 -11.0702394 -13.2596784 8 -1.6979993 -11.0702394 9 4.3820007 -1.6979993 10 6.7097606 4.3820007 11 0.6514398 6.7097606 12 -3.2518399 0.6514398 13 -5.6273598 -3.2518399 14 -9.4812790 -5.6273598 15 0.2272812 -9.4812790 16 7.4616006 0.2272812 17 17.0256806 7.4616006 18 16.0791211 17.0256806 19 16.7093605 16.0791211 20 4.4224009 16.7093605 21 2.4024009 4.4224009 22 -7.0106395 2.4024009 23 -4.9465595 -7.0106395 24 -1.9906395 -4.9465595 25 -1.0069596 -1.9906395 26 0.1371204 -1.0069596 27 -2.7359200 0.1371204 28 -4.0383994 -2.7359200 29 -4.6743194 -4.0383994 30 -5.2840800 -4.6743194 31 -4.3294391 -5.2840800 32 1.0612004 -4.3294391 33 4.6004001 1.0612004 34 9.7485602 4.6004001 35 10.6922401 9.7485602 36 13.8277599 10.6922401 37 16.1502394 13.8277599 38 22.5739192 16.1502394 39 13.1804787 22.5739192 40 13.7759985 13.1804787 41 6.8604787 13.7759985 42 14.2323187 6.8604787 43 10.7257592 14.2323187 44 12.1163987 10.7257592 45 2.6371990 12.1163987 46 -0.1350411 2.6371990 47 -1.9485602 -0.1350411 48 -4.1354413 -1.9485602 49 -8.7109611 -4.1354413 50 -11.1484816 -8.7109611 51 -15.6379207 -11.1484816 52 -15.1832012 -15.6379207 53 -12.6191211 -15.1832012 54 -11.7676813 -12.6191211 55 -12.0354413 -11.7676813 56 -15.9020007 -12.0354413 57 -14.0220007 -15.9020007 58 -9.3126402 -14.0220007 59 -4.4485602 -9.3126402 > 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/7egxd1258740233.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/8ip451258740233.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/99qwx1258740233.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/10bs371258740233.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/11959f1258740233.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/12u70g1258740233.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/13vl371258740233.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/14xev61258740233.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/15euu71258740233.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/160ela1258740233.tab") + } > system("convert tmp/1b17v1258740233.ps tmp/1b17v1258740233.png") > system("convert tmp/2gvde1258740233.ps tmp/2gvde1258740233.png") > system("convert tmp/303vd1258740233.ps tmp/303vd1258740233.png") > system("convert tmp/41w8m1258740233.ps tmp/41w8m1258740233.png") > system("convert tmp/52cvl1258740233.ps tmp/52cvl1258740233.png") > system("convert tmp/6aqy71258740233.ps tmp/6aqy71258740233.png") > system("convert tmp/7egxd1258740233.ps tmp/7egxd1258740233.png") > system("convert tmp/8ip451258740233.ps tmp/8ip451258740233.png") > system("convert tmp/99qwx1258740233.ps tmp/99qwx1258740233.png") > system("convert tmp/10bs371258740233.ps tmp/10bs371258740233.png") > > > proc.time() user system elapsed 2.389 1.546 2.775