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(108.00,0,99.00,0,108.00,0,104.00,0,111.00,0,110.00,0,106.00,0,101.00,0,102.00,0,99.00,0,100.00,0,98.00,0,92.00,1,87.00,1,79.00,1,87.00,1,87.00,1,88.00,1,83.00,1,85.00,1,92.00,1,84.00,1,92.00,1,98.00,1,103.00,0,104.00,0,109.00,0,107.00,0,106.00,0,113.00,0,107.00,0,114.00,0,108.00,0,104.00,0,105.00,0,109.00,0,109.00,0,112.00,0,118.00,0,111.00,0,99.00,1,92.00,1,92.00,1,98.00,1,87.00,1,97.00,1,102.00,0,105.00,0,111.00,0,110.00,0,109.00,0,111.00,0,113.00,0,114.00,0,120.00,0,114.00,0,120.00,0,122.00,0,123.00,0,115.00,0,123.00,0,124.00,0,124.00,0,132.00,0,126.00,0,126.00,0,122.00,0,120.00,0,114.00,0,116.00,0,100.00,0,97.00,0),dim=c(2,72),dimnames=list(c('Consumentenvertrouwen','Dummy'),1:72)) > y <- array(NA,dim=c(2,72),dimnames=list(c('Consumentenvertrouwen','Dummy'),1:72)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No 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 Consumentenvertrouwen Dummy 1 108 0 2 99 0 3 108 0 4 104 0 5 111 0 6 110 0 7 106 0 8 101 0 9 102 0 10 99 0 11 100 0 12 98 0 13 92 1 14 87 1 15 79 1 16 87 1 17 87 1 18 88 1 19 83 1 20 85 1 21 92 1 22 84 1 23 92 1 24 98 1 25 103 0 26 104 0 27 109 0 28 107 0 29 106 0 30 113 0 31 107 0 32 114 0 33 108 0 34 104 0 35 105 0 36 109 0 37 109 0 38 112 0 39 118 0 40 111 0 41 99 1 42 92 1 43 92 1 44 98 1 45 87 1 46 97 1 47 102 0 48 105 0 49 111 0 50 110 0 51 109 0 52 111 0 53 113 0 54 114 0 55 120 0 56 114 0 57 120 0 58 122 0 59 123 0 60 115 0 61 123 0 62 124 0 63 124 0 64 132 0 65 126 0 66 126 0 67 122 0 68 120 0 69 114 0 70 116 0 71 100 0 72 97 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Dummy 111.07 -21.13 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -14.074 -5.292 -1.074 4.176 20.926 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 111.074 1.061 104.72 < 2e-16 *** Dummy -21.130 2.121 -9.96 4.71e-15 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 7.794 on 70 degrees of freedom Multiple R-squared: 0.5863, Adjusted R-squared: 0.5804 F-statistic: 99.21 on 1 and 70 DF, p-value: 4.711e-15 > 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.290886754 0.581773509 0.7091132 [2,] 0.188607897 0.377215794 0.8113921 [3,] 0.097754335 0.195508669 0.9022457 [4,] 0.086155173 0.172310346 0.9138448 [5,] 0.059800130 0.119600260 0.9401999 [6,] 0.068044079 0.136088157 0.9319559 [7,] 0.059445588 0.118891177 0.9405544 [8,] 0.071889624 0.143779248 0.9281104 [9,] 0.041745484 0.083490968 0.9582545 [10,] 0.028739284 0.057478568 0.9712607 [11,] 0.054573245 0.109146491 0.9454268 [12,] 0.033727142 0.067454284 0.9662729 [13,] 0.020183906 0.040367811 0.9798161 [14,] 0.011927623 0.023855247 0.9880724 [15,] 0.009125870 0.018251740 0.9908741 [16,] 0.005670560 0.011341121 0.9943294 [17,] 0.005274700 0.010549400 0.9947253 [18,] 0.003913547 0.007827094 0.9960865 [19,] 0.003448517 0.006897034 0.9965515 [20,] 0.009808135 0.019616269 0.9901919 [21,] 0.007410427 0.014820854 0.9925896 [22,] 0.005401056 0.010802112 0.9945989 [23,] 0.004592113 0.009184225 0.9954079 [24,] 0.003307425 0.006614850 0.9966926 [25,] 0.002346064 0.004692128 0.9976539 [26,] 0.003327074 0.006654149 0.9966729 [27,] 0.002367566 0.004735131 0.9976324 [28,] 0.003401422 0.006802844 0.9965986 [29,] 0.002420703 0.004841406 0.9975793 [30,] 0.002157817 0.004315633 0.9978422 [31,] 0.001824845 0.003649690 0.9981752 [32,] 0.001401084 0.002802168 0.9985989 [33,] 0.001075508 0.002151016 0.9989245 [34,] 0.000999519 0.001999038 0.9990005 [35,] 0.002546590 0.005093180 0.9974534 [36,] 0.001968471 0.003936943 0.9980315 [37,] 0.003584624 0.007169248 0.9964154 [38,] 0.002301601 0.004603202 0.9976984 [39,] 0.001438654 0.002877307 0.9985613 [40,] 0.001695324 0.003390648 0.9983047 [41,] 0.001289764 0.002579528 0.9987102 [42,] 0.001102143 0.002204285 0.9988979 [43,] 0.002065348 0.004130697 0.9979347 [44,] 0.002555625 0.005111249 0.9974444 [45,] 0.002095980 0.004191960 0.9979040 [46,] 0.001782922 0.003565844 0.9982171 [47,] 0.001679214 0.003358428 0.9983208 [48,] 0.001475409 0.002950817 0.9985246 [49,] 0.001277669 0.002555339 0.9987223 [50,] 0.001110889 0.002221778 0.9988891 [51,] 0.001648492 0.003296984 0.9983515 [52,] 0.001305314 0.002610629 0.9986947 [53,] 0.001533626 0.003067251 0.9984664 [54,] 0.002126146 0.004252292 0.9978739 [55,] 0.002968357 0.005936714 0.9970316 [56,] 0.001901486 0.003802973 0.9980985 [57,] 0.002173036 0.004346072 0.9978270 [58,] 0.002630243 0.005260486 0.9973698 [59,] 0.002932095 0.005864190 0.9970679 [60,] 0.018798949 0.037597898 0.9812011 [61,] 0.030515675 0.061031350 0.9694843 [62,] 0.060390189 0.120780377 0.9396098 [63,] 0.077767762 0.155535525 0.9222322 > postscript(file="/var/www/html/rcomp/tmp/1pus31228940767.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/27tka1228940767.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/3tq7s1228940767.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/4137u1228940767.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/5mp1r1228940767.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 = 72 Frequency = 1 1 2 3 4 5 6 -3.07407407 -12.07407407 -3.07407407 -7.07407407 -0.07407407 -1.07407407 7 8 9 10 11 12 -5.07407407 -10.07407407 -9.07407407 -12.07407407 -11.07407407 -13.07407407 13 14 15 16 17 18 2.05555556 -2.94444444 -10.94444444 -2.94444444 -2.94444444 -1.94444444 19 20 21 22 23 24 -6.94444444 -4.94444444 2.05555556 -5.94444444 2.05555556 8.05555556 25 26 27 28 29 30 -8.07407407 -7.07407407 -2.07407407 -4.07407407 -5.07407407 1.92592593 31 32 33 34 35 36 -4.07407407 2.92592593 -3.07407407 -7.07407407 -6.07407407 -2.07407407 37 38 39 40 41 42 -2.07407407 0.92592593 6.92592593 -0.07407407 9.05555556 2.05555556 43 44 45 46 47 48 2.05555556 8.05555556 -2.94444444 7.05555556 -9.07407407 -6.07407407 49 50 51 52 53 54 -0.07407407 -1.07407407 -2.07407407 -0.07407407 1.92592593 2.92592593 55 56 57 58 59 60 8.92592593 2.92592593 8.92592593 10.92592593 11.92592593 3.92592593 61 62 63 64 65 66 11.92592593 12.92592593 12.92592593 20.92592593 14.92592593 14.92592593 67 68 69 70 71 72 10.92592593 8.92592593 2.92592593 4.92592593 -11.07407407 -14.07407407 > postscript(file="/var/www/html/rcomp/tmp/60g0a1228940767.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 = 72 Frequency = 1 lag(myerror, k = 1) myerror 0 -3.07407407 NA 1 -12.07407407 -3.07407407 2 -3.07407407 -12.07407407 3 -7.07407407 -3.07407407 4 -0.07407407 -7.07407407 5 -1.07407407 -0.07407407 6 -5.07407407 -1.07407407 7 -10.07407407 -5.07407407 8 -9.07407407 -10.07407407 9 -12.07407407 -9.07407407 10 -11.07407407 -12.07407407 11 -13.07407407 -11.07407407 12 2.05555556 -13.07407407 13 -2.94444444 2.05555556 14 -10.94444444 -2.94444444 15 -2.94444444 -10.94444444 16 -2.94444444 -2.94444444 17 -1.94444444 -2.94444444 18 -6.94444444 -1.94444444 19 -4.94444444 -6.94444444 20 2.05555556 -4.94444444 21 -5.94444444 2.05555556 22 2.05555556 -5.94444444 23 8.05555556 2.05555556 24 -8.07407407 8.05555556 25 -7.07407407 -8.07407407 26 -2.07407407 -7.07407407 27 -4.07407407 -2.07407407 28 -5.07407407 -4.07407407 29 1.92592593 -5.07407407 30 -4.07407407 1.92592593 31 2.92592593 -4.07407407 32 -3.07407407 2.92592593 33 -7.07407407 -3.07407407 34 -6.07407407 -7.07407407 35 -2.07407407 -6.07407407 36 -2.07407407 -2.07407407 37 0.92592593 -2.07407407 38 6.92592593 0.92592593 39 -0.07407407 6.92592593 40 9.05555556 -0.07407407 41 2.05555556 9.05555556 42 2.05555556 2.05555556 43 8.05555556 2.05555556 44 -2.94444444 8.05555556 45 7.05555556 -2.94444444 46 -9.07407407 7.05555556 47 -6.07407407 -9.07407407 48 -0.07407407 -6.07407407 49 -1.07407407 -0.07407407 50 -2.07407407 -1.07407407 51 -0.07407407 -2.07407407 52 1.92592593 -0.07407407 53 2.92592593 1.92592593 54 8.92592593 2.92592593 55 2.92592593 8.92592593 56 8.92592593 2.92592593 57 10.92592593 8.92592593 58 11.92592593 10.92592593 59 3.92592593 11.92592593 60 11.92592593 3.92592593 61 12.92592593 11.92592593 62 12.92592593 12.92592593 63 20.92592593 12.92592593 64 14.92592593 20.92592593 65 14.92592593 14.92592593 66 10.92592593 14.92592593 67 8.92592593 10.92592593 68 2.92592593 8.92592593 69 4.92592593 2.92592593 70 -11.07407407 4.92592593 71 -14.07407407 -11.07407407 72 NA -14.07407407 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -12.07407407 -3.07407407 [2,] -3.07407407 -12.07407407 [3,] -7.07407407 -3.07407407 [4,] -0.07407407 -7.07407407 [5,] -1.07407407 -0.07407407 [6,] -5.07407407 -1.07407407 [7,] -10.07407407 -5.07407407 [8,] -9.07407407 -10.07407407 [9,] -12.07407407 -9.07407407 [10,] -11.07407407 -12.07407407 [11,] -13.07407407 -11.07407407 [12,] 2.05555556 -13.07407407 [13,] -2.94444444 2.05555556 [14,] -10.94444444 -2.94444444 [15,] -2.94444444 -10.94444444 [16,] -2.94444444 -2.94444444 [17,] -1.94444444 -2.94444444 [18,] -6.94444444 -1.94444444 [19,] -4.94444444 -6.94444444 [20,] 2.05555556 -4.94444444 [21,] -5.94444444 2.05555556 [22,] 2.05555556 -5.94444444 [23,] 8.05555556 2.05555556 [24,] -8.07407407 8.05555556 [25,] -7.07407407 -8.07407407 [26,] -2.07407407 -7.07407407 [27,] -4.07407407 -2.07407407 [28,] -5.07407407 -4.07407407 [29,] 1.92592593 -5.07407407 [30,] -4.07407407 1.92592593 [31,] 2.92592593 -4.07407407 [32,] -3.07407407 2.92592593 [33,] -7.07407407 -3.07407407 [34,] -6.07407407 -7.07407407 [35,] -2.07407407 -6.07407407 [36,] -2.07407407 -2.07407407 [37,] 0.92592593 -2.07407407 [38,] 6.92592593 0.92592593 [39,] -0.07407407 6.92592593 [40,] 9.05555556 -0.07407407 [41,] 2.05555556 9.05555556 [42,] 2.05555556 2.05555556 [43,] 8.05555556 2.05555556 [44,] -2.94444444 8.05555556 [45,] 7.05555556 -2.94444444 [46,] -9.07407407 7.05555556 [47,] -6.07407407 -9.07407407 [48,] -0.07407407 -6.07407407 [49,] -1.07407407 -0.07407407 [50,] -2.07407407 -1.07407407 [51,] -0.07407407 -2.07407407 [52,] 1.92592593 -0.07407407 [53,] 2.92592593 1.92592593 [54,] 8.92592593 2.92592593 [55,] 2.92592593 8.92592593 [56,] 8.92592593 2.92592593 [57,] 10.92592593 8.92592593 [58,] 11.92592593 10.92592593 [59,] 3.92592593 11.92592593 [60,] 11.92592593 3.92592593 [61,] 12.92592593 11.92592593 [62,] 12.92592593 12.92592593 [63,] 20.92592593 12.92592593 [64,] 14.92592593 20.92592593 [65,] 14.92592593 14.92592593 [66,] 10.92592593 14.92592593 [67,] 8.92592593 10.92592593 [68,] 2.92592593 8.92592593 [69,] 4.92592593 2.92592593 [70,] -11.07407407 4.92592593 [71,] -14.07407407 -11.07407407 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -12.07407407 -3.07407407 2 -3.07407407 -12.07407407 3 -7.07407407 -3.07407407 4 -0.07407407 -7.07407407 5 -1.07407407 -0.07407407 6 -5.07407407 -1.07407407 7 -10.07407407 -5.07407407 8 -9.07407407 -10.07407407 9 -12.07407407 -9.07407407 10 -11.07407407 -12.07407407 11 -13.07407407 -11.07407407 12 2.05555556 -13.07407407 13 -2.94444444 2.05555556 14 -10.94444444 -2.94444444 15 -2.94444444 -10.94444444 16 -2.94444444 -2.94444444 17 -1.94444444 -2.94444444 18 -6.94444444 -1.94444444 19 -4.94444444 -6.94444444 20 2.05555556 -4.94444444 21 -5.94444444 2.05555556 22 2.05555556 -5.94444444 23 8.05555556 2.05555556 24 -8.07407407 8.05555556 25 -7.07407407 -8.07407407 26 -2.07407407 -7.07407407 27 -4.07407407 -2.07407407 28 -5.07407407 -4.07407407 29 1.92592593 -5.07407407 30 -4.07407407 1.92592593 31 2.92592593 -4.07407407 32 -3.07407407 2.92592593 33 -7.07407407 -3.07407407 34 -6.07407407 -7.07407407 35 -2.07407407 -6.07407407 36 -2.07407407 -2.07407407 37 0.92592593 -2.07407407 38 6.92592593 0.92592593 39 -0.07407407 6.92592593 40 9.05555556 -0.07407407 41 2.05555556 9.05555556 42 2.05555556 2.05555556 43 8.05555556 2.05555556 44 -2.94444444 8.05555556 45 7.05555556 -2.94444444 46 -9.07407407 7.05555556 47 -6.07407407 -9.07407407 48 -0.07407407 -6.07407407 49 -1.07407407 -0.07407407 50 -2.07407407 -1.07407407 51 -0.07407407 -2.07407407 52 1.92592593 -0.07407407 53 2.92592593 1.92592593 54 8.92592593 2.92592593 55 2.92592593 8.92592593 56 8.92592593 2.92592593 57 10.92592593 8.92592593 58 11.92592593 10.92592593 59 3.92592593 11.92592593 60 11.92592593 3.92592593 61 12.92592593 11.92592593 62 12.92592593 12.92592593 63 20.92592593 12.92592593 64 14.92592593 20.92592593 65 14.92592593 14.92592593 66 10.92592593 14.92592593 67 8.92592593 10.92592593 68 2.92592593 8.92592593 69 4.92592593 2.92592593 70 -11.07407407 4.92592593 71 -14.07407407 -11.07407407 > 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/7jkre1228940767.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/8b6hr1228940767.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/9wtbg1228940767.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/10r5921228940767.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/118nsz1228940767.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/121g7k1228940767.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/13wzwy1228940767.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/14i74n1228940767.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/15jo7n1228940768.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/16bgk61228940768.tab") + } > > system("convert tmp/1pus31228940767.ps tmp/1pus31228940767.png") > system("convert tmp/27tka1228940767.ps tmp/27tka1228940767.png") > system("convert tmp/3tq7s1228940767.ps tmp/3tq7s1228940767.png") > system("convert tmp/4137u1228940767.ps tmp/4137u1228940767.png") > system("convert tmp/5mp1r1228940767.ps tmp/5mp1r1228940767.png") > system("convert tmp/60g0a1228940767.ps tmp/60g0a1228940767.png") > system("convert tmp/7jkre1228940767.ps tmp/7jkre1228940767.png") > system("convert tmp/8b6hr1228940767.ps tmp/8b6hr1228940767.png") > system("convert tmp/9wtbg1228940767.ps tmp/9wtbg1228940767.png") > system("convert tmp/10r5921228940767.ps tmp/10r5921228940767.png") > > > proc.time() user system elapsed 2.707 1.691 3.723