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(1.43,0.51,1.43,0.51,1.43,0.51,1.43,0.51,1.43,0.52,1.43,0.52,1.44,0.52,1.48,0.53,1.48,0.53,1.48,0.52,1.48,0.52,1.48,0.52,1.48,0.52,1.48,0.52,1.48,0.52,1.48,0.52,1.48,0.52,1.48,0.52,1.48,0.52,1.48,0.53,1.48,0.53,1.48,0.53,1.48,0.54,1.48,0.54,1.48,0.54,1.48,0.54,1.48,0.54,1.48,0.54,1.48,0.54,1.48,0.54,1.48,0.54,1.48,0.54,1.48,0.53,1.48,0.53,1.48,0.53,1.48,0.53,1.48,0.53,1.57,0.54,1.58,0.55,1.58,0.55,1.58,0.55,1.58,0.55,1.59,0.55,1.6,0.55,1.6,0.55,1.61,0.55,1.61,0.56,1.61,0.56,1.62,0.56,1.63,0.56,1.63,0.56,1.64,0.55,1.64,0.56,1.64,0.55,1.64,0.55,1.64,0.56,1.65,0.55,1.65,0.55,1.65,0.55,1.65,0.55),dim=c(2,60),dimnames=list(c('Broodprijs','Bakmeelprijs'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Broodprijs','Bakmeelprijs'),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 = 'Do not include Seasonal 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 Broodprijs Bakmeelprijs t 1 1.43 0.51 1 2 1.43 0.51 2 3 1.43 0.51 3 4 1.43 0.51 4 5 1.43 0.52 5 6 1.43 0.52 6 7 1.44 0.52 7 8 1.48 0.53 8 9 1.48 0.53 9 10 1.48 0.52 10 11 1.48 0.52 11 12 1.48 0.52 12 13 1.48 0.52 13 14 1.48 0.52 14 15 1.48 0.52 15 16 1.48 0.52 16 17 1.48 0.52 17 18 1.48 0.52 18 19 1.48 0.52 19 20 1.48 0.53 20 21 1.48 0.53 21 22 1.48 0.53 22 23 1.48 0.54 23 24 1.48 0.54 24 25 1.48 0.54 25 26 1.48 0.54 26 27 1.48 0.54 27 28 1.48 0.54 28 29 1.48 0.54 29 30 1.48 0.54 30 31 1.48 0.54 31 32 1.48 0.54 32 33 1.48 0.53 33 34 1.48 0.53 34 35 1.48 0.53 35 36 1.48 0.53 36 37 1.48 0.53 37 38 1.57 0.54 38 39 1.58 0.55 39 40 1.58 0.55 40 41 1.58 0.55 41 42 1.58 0.55 42 43 1.59 0.55 43 44 1.60 0.55 44 45 1.60 0.55 45 46 1.61 0.55 46 47 1.61 0.56 47 48 1.61 0.56 48 49 1.62 0.56 49 50 1.63 0.56 50 51 1.63 0.56 51 52 1.64 0.55 52 53 1.64 0.56 53 54 1.64 0.55 54 55 1.64 0.55 55 56 1.64 0.56 56 57 1.65 0.55 57 58 1.65 0.55 58 59 1.65 0.55 59 60 1.65 0.55 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Bakmeelprijs t 0.864897 1.054890 0.003136 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.06001 -0.01639 0.01042 0.02010 0.03520 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.8648973 0.3008914 2.874 0.00568 ** Bakmeelprijs 1.0548898 0.5864515 1.799 0.07735 . t 0.0031356 0.0005079 6.173 7.47e-08 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.02889 on 57 degrees of freedom Multiple R-squared: 0.8571, Adjusted R-squared: 0.8521 F-statistic: 170.9 on 2 and 57 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,] 3.253350e-43 6.506700e-43 1.000000e+00 [2,] 4.259567e-04 8.519134e-04 9.995740e-01 [3,] 2.783022e-02 5.566045e-02 9.721698e-01 [4,] 1.909243e-02 3.818486e-02 9.809076e-01 [5,] 2.498965e-02 4.997930e-02 9.750103e-01 [6,] 1.358153e-02 2.716306e-02 9.864185e-01 [7,] 7.235415e-03 1.447083e-02 9.927646e-01 [8,] 4.254144e-03 8.508287e-03 9.957459e-01 [9,] 2.893481e-03 5.786961e-03 9.971065e-01 [10,] 2.334189e-03 4.668378e-03 9.976658e-01 [11,] 2.286625e-03 4.573249e-03 9.977134e-01 [12,] 2.833426e-03 5.666853e-03 9.971666e-01 [13,] 4.835820e-03 9.671640e-03 9.951642e-01 [14,] 1.371554e-02 2.743108e-02 9.862845e-01 [15,] 5.410101e-02 1.082020e-01 9.458990e-01 [16,] 1.413981e-01 2.827963e-01 8.586019e-01 [17,] 3.163343e-01 6.326685e-01 6.836657e-01 [18,] 4.118944e-01 8.237888e-01 5.881056e-01 [19,] 4.452376e-01 8.904751e-01 5.547624e-01 [20,] 4.484415e-01 8.968830e-01 5.515585e-01 [21,] 4.332662e-01 8.665323e-01 5.667338e-01 [22,] 4.066421e-01 8.132842e-01 5.933579e-01 [23,] 3.750629e-01 7.501258e-01 6.249371e-01 [24,] 3.460387e-01 6.920773e-01 6.539613e-01 [25,] 3.289633e-01 6.579266e-01 6.710367e-01 [26,] 3.376812e-01 6.753624e-01 6.623188e-01 [27,] 3.995727e-01 7.991454e-01 6.004273e-01 [28,] 3.606188e-01 7.212377e-01 6.393812e-01 [29,] 3.312335e-01 6.624670e-01 6.687665e-01 [30,] 3.425406e-01 6.850811e-01 6.574594e-01 [31,] 5.044390e-01 9.911221e-01 4.955610e-01 [32,] 9.999820e-01 3.600028e-05 1.800014e-05 [33,] 9.999995e-01 1.034278e-06 5.171392e-07 [34,] 9.999999e-01 2.415013e-07 1.207507e-07 [35,] 9.999999e-01 2.290489e-07 1.145244e-07 [36,] 9.999999e-01 2.811248e-07 1.405624e-07 [37,] 9.999999e-01 1.250069e-07 6.250346e-08 [38,] 9.999999e-01 1.443921e-07 7.219605e-08 [39,] 9.999998e-01 3.735378e-07 1.867689e-07 [40,] 9.999998e-01 4.768891e-07 2.384445e-07 [41,] 9.999994e-01 1.232382e-06 6.161912e-07 [42,] 9.999986e-01 2.827275e-06 1.413637e-06 [43,] 9.999998e-01 3.971938e-07 1.985969e-07 [44,] 9.999999e-01 2.043811e-07 1.021906e-07 [45,] 9.999991e-01 1.891610e-06 9.458050e-07 [46,] 9.999957e-01 8.645102e-06 4.322551e-06 [47,] 9.999661e-01 6.787844e-05 3.393922e-05 [48,] 9.998593e-01 2.814971e-04 1.407486e-04 [49,] 9.984721e-01 3.055844e-03 1.527922e-03 > postscript(file="/var/www/html/rcomp/tmp/1dmys1258714571.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/23r091258714571.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/3z2ti1258714571.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/4dcpg1258714571.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/5v1os1258714571.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 0.0239732543 0.0208376483 0.0177020423 0.0145664363 0.0008819319 6 7 8 9 10 -0.0022536741 0.0046107199 0.0309262155 0.0277906095 0.0352039019 11 12 13 14 15 0.0320682959 0.0289326899 0.0257970839 0.0226614779 0.0195258719 16 17 18 19 20 0.0163902659 0.0132546599 0.0101190539 0.0069834479 -0.0067010565 21 22 23 24 25 -0.0098366625 -0.0129722685 -0.0266567729 -0.0297923789 -0.0329279848 26 27 28 29 30 -0.0360635908 -0.0391991968 -0.0423348028 -0.0454704088 -0.0486060148 31 32 33 34 35 -0.0517416208 -0.0548772268 -0.0474639344 -0.0505995404 -0.0537351464 36 37 38 39 40 -0.0568707524 -0.0600063584 0.0163091372 0.0126246328 0.0094890268 41 42 43 44 45 0.0063534208 0.0032178148 0.0100822088 0.0169466028 0.0138109968 46 47 48 49 50 0.0206753908 0.0069908864 0.0038552804 0.0107196744 0.0175840684 51 52 53 54 55 0.0144484624 0.0318617548 0.0181772504 0.0255905429 0.0224549369 56 57 58 59 60 0.0087704325 0.0261837249 0.0230481189 0.0199125129 0.0167769069 > postscript(file="/var/www/html/rcomp/tmp/63wk41258714571.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 0.0239732543 NA 1 0.0208376483 0.0239732543 2 0.0177020423 0.0208376483 3 0.0145664363 0.0177020423 4 0.0008819319 0.0145664363 5 -0.0022536741 0.0008819319 6 0.0046107199 -0.0022536741 7 0.0309262155 0.0046107199 8 0.0277906095 0.0309262155 9 0.0352039019 0.0277906095 10 0.0320682959 0.0352039019 11 0.0289326899 0.0320682959 12 0.0257970839 0.0289326899 13 0.0226614779 0.0257970839 14 0.0195258719 0.0226614779 15 0.0163902659 0.0195258719 16 0.0132546599 0.0163902659 17 0.0101190539 0.0132546599 18 0.0069834479 0.0101190539 19 -0.0067010565 0.0069834479 20 -0.0098366625 -0.0067010565 21 -0.0129722685 -0.0098366625 22 -0.0266567729 -0.0129722685 23 -0.0297923789 -0.0266567729 24 -0.0329279848 -0.0297923789 25 -0.0360635908 -0.0329279848 26 -0.0391991968 -0.0360635908 27 -0.0423348028 -0.0391991968 28 -0.0454704088 -0.0423348028 29 -0.0486060148 -0.0454704088 30 -0.0517416208 -0.0486060148 31 -0.0548772268 -0.0517416208 32 -0.0474639344 -0.0548772268 33 -0.0505995404 -0.0474639344 34 -0.0537351464 -0.0505995404 35 -0.0568707524 -0.0537351464 36 -0.0600063584 -0.0568707524 37 0.0163091372 -0.0600063584 38 0.0126246328 0.0163091372 39 0.0094890268 0.0126246328 40 0.0063534208 0.0094890268 41 0.0032178148 0.0063534208 42 0.0100822088 0.0032178148 43 0.0169466028 0.0100822088 44 0.0138109968 0.0169466028 45 0.0206753908 0.0138109968 46 0.0069908864 0.0206753908 47 0.0038552804 0.0069908864 48 0.0107196744 0.0038552804 49 0.0175840684 0.0107196744 50 0.0144484624 0.0175840684 51 0.0318617548 0.0144484624 52 0.0181772504 0.0318617548 53 0.0255905429 0.0181772504 54 0.0224549369 0.0255905429 55 0.0087704325 0.0224549369 56 0.0261837249 0.0087704325 57 0.0230481189 0.0261837249 58 0.0199125129 0.0230481189 59 0.0167769069 0.0199125129 60 NA 0.0167769069 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.0208376483 0.0239732543 [2,] 0.0177020423 0.0208376483 [3,] 0.0145664363 0.0177020423 [4,] 0.0008819319 0.0145664363 [5,] -0.0022536741 0.0008819319 [6,] 0.0046107199 -0.0022536741 [7,] 0.0309262155 0.0046107199 [8,] 0.0277906095 0.0309262155 [9,] 0.0352039019 0.0277906095 [10,] 0.0320682959 0.0352039019 [11,] 0.0289326899 0.0320682959 [12,] 0.0257970839 0.0289326899 [13,] 0.0226614779 0.0257970839 [14,] 0.0195258719 0.0226614779 [15,] 0.0163902659 0.0195258719 [16,] 0.0132546599 0.0163902659 [17,] 0.0101190539 0.0132546599 [18,] 0.0069834479 0.0101190539 [19,] -0.0067010565 0.0069834479 [20,] -0.0098366625 -0.0067010565 [21,] -0.0129722685 -0.0098366625 [22,] -0.0266567729 -0.0129722685 [23,] -0.0297923789 -0.0266567729 [24,] -0.0329279848 -0.0297923789 [25,] -0.0360635908 -0.0329279848 [26,] -0.0391991968 -0.0360635908 [27,] -0.0423348028 -0.0391991968 [28,] -0.0454704088 -0.0423348028 [29,] -0.0486060148 -0.0454704088 [30,] -0.0517416208 -0.0486060148 [31,] -0.0548772268 -0.0517416208 [32,] -0.0474639344 -0.0548772268 [33,] -0.0505995404 -0.0474639344 [34,] -0.0537351464 -0.0505995404 [35,] -0.0568707524 -0.0537351464 [36,] -0.0600063584 -0.0568707524 [37,] 0.0163091372 -0.0600063584 [38,] 0.0126246328 0.0163091372 [39,] 0.0094890268 0.0126246328 [40,] 0.0063534208 0.0094890268 [41,] 0.0032178148 0.0063534208 [42,] 0.0100822088 0.0032178148 [43,] 0.0169466028 0.0100822088 [44,] 0.0138109968 0.0169466028 [45,] 0.0206753908 0.0138109968 [46,] 0.0069908864 0.0206753908 [47,] 0.0038552804 0.0069908864 [48,] 0.0107196744 0.0038552804 [49,] 0.0175840684 0.0107196744 [50,] 0.0144484624 0.0175840684 [51,] 0.0318617548 0.0144484624 [52,] 0.0181772504 0.0318617548 [53,] 0.0255905429 0.0181772504 [54,] 0.0224549369 0.0255905429 [55,] 0.0087704325 0.0224549369 [56,] 0.0261837249 0.0087704325 [57,] 0.0230481189 0.0261837249 [58,] 0.0199125129 0.0230481189 [59,] 0.0167769069 0.0199125129 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.0208376483 0.0239732543 2 0.0177020423 0.0208376483 3 0.0145664363 0.0177020423 4 0.0008819319 0.0145664363 5 -0.0022536741 0.0008819319 6 0.0046107199 -0.0022536741 7 0.0309262155 0.0046107199 8 0.0277906095 0.0309262155 9 0.0352039019 0.0277906095 10 0.0320682959 0.0352039019 11 0.0289326899 0.0320682959 12 0.0257970839 0.0289326899 13 0.0226614779 0.0257970839 14 0.0195258719 0.0226614779 15 0.0163902659 0.0195258719 16 0.0132546599 0.0163902659 17 0.0101190539 0.0132546599 18 0.0069834479 0.0101190539 19 -0.0067010565 0.0069834479 20 -0.0098366625 -0.0067010565 21 -0.0129722685 -0.0098366625 22 -0.0266567729 -0.0129722685 23 -0.0297923789 -0.0266567729 24 -0.0329279848 -0.0297923789 25 -0.0360635908 -0.0329279848 26 -0.0391991968 -0.0360635908 27 -0.0423348028 -0.0391991968 28 -0.0454704088 -0.0423348028 29 -0.0486060148 -0.0454704088 30 -0.0517416208 -0.0486060148 31 -0.0548772268 -0.0517416208 32 -0.0474639344 -0.0548772268 33 -0.0505995404 -0.0474639344 34 -0.0537351464 -0.0505995404 35 -0.0568707524 -0.0537351464 36 -0.0600063584 -0.0568707524 37 0.0163091372 -0.0600063584 38 0.0126246328 0.0163091372 39 0.0094890268 0.0126246328 40 0.0063534208 0.0094890268 41 0.0032178148 0.0063534208 42 0.0100822088 0.0032178148 43 0.0169466028 0.0100822088 44 0.0138109968 0.0169466028 45 0.0206753908 0.0138109968 46 0.0069908864 0.0206753908 47 0.0038552804 0.0069908864 48 0.0107196744 0.0038552804 49 0.0175840684 0.0107196744 50 0.0144484624 0.0175840684 51 0.0318617548 0.0144484624 52 0.0181772504 0.0318617548 53 0.0255905429 0.0181772504 54 0.0224549369 0.0255905429 55 0.0087704325 0.0224549369 56 0.0261837249 0.0087704325 57 0.0230481189 0.0261837249 58 0.0199125129 0.0230481189 59 0.0167769069 0.0199125129 > 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/7cubg1258714571.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/8cox71258714571.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/9rwsh1258714571.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/10l73r1258714571.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/11oxh81258714571.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/12iubv1258714571.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/139e731258714571.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/14tgep1258714571.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/151tgt1258714571.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/16pjr71258714571.tab") + } > > system("convert tmp/1dmys1258714571.ps tmp/1dmys1258714571.png") > system("convert tmp/23r091258714571.ps tmp/23r091258714571.png") > system("convert tmp/3z2ti1258714571.ps tmp/3z2ti1258714571.png") > system("convert tmp/4dcpg1258714571.ps tmp/4dcpg1258714571.png") > system("convert tmp/5v1os1258714571.ps tmp/5v1os1258714571.png") > system("convert tmp/63wk41258714571.ps tmp/63wk41258714571.png") > system("convert tmp/7cubg1258714571.ps tmp/7cubg1258714571.png") > system("convert tmp/8cox71258714571.ps tmp/8cox71258714571.png") > system("convert tmp/9rwsh1258714571.ps tmp/9rwsh1258714571.png") > system("convert tmp/10l73r1258714571.ps tmp/10l73r1258714571.png") > > > proc.time() user system elapsed 2.375 1.502 2.905