R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(127059,0,122860,0,117702,0,113537,0,108366,0,111078,0,150739,1,159129,0,157928,0,147768,0,137507,0,136919,0,136151,0,133001,0,125554,0,119647,0,114158,0,116193,0,152803,1,161761,0,160942,0,149470,0,139208,0,134588,0,130322,0,126611,0,122401,0,117352,0,112135,0,112879,0,148729,1,157230,0,157221,0,146681,0,136524,0,132111,0,125326,0,122716,0,116615,0,113719,0,110737,0,112093,0,143565,1,149946,0,149147,0,134339,0,122683,0,115614,0,116566,0,111272,0,104609,0,101802,0,94542,0,93051,0,124129,1,130374,0,123946,0,114971,0,105531,0,104919,0),dim=c(2,60),dimnames=list(c('X','Y'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('X','Y'),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 Quarterly 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 X Y Q1 Q2 Q3 t 1 127059 0 1 0 0 1 2 122860 0 0 1 0 2 3 117702 0 0 0 1 3 4 113537 0 0 0 0 4 5 108366 0 1 0 0 5 6 111078 0 0 1 0 6 7 150739 1 0 0 1 7 8 159129 0 0 0 0 8 9 157928 0 1 0 0 9 10 147768 0 0 1 0 10 11 137507 0 0 0 1 11 12 136919 0 0 0 0 12 13 136151 0 1 0 0 13 14 133001 0 0 1 0 14 15 125554 0 0 0 1 15 16 119647 0 0 0 0 16 17 114158 0 1 0 0 17 18 116193 0 0 1 0 18 19 152803 1 0 0 1 19 20 161761 0 0 0 0 20 21 160942 0 1 0 0 21 22 149470 0 0 1 0 22 23 139208 0 0 0 1 23 24 134588 0 0 0 0 24 25 130322 0 1 0 0 25 26 126611 0 0 1 0 26 27 122401 0 0 0 1 27 28 117352 0 0 0 0 28 29 112135 0 1 0 0 29 30 112879 0 0 1 0 30 31 148729 1 0 0 1 31 32 157230 0 0 0 0 32 33 157221 0 1 0 0 33 34 146681 0 0 1 0 34 35 136524 0 0 0 1 35 36 132111 0 0 0 0 36 37 125326 0 1 0 0 37 38 122716 0 0 1 0 38 39 116615 0 0 0 1 39 40 113719 0 0 0 0 40 41 110737 0 1 0 0 41 42 112093 0 0 1 0 42 43 143565 1 0 0 1 43 44 149946 0 0 0 0 44 45 149147 0 1 0 0 45 46 134339 0 0 1 0 46 47 122683 0 0 0 1 47 48 115614 0 0 0 0 48 49 116566 0 1 0 0 49 50 111272 0 0 1 0 50 51 104609 0 0 0 1 51 52 101802 0 0 0 0 52 53 94542 0 1 0 0 53 54 93051 0 0 1 0 54 55 124129 1 0 0 1 55 56 130374 0 0 0 0 56 57 123946 0 1 0 0 57 58 114971 0 0 1 0 58 59 105531 0 0 0 1 59 60 104919 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Y Q1 Q2 Q3 t 141817.1 21159.6 -2723.1 -6988.5 -7448.6 -372.1 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -28867.5 -11731.6 -216.6 7772.3 30406.3 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 141817.1 5728.2 24.758 < 2e-16 *** Y 21159.6 8916.6 2.373 0.02123 * Q1 -2723.1 5955.6 -0.457 0.64934 Q2 -6988.5 5949.4 -1.175 0.24528 Q3 -7448.6 6647.2 -1.121 0.26743 t -372.1 121.6 -3.060 0.00345 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 16280 on 54 degrees of freedom Multiple R-squared: 0.2337, Adjusted R-squared: 0.1628 F-statistic: 3.294 on 5 and 54 DF, p-value: 0.01144 > 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.9158129 0.1683743 0.08418713 [2,] 0.8475356 0.3049287 0.15246437 [3,] 0.7737514 0.4524971 0.22624857 [4,] 0.7505466 0.4989068 0.24945338 [5,] 0.7118566 0.5762868 0.28814340 [6,] 0.6420290 0.7159420 0.35797101 [7,] 0.6038171 0.7923658 0.39618289 [8,] 0.7088128 0.5823743 0.29118715 [9,] 0.8032233 0.3935534 0.19677670 [10,] 0.8128823 0.3742354 0.18711769 [11,] 0.7481175 0.5037651 0.25188253 [12,] 0.7893322 0.4213356 0.21066781 [13,] 0.8228676 0.3542647 0.17713236 [14,] 0.7962567 0.4074866 0.20374328 [15,] 0.7345891 0.5308218 0.26541092 [16,] 0.6943511 0.6112979 0.30564893 [17,] 0.6549399 0.6901202 0.34506012 [18,] 0.6030887 0.7938227 0.39691134 [19,] 0.5655448 0.8689103 0.43445517 [20,] 0.6517944 0.6964112 0.34820561 [21,] 0.7614374 0.4771252 0.23856260 [22,] 0.8075259 0.3849481 0.19247406 [23,] 0.7539813 0.4920374 0.24601871 [24,] 0.7638842 0.4722316 0.23611581 [25,] 0.8042363 0.3915274 0.19576370 [26,] 0.8029846 0.3940309 0.19701545 [27,] 0.7597067 0.4805865 0.24029327 [28,] 0.6984618 0.6030764 0.30153822 [29,] 0.6381973 0.7236055 0.36180275 [30,] 0.5643161 0.8713677 0.43568387 [31,] 0.5055222 0.9889556 0.49447781 [32,] 0.5453307 0.9093385 0.45466926 [33,] 0.6108069 0.7783863 0.38919313 [34,] 0.6068098 0.7863803 0.39319017 [35,] 0.5116452 0.9767096 0.48835480 [36,] 0.5288614 0.9422773 0.47113863 [37,] 0.6506393 0.6987213 0.34936067 [38,] 0.7060580 0.5878840 0.29394199 [39,] 0.6861128 0.6277743 0.31388715 [40,] 0.5967603 0.8064794 0.40323970 [41,] 0.5113683 0.9772634 0.48863170 [42,] 0.4388548 0.8777097 0.56114516 [43,] 0.3416268 0.6832536 0.65837321 > postscript(file="/var/www/html/rcomp/tmp/1jxvu1227466158.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/2o8um1227466158.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/3wlu91227466158.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/4subn1227466158.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/5pei81227466158.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 -1.166290e+04 -1.122436e+04 -1.555023e+04 -2.679170e+04 -2.886749e+04 6 7 8 9 10 -2.151796e+04 -2.184427e+03 2.028871e+04 2.218291e+04 1.666044e+04 11 12 13 14 15 7.231578e+03 -4.328890e+02 1.894315e+03 3.381849e+03 -3.233018e+03 16 17 18 19 20 -1.621648e+04 -1.861028e+04 -1.193775e+04 4.344787e+03 2.738592e+04 21 22 23 24 25 2.966212e+04 2.282766e+04 1.339779e+04 1.701324e+03 5.305289e+02 26 27 28 29 30 1.457062e+03 -1.920804e+03 -1.404627e+04 -1.616807e+04 -1.078653e+04 31 32 33 34 35 4.736000e+03 2.732013e+04 3.040634e+04 2.450387e+04 1.517900e+04 36 37 38 39 40 3.689538e+03 -2.577381e-01 2.027276e+03 -3.241591e+03 -1.321406e+04 41 42 43 44 45 -1.310085e+04 -7.107320e+03 4.037213e+03 2.450135e+04 2.679755e+04 46 47 48 49 50 1.662708e+04 5.803218e+03 -8.342249e+03 -4.295044e+03 -4.951511e+03 51 52 53 54 55 -1.078238e+04 -2.066584e+04 -2.483064e+04 -2.168411e+04 -1.093357e+04 56 57 58 59 60 9.394560e+03 6.061765e+03 1.724298e+03 -6.883569e+03 -1.457204e+04 > postscript(file="/var/www/html/rcomp/tmp/6aqdf1227466158.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.166290e+04 NA 1 -1.122436e+04 -1.166290e+04 2 -1.555023e+04 -1.122436e+04 3 -2.679170e+04 -1.555023e+04 4 -2.886749e+04 -2.679170e+04 5 -2.151796e+04 -2.886749e+04 6 -2.184427e+03 -2.151796e+04 7 2.028871e+04 -2.184427e+03 8 2.218291e+04 2.028871e+04 9 1.666044e+04 2.218291e+04 10 7.231578e+03 1.666044e+04 11 -4.328890e+02 7.231578e+03 12 1.894315e+03 -4.328890e+02 13 3.381849e+03 1.894315e+03 14 -3.233018e+03 3.381849e+03 15 -1.621648e+04 -3.233018e+03 16 -1.861028e+04 -1.621648e+04 17 -1.193775e+04 -1.861028e+04 18 4.344787e+03 -1.193775e+04 19 2.738592e+04 4.344787e+03 20 2.966212e+04 2.738592e+04 21 2.282766e+04 2.966212e+04 22 1.339779e+04 2.282766e+04 23 1.701324e+03 1.339779e+04 24 5.305289e+02 1.701324e+03 25 1.457062e+03 5.305289e+02 26 -1.920804e+03 1.457062e+03 27 -1.404627e+04 -1.920804e+03 28 -1.616807e+04 -1.404627e+04 29 -1.078653e+04 -1.616807e+04 30 4.736000e+03 -1.078653e+04 31 2.732013e+04 4.736000e+03 32 3.040634e+04 2.732013e+04 33 2.450387e+04 3.040634e+04 34 1.517900e+04 2.450387e+04 35 3.689538e+03 1.517900e+04 36 -2.577381e-01 3.689538e+03 37 2.027276e+03 -2.577381e-01 38 -3.241591e+03 2.027276e+03 39 -1.321406e+04 -3.241591e+03 40 -1.310085e+04 -1.321406e+04 41 -7.107320e+03 -1.310085e+04 42 4.037213e+03 -7.107320e+03 43 2.450135e+04 4.037213e+03 44 2.679755e+04 2.450135e+04 45 1.662708e+04 2.679755e+04 46 5.803218e+03 1.662708e+04 47 -8.342249e+03 5.803218e+03 48 -4.295044e+03 -8.342249e+03 49 -4.951511e+03 -4.295044e+03 50 -1.078238e+04 -4.951511e+03 51 -2.066584e+04 -1.078238e+04 52 -2.483064e+04 -2.066584e+04 53 -2.168411e+04 -2.483064e+04 54 -1.093357e+04 -2.168411e+04 55 9.394560e+03 -1.093357e+04 56 6.061765e+03 9.394560e+03 57 1.724298e+03 6.061765e+03 58 -6.883569e+03 1.724298e+03 59 -1.457204e+04 -6.883569e+03 60 NA -1.457204e+04 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.122436e+04 -1.166290e+04 [2,] -1.555023e+04 -1.122436e+04 [3,] -2.679170e+04 -1.555023e+04 [4,] -2.886749e+04 -2.679170e+04 [5,] -2.151796e+04 -2.886749e+04 [6,] -2.184427e+03 -2.151796e+04 [7,] 2.028871e+04 -2.184427e+03 [8,] 2.218291e+04 2.028871e+04 [9,] 1.666044e+04 2.218291e+04 [10,] 7.231578e+03 1.666044e+04 [11,] -4.328890e+02 7.231578e+03 [12,] 1.894315e+03 -4.328890e+02 [13,] 3.381849e+03 1.894315e+03 [14,] -3.233018e+03 3.381849e+03 [15,] -1.621648e+04 -3.233018e+03 [16,] -1.861028e+04 -1.621648e+04 [17,] -1.193775e+04 -1.861028e+04 [18,] 4.344787e+03 -1.193775e+04 [19,] 2.738592e+04 4.344787e+03 [20,] 2.966212e+04 2.738592e+04 [21,] 2.282766e+04 2.966212e+04 [22,] 1.339779e+04 2.282766e+04 [23,] 1.701324e+03 1.339779e+04 [24,] 5.305289e+02 1.701324e+03 [25,] 1.457062e+03 5.305289e+02 [26,] -1.920804e+03 1.457062e+03 [27,] -1.404627e+04 -1.920804e+03 [28,] -1.616807e+04 -1.404627e+04 [29,] -1.078653e+04 -1.616807e+04 [30,] 4.736000e+03 -1.078653e+04 [31,] 2.732013e+04 4.736000e+03 [32,] 3.040634e+04 2.732013e+04 [33,] 2.450387e+04 3.040634e+04 [34,] 1.517900e+04 2.450387e+04 [35,] 3.689538e+03 1.517900e+04 [36,] -2.577381e-01 3.689538e+03 [37,] 2.027276e+03 -2.577381e-01 [38,] -3.241591e+03 2.027276e+03 [39,] -1.321406e+04 -3.241591e+03 [40,] -1.310085e+04 -1.321406e+04 [41,] -7.107320e+03 -1.310085e+04 [42,] 4.037213e+03 -7.107320e+03 [43,] 2.450135e+04 4.037213e+03 [44,] 2.679755e+04 2.450135e+04 [45,] 1.662708e+04 2.679755e+04 [46,] 5.803218e+03 1.662708e+04 [47,] -8.342249e+03 5.803218e+03 [48,] -4.295044e+03 -8.342249e+03 [49,] -4.951511e+03 -4.295044e+03 [50,] -1.078238e+04 -4.951511e+03 [51,] -2.066584e+04 -1.078238e+04 [52,] -2.483064e+04 -2.066584e+04 [53,] -2.168411e+04 -2.483064e+04 [54,] -1.093357e+04 -2.168411e+04 [55,] 9.394560e+03 -1.093357e+04 [56,] 6.061765e+03 9.394560e+03 [57,] 1.724298e+03 6.061765e+03 [58,] -6.883569e+03 1.724298e+03 [59,] -1.457204e+04 -6.883569e+03 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.122436e+04 -1.166290e+04 2 -1.555023e+04 -1.122436e+04 3 -2.679170e+04 -1.555023e+04 4 -2.886749e+04 -2.679170e+04 5 -2.151796e+04 -2.886749e+04 6 -2.184427e+03 -2.151796e+04 7 2.028871e+04 -2.184427e+03 8 2.218291e+04 2.028871e+04 9 1.666044e+04 2.218291e+04 10 7.231578e+03 1.666044e+04 11 -4.328890e+02 7.231578e+03 12 1.894315e+03 -4.328890e+02 13 3.381849e+03 1.894315e+03 14 -3.233018e+03 3.381849e+03 15 -1.621648e+04 -3.233018e+03 16 -1.861028e+04 -1.621648e+04 17 -1.193775e+04 -1.861028e+04 18 4.344787e+03 -1.193775e+04 19 2.738592e+04 4.344787e+03 20 2.966212e+04 2.738592e+04 21 2.282766e+04 2.966212e+04 22 1.339779e+04 2.282766e+04 23 1.701324e+03 1.339779e+04 24 5.305289e+02 1.701324e+03 25 1.457062e+03 5.305289e+02 26 -1.920804e+03 1.457062e+03 27 -1.404627e+04 -1.920804e+03 28 -1.616807e+04 -1.404627e+04 29 -1.078653e+04 -1.616807e+04 30 4.736000e+03 -1.078653e+04 31 2.732013e+04 4.736000e+03 32 3.040634e+04 2.732013e+04 33 2.450387e+04 3.040634e+04 34 1.517900e+04 2.450387e+04 35 3.689538e+03 1.517900e+04 36 -2.577381e-01 3.689538e+03 37 2.027276e+03 -2.577381e-01 38 -3.241591e+03 2.027276e+03 39 -1.321406e+04 -3.241591e+03 40 -1.310085e+04 -1.321406e+04 41 -7.107320e+03 -1.310085e+04 42 4.037213e+03 -7.107320e+03 43 2.450135e+04 4.037213e+03 44 2.679755e+04 2.450135e+04 45 1.662708e+04 2.679755e+04 46 5.803218e+03 1.662708e+04 47 -8.342249e+03 5.803218e+03 48 -4.295044e+03 -8.342249e+03 49 -4.951511e+03 -4.295044e+03 50 -1.078238e+04 -4.951511e+03 51 -2.066584e+04 -1.078238e+04 52 -2.483064e+04 -2.066584e+04 53 -2.168411e+04 -2.483064e+04 54 -1.093357e+04 -2.168411e+04 55 9.394560e+03 -1.093357e+04 56 6.061765e+03 9.394560e+03 57 1.724298e+03 6.061765e+03 58 -6.883569e+03 1.724298e+03 59 -1.457204e+04 -6.883569e+03 > 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/7btff1227466158.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/817fs1227466158.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/9k8ji1227466158.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/104ybw1227466158.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/1193ub1227466158.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/12mcr31227466158.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/13m3ui1227466158.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/14dyz51227466158.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/15qahg1227466158.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/16vr2h1227466158.tab") + } > > system("convert tmp/1jxvu1227466158.ps tmp/1jxvu1227466158.png") > system("convert tmp/2o8um1227466158.ps tmp/2o8um1227466158.png") > system("convert tmp/3wlu91227466158.ps tmp/3wlu91227466158.png") > system("convert tmp/4subn1227466158.ps tmp/4subn1227466158.png") > system("convert tmp/5pei81227466158.ps tmp/5pei81227466158.png") > system("convert tmp/6aqdf1227466158.ps tmp/6aqdf1227466158.png") > system("convert tmp/7btff1227466158.ps tmp/7btff1227466158.png") > system("convert tmp/817fs1227466158.ps tmp/817fs1227466158.png") > system("convert tmp/9k8ji1227466158.ps tmp/9k8ji1227466158.png") > system("convert tmp/104ybw1227466158.ps tmp/104ybw1227466158.png") > > > proc.time() user system elapsed 2.432 1.551 2.849