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(97.57,0,97.74,0,97.92,0,98.19,0,98.23,0,98.41,0,98.59,0,98.71,0,99.14,0,99.62,0,100.18,1,100.66,1,101.19,1,101.75,1,102.2,1,102.87,1,98.81,0,97.6,0,96.68,0,95.96,0,98.89,0,99.05,0,99.2,0,99.11,0,99.19,0,99.77,0,100.6956867,0,100.7751938,0,100.5267342,0,101.013715,0,100.9242695,0,101.1031604,0,103.1107136,0,102.991453,0,102.3057046,0,102.6137945,0,103.6772014,0,104.7207315,0,107.6624925,0,108.8749752,0,108.1196581,0,107.6128006,0,106.4201948,0,105.6052475,0,105.7145697,0,105.4859869,0,105.5654939,0,105.177897,0,106.0922282,0,106.3406877,0,108.4675015,1,116.8654343,1,121.0793083,1,123.2657523,1,124.1800835,1,125.6012721,1,126.5652952,1,127.1814749,1,128.0361757,1,128.5529716,1,129.6660704,1),dim=c(2,61),dimnames=list(c('elektrictietsindex','dumivariable'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('elektrictietsindex','dumivariable'),1:61)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x elektrictietsindex dumivariable M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 97.5700 0 1 0 0 0 0 0 0 0 0 0 0 1 2 97.7400 0 0 1 0 0 0 0 0 0 0 0 0 2 3 97.9200 0 0 0 1 0 0 0 0 0 0 0 0 3 4 98.1900 0 0 0 0 1 0 0 0 0 0 0 0 4 5 98.2300 0 0 0 0 0 1 0 0 0 0 0 0 5 6 98.4100 0 0 0 0 0 0 1 0 0 0 0 0 6 7 98.5900 0 0 0 0 0 0 0 1 0 0 0 0 7 8 98.7100 0 0 0 0 0 0 0 0 1 0 0 0 8 9 99.1400 0 0 0 0 0 0 0 0 0 1 0 0 9 10 99.6200 0 0 0 0 0 0 0 0 0 0 1 0 10 11 100.1800 1 0 0 0 0 0 0 0 0 0 0 1 11 12 100.6600 1 0 0 0 0 0 0 0 0 0 0 0 12 13 101.1900 1 1 0 0 0 0 0 0 0 0 0 0 13 14 101.7500 1 0 1 0 0 0 0 0 0 0 0 0 14 15 102.2000 1 0 0 1 0 0 0 0 0 0 0 0 15 16 102.8700 1 0 0 0 1 0 0 0 0 0 0 0 16 17 98.8100 0 0 0 0 0 1 0 0 0 0 0 0 17 18 97.6000 0 0 0 0 0 0 1 0 0 0 0 0 18 19 96.6800 0 0 0 0 0 0 0 1 0 0 0 0 19 20 95.9600 0 0 0 0 0 0 0 0 1 0 0 0 20 21 98.8900 0 0 0 0 0 0 0 0 0 1 0 0 21 22 99.0500 0 0 0 0 0 0 0 0 0 0 1 0 22 23 99.2000 0 0 0 0 0 0 0 0 0 0 0 1 23 24 99.1100 0 0 0 0 0 0 0 0 0 0 0 0 24 25 99.1900 0 1 0 0 0 0 0 0 0 0 0 0 25 26 99.7700 0 0 1 0 0 0 0 0 0 0 0 0 26 27 100.6957 0 0 0 1 0 0 0 0 0 0 0 0 27 28 100.7752 0 0 0 0 1 0 0 0 0 0 0 0 28 29 100.5267 0 0 0 0 0 1 0 0 0 0 0 0 29 30 101.0137 0 0 0 0 0 0 1 0 0 0 0 0 30 31 100.9243 0 0 0 0 0 0 0 1 0 0 0 0 31 32 101.1032 0 0 0 0 0 0 0 0 1 0 0 0 32 33 103.1107 0 0 0 0 0 0 0 0 0 1 0 0 33 34 102.9915 0 0 0 0 0 0 0 0 0 0 1 0 34 35 102.3057 0 0 0 0 0 0 0 0 0 0 0 1 35 36 102.6138 0 0 0 0 0 0 0 0 0 0 0 0 36 37 103.6772 0 1 0 0 0 0 0 0 0 0 0 0 37 38 104.7207 0 0 1 0 0 0 0 0 0 0 0 0 38 39 107.6625 0 0 0 1 0 0 0 0 0 0 0 0 39 40 108.8750 0 0 0 0 1 0 0 0 0 0 0 0 40 41 108.1197 0 0 0 0 0 1 0 0 0 0 0 0 41 42 107.6128 0 0 0 0 0 0 1 0 0 0 0 0 42 43 106.4202 0 0 0 0 0 0 0 1 0 0 0 0 43 44 105.6052 0 0 0 0 0 0 0 0 1 0 0 0 44 45 105.7146 0 0 0 0 0 0 0 0 0 1 0 0 45 46 105.4860 0 0 0 0 0 0 0 0 0 0 1 0 46 47 105.5655 0 0 0 0 0 0 0 0 0 0 0 1 47 48 105.1779 0 0 0 0 0 0 0 0 0 0 0 0 48 49 106.0922 0 1 0 0 0 0 0 0 0 0 0 0 49 50 106.3407 0 0 1 0 0 0 0 0 0 0 0 0 50 51 108.4675 1 0 0 1 0 0 0 0 0 0 0 0 51 52 116.8654 1 0 0 0 1 0 0 0 0 0 0 0 52 53 121.0793 1 0 0 0 0 1 0 0 0 0 0 0 53 54 123.2658 1 0 0 0 0 0 1 0 0 0 0 0 54 55 124.1801 1 0 0 0 0 0 0 1 0 0 0 0 55 56 125.6013 1 0 0 0 0 0 0 0 1 0 0 0 56 57 126.5653 1 0 0 0 0 0 0 0 0 1 0 0 57 58 127.1815 1 0 0 0 0 0 0 0 0 0 1 0 58 59 128.0362 1 0 0 0 0 0 0 0 0 0 0 1 59 60 128.5530 1 0 0 0 0 0 0 0 0 0 0 0 60 61 129.6661 1 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) dumivariable M1 M2 M3 90.8628 9.7125 1.3881 0.2492 -0.7150 M4 M5 M6 M7 M8 1.0644 2.4984 2.3792 1.8111 1.5016 M9 M10 M11 t 2.4433 2.2784 0.1811 0.3465 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -9.066 -2.492 -0.855 3.086 7.186 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 90.86278 2.05608 44.192 < 2e-16 *** dumivariable 9.71252 1.23673 7.853 4.22e-10 *** M1 1.38814 2.39585 0.579 0.565 M2 0.24917 2.51812 0.099 0.922 M3 -0.71501 2.51340 -0.284 0.777 M4 1.06444 2.51009 0.424 0.673 M5 2.49843 2.51155 0.995 0.325 M6 2.37922 2.51014 0.948 0.348 M7 1.81114 2.50911 0.722 0.474 M8 1.50163 2.50847 0.599 0.552 M9 2.44328 2.50822 0.974 0.335 M10 2.27842 2.50837 0.908 0.368 M11 0.18107 2.49780 0.072 0.943 t 0.34653 0.03126 11.084 1.04e-14 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.949 on 47 degrees of freedom Multiple R-squared: 0.8618, Adjusted R-squared: 0.8236 F-statistic: 22.54 on 13 and 47 DF, p-value: 7.083e-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,] 1.405851e-03 2.811701e-03 0.9985941 [2,] 7.493240e-04 1.498648e-03 0.9992507 [3,] 7.118813e-04 1.423763e-03 0.9992881 [4,] 6.703703e-04 1.340741e-03 0.9993296 [5,] 1.874484e-04 3.748968e-04 0.9998126 [6,] 3.909221e-05 7.818443e-05 0.9999609 [7,] 4.786382e-04 9.572764e-04 0.9995214 [8,] 2.345075e-04 4.690149e-04 0.9997655 [9,] 8.208918e-05 1.641784e-04 0.9999179 [10,] 2.734890e-05 5.469779e-05 0.9999727 [11,] 1.794195e-05 3.588389e-05 0.9999821 [12,] 5.550887e-06 1.110177e-05 0.9999944 [13,] 1.839277e-06 3.678554e-06 0.9999982 [14,] 1.175641e-06 2.351283e-06 0.9999988 [15,] 7.679087e-07 1.535817e-06 0.9999992 [16,] 6.218043e-07 1.243609e-06 0.9999994 [17,] 5.080263e-07 1.016053e-06 0.9999995 [18,] 2.337743e-07 4.675487e-07 0.9999998 [19,] 1.260826e-07 2.521651e-07 0.9999999 [20,] 6.201482e-08 1.240296e-07 0.9999999 [21,] 4.284753e-08 8.569505e-08 1.0000000 [22,] 3.065243e-08 6.130486e-08 1.0000000 [23,] 1.721082e-04 3.442164e-04 0.9998279 [24,] 3.548703e-02 7.097405e-02 0.9645130 [25,] 2.767298e-01 5.534596e-01 0.7232702 [26,] 6.312533e-01 7.374934e-01 0.3687467 [27,] 8.498990e-01 3.002019e-01 0.1501010 [28,] 8.689929e-01 2.620142e-01 0.1310071 > postscript(file="/var/www/html/rcomp/tmp/1tk081229947591.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/2ll9u1229947591.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/34gjx1229947591.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/4selz1229947591.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/5ye1s1229947591.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 61 Frequency = 1 1 2 3 4 5 6 4.97254667 5.93498574 6.73263671 4.87665219 3.13612946 3.08881600 7 8 9 10 11 12 3.49036002 3.57333358 2.71515388 3.01348662 -4.38821836 -4.07367614 13 14 15 16 17 18 -5.27835285 -3.92591379 -2.85826281 -4.31424733 -0.44225370 -1.87956716 19 20 21 22 23 24 -2.57802314 -3.33504958 -1.69322928 -1.71489654 0.18591486 -0.06954292 25 26 27 28 29 30 -1.72421963 -0.35178057 1.19155711 -0.85492031 -2.88390265 -2.62423531 31 32 33 34 35 36 -2.49213679 -2.35027233 -1.63089883 -1.93182669 -0.86676369 -0.72413157 37 38 39 40 41 42 -1.39540139 0.44056778 3.99997976 3.08647794 0.55063810 -0.18353286 43 44 45 46 47 48 -1.15459464 -2.00656838 -3.18542588 -3.59567594 -1.76535754 -2.31841222 49 50 51 52 53 54 -3.13875774 -2.09785917 -9.06591076 -2.79396248 -0.36061122 1.59851932 55 56 57 58 59 60 2.73439454 4.11855670 3.79440010 4.22891254 6.83442474 7.18576286 61 6.56418494 > postscript(file="/var/www/html/rcomp/tmp/662hz1229947591.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 4.97254667 NA 1 5.93498574 4.97254667 2 6.73263671 5.93498574 3 4.87665219 6.73263671 4 3.13612946 4.87665219 5 3.08881600 3.13612946 6 3.49036002 3.08881600 7 3.57333358 3.49036002 8 2.71515388 3.57333358 9 3.01348662 2.71515388 10 -4.38821836 3.01348662 11 -4.07367614 -4.38821836 12 -5.27835285 -4.07367614 13 -3.92591379 -5.27835285 14 -2.85826281 -3.92591379 15 -4.31424733 -2.85826281 16 -0.44225370 -4.31424733 17 -1.87956716 -0.44225370 18 -2.57802314 -1.87956716 19 -3.33504958 -2.57802314 20 -1.69322928 -3.33504958 21 -1.71489654 -1.69322928 22 0.18591486 -1.71489654 23 -0.06954292 0.18591486 24 -1.72421963 -0.06954292 25 -0.35178057 -1.72421963 26 1.19155711 -0.35178057 27 -0.85492031 1.19155711 28 -2.88390265 -0.85492031 29 -2.62423531 -2.88390265 30 -2.49213679 -2.62423531 31 -2.35027233 -2.49213679 32 -1.63089883 -2.35027233 33 -1.93182669 -1.63089883 34 -0.86676369 -1.93182669 35 -0.72413157 -0.86676369 36 -1.39540139 -0.72413157 37 0.44056778 -1.39540139 38 3.99997976 0.44056778 39 3.08647794 3.99997976 40 0.55063810 3.08647794 41 -0.18353286 0.55063810 42 -1.15459464 -0.18353286 43 -2.00656838 -1.15459464 44 -3.18542588 -2.00656838 45 -3.59567594 -3.18542588 46 -1.76535754 -3.59567594 47 -2.31841222 -1.76535754 48 -3.13875774 -2.31841222 49 -2.09785917 -3.13875774 50 -9.06591076 -2.09785917 51 -2.79396248 -9.06591076 52 -0.36061122 -2.79396248 53 1.59851932 -0.36061122 54 2.73439454 1.59851932 55 4.11855670 2.73439454 56 3.79440010 4.11855670 57 4.22891254 3.79440010 58 6.83442474 4.22891254 59 7.18576286 6.83442474 60 6.56418494 7.18576286 61 NA 6.56418494 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 5.93498574 4.97254667 [2,] 6.73263671 5.93498574 [3,] 4.87665219 6.73263671 [4,] 3.13612946 4.87665219 [5,] 3.08881600 3.13612946 [6,] 3.49036002 3.08881600 [7,] 3.57333358 3.49036002 [8,] 2.71515388 3.57333358 [9,] 3.01348662 2.71515388 [10,] -4.38821836 3.01348662 [11,] -4.07367614 -4.38821836 [12,] -5.27835285 -4.07367614 [13,] -3.92591379 -5.27835285 [14,] -2.85826281 -3.92591379 [15,] -4.31424733 -2.85826281 [16,] -0.44225370 -4.31424733 [17,] -1.87956716 -0.44225370 [18,] -2.57802314 -1.87956716 [19,] -3.33504958 -2.57802314 [20,] -1.69322928 -3.33504958 [21,] -1.71489654 -1.69322928 [22,] 0.18591486 -1.71489654 [23,] -0.06954292 0.18591486 [24,] -1.72421963 -0.06954292 [25,] -0.35178057 -1.72421963 [26,] 1.19155711 -0.35178057 [27,] -0.85492031 1.19155711 [28,] -2.88390265 -0.85492031 [29,] -2.62423531 -2.88390265 [30,] -2.49213679 -2.62423531 [31,] -2.35027233 -2.49213679 [32,] -1.63089883 -2.35027233 [33,] -1.93182669 -1.63089883 [34,] -0.86676369 -1.93182669 [35,] -0.72413157 -0.86676369 [36,] -1.39540139 -0.72413157 [37,] 0.44056778 -1.39540139 [38,] 3.99997976 0.44056778 [39,] 3.08647794 3.99997976 [40,] 0.55063810 3.08647794 [41,] -0.18353286 0.55063810 [42,] -1.15459464 -0.18353286 [43,] -2.00656838 -1.15459464 [44,] -3.18542588 -2.00656838 [45,] -3.59567594 -3.18542588 [46,] -1.76535754 -3.59567594 [47,] -2.31841222 -1.76535754 [48,] -3.13875774 -2.31841222 [49,] -2.09785917 -3.13875774 [50,] -9.06591076 -2.09785917 [51,] -2.79396248 -9.06591076 [52,] -0.36061122 -2.79396248 [53,] 1.59851932 -0.36061122 [54,] 2.73439454 1.59851932 [55,] 4.11855670 2.73439454 [56,] 3.79440010 4.11855670 [57,] 4.22891254 3.79440010 [58,] 6.83442474 4.22891254 [59,] 7.18576286 6.83442474 [60,] 6.56418494 7.18576286 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 5.93498574 4.97254667 2 6.73263671 5.93498574 3 4.87665219 6.73263671 4 3.13612946 4.87665219 5 3.08881600 3.13612946 6 3.49036002 3.08881600 7 3.57333358 3.49036002 8 2.71515388 3.57333358 9 3.01348662 2.71515388 10 -4.38821836 3.01348662 11 -4.07367614 -4.38821836 12 -5.27835285 -4.07367614 13 -3.92591379 -5.27835285 14 -2.85826281 -3.92591379 15 -4.31424733 -2.85826281 16 -0.44225370 -4.31424733 17 -1.87956716 -0.44225370 18 -2.57802314 -1.87956716 19 -3.33504958 -2.57802314 20 -1.69322928 -3.33504958 21 -1.71489654 -1.69322928 22 0.18591486 -1.71489654 23 -0.06954292 0.18591486 24 -1.72421963 -0.06954292 25 -0.35178057 -1.72421963 26 1.19155711 -0.35178057 27 -0.85492031 1.19155711 28 -2.88390265 -0.85492031 29 -2.62423531 -2.88390265 30 -2.49213679 -2.62423531 31 -2.35027233 -2.49213679 32 -1.63089883 -2.35027233 33 -1.93182669 -1.63089883 34 -0.86676369 -1.93182669 35 -0.72413157 -0.86676369 36 -1.39540139 -0.72413157 37 0.44056778 -1.39540139 38 3.99997976 0.44056778 39 3.08647794 3.99997976 40 0.55063810 3.08647794 41 -0.18353286 0.55063810 42 -1.15459464 -0.18353286 43 -2.00656838 -1.15459464 44 -3.18542588 -2.00656838 45 -3.59567594 -3.18542588 46 -1.76535754 -3.59567594 47 -2.31841222 -1.76535754 48 -3.13875774 -2.31841222 49 -2.09785917 -3.13875774 50 -9.06591076 -2.09785917 51 -2.79396248 -9.06591076 52 -0.36061122 -2.79396248 53 1.59851932 -0.36061122 54 2.73439454 1.59851932 55 4.11855670 2.73439454 56 3.79440010 4.11855670 57 4.22891254 3.79440010 58 6.83442474 4.22891254 59 7.18576286 6.83442474 60 6.56418494 7.18576286 > 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/7n8091229947591.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/8blo11229947591.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/9tzfq1229947591.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/10sum11229947591.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/112we91229947591.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/12fari1229947591.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/13s4sx1229947591.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/14ivka1229947591.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/15xkkr1229947591.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/167yvk1229947591.tab") + } > > system("convert tmp/1tk081229947591.ps tmp/1tk081229947591.png") > system("convert tmp/2ll9u1229947591.ps tmp/2ll9u1229947591.png") > system("convert tmp/34gjx1229947591.ps tmp/34gjx1229947591.png") > system("convert tmp/4selz1229947591.ps tmp/4selz1229947591.png") > system("convert tmp/5ye1s1229947591.ps tmp/5ye1s1229947591.png") > system("convert tmp/662hz1229947591.ps tmp/662hz1229947591.png") > system("convert tmp/7n8091229947591.ps tmp/7n8091229947591.png") > system("convert tmp/8blo11229947591.ps tmp/8blo11229947591.png") > system("convert tmp/9tzfq1229947591.ps tmp/9tzfq1229947591.png") > system("convert tmp/10sum11229947591.ps tmp/10sum11229947591.png") > > > proc.time() user system elapsed 2.442 1.579 2.993