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 = 'No 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 1 97.5700 0 1 0 0 0 0 0 0 0 0 0 0 2 97.7400 0 0 1 0 0 0 0 0 0 0 0 0 3 97.9200 0 0 0 1 0 0 0 0 0 0 0 0 4 98.1900 0 0 0 0 1 0 0 0 0 0 0 0 5 98.2300 0 0 0 0 0 1 0 0 0 0 0 0 6 98.4100 0 0 0 0 0 0 1 0 0 0 0 0 7 98.5900 0 0 0 0 0 0 0 1 0 0 0 0 8 98.7100 0 0 0 0 0 0 0 0 1 0 0 0 9 99.1400 0 0 0 0 0 0 0 0 0 1 0 0 10 99.6200 0 0 0 0 0 0 0 0 0 0 1 0 11 100.1800 1 0 0 0 0 0 0 0 0 0 0 1 12 100.6600 1 0 0 0 0 0 0 0 0 0 0 0 13 101.1900 1 1 0 0 0 0 0 0 0 0 0 0 14 101.7500 1 0 1 0 0 0 0 0 0 0 0 0 15 102.2000 1 0 0 1 0 0 0 0 0 0 0 0 16 102.8700 1 0 0 0 1 0 0 0 0 0 0 0 17 98.8100 0 0 0 0 0 1 0 0 0 0 0 0 18 97.6000 0 0 0 0 0 0 1 0 0 0 0 0 19 96.6800 0 0 0 0 0 0 0 1 0 0 0 0 20 95.9600 0 0 0 0 0 0 0 0 1 0 0 0 21 98.8900 0 0 0 0 0 0 0 0 0 1 0 0 22 99.0500 0 0 0 0 0 0 0 0 0 0 1 0 23 99.2000 0 0 0 0 0 0 0 0 0 0 0 1 24 99.1100 0 0 0 0 0 0 0 0 0 0 0 0 25 99.1900 0 1 0 0 0 0 0 0 0 0 0 0 26 99.7700 0 0 1 0 0 0 0 0 0 0 0 0 27 100.6957 0 0 0 1 0 0 0 0 0 0 0 0 28 100.7752 0 0 0 0 1 0 0 0 0 0 0 0 29 100.5267 0 0 0 0 0 1 0 0 0 0 0 0 30 101.0137 0 0 0 0 0 0 1 0 0 0 0 0 31 100.9243 0 0 0 0 0 0 0 1 0 0 0 0 32 101.1032 0 0 0 0 0 0 0 0 1 0 0 0 33 103.1107 0 0 0 0 0 0 0 0 0 1 0 0 34 102.9915 0 0 0 0 0 0 0 0 0 0 1 0 35 102.3057 0 0 0 0 0 0 0 0 0 0 0 1 36 102.6138 0 0 0 0 0 0 0 0 0 0 0 0 37 103.6772 0 1 0 0 0 0 0 0 0 0 0 0 38 104.7207 0 0 1 0 0 0 0 0 0 0 0 0 39 107.6625 0 0 0 1 0 0 0 0 0 0 0 0 40 108.8750 0 0 0 0 1 0 0 0 0 0 0 0 41 108.1197 0 0 0 0 0 1 0 0 0 0 0 0 42 107.6128 0 0 0 0 0 0 1 0 0 0 0 0 43 106.4202 0 0 0 0 0 0 0 1 0 0 0 0 44 105.6052 0 0 0 0 0 0 0 0 1 0 0 0 45 105.7146 0 0 0 0 0 0 0 0 0 1 0 0 46 105.4860 0 0 0 0 0 0 0 0 0 0 1 0 47 105.5655 0 0 0 0 0 0 0 0 0 0 0 1 48 105.1779 0 0 0 0 0 0 0 0 0 0 0 0 49 106.0922 0 1 0 0 0 0 0 0 0 0 0 0 50 106.3407 0 0 1 0 0 0 0 0 0 0 0 0 51 108.4675 1 0 0 1 0 0 0 0 0 0 0 0 52 116.8654 1 0 0 0 1 0 0 0 0 0 0 0 53 121.0793 1 0 0 0 0 1 0 0 0 0 0 0 54 123.2658 1 0 0 0 0 0 1 0 0 0 0 0 55 124.1801 1 0 0 0 0 0 0 1 0 0 0 0 56 125.6013 1 0 0 0 0 0 0 0 1 0 0 0 57 126.5653 1 0 0 0 0 0 0 0 0 1 0 0 58 127.1815 1 0 0 0 0 0 0 0 0 0 1 0 59 128.0362 1 0 0 0 0 0 0 0 0 0 0 1 60 128.5530 1 0 0 0 0 0 0 0 0 0 0 0 61 129.6661 1 1 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) dumivariable M1 M2 M3 101.35324 14.67422 -0.01373 -2.22380 -3.83380 M4 M5 M6 M7 M8 -1.70781 1.06505 1.29237 1.07082 1.10785 M9 M10 M11 2.39603 2.57770 -0.16546 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -15.6820 -3.8341 -0.6386 4.3777 13.6523 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 101.35324 3.43357 29.518 < 2e-16 *** dumivariable 14.67422 2.16869 6.766 1.68e-08 *** M1 -0.01373 4.50058 -0.003 0.998 M2 -2.22380 4.71826 -0.471 0.640 M3 -3.83380 4.69828 -0.816 0.419 M4 -1.70781 4.69828 -0.363 0.718 M5 1.06505 4.71826 0.226 0.822 M6 1.29237 4.71826 0.274 0.785 M7 1.07082 4.71826 0.227 0.821 M8 1.10785 4.71826 0.235 0.815 M9 2.39603 4.71826 0.508 0.614 M10 2.57770 4.71826 0.546 0.587 M11 -0.16546 4.69828 -0.035 0.972 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 7.429 on 48 degrees of freedom Multiple R-squared: 0.5005, Adjusted R-squared: 0.3757 F-statistic: 4.008 on 12 and 48 DF, p-value: 0.0002676 > 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,] 4.167718e-04 8.335436e-04 0.999583228 [2,] 5.557406e-05 1.111481e-04 0.999944426 [3,] 1.367923e-05 2.735846e-05 0.999986321 [4,] 3.952914e-05 7.905828e-05 0.999960471 [5,] 1.311599e-04 2.623198e-04 0.999868840 [6,] 2.928665e-05 5.857330e-05 0.999970713 [7,] 7.052487e-06 1.410497e-05 0.999992948 [8,] 1.476369e-05 2.952739e-05 0.999985236 [9,] 8.643601e-06 1.728720e-05 0.999991356 [10,] 5.242306e-06 1.048461e-05 0.999994758 [11,] 2.978748e-06 5.957497e-06 0.999997021 [12,] 2.081044e-06 4.162089e-06 0.999997919 [13,] 9.249156e-07 1.849831e-06 0.999999075 [14,] 6.862943e-07 1.372589e-06 0.999999314 [15,] 1.369866e-06 2.739731e-06 0.999998630 [16,] 2.915352e-06 5.830704e-06 0.999997085 [17,] 7.896333e-06 1.579267e-05 0.999992104 [18,] 1.770834e-05 3.541668e-05 0.999982292 [19,] 2.510893e-05 5.021785e-05 0.999974891 [20,] 4.350898e-05 8.701796e-05 0.999956491 [21,] 6.786670e-05 1.357334e-04 0.999932133 [22,] 2.098141e-04 4.196283e-04 0.999790186 [23,] 3.672627e-04 7.345255e-04 0.999632737 [24,] 8.258984e-02 1.651797e-01 0.917410159 [25,] 5.986954e-01 8.026092e-01 0.401304604 [26,] 9.040785e-01 1.918431e-01 0.095921539 [27,] 9.796963e-01 4.060740e-02 0.020303699 [28,] 9.950581e-01 9.883762e-03 0.004941881 [29,] 9.953704e-01 9.259169e-03 0.004629585 [30,] 9.937851e-01 1.242975e-02 0.006214873 > postscript(file="/var/www/html/rcomp/tmp/1rf451229947901.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/21vx81229947901.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/3pmij1229947901.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/4zmgl1229947901.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/5a9bq1229947901.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 -3.7695088 -1.3894391 0.4005533 -1.4554312 -4.1882954 -4.2356089 7 8 9 10 11 12 -3.8340649 -3.7510913 -4.6092710 -4.3109383 -15.6820090 -15.3674667 13 14 15 16 17 18 -14.8237324 -12.0536627 -9.9936703 -11.4496548 -3.6082954 -5.0456089 19 20 21 22 23 24 -5.7440649 -6.5010913 -4.8592710 -4.8809383 -1.9877854 -2.2432432 25 26 27 28 29 30 -2.1495088 0.6405609 3.1762400 1.1297626 -1.8915612 -1.6318939 31 32 33 34 35 36 -1.4997954 -1.3579309 -0.6385574 -0.9394853 1.1179192 1.2605513 37 38 39 40 41 42 2.3376926 5.5912924 10.1430458 9.2295440 5.7013627 4.9671917 43 44 45 46 47 48 3.9961299 3.1441562 1.9652987 1.5550486 4.3777085 3.8246538 49 50 51 52 53 54 4.7527194 7.2112486 -3.7261688 2.5457795 3.9867893 5.9459199 55 56 57 58 59 60 7.0817951 8.4659573 8.1418007 8.5763131 12.1741667 12.5255049 61 13.6523380 > postscript(file="/var/www/html/rcomp/tmp/6d5yo1229947901.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 -3.7695088 NA 1 -1.3894391 -3.7695088 2 0.4005533 -1.3894391 3 -1.4554312 0.4005533 4 -4.1882954 -1.4554312 5 -4.2356089 -4.1882954 6 -3.8340649 -4.2356089 7 -3.7510913 -3.8340649 8 -4.6092710 -3.7510913 9 -4.3109383 -4.6092710 10 -15.6820090 -4.3109383 11 -15.3674667 -15.6820090 12 -14.8237324 -15.3674667 13 -12.0536627 -14.8237324 14 -9.9936703 -12.0536627 15 -11.4496548 -9.9936703 16 -3.6082954 -11.4496548 17 -5.0456089 -3.6082954 18 -5.7440649 -5.0456089 19 -6.5010913 -5.7440649 20 -4.8592710 -6.5010913 21 -4.8809383 -4.8592710 22 -1.9877854 -4.8809383 23 -2.2432432 -1.9877854 24 -2.1495088 -2.2432432 25 0.6405609 -2.1495088 26 3.1762400 0.6405609 27 1.1297626 3.1762400 28 -1.8915612 1.1297626 29 -1.6318939 -1.8915612 30 -1.4997954 -1.6318939 31 -1.3579309 -1.4997954 32 -0.6385574 -1.3579309 33 -0.9394853 -0.6385574 34 1.1179192 -0.9394853 35 1.2605513 1.1179192 36 2.3376926 1.2605513 37 5.5912924 2.3376926 38 10.1430458 5.5912924 39 9.2295440 10.1430458 40 5.7013627 9.2295440 41 4.9671917 5.7013627 42 3.9961299 4.9671917 43 3.1441562 3.9961299 44 1.9652987 3.1441562 45 1.5550486 1.9652987 46 4.3777085 1.5550486 47 3.8246538 4.3777085 48 4.7527194 3.8246538 49 7.2112486 4.7527194 50 -3.7261688 7.2112486 51 2.5457795 -3.7261688 52 3.9867893 2.5457795 53 5.9459199 3.9867893 54 7.0817951 5.9459199 55 8.4659573 7.0817951 56 8.1418007 8.4659573 57 8.5763131 8.1418007 58 12.1741667 8.5763131 59 12.5255049 12.1741667 60 13.6523380 12.5255049 61 NA 13.6523380 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.3894391 -3.7695088 [2,] 0.4005533 -1.3894391 [3,] -1.4554312 0.4005533 [4,] -4.1882954 -1.4554312 [5,] -4.2356089 -4.1882954 [6,] -3.8340649 -4.2356089 [7,] -3.7510913 -3.8340649 [8,] -4.6092710 -3.7510913 [9,] -4.3109383 -4.6092710 [10,] -15.6820090 -4.3109383 [11,] -15.3674667 -15.6820090 [12,] -14.8237324 -15.3674667 [13,] -12.0536627 -14.8237324 [14,] -9.9936703 -12.0536627 [15,] -11.4496548 -9.9936703 [16,] -3.6082954 -11.4496548 [17,] -5.0456089 -3.6082954 [18,] -5.7440649 -5.0456089 [19,] -6.5010913 -5.7440649 [20,] -4.8592710 -6.5010913 [21,] -4.8809383 -4.8592710 [22,] -1.9877854 -4.8809383 [23,] -2.2432432 -1.9877854 [24,] -2.1495088 -2.2432432 [25,] 0.6405609 -2.1495088 [26,] 3.1762400 0.6405609 [27,] 1.1297626 3.1762400 [28,] -1.8915612 1.1297626 [29,] -1.6318939 -1.8915612 [30,] -1.4997954 -1.6318939 [31,] -1.3579309 -1.4997954 [32,] -0.6385574 -1.3579309 [33,] -0.9394853 -0.6385574 [34,] 1.1179192 -0.9394853 [35,] 1.2605513 1.1179192 [36,] 2.3376926 1.2605513 [37,] 5.5912924 2.3376926 [38,] 10.1430458 5.5912924 [39,] 9.2295440 10.1430458 [40,] 5.7013627 9.2295440 [41,] 4.9671917 5.7013627 [42,] 3.9961299 4.9671917 [43,] 3.1441562 3.9961299 [44,] 1.9652987 3.1441562 [45,] 1.5550486 1.9652987 [46,] 4.3777085 1.5550486 [47,] 3.8246538 4.3777085 [48,] 4.7527194 3.8246538 [49,] 7.2112486 4.7527194 [50,] -3.7261688 7.2112486 [51,] 2.5457795 -3.7261688 [52,] 3.9867893 2.5457795 [53,] 5.9459199 3.9867893 [54,] 7.0817951 5.9459199 [55,] 8.4659573 7.0817951 [56,] 8.1418007 8.4659573 [57,] 8.5763131 8.1418007 [58,] 12.1741667 8.5763131 [59,] 12.5255049 12.1741667 [60,] 13.6523380 12.5255049 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.3894391 -3.7695088 2 0.4005533 -1.3894391 3 -1.4554312 0.4005533 4 -4.1882954 -1.4554312 5 -4.2356089 -4.1882954 6 -3.8340649 -4.2356089 7 -3.7510913 -3.8340649 8 -4.6092710 -3.7510913 9 -4.3109383 -4.6092710 10 -15.6820090 -4.3109383 11 -15.3674667 -15.6820090 12 -14.8237324 -15.3674667 13 -12.0536627 -14.8237324 14 -9.9936703 -12.0536627 15 -11.4496548 -9.9936703 16 -3.6082954 -11.4496548 17 -5.0456089 -3.6082954 18 -5.7440649 -5.0456089 19 -6.5010913 -5.7440649 20 -4.8592710 -6.5010913 21 -4.8809383 -4.8592710 22 -1.9877854 -4.8809383 23 -2.2432432 -1.9877854 24 -2.1495088 -2.2432432 25 0.6405609 -2.1495088 26 3.1762400 0.6405609 27 1.1297626 3.1762400 28 -1.8915612 1.1297626 29 -1.6318939 -1.8915612 30 -1.4997954 -1.6318939 31 -1.3579309 -1.4997954 32 -0.6385574 -1.3579309 33 -0.9394853 -0.6385574 34 1.1179192 -0.9394853 35 1.2605513 1.1179192 36 2.3376926 1.2605513 37 5.5912924 2.3376926 38 10.1430458 5.5912924 39 9.2295440 10.1430458 40 5.7013627 9.2295440 41 4.9671917 5.7013627 42 3.9961299 4.9671917 43 3.1441562 3.9961299 44 1.9652987 3.1441562 45 1.5550486 1.9652987 46 4.3777085 1.5550486 47 3.8246538 4.3777085 48 4.7527194 3.8246538 49 7.2112486 4.7527194 50 -3.7261688 7.2112486 51 2.5457795 -3.7261688 52 3.9867893 2.5457795 53 5.9459199 3.9867893 54 7.0817951 5.9459199 55 8.4659573 7.0817951 56 8.1418007 8.4659573 57 8.5763131 8.1418007 58 12.1741667 8.5763131 59 12.5255049 12.1741667 60 13.6523380 12.5255049 > 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/77z7f1229947901.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/80hsd1229947901.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/9igvy1229947901.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/10ek381229947901.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/11ionv1229947901.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/121kdm1229947901.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/13h6591229947901.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/14en9e1229947901.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/15nqys1229947902.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/162y9a1229947902.tab") + } > > system("convert tmp/1rf451229947901.ps tmp/1rf451229947901.png") > system("convert tmp/21vx81229947901.ps tmp/21vx81229947901.png") > system("convert tmp/3pmij1229947901.ps tmp/3pmij1229947901.png") > system("convert tmp/4zmgl1229947901.ps tmp/4zmgl1229947901.png") > system("convert tmp/5a9bq1229947901.ps tmp/5a9bq1229947901.png") > system("convert tmp/6d5yo1229947901.ps tmp/6d5yo1229947901.png") > system("convert tmp/77z7f1229947901.ps tmp/77z7f1229947901.png") > system("convert tmp/80hsd1229947901.ps tmp/80hsd1229947901.png") > system("convert tmp/9igvy1229947901.ps tmp/9igvy1229947901.png") > system("convert tmp/10ek381229947901.ps tmp/10ek381229947901.png") > > > proc.time() user system elapsed 2.489 1.585 3.240