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,0,0,0,1.43,0,0,0,0,1.43,0,0,0,0,1.43,0,0,0,0,1.43,0,0,0,0,1.43,0,0,0,0,1.44,0,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.48,1,0,0,0,1.57,1,1,0,0,1.58,1,1,0,0,1.58,1,1,0,0,1.58,1,1,0,0,1.58,1,1,0,0,1.59,1,1,1,1,1.6,1,1,1,2,1.6,1,1,1,3,1.61,1,1,1,4,1.61,1,1,1,5,1.61,1,1,1,6,1.62,1,1,1,7,1.63,1,1,1,8,1.63,1,1,1,9,1.64,1,1,1,10,1.64,1,1,1,11,1.64,1,1,1,12,1.64,1,1,1,13,1.64,1,1,1,14,1.65,1,1,1,15,1.65,1,1,1,16,1.65,1,1,1,17,1.65,1,1,1,18),dim=c(5,60),dimnames=list(c('Broodprijzen','Dummy2','Dummy3','Dummy1','Dummy4'),1:60)) > y <- array(NA,dim=c(5,60),dimnames=list(c('Broodprijzen','Dummy2','Dummy3','Dummy1','Dummy4'),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 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' + } >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.64 1 1 1 14 0 0 0 0 0 0 0 1 0 0 0 57 1.65 1 1 1 15 0 0 0 0 0 0 0 0 1 0 0 58 1.65 1 1 1 16 0 0 0 0 0 0 0 0 0 1 0 59 1.65 1 1 1 17 0 0 0 0 0 0 0 0 0 0 1 60 1.65 1 1 1 18 0 0 0 0 0 0 0 0 0 0 0 t 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53 54 54 55 55 56 56 57 57 58 58 59 59 60 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Dummy2 Dummy3 Dummy1 Dummy4 M1 1.427e+00 4.932e-02 9.612e-02 1.705e-02 3.591e-03 2.945e-03 M2 M3 M4 M5 M6 M7 2.982e-03 4.242e-03 5.502e-03 4.763e-03 4.023e-03 3.154e-03 M8 M9 M10 M11 t 1.832e-03 2.374e-03 2.916e-03 1.458e-03 2.154e-05 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.0075614 -0.0015442 -0.0001552 0.0013757 0.0092972 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.427e+00 2.198e-03 649.376 < 2e-16 *** Dummy2 4.932e-02 2.075e-03 23.774 < 2e-16 *** Dummy3 9.612e-02 2.234e-03 43.031 < 2e-16 *** Dummy1 1.705e-02 2.458e-03 6.938 1.58e-08 *** Dummy4 3.591e-03 1.765e-04 20.344 < 2e-16 *** M1 2.945e-03 2.236e-03 1.317 0.1948 M2 2.982e-03 2.277e-03 1.310 0.1972 M3 4.242e-03 2.269e-03 1.869 0.0684 . M4 5.502e-03 2.264e-03 2.430 0.0193 * M5 4.763e-03 2.261e-03 2.107 0.0410 * M6 4.023e-03 2.260e-03 1.780 0.0821 . M7 3.154e-03 2.244e-03 1.405 0.1671 M8 1.832e-03 2.220e-03 0.825 0.4139 M9 2.374e-03 2.211e-03 1.074 0.2889 M10 2.916e-03 2.204e-03 1.323 0.1928 M11 1.458e-03 2.200e-03 0.663 0.5110 t 2.154e-05 7.385e-05 0.292 0.7720 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.003476 on 43 degrees of freedom Multiple R-squared: 0.9984, Adjusted R-squared: 0.9979 F-statistic: 1720 on 16 and 43 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.601040967 0.797918067 0.3989590 [2,] 0.427733940 0.855467880 0.5722661 [3,] 0.278565378 0.557130756 0.7214346 [4,] 0.182266517 0.364533034 0.8177335 [5,] 0.170728889 0.341457779 0.8292711 [6,] 0.160741096 0.321482193 0.8392589 [7,] 0.111576047 0.223152094 0.8884240 [8,] 0.063862096 0.127724192 0.9361379 [9,] 0.038593391 0.077186782 0.9614066 [10,] 0.022793319 0.045586638 0.9772067 [11,] 0.014270104 0.028540208 0.9857299 [12,] 0.027367526 0.054735053 0.9726325 [13,] 0.017305303 0.034610606 0.9826947 [14,] 0.009155725 0.018311450 0.9908443 [15,] 0.004029209 0.008058417 0.9959708 [16,] 0.001807654 0.003615308 0.9981923 [17,] 0.002893078 0.005786156 0.9971069 [18,] 0.001105783 0.002211565 0.9988942 [19,] 0.001360217 0.002720434 0.9986398 [20,] 0.015829533 0.031659066 0.9841705 [21,] 0.010009794 0.020019587 0.9899902 > postscript(file="/var/www/html/rcomp/tmp/1xfhm1260526148.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/2wwbs1260526148.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/39h7y1260526148.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/4ciq31260526148.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/5qhmx1260526148.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 -3.647148e-04 -4.229667e-04 -1.704733e-03 -2.986500e-03 -2.268267e-03 6 7 8 9 10 -1.550034e-03 9.297216e-03 1.277254e-03 7.137210e-04 1.501875e-04 11 12 13 14 15 1.586654e-03 3.023120e-03 5.628708e-05 -1.964749e-06 -1.283732e-03 16 17 18 19 20 -2.565498e-03 -1.847265e-03 -1.129032e-03 -2.817825e-04 1.018791e-03 21 22 23 24 25 4.552574e-04 -1.082761e-04 1.328190e-03 2.764657e-03 -2.021765e-04 26 27 28 29 30 -2.604283e-04 -1.542195e-03 -2.823962e-03 -2.105729e-03 -1.387495e-03 31 32 33 34 35 -5.402461e-04 7.603273e-04 1.967938e-04 -3.667397e-04 1.069727e-03 36 37 38 39 40 2.506193e-03 -4.606401e-04 -6.636466e-03 2.081767e-03 8.000000e-04 41 42 43 44 45 1.518233e-03 2.236466e-03 -7.561364e-03 1.480429e-04 -4.006657e-03 46 47 48 49 50 1.838643e-03 -3.160564e-04 -2.470756e-03 9.712443e-04 7.321826e-03 51 52 53 54 55 2.448893e-03 7.575960e-03 4.703027e-03 1.830094e-03 -9.138227e-04 56 57 58 59 60 -3.204416e-03 2.640885e-03 -1.513815e-03 -3.668515e-03 -5.823215e-03 > postscript(file="/var/www/html/rcomp/tmp/6wwah1260526148.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 -3.647148e-04 NA 1 -4.229667e-04 -3.647148e-04 2 -1.704733e-03 -4.229667e-04 3 -2.986500e-03 -1.704733e-03 4 -2.268267e-03 -2.986500e-03 5 -1.550034e-03 -2.268267e-03 6 9.297216e-03 -1.550034e-03 7 1.277254e-03 9.297216e-03 8 7.137210e-04 1.277254e-03 9 1.501875e-04 7.137210e-04 10 1.586654e-03 1.501875e-04 11 3.023120e-03 1.586654e-03 12 5.628708e-05 3.023120e-03 13 -1.964749e-06 5.628708e-05 14 -1.283732e-03 -1.964749e-06 15 -2.565498e-03 -1.283732e-03 16 -1.847265e-03 -2.565498e-03 17 -1.129032e-03 -1.847265e-03 18 -2.817825e-04 -1.129032e-03 19 1.018791e-03 -2.817825e-04 20 4.552574e-04 1.018791e-03 21 -1.082761e-04 4.552574e-04 22 1.328190e-03 -1.082761e-04 23 2.764657e-03 1.328190e-03 24 -2.021765e-04 2.764657e-03 25 -2.604283e-04 -2.021765e-04 26 -1.542195e-03 -2.604283e-04 27 -2.823962e-03 -1.542195e-03 28 -2.105729e-03 -2.823962e-03 29 -1.387495e-03 -2.105729e-03 30 -5.402461e-04 -1.387495e-03 31 7.603273e-04 -5.402461e-04 32 1.967938e-04 7.603273e-04 33 -3.667397e-04 1.967938e-04 34 1.069727e-03 -3.667397e-04 35 2.506193e-03 1.069727e-03 36 -4.606401e-04 2.506193e-03 37 -6.636466e-03 -4.606401e-04 38 2.081767e-03 -6.636466e-03 39 8.000000e-04 2.081767e-03 40 1.518233e-03 8.000000e-04 41 2.236466e-03 1.518233e-03 42 -7.561364e-03 2.236466e-03 43 1.480429e-04 -7.561364e-03 44 -4.006657e-03 1.480429e-04 45 1.838643e-03 -4.006657e-03 46 -3.160564e-04 1.838643e-03 47 -2.470756e-03 -3.160564e-04 48 9.712443e-04 -2.470756e-03 49 7.321826e-03 9.712443e-04 50 2.448893e-03 7.321826e-03 51 7.575960e-03 2.448893e-03 52 4.703027e-03 7.575960e-03 53 1.830094e-03 4.703027e-03 54 -9.138227e-04 1.830094e-03 55 -3.204416e-03 -9.138227e-04 56 2.640885e-03 -3.204416e-03 57 -1.513815e-03 2.640885e-03 58 -3.668515e-03 -1.513815e-03 59 -5.823215e-03 -3.668515e-03 60 NA -5.823215e-03 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -4.229667e-04 -3.647148e-04 [2,] -1.704733e-03 -4.229667e-04 [3,] -2.986500e-03 -1.704733e-03 [4,] -2.268267e-03 -2.986500e-03 [5,] -1.550034e-03 -2.268267e-03 [6,] 9.297216e-03 -1.550034e-03 [7,] 1.277254e-03 9.297216e-03 [8,] 7.137210e-04 1.277254e-03 [9,] 1.501875e-04 7.137210e-04 [10,] 1.586654e-03 1.501875e-04 [11,] 3.023120e-03 1.586654e-03 [12,] 5.628708e-05 3.023120e-03 [13,] -1.964749e-06 5.628708e-05 [14,] -1.283732e-03 -1.964749e-06 [15,] -2.565498e-03 -1.283732e-03 [16,] -1.847265e-03 -2.565498e-03 [17,] -1.129032e-03 -1.847265e-03 [18,] -2.817825e-04 -1.129032e-03 [19,] 1.018791e-03 -2.817825e-04 [20,] 4.552574e-04 1.018791e-03 [21,] -1.082761e-04 4.552574e-04 [22,] 1.328190e-03 -1.082761e-04 [23,] 2.764657e-03 1.328190e-03 [24,] -2.021765e-04 2.764657e-03 [25,] -2.604283e-04 -2.021765e-04 [26,] -1.542195e-03 -2.604283e-04 [27,] -2.823962e-03 -1.542195e-03 [28,] -2.105729e-03 -2.823962e-03 [29,] -1.387495e-03 -2.105729e-03 [30,] -5.402461e-04 -1.387495e-03 [31,] 7.603273e-04 -5.402461e-04 [32,] 1.967938e-04 7.603273e-04 [33,] -3.667397e-04 1.967938e-04 [34,] 1.069727e-03 -3.667397e-04 [35,] 2.506193e-03 1.069727e-03 [36,] -4.606401e-04 2.506193e-03 [37,] -6.636466e-03 -4.606401e-04 [38,] 2.081767e-03 -6.636466e-03 [39,] 8.000000e-04 2.081767e-03 [40,] 1.518233e-03 8.000000e-04 [41,] 2.236466e-03 1.518233e-03 [42,] -7.561364e-03 2.236466e-03 [43,] 1.480429e-04 -7.561364e-03 [44,] -4.006657e-03 1.480429e-04 [45,] 1.838643e-03 -4.006657e-03 [46,] -3.160564e-04 1.838643e-03 [47,] -2.470756e-03 -3.160564e-04 [48,] 9.712443e-04 -2.470756e-03 [49,] 7.321826e-03 9.712443e-04 [50,] 2.448893e-03 7.321826e-03 [51,] 7.575960e-03 2.448893e-03 [52,] 4.703027e-03 7.575960e-03 [53,] 1.830094e-03 4.703027e-03 [54,] -9.138227e-04 1.830094e-03 [55,] -3.204416e-03 -9.138227e-04 [56,] 2.640885e-03 -3.204416e-03 [57,] -1.513815e-03 2.640885e-03 [58,] -3.668515e-03 -1.513815e-03 [59,] -5.823215e-03 -3.668515e-03 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -4.229667e-04 -3.647148e-04 2 -1.704733e-03 -4.229667e-04 3 -2.986500e-03 -1.704733e-03 4 -2.268267e-03 -2.986500e-03 5 -1.550034e-03 -2.268267e-03 6 9.297216e-03 -1.550034e-03 7 1.277254e-03 9.297216e-03 8 7.137210e-04 1.277254e-03 9 1.501875e-04 7.137210e-04 10 1.586654e-03 1.501875e-04 11 3.023120e-03 1.586654e-03 12 5.628708e-05 3.023120e-03 13 -1.964749e-06 5.628708e-05 14 -1.283732e-03 -1.964749e-06 15 -2.565498e-03 -1.283732e-03 16 -1.847265e-03 -2.565498e-03 17 -1.129032e-03 -1.847265e-03 18 -2.817825e-04 -1.129032e-03 19 1.018791e-03 -2.817825e-04 20 4.552574e-04 1.018791e-03 21 -1.082761e-04 4.552574e-04 22 1.328190e-03 -1.082761e-04 23 2.764657e-03 1.328190e-03 24 -2.021765e-04 2.764657e-03 25 -2.604283e-04 -2.021765e-04 26 -1.542195e-03 -2.604283e-04 27 -2.823962e-03 -1.542195e-03 28 -2.105729e-03 -2.823962e-03 29 -1.387495e-03 -2.105729e-03 30 -5.402461e-04 -1.387495e-03 31 7.603273e-04 -5.402461e-04 32 1.967938e-04 7.603273e-04 33 -3.667397e-04 1.967938e-04 34 1.069727e-03 -3.667397e-04 35 2.506193e-03 1.069727e-03 36 -4.606401e-04 2.506193e-03 37 -6.636466e-03 -4.606401e-04 38 2.081767e-03 -6.636466e-03 39 8.000000e-04 2.081767e-03 40 1.518233e-03 8.000000e-04 41 2.236466e-03 1.518233e-03 42 -7.561364e-03 2.236466e-03 43 1.480429e-04 -7.561364e-03 44 -4.006657e-03 1.480429e-04 45 1.838643e-03 -4.006657e-03 46 -3.160564e-04 1.838643e-03 47 -2.470756e-03 -3.160564e-04 48 9.712443e-04 -2.470756e-03 49 7.321826e-03 9.712443e-04 50 2.448893e-03 7.321826e-03 51 7.575960e-03 2.448893e-03 52 4.703027e-03 7.575960e-03 53 1.830094e-03 4.703027e-03 54 -9.138227e-04 1.830094e-03 55 -3.204416e-03 -9.138227e-04 56 2.640885e-03 -3.204416e-03 57 -1.513815e-03 2.640885e-03 58 -3.668515e-03 -1.513815e-03 59 -5.823215e-03 -3.668515e-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/7uv0f1260526148.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/8kdox1260526148.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/903lb1260526148.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/10ljf01260526148.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/118znr1260526148.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/12knzi1260526148.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/13qcdm1260526148.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/14l0nm1260526148.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/15idci1260526148.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/16p67n1260526148.tab") + } > > system("convert tmp/1xfhm1260526148.ps tmp/1xfhm1260526148.png") > system("convert tmp/2wwbs1260526148.ps tmp/2wwbs1260526148.png") > system("convert tmp/39h7y1260526148.ps tmp/39h7y1260526148.png") > system("convert tmp/4ciq31260526148.ps tmp/4ciq31260526148.png") > system("convert tmp/5qhmx1260526148.ps tmp/5qhmx1260526148.png") > system("convert tmp/6wwah1260526148.ps tmp/6wwah1260526148.png") > system("convert tmp/7uv0f1260526148.ps tmp/7uv0f1260526148.png") > system("convert tmp/8kdox1260526148.ps tmp/8kdox1260526148.png") > system("convert tmp/903lb1260526148.ps tmp/903lb1260526148.png") > system("convert tmp/10ljf01260526148.ps tmp/10ljf01260526148.png") > > > proc.time() user system elapsed 2.253 1.493 3.154