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(20366,0,22782,0,19169,0,13807,0,29743,0,25591,0,29096,0,26482,0,22405,0,27044,0,17970,0,18730,0,19684,0,19785,0,18479,0,10698,0,31956,0,29506,0,34506,0,27165,0,26736,0,23691,0,18157,0,17328,0,18205,0,20995,0,17382,0,9367,0,31124,0,26551,0,30651,0,25859,0,25100,0,25778,0,20418,0,18688,0,20424,0,24776,0,19814,0,12738,0,31566,0,30111,0,30019,0,31934,1,25826,1,26835,1,20205,1,17789,1,20520,1,22518,1,15572,1,11509,1,25447,1,24090,1,27786,1,26195,1,20516,1,22759,1,19028,1,16971,1,20036,1),dim=c(2,61),dimnames=list(c('Y','X'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),1:61)) > 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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 20366 0 1 0 0 0 0 0 0 0 0 0 0 1 2 22782 0 0 1 0 0 0 0 0 0 0 0 0 2 3 19169 0 0 0 1 0 0 0 0 0 0 0 0 3 4 13807 0 0 0 0 1 0 0 0 0 0 0 0 4 5 29743 0 0 0 0 0 1 0 0 0 0 0 0 5 6 25591 0 0 0 0 0 0 1 0 0 0 0 0 6 7 29096 0 0 0 0 0 0 0 1 0 0 0 0 7 8 26482 0 0 0 0 0 0 0 0 1 0 0 0 8 9 22405 0 0 0 0 0 0 0 0 0 1 0 0 9 10 27044 0 0 0 0 0 0 0 0 0 0 1 0 10 11 17970 0 0 0 0 0 0 0 0 0 0 0 1 11 12 18730 0 0 0 0 0 0 0 0 0 0 0 0 12 13 19684 0 1 0 0 0 0 0 0 0 0 0 0 13 14 19785 0 0 1 0 0 0 0 0 0 0 0 0 14 15 18479 0 0 0 1 0 0 0 0 0 0 0 0 15 16 10698 0 0 0 0 1 0 0 0 0 0 0 0 16 17 31956 0 0 0 0 0 1 0 0 0 0 0 0 17 18 29506 0 0 0 0 0 0 1 0 0 0 0 0 18 19 34506 0 0 0 0 0 0 0 1 0 0 0 0 19 20 27165 0 0 0 0 0 0 0 0 1 0 0 0 20 21 26736 0 0 0 0 0 0 0 0 0 1 0 0 21 22 23691 0 0 0 0 0 0 0 0 0 0 1 0 22 23 18157 0 0 0 0 0 0 0 0 0 0 0 1 23 24 17328 0 0 0 0 0 0 0 0 0 0 0 0 24 25 18205 0 1 0 0 0 0 0 0 0 0 0 0 25 26 20995 0 0 1 0 0 0 0 0 0 0 0 0 26 27 17382 0 0 0 1 0 0 0 0 0 0 0 0 27 28 9367 0 0 0 0 1 0 0 0 0 0 0 0 28 29 31124 0 0 0 0 0 1 0 0 0 0 0 0 29 30 26551 0 0 0 0 0 0 1 0 0 0 0 0 30 31 30651 0 0 0 0 0 0 0 1 0 0 0 0 31 32 25859 0 0 0 0 0 0 0 0 1 0 0 0 32 33 25100 0 0 0 0 0 0 0 0 0 1 0 0 33 34 25778 0 0 0 0 0 0 0 0 0 0 1 0 34 35 20418 0 0 0 0 0 0 0 0 0 0 0 1 35 36 18688 0 0 0 0 0 0 0 0 0 0 0 0 36 37 20424 0 1 0 0 0 0 0 0 0 0 0 0 37 38 24776 0 0 1 0 0 0 0 0 0 0 0 0 38 39 19814 0 0 0 1 0 0 0 0 0 0 0 0 39 40 12738 0 0 0 0 1 0 0 0 0 0 0 0 40 41 31566 0 0 0 0 0 1 0 0 0 0 0 0 41 42 30111 0 0 0 0 0 0 1 0 0 0 0 0 42 43 30019 0 0 0 0 0 0 0 1 0 0 0 0 43 44 31934 1 0 0 0 0 0 0 0 1 0 0 0 44 45 25826 1 0 0 0 0 0 0 0 0 1 0 0 45 46 26835 1 0 0 0 0 0 0 0 0 0 1 0 46 47 20205 1 0 0 0 0 0 0 0 0 0 0 1 47 48 17789 1 0 0 0 0 0 0 0 0 0 0 0 48 49 20520 1 1 0 0 0 0 0 0 0 0 0 0 49 50 22518 1 0 1 0 0 0 0 0 0 0 0 0 50 51 15572 1 0 0 1 0 0 0 0 0 0 0 0 51 52 11509 1 0 0 0 1 0 0 0 0 0 0 0 52 53 25447 1 0 0 0 0 1 0 0 0 0 0 0 53 54 24090 1 0 0 0 0 0 1 0 0 0 0 0 54 55 27786 1 0 0 0 0 0 0 1 0 0 0 0 55 56 26195 1 0 0 0 0 0 0 0 1 0 0 0 56 57 20516 1 0 0 0 0 0 0 0 0 1 0 0 57 58 22759 1 0 0 0 0 0 0 0 0 0 1 0 58 59 19028 1 0 0 0 0 0 0 0 0 0 0 1 59 60 16971 1 0 0 0 0 0 0 0 0 0 0 0 60 61 20036 1 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 18131.475 -1137.486 1926.679 4104.925 10.683 -6454.960 M5 M6 M7 M8 M9 M10 11882.198 9078.556 12314.114 9650.769 6234.127 7332.684 M11 t 1260.642 6.242 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3760.0 -1393.3 134.9 1107.0 5014.6 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 18131.475 1075.087 16.865 < 2e-16 *** X -1137.486 924.549 -1.230 0.22470 M1 1926.679 1202.869 1.602 0.11591 M2 4104.925 1262.093 3.252 0.00212 ** M3 10.683 1260.585 0.008 0.99327 M4 -6454.960 1259.523 -5.125 5.51e-06 *** M5 11882.198 1258.909 9.438 2.00e-12 *** M6 9078.556 1258.744 7.212 3.90e-09 *** M7 12314.114 1259.028 9.781 6.52e-13 *** M8 9650.769 1257.185 7.676 7.77e-10 *** M9 6234.127 1255.611 4.965 9.47e-06 *** M10 7332.684 1254.486 5.845 4.61e-07 *** M11 1260.642 1253.810 1.005 0.31983 t 6.242 23.768 0.263 0.79398 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1982 on 47 degrees of freedom Multiple R-squared: 0.9059, Adjusted R-squared: 0.8799 F-statistic: 34.81 on 13 and 47 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.4176823 0.8353645 0.5823177 [2,] 0.5862682 0.8274636 0.4137318 [3,] 0.7837503 0.4324994 0.2162497 [4,] 0.6786235 0.6427530 0.3213765 [5,] 0.6902515 0.6194971 0.3097485 [6,] 0.7170309 0.5659383 0.2829691 [7,] 0.6376212 0.7247576 0.3623788 [8,] 0.5625367 0.8749265 0.4374633 [9,] 0.5533514 0.8932971 0.4466486 [10,] 0.5259907 0.9480187 0.4740093 [11,] 0.4568831 0.9137662 0.5431169 [12,] 0.5414365 0.9171269 0.4585635 [13,] 0.4481270 0.8962540 0.5518730 [14,] 0.4007256 0.8014513 0.5992744 [15,] 0.3123365 0.6246730 0.6876635 [16,] 0.4877822 0.9755644 0.5122178 [17,] 0.4056419 0.8112837 0.5943581 [18,] 0.3572928 0.7145857 0.6427072 [19,] 0.3882899 0.7765798 0.6117101 [20,] 0.3692891 0.7385781 0.6307109 [21,] 0.5799424 0.8401152 0.4200576 [22,] 0.5921384 0.8157233 0.4078616 [23,] 0.4857757 0.9715513 0.5142243 [24,] 0.5162404 0.9675193 0.4837596 [25,] 0.4319706 0.8639412 0.5680294 [26,] 0.4557297 0.9114594 0.5442703 [27,] 0.3291250 0.6582500 0.6708750 [28,] 0.3600804 0.7201607 0.6399196 > postscript(file="/var/www/html/rcomp/tmp/17jkg1258729748.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/2imrr1258729748.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/3nvwz1258729748.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/476081258729748.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/5lllz1258729748.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 = 61 Frequency = 1 1 2 3 4 5 6 301.60410 533.11570 1008.11570 2105.51570 -301.88430 -1656.48430 7 8 9 10 11 12 -1393.28430 -1350.18157 -2016.78157 1517.41843 -1490.78157 523.61843 13 14 15 16 17 18 -455.30239 -2538.79078 243.20922 -1078.39078 1836.20922 2183.60922 19 20 21 22 23 24 3941.80922 -742.08805 2239.31195 -1910.48805 -1378.68805 -953.28805 25 26 27 28 29 30 -2009.20887 -1403.69727 -928.69727 -2484.29727 929.30273 -846.29727 31 32 33 34 35 36 11.90273 -2122.99454 528.40546 101.60546 807.40546 331.80546 37 38 39 40 41 42 134.88464 2302.39625 1428.39625 811.79625 1296.39625 2638.79625 43 44 45 46 47 48 -695.00375 5014.58532 2316.98532 2221.18532 1656.98532 495.38532 49 50 51 52 53 54 1293.46451 1106.97611 -1751.02389 645.37611 -3760.02389 -2319.62389 55 56 57 58 59 60 -1865.42389 -799.32116 -3067.92116 -1929.72116 405.07884 -397.52116 61 734.55802 > postscript(file="/var/www/html/rcomp/tmp/6zv1u1258729748.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 301.60410 NA 1 533.11570 301.60410 2 1008.11570 533.11570 3 2105.51570 1008.11570 4 -301.88430 2105.51570 5 -1656.48430 -301.88430 6 -1393.28430 -1656.48430 7 -1350.18157 -1393.28430 8 -2016.78157 -1350.18157 9 1517.41843 -2016.78157 10 -1490.78157 1517.41843 11 523.61843 -1490.78157 12 -455.30239 523.61843 13 -2538.79078 -455.30239 14 243.20922 -2538.79078 15 -1078.39078 243.20922 16 1836.20922 -1078.39078 17 2183.60922 1836.20922 18 3941.80922 2183.60922 19 -742.08805 3941.80922 20 2239.31195 -742.08805 21 -1910.48805 2239.31195 22 -1378.68805 -1910.48805 23 -953.28805 -1378.68805 24 -2009.20887 -953.28805 25 -1403.69727 -2009.20887 26 -928.69727 -1403.69727 27 -2484.29727 -928.69727 28 929.30273 -2484.29727 29 -846.29727 929.30273 30 11.90273 -846.29727 31 -2122.99454 11.90273 32 528.40546 -2122.99454 33 101.60546 528.40546 34 807.40546 101.60546 35 331.80546 807.40546 36 134.88464 331.80546 37 2302.39625 134.88464 38 1428.39625 2302.39625 39 811.79625 1428.39625 40 1296.39625 811.79625 41 2638.79625 1296.39625 42 -695.00375 2638.79625 43 5014.58532 -695.00375 44 2316.98532 5014.58532 45 2221.18532 2316.98532 46 1656.98532 2221.18532 47 495.38532 1656.98532 48 1293.46451 495.38532 49 1106.97611 1293.46451 50 -1751.02389 1106.97611 51 645.37611 -1751.02389 52 -3760.02389 645.37611 53 -2319.62389 -3760.02389 54 -1865.42389 -2319.62389 55 -799.32116 -1865.42389 56 -3067.92116 -799.32116 57 -1929.72116 -3067.92116 58 405.07884 -1929.72116 59 -397.52116 405.07884 60 734.55802 -397.52116 61 NA 734.55802 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 533.11570 301.60410 [2,] 1008.11570 533.11570 [3,] 2105.51570 1008.11570 [4,] -301.88430 2105.51570 [5,] -1656.48430 -301.88430 [6,] -1393.28430 -1656.48430 [7,] -1350.18157 -1393.28430 [8,] -2016.78157 -1350.18157 [9,] 1517.41843 -2016.78157 [10,] -1490.78157 1517.41843 [11,] 523.61843 -1490.78157 [12,] -455.30239 523.61843 [13,] -2538.79078 -455.30239 [14,] 243.20922 -2538.79078 [15,] -1078.39078 243.20922 [16,] 1836.20922 -1078.39078 [17,] 2183.60922 1836.20922 [18,] 3941.80922 2183.60922 [19,] -742.08805 3941.80922 [20,] 2239.31195 -742.08805 [21,] -1910.48805 2239.31195 [22,] -1378.68805 -1910.48805 [23,] -953.28805 -1378.68805 [24,] -2009.20887 -953.28805 [25,] -1403.69727 -2009.20887 [26,] -928.69727 -1403.69727 [27,] -2484.29727 -928.69727 [28,] 929.30273 -2484.29727 [29,] -846.29727 929.30273 [30,] 11.90273 -846.29727 [31,] -2122.99454 11.90273 [32,] 528.40546 -2122.99454 [33,] 101.60546 528.40546 [34,] 807.40546 101.60546 [35,] 331.80546 807.40546 [36,] 134.88464 331.80546 [37,] 2302.39625 134.88464 [38,] 1428.39625 2302.39625 [39,] 811.79625 1428.39625 [40,] 1296.39625 811.79625 [41,] 2638.79625 1296.39625 [42,] -695.00375 2638.79625 [43,] 5014.58532 -695.00375 [44,] 2316.98532 5014.58532 [45,] 2221.18532 2316.98532 [46,] 1656.98532 2221.18532 [47,] 495.38532 1656.98532 [48,] 1293.46451 495.38532 [49,] 1106.97611 1293.46451 [50,] -1751.02389 1106.97611 [51,] 645.37611 -1751.02389 [52,] -3760.02389 645.37611 [53,] -2319.62389 -3760.02389 [54,] -1865.42389 -2319.62389 [55,] -799.32116 -1865.42389 [56,] -3067.92116 -799.32116 [57,] -1929.72116 -3067.92116 [58,] 405.07884 -1929.72116 [59,] -397.52116 405.07884 [60,] 734.55802 -397.52116 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 533.11570 301.60410 2 1008.11570 533.11570 3 2105.51570 1008.11570 4 -301.88430 2105.51570 5 -1656.48430 -301.88430 6 -1393.28430 -1656.48430 7 -1350.18157 -1393.28430 8 -2016.78157 -1350.18157 9 1517.41843 -2016.78157 10 -1490.78157 1517.41843 11 523.61843 -1490.78157 12 -455.30239 523.61843 13 -2538.79078 -455.30239 14 243.20922 -2538.79078 15 -1078.39078 243.20922 16 1836.20922 -1078.39078 17 2183.60922 1836.20922 18 3941.80922 2183.60922 19 -742.08805 3941.80922 20 2239.31195 -742.08805 21 -1910.48805 2239.31195 22 -1378.68805 -1910.48805 23 -953.28805 -1378.68805 24 -2009.20887 -953.28805 25 -1403.69727 -2009.20887 26 -928.69727 -1403.69727 27 -2484.29727 -928.69727 28 929.30273 -2484.29727 29 -846.29727 929.30273 30 11.90273 -846.29727 31 -2122.99454 11.90273 32 528.40546 -2122.99454 33 101.60546 528.40546 34 807.40546 101.60546 35 331.80546 807.40546 36 134.88464 331.80546 37 2302.39625 134.88464 38 1428.39625 2302.39625 39 811.79625 1428.39625 40 1296.39625 811.79625 41 2638.79625 1296.39625 42 -695.00375 2638.79625 43 5014.58532 -695.00375 44 2316.98532 5014.58532 45 2221.18532 2316.98532 46 1656.98532 2221.18532 47 495.38532 1656.98532 48 1293.46451 495.38532 49 1106.97611 1293.46451 50 -1751.02389 1106.97611 51 645.37611 -1751.02389 52 -3760.02389 645.37611 53 -2319.62389 -3760.02389 54 -1865.42389 -2319.62389 55 -799.32116 -1865.42389 56 -3067.92116 -799.32116 57 -1929.72116 -3067.92116 58 405.07884 -1929.72116 59 -397.52116 405.07884 60 734.55802 -397.52116 > 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/7u6451258729748.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/87ev31258729748.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/9ruf91258729748.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/10maxh1258729748.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/11hoqh1258729748.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/12nm5q1258729748.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/13zadg1258729748.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/14ktgf1258729748.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/152gyc1258729748.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/16dcr31258729748.tab") + } > > system("convert tmp/17jkg1258729748.ps tmp/17jkg1258729748.png") > system("convert tmp/2imrr1258729748.ps tmp/2imrr1258729748.png") > system("convert tmp/3nvwz1258729748.ps tmp/3nvwz1258729748.png") > system("convert tmp/476081258729748.ps tmp/476081258729748.png") > system("convert tmp/5lllz1258729748.ps tmp/5lllz1258729748.png") > system("convert tmp/6zv1u1258729748.ps tmp/6zv1u1258729748.png") > system("convert tmp/7u6451258729748.ps tmp/7u6451258729748.png") > system("convert tmp/87ev31258729748.ps tmp/87ev31258729748.png") > system("convert tmp/9ruf91258729748.ps tmp/9ruf91258729748.png") > system("convert tmp/10maxh1258729748.ps tmp/10maxh1258729748.png") > > > proc.time() user system elapsed 2.413 1.573 2.801