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(3353,1,3186,1,3902,1,4164,1,3499,1,4145,1,3796,1,3711,1,3949,1,3740,1,3243,1,4407,1,4814,1,3908,1,5250,1,3937,1,4004,1,5560,1,3922,1,3759,1,4138,1,4634,1,3996,1,4308,1,4143,0,4429,0,5219,0,4929,0,5755,0,5592,0,4163,0,4962,0,5208,0,4755,0,4491,0,5732,0,5731,0,5040,0,6102,0,4904,0,5369,0,5578,0,4619,0,4731,0,5011,0,5299,0,4146,0,4625,0,4736,0,4219,0,5116,0,4205,0,4121,0,5103,1,4300,1,4578,1,3809,1,5526,1,4247,1,3830,1,4394,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 3353 1 1 0 0 0 0 0 0 0 0 0 0 1 2 3186 1 0 1 0 0 0 0 0 0 0 0 0 2 3 3902 1 0 0 1 0 0 0 0 0 0 0 0 3 4 4164 1 0 0 0 1 0 0 0 0 0 0 0 4 5 3499 1 0 0 0 0 1 0 0 0 0 0 0 5 6 4145 1 0 0 0 0 0 1 0 0 0 0 0 6 7 3796 1 0 0 0 0 0 0 1 0 0 0 0 7 8 3711 1 0 0 0 0 0 0 0 1 0 0 0 8 9 3949 1 0 0 0 0 0 0 0 0 1 0 0 9 10 3740 1 0 0 0 0 0 0 0 0 0 1 0 10 11 3243 1 0 0 0 0 0 0 0 0 0 0 1 11 12 4407 1 0 0 0 0 0 0 0 0 0 0 0 12 13 4814 1 1 0 0 0 0 0 0 0 0 0 0 13 14 3908 1 0 1 0 0 0 0 0 0 0 0 0 14 15 5250 1 0 0 1 0 0 0 0 0 0 0 0 15 16 3937 1 0 0 0 1 0 0 0 0 0 0 0 16 17 4004 1 0 0 0 0 1 0 0 0 0 0 0 17 18 5560 1 0 0 0 0 0 1 0 0 0 0 0 18 19 3922 1 0 0 0 0 0 0 1 0 0 0 0 19 20 3759 1 0 0 0 0 0 0 0 1 0 0 0 20 21 4138 1 0 0 0 0 0 0 0 0 1 0 0 21 22 4634 1 0 0 0 0 0 0 0 0 0 1 0 22 23 3996 1 0 0 0 0 0 0 0 0 0 0 1 23 24 4308 1 0 0 0 0 0 0 0 0 0 0 0 24 25 4143 0 1 0 0 0 0 0 0 0 0 0 0 25 26 4429 0 0 1 0 0 0 0 0 0 0 0 0 26 27 5219 0 0 0 1 0 0 0 0 0 0 0 0 27 28 4929 0 0 0 0 1 0 0 0 0 0 0 0 28 29 5755 0 0 0 0 0 1 0 0 0 0 0 0 29 30 5592 0 0 0 0 0 0 1 0 0 0 0 0 30 31 4163 0 0 0 0 0 0 0 1 0 0 0 0 31 32 4962 0 0 0 0 0 0 0 0 1 0 0 0 32 33 5208 0 0 0 0 0 0 0 0 0 1 0 0 33 34 4755 0 0 0 0 0 0 0 0 0 0 1 0 34 35 4491 0 0 0 0 0 0 0 0 0 0 0 1 35 36 5732 0 0 0 0 0 0 0 0 0 0 0 0 36 37 5731 0 1 0 0 0 0 0 0 0 0 0 0 37 38 5040 0 0 1 0 0 0 0 0 0 0 0 0 38 39 6102 0 0 0 1 0 0 0 0 0 0 0 0 39 40 4904 0 0 0 0 1 0 0 0 0 0 0 0 40 41 5369 0 0 0 0 0 1 0 0 0 0 0 0 41 42 5578 0 0 0 0 0 0 1 0 0 0 0 0 42 43 4619 0 0 0 0 0 0 0 1 0 0 0 0 43 44 4731 0 0 0 0 0 0 0 0 1 0 0 0 44 45 5011 0 0 0 0 0 0 0 0 0 1 0 0 45 46 5299 0 0 0 0 0 0 0 0 0 0 1 0 46 47 4146 0 0 0 0 0 0 0 0 0 0 0 1 47 48 4625 0 0 0 0 0 0 0 0 0 0 0 0 48 49 4736 0 1 0 0 0 0 0 0 0 0 0 0 49 50 4219 0 0 1 0 0 0 0 0 0 0 0 0 50 51 5116 0 0 0 1 0 0 0 0 0 0 0 0 51 52 4205 0 0 0 0 1 0 0 0 0 0 0 0 52 53 4121 0 0 0 0 0 1 0 0 0 0 0 0 53 54 5103 1 0 0 0 0 0 1 0 0 0 0 0 54 55 4300 1 0 0 0 0 0 0 1 0 0 0 0 55 56 4578 1 0 0 0 0 0 0 0 1 0 0 0 56 57 3809 1 0 0 0 0 0 0 0 0 1 0 0 57 58 5526 1 0 0 0 0 0 0 0 0 0 1 0 58 59 4247 1 0 0 0 0 0 0 0 0 0 0 1 59 60 3830 1 0 0 0 0 0 0 0 0 0 0 0 60 61 4394 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 4671.000 -647.000 -75.267 -470.733 482.400 -215.867 M5 M6 M7 M8 M9 M10 -102.333 664.800 -379.067 -199.133 -132.600 226.933 M11 t -547.533 8.267 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -885.8 -383.8 8.2 282.8 946.6 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4671.000 305.156 15.307 < 2e-16 *** X -647.000 147.896 -4.375 6.71e-05 *** M1 -75.267 303.993 -0.248 0.8055 M2 -470.733 321.831 -1.463 0.1502 M3 482.400 321.131 1.502 0.1397 M4 -215.867 320.484 -0.674 0.5039 M5 -102.333 319.891 -0.320 0.7505 M6 664.800 316.871 2.098 0.0413 * M7 -379.067 316.567 -1.197 0.2371 M8 -199.133 316.318 -0.630 0.5320 M9 -132.600 316.124 -0.419 0.6768 M10 226.933 315.985 0.718 0.4762 M11 -547.533 315.902 -1.733 0.0896 . t 8.267 4.185 1.975 0.0541 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 499.4 on 47 degrees of freedom Multiple R-squared: 0.5956, Adjusted R-squared: 0.4838 F-statistic: 5.326 on 13 and 47 DF, p-value: 9.493e-06 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.6963926 0.6072149 0.30360743 [2,] 0.6321740 0.7356520 0.36782601 [3,] 0.5897342 0.8205316 0.41026581 [4,] 0.5746086 0.8507827 0.42539137 [5,] 0.4936421 0.9872843 0.50635785 [6,] 0.3978532 0.7957064 0.60214680 [7,] 0.2948837 0.5897674 0.70511629 [8,] 0.3000688 0.6001376 0.69993119 [9,] 0.3497079 0.6994159 0.65029207 [10,] 0.3700643 0.7401287 0.62993565 [11,] 0.3873119 0.7746237 0.61268814 [12,] 0.3259406 0.6518811 0.67405943 [13,] 0.5203545 0.9592909 0.47964546 [14,] 0.4408264 0.8816527 0.55917364 [15,] 0.5290589 0.9418821 0.47094107 [16,] 0.4894227 0.9788453 0.51057734 [17,] 0.4023769 0.8047539 0.59762307 [18,] 0.8520356 0.2959288 0.14796439 [19,] 0.9343336 0.1313328 0.06566639 [20,] 0.9252434 0.1495132 0.07475662 [21,] 0.8860638 0.2278724 0.11393619 [22,] 0.8233461 0.3533077 0.17665387 [23,] 0.7337227 0.5325547 0.26627735 [24,] 0.7154443 0.5691114 0.28455570 [25,] 0.5971496 0.8057007 0.40285036 [26,] 0.5008889 0.9982223 0.49911114 [27,] 0.3668812 0.7337624 0.63311878 [28,] 0.2503988 0.5007977 0.74960115 > postscript(file="/var/www/html/rcomp/tmp/1h6ob1258621492.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/23e5b1258621492.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/3ykfo1258621492.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/4ti4x1258621492.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/59dnw1258621492.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 7 8 9 10 11 -604.0 -383.8 -629.2 322.8 -464.0 -593.4 93.2 -180.0 -16.8 -593.6 -324.4 12 13 14 15 16 17 18 19 20 21 22 283.8 757.8 239.0 619.6 -3.4 -58.2 722.4 120.0 -231.2 73.0 201.2 23 24 25 26 27 28 29 30 31 32 33 329.4 85.6 -659.4 13.8 -157.6 242.4 946.6 8.2 -385.2 225.6 396.8 34 35 36 37 38 39 40 41 42 43 44 -424.0 78.2 763.4 829.4 525.6 626.2 118.2 461.4 -105.0 -28.4 -104.6 45 46 47 48 49 50 51 52 53 54 55 100.6 20.8 -366.0 -442.8 -264.8 -394.6 -459.0 -680.0 -885.8 -32.2 200.4 56 57 58 59 60 61 290.2 -553.6 795.6 282.8 -690.0 -59.0 > postscript(file="/var/www/html/rcomp/tmp/65ap81258621492.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 -604.0 NA 1 -383.8 -604.0 2 -629.2 -383.8 3 322.8 -629.2 4 -464.0 322.8 5 -593.4 -464.0 6 93.2 -593.4 7 -180.0 93.2 8 -16.8 -180.0 9 -593.6 -16.8 10 -324.4 -593.6 11 283.8 -324.4 12 757.8 283.8 13 239.0 757.8 14 619.6 239.0 15 -3.4 619.6 16 -58.2 -3.4 17 722.4 -58.2 18 120.0 722.4 19 -231.2 120.0 20 73.0 -231.2 21 201.2 73.0 22 329.4 201.2 23 85.6 329.4 24 -659.4 85.6 25 13.8 -659.4 26 -157.6 13.8 27 242.4 -157.6 28 946.6 242.4 29 8.2 946.6 30 -385.2 8.2 31 225.6 -385.2 32 396.8 225.6 33 -424.0 396.8 34 78.2 -424.0 35 763.4 78.2 36 829.4 763.4 37 525.6 829.4 38 626.2 525.6 39 118.2 626.2 40 461.4 118.2 41 -105.0 461.4 42 -28.4 -105.0 43 -104.6 -28.4 44 100.6 -104.6 45 20.8 100.6 46 -366.0 20.8 47 -442.8 -366.0 48 -264.8 -442.8 49 -394.6 -264.8 50 -459.0 -394.6 51 -680.0 -459.0 52 -885.8 -680.0 53 -32.2 -885.8 54 200.4 -32.2 55 290.2 200.4 56 -553.6 290.2 57 795.6 -553.6 58 282.8 795.6 59 -690.0 282.8 60 -59.0 -690.0 61 NA -59.0 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -383.8 -604.0 [2,] -629.2 -383.8 [3,] 322.8 -629.2 [4,] -464.0 322.8 [5,] -593.4 -464.0 [6,] 93.2 -593.4 [7,] -180.0 93.2 [8,] -16.8 -180.0 [9,] -593.6 -16.8 [10,] -324.4 -593.6 [11,] 283.8 -324.4 [12,] 757.8 283.8 [13,] 239.0 757.8 [14,] 619.6 239.0 [15,] -3.4 619.6 [16,] -58.2 -3.4 [17,] 722.4 -58.2 [18,] 120.0 722.4 [19,] -231.2 120.0 [20,] 73.0 -231.2 [21,] 201.2 73.0 [22,] 329.4 201.2 [23,] 85.6 329.4 [24,] -659.4 85.6 [25,] 13.8 -659.4 [26,] -157.6 13.8 [27,] 242.4 -157.6 [28,] 946.6 242.4 [29,] 8.2 946.6 [30,] -385.2 8.2 [31,] 225.6 -385.2 [32,] 396.8 225.6 [33,] -424.0 396.8 [34,] 78.2 -424.0 [35,] 763.4 78.2 [36,] 829.4 763.4 [37,] 525.6 829.4 [38,] 626.2 525.6 [39,] 118.2 626.2 [40,] 461.4 118.2 [41,] -105.0 461.4 [42,] -28.4 -105.0 [43,] -104.6 -28.4 [44,] 100.6 -104.6 [45,] 20.8 100.6 [46,] -366.0 20.8 [47,] -442.8 -366.0 [48,] -264.8 -442.8 [49,] -394.6 -264.8 [50,] -459.0 -394.6 [51,] -680.0 -459.0 [52,] -885.8 -680.0 [53,] -32.2 -885.8 [54,] 200.4 -32.2 [55,] 290.2 200.4 [56,] -553.6 290.2 [57,] 795.6 -553.6 [58,] 282.8 795.6 [59,] -690.0 282.8 [60,] -59.0 -690.0 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -383.8 -604.0 2 -629.2 -383.8 3 322.8 -629.2 4 -464.0 322.8 5 -593.4 -464.0 6 93.2 -593.4 7 -180.0 93.2 8 -16.8 -180.0 9 -593.6 -16.8 10 -324.4 -593.6 11 283.8 -324.4 12 757.8 283.8 13 239.0 757.8 14 619.6 239.0 15 -3.4 619.6 16 -58.2 -3.4 17 722.4 -58.2 18 120.0 722.4 19 -231.2 120.0 20 73.0 -231.2 21 201.2 73.0 22 329.4 201.2 23 85.6 329.4 24 -659.4 85.6 25 13.8 -659.4 26 -157.6 13.8 27 242.4 -157.6 28 946.6 242.4 29 8.2 946.6 30 -385.2 8.2 31 225.6 -385.2 32 396.8 225.6 33 -424.0 396.8 34 78.2 -424.0 35 763.4 78.2 36 829.4 763.4 37 525.6 829.4 38 626.2 525.6 39 118.2 626.2 40 461.4 118.2 41 -105.0 461.4 42 -28.4 -105.0 43 -104.6 -28.4 44 100.6 -104.6 45 20.8 100.6 46 -366.0 20.8 47 -442.8 -366.0 48 -264.8 -442.8 49 -394.6 -264.8 50 -459.0 -394.6 51 -680.0 -459.0 52 -885.8 -680.0 53 -32.2 -885.8 54 200.4 -32.2 55 290.2 200.4 56 -553.6 290.2 57 795.6 -553.6 58 282.8 795.6 59 -690.0 282.8 60 -59.0 -690.0 > 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/7uyix1258621492.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/88skq1258621492.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/90pe11258621492.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/10x6dq1258621492.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/11rzkp1258621492.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/12rx7y1258621492.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/13vajj1258621492.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/14d0e11258621492.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/153x9v1258621492.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/16n40z1258621492.tab") + } > > system("convert tmp/1h6ob1258621492.ps tmp/1h6ob1258621492.png") > system("convert tmp/23e5b1258621492.ps tmp/23e5b1258621492.png") > system("convert tmp/3ykfo1258621492.ps tmp/3ykfo1258621492.png") > system("convert tmp/4ti4x1258621492.ps tmp/4ti4x1258621492.png") > system("convert tmp/59dnw1258621492.ps tmp/59dnw1258621492.png") > system("convert tmp/65ap81258621492.ps tmp/65ap81258621492.png") > system("convert tmp/7uyix1258621492.ps tmp/7uyix1258621492.png") > system("convert tmp/88skq1258621492.ps tmp/88skq1258621492.png") > system("convert tmp/90pe11258621492.ps tmp/90pe11258621492.png") > system("convert tmp/10x6dq1258621492.ps tmp/10x6dq1258621492.png") > > > proc.time() user system elapsed 2.377 1.565 3.185