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(99.29,0,98.69,0,107.92,0,101.03,0,97.55,0,103.02,0,94.08,0,94.12,0,115.08,0,116.48,0,103.42,0,112.51,0,95.55,0,97.53,0,119.26,0,100.94,0,97.73,0,115.25,0,92.8,0,99.2,0,118.69,0,110.12,0,110.26,0,112.9,0,102.17,1,99.38,1,116.1,1,103.77,1,101.81,1,113.74,1,89.67,1,99.5,1,122.89,1,108.61,1,114.37,1,110.5,1,104.08,1,103.64,1,121.61,1,101.14,1,115.97,1,120.12,1,95.97,1,105.01,1,124.68,1,123.89,1,123.61,1,114.76,1,108.75,1,106.09,1,123.17,1,106.16,1,115.18,1,120.6,1,109.48,1,114.44,1,121.44,1,129.48,1,124.32,1,112.59,1),dim=c(2,60),dimnames=list(c('omzet','dummievariabele'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('omzet','dummievariabele'),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' + } > x omzet dummievariabele M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 99.29 0 1 0 0 0 0 0 0 0 0 0 0 1 2 98.69 0 0 1 0 0 0 0 0 0 0 0 0 2 3 107.92 0 0 0 1 0 0 0 0 0 0 0 0 3 4 101.03 0 0 0 0 1 0 0 0 0 0 0 0 4 5 97.55 0 0 0 0 0 1 0 0 0 0 0 0 5 6 103.02 0 0 0 0 0 0 1 0 0 0 0 0 6 7 94.08 0 0 0 0 0 0 0 1 0 0 0 0 7 8 94.12 0 0 0 0 0 0 0 0 1 0 0 0 8 9 115.08 0 0 0 0 0 0 0 0 0 1 0 0 9 10 116.48 0 0 0 0 0 0 0 0 0 0 1 0 10 11 103.42 0 0 0 0 0 0 0 0 0 0 0 1 11 12 112.51 0 0 0 0 0 0 0 0 0 0 0 0 12 13 95.55 0 1 0 0 0 0 0 0 0 0 0 0 13 14 97.53 0 0 1 0 0 0 0 0 0 0 0 0 14 15 119.26 0 0 0 1 0 0 0 0 0 0 0 0 15 16 100.94 0 0 0 0 1 0 0 0 0 0 0 0 16 17 97.73 0 0 0 0 0 1 0 0 0 0 0 0 17 18 115.25 0 0 0 0 0 0 1 0 0 0 0 0 18 19 92.80 0 0 0 0 0 0 0 1 0 0 0 0 19 20 99.20 0 0 0 0 0 0 0 0 1 0 0 0 20 21 118.69 0 0 0 0 0 0 0 0 0 1 0 0 21 22 110.12 0 0 0 0 0 0 0 0 0 0 1 0 22 23 110.26 0 0 0 0 0 0 0 0 0 0 0 1 23 24 112.90 0 0 0 0 0 0 0 0 0 0 0 0 24 25 102.17 1 1 0 0 0 0 0 0 0 0 0 0 25 26 99.38 1 0 1 0 0 0 0 0 0 0 0 0 26 27 116.10 1 0 0 1 0 0 0 0 0 0 0 0 27 28 103.77 1 0 0 0 1 0 0 0 0 0 0 0 28 29 101.81 1 0 0 0 0 1 0 0 0 0 0 0 29 30 113.74 1 0 0 0 0 0 1 0 0 0 0 0 30 31 89.67 1 0 0 0 0 0 0 1 0 0 0 0 31 32 99.50 1 0 0 0 0 0 0 0 1 0 0 0 32 33 122.89 1 0 0 0 0 0 0 0 0 1 0 0 33 34 108.61 1 0 0 0 0 0 0 0 0 0 1 0 34 35 114.37 1 0 0 0 0 0 0 0 0 0 0 1 35 36 110.50 1 0 0 0 0 0 0 0 0 0 0 0 36 37 104.08 1 1 0 0 0 0 0 0 0 0 0 0 37 38 103.64 1 0 1 0 0 0 0 0 0 0 0 0 38 39 121.61 1 0 0 1 0 0 0 0 0 0 0 0 39 40 101.14 1 0 0 0 1 0 0 0 0 0 0 0 40 41 115.97 1 0 0 0 0 1 0 0 0 0 0 0 41 42 120.12 1 0 0 0 0 0 1 0 0 0 0 0 42 43 95.97 1 0 0 0 0 0 0 1 0 0 0 0 43 44 105.01 1 0 0 0 0 0 0 0 1 0 0 0 44 45 124.68 1 0 0 0 0 0 0 0 0 1 0 0 45 46 123.89 1 0 0 0 0 0 0 0 0 0 1 0 46 47 123.61 1 0 0 0 0 0 0 0 0 0 0 1 47 48 114.76 1 0 0 0 0 0 0 0 0 0 0 0 48 49 108.75 1 1 0 0 0 0 0 0 0 0 0 0 49 50 106.09 1 0 1 0 0 0 0 0 0 0 0 0 50 51 123.17 1 0 0 1 0 0 0 0 0 0 0 0 51 52 106.16 1 0 0 0 1 0 0 0 0 0 0 0 52 53 115.18 1 0 0 0 0 1 0 0 0 0 0 0 53 54 120.60 1 0 0 0 0 0 1 0 0 0 0 0 54 55 109.48 1 0 0 0 0 0 0 1 0 0 0 0 55 56 114.44 1 0 0 0 0 0 0 0 1 0 0 0 56 57 121.44 1 0 0 0 0 0 0 0 0 1 0 0 57 58 129.48 1 0 0 0 0 0 0 0 0 0 1 0 58 59 124.32 1 0 0 0 0 0 0 0 0 0 0 1 59 60 112.59 1 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) dummievariabele M1 M2 102.2072 -3.0436 -6.9345 -8.1774 M3 M4 M5 M6 8.0278 -7.3171 -4.6180 3.9392 M7 M8 M9 M10 -14.5477 -8.8346 8.9266 5.7457 M11 t 2.8849 0.3409 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7.8886 -2.1398 -0.2967 2.7679 7.4491 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 102.20717 2.27338 44.958 < 2e-16 *** dummievariabele -3.04361 2.18756 -1.391 0.17082 M1 -6.93453 2.71542 -2.554 0.01404 * M2 -8.17739 2.69996 -3.029 0.00402 ** M3 8.02775 2.68589 2.989 0.00448 ** M4 -7.31711 2.67324 -2.737 0.00878 ** M5 -4.61797 2.66203 -1.735 0.08948 . M6 3.93917 2.65227 1.485 0.14431 M7 -14.54769 2.64399 -5.502 1.60e-06 *** M8 -8.83456 2.63719 -3.350 0.00162 ** M9 8.92658 2.63189 3.392 0.00144 ** M10 5.74572 2.62810 2.186 0.03392 * M11 2.88486 2.62583 1.099 0.27764 t 0.34086 0.06315 5.398 2.29e-06 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.151 on 46 degrees of freedom Multiple R-squared: 0.8609, Adjusted R-squared: 0.8216 F-statistic: 21.91 on 13 and 46 DF, p-value: 1.97e-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.7576276 0.4847448 0.2423724 [2,] 0.8584606 0.2830788 0.1415394 [3,] 0.7938528 0.4122944 0.2061472 [4,] 0.6988033 0.6023934 0.3011967 [5,] 0.5864338 0.8271323 0.4135662 [6,] 0.6622166 0.6755668 0.3377834 [7,] 0.6690037 0.6619926 0.3309963 [8,] 0.5698444 0.8603111 0.4301556 [9,] 0.4700145 0.9400290 0.5299855 [10,] 0.3837635 0.7675270 0.6162365 [11,] 0.2883502 0.5767004 0.7116498 [12,] 0.2705645 0.5411291 0.7294355 [13,] 0.2414401 0.4828801 0.7585599 [14,] 0.1723148 0.3446296 0.8276852 [15,] 0.2252771 0.4505543 0.7747229 [16,] 0.1733035 0.3466071 0.8266965 [17,] 0.1799730 0.3599460 0.8200270 [18,] 0.5241093 0.9517815 0.4758907 [19,] 0.5501476 0.8997048 0.4498524 [20,] 0.4827009 0.9654017 0.5172991 [21,] 0.3826028 0.7652057 0.6173972 [22,] 0.2810463 0.5620927 0.7189537 [23,] 0.2054017 0.4108034 0.7945983 [24,] 0.1571461 0.3142922 0.8428539 [25,] 0.2346010 0.4692021 0.7653990 [26,] 0.1655182 0.3310364 0.8344818 [27,] 0.3139635 0.6279270 0.6860365 > postscript(file="/var/www/html/rcomp/tmp/13xll1227269247.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/2re201227269248.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/3o32u1227269248.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/4xehw1227269248.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/5gn511227269248.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 6 7 3.6765000 3.9785000 -3.3375000 4.7765000 -1.7435000 -5.1715000 4.0345000 8 9 10 11 12 13 14 -1.9795000 0.8785000 5.1185000 -5.4215000 6.2125000 -4.1538333 -1.2718333 15 16 17 18 19 20 21 3.9121667 0.5961667 -5.6538333 2.9681667 -1.3358333 -0.9898333 0.3981667 22 23 24 25 26 27 28 -5.3318333 -2.6718333 2.5121667 1.4194444 -0.4685556 -0.2945556 2.3794444 29 30 31 32 33 34 35 -2.6205556 0.4114444 -5.5125556 -1.7365556 3.5514444 -7.8885556 0.3914444 36 37 38 39 40 41 42 -0.9345556 -0.7608889 -0.2988889 1.1251111 -4.3408889 7.4491111 2.7011111 43 44 45 46 47 48 49 -3.3028889 -0.3168889 1.2511111 3.3011111 5.5411111 -0.7648889 -0.1812222 50 51 52 53 54 55 56 -1.9392222 -1.4052222 -3.4112222 2.5687778 -0.9092222 6.1167778 5.0227778 57 58 59 60 -6.0792222 4.8007778 2.1607778 -7.0252222 > postscript(file="/var/www/html/rcomp/tmp/687px1227269248.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.6765000 NA 1 3.9785000 3.6765000 2 -3.3375000 3.9785000 3 4.7765000 -3.3375000 4 -1.7435000 4.7765000 5 -5.1715000 -1.7435000 6 4.0345000 -5.1715000 7 -1.9795000 4.0345000 8 0.8785000 -1.9795000 9 5.1185000 0.8785000 10 -5.4215000 5.1185000 11 6.2125000 -5.4215000 12 -4.1538333 6.2125000 13 -1.2718333 -4.1538333 14 3.9121667 -1.2718333 15 0.5961667 3.9121667 16 -5.6538333 0.5961667 17 2.9681667 -5.6538333 18 -1.3358333 2.9681667 19 -0.9898333 -1.3358333 20 0.3981667 -0.9898333 21 -5.3318333 0.3981667 22 -2.6718333 -5.3318333 23 2.5121667 -2.6718333 24 1.4194444 2.5121667 25 -0.4685556 1.4194444 26 -0.2945556 -0.4685556 27 2.3794444 -0.2945556 28 -2.6205556 2.3794444 29 0.4114444 -2.6205556 30 -5.5125556 0.4114444 31 -1.7365556 -5.5125556 32 3.5514444 -1.7365556 33 -7.8885556 3.5514444 34 0.3914444 -7.8885556 35 -0.9345556 0.3914444 36 -0.7608889 -0.9345556 37 -0.2988889 -0.7608889 38 1.1251111 -0.2988889 39 -4.3408889 1.1251111 40 7.4491111 -4.3408889 41 2.7011111 7.4491111 42 -3.3028889 2.7011111 43 -0.3168889 -3.3028889 44 1.2511111 -0.3168889 45 3.3011111 1.2511111 46 5.5411111 3.3011111 47 -0.7648889 5.5411111 48 -0.1812222 -0.7648889 49 -1.9392222 -0.1812222 50 -1.4052222 -1.9392222 51 -3.4112222 -1.4052222 52 2.5687778 -3.4112222 53 -0.9092222 2.5687778 54 6.1167778 -0.9092222 55 5.0227778 6.1167778 56 -6.0792222 5.0227778 57 4.8007778 -6.0792222 58 2.1607778 4.8007778 59 -7.0252222 2.1607778 60 NA -7.0252222 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3.9785000 3.6765000 [2,] -3.3375000 3.9785000 [3,] 4.7765000 -3.3375000 [4,] -1.7435000 4.7765000 [5,] -5.1715000 -1.7435000 [6,] 4.0345000 -5.1715000 [7,] -1.9795000 4.0345000 [8,] 0.8785000 -1.9795000 [9,] 5.1185000 0.8785000 [10,] -5.4215000 5.1185000 [11,] 6.2125000 -5.4215000 [12,] -4.1538333 6.2125000 [13,] -1.2718333 -4.1538333 [14,] 3.9121667 -1.2718333 [15,] 0.5961667 3.9121667 [16,] -5.6538333 0.5961667 [17,] 2.9681667 -5.6538333 [18,] -1.3358333 2.9681667 [19,] -0.9898333 -1.3358333 [20,] 0.3981667 -0.9898333 [21,] -5.3318333 0.3981667 [22,] -2.6718333 -5.3318333 [23,] 2.5121667 -2.6718333 [24,] 1.4194444 2.5121667 [25,] -0.4685556 1.4194444 [26,] -0.2945556 -0.4685556 [27,] 2.3794444 -0.2945556 [28,] -2.6205556 2.3794444 [29,] 0.4114444 -2.6205556 [30,] -5.5125556 0.4114444 [31,] -1.7365556 -5.5125556 [32,] 3.5514444 -1.7365556 [33,] -7.8885556 3.5514444 [34,] 0.3914444 -7.8885556 [35,] -0.9345556 0.3914444 [36,] -0.7608889 -0.9345556 [37,] -0.2988889 -0.7608889 [38,] 1.1251111 -0.2988889 [39,] -4.3408889 1.1251111 [40,] 7.4491111 -4.3408889 [41,] 2.7011111 7.4491111 [42,] -3.3028889 2.7011111 [43,] -0.3168889 -3.3028889 [44,] 1.2511111 -0.3168889 [45,] 3.3011111 1.2511111 [46,] 5.5411111 3.3011111 [47,] -0.7648889 5.5411111 [48,] -0.1812222 -0.7648889 [49,] -1.9392222 -0.1812222 [50,] -1.4052222 -1.9392222 [51,] -3.4112222 -1.4052222 [52,] 2.5687778 -3.4112222 [53,] -0.9092222 2.5687778 [54,] 6.1167778 -0.9092222 [55,] 5.0227778 6.1167778 [56,] -6.0792222 5.0227778 [57,] 4.8007778 -6.0792222 [58,] 2.1607778 4.8007778 [59,] -7.0252222 2.1607778 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3.9785000 3.6765000 2 -3.3375000 3.9785000 3 4.7765000 -3.3375000 4 -1.7435000 4.7765000 5 -5.1715000 -1.7435000 6 4.0345000 -5.1715000 7 -1.9795000 4.0345000 8 0.8785000 -1.9795000 9 5.1185000 0.8785000 10 -5.4215000 5.1185000 11 6.2125000 -5.4215000 12 -4.1538333 6.2125000 13 -1.2718333 -4.1538333 14 3.9121667 -1.2718333 15 0.5961667 3.9121667 16 -5.6538333 0.5961667 17 2.9681667 -5.6538333 18 -1.3358333 2.9681667 19 -0.9898333 -1.3358333 20 0.3981667 -0.9898333 21 -5.3318333 0.3981667 22 -2.6718333 -5.3318333 23 2.5121667 -2.6718333 24 1.4194444 2.5121667 25 -0.4685556 1.4194444 26 -0.2945556 -0.4685556 27 2.3794444 -0.2945556 28 -2.6205556 2.3794444 29 0.4114444 -2.6205556 30 -5.5125556 0.4114444 31 -1.7365556 -5.5125556 32 3.5514444 -1.7365556 33 -7.8885556 3.5514444 34 0.3914444 -7.8885556 35 -0.9345556 0.3914444 36 -0.7608889 -0.9345556 37 -0.2988889 -0.7608889 38 1.1251111 -0.2988889 39 -4.3408889 1.1251111 40 7.4491111 -4.3408889 41 2.7011111 7.4491111 42 -3.3028889 2.7011111 43 -0.3168889 -3.3028889 44 1.2511111 -0.3168889 45 3.3011111 1.2511111 46 5.5411111 3.3011111 47 -0.7648889 5.5411111 48 -0.1812222 -0.7648889 49 -1.9392222 -0.1812222 50 -1.4052222 -1.9392222 51 -3.4112222 -1.4052222 52 2.5687778 -3.4112222 53 -0.9092222 2.5687778 54 6.1167778 -0.9092222 55 5.0227778 6.1167778 56 -6.0792222 5.0227778 57 4.8007778 -6.0792222 58 2.1607778 4.8007778 59 -7.0252222 2.1607778 > 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/733mk1227269248.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/8ocuo1227269248.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/9jah81227269248.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/10ld511227269248.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/11gwxe1227269248.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/12h86w1227269248.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/13s8uo1227269248.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/14cesr1227269248.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/153bky1227269248.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/16vzvz1227269248.tab") + } > > system("convert tmp/13xll1227269247.ps tmp/13xll1227269247.png") > system("convert tmp/2re201227269248.ps tmp/2re201227269248.png") > system("convert tmp/3o32u1227269248.ps tmp/3o32u1227269248.png") > system("convert tmp/4xehw1227269248.ps tmp/4xehw1227269248.png") > system("convert tmp/5gn511227269248.ps tmp/5gn511227269248.png") > system("convert tmp/687px1227269248.ps tmp/687px1227269248.png") > system("convert tmp/733mk1227269248.ps tmp/733mk1227269248.png") > system("convert tmp/8ocuo1227269248.ps tmp/8ocuo1227269248.png") > system("convert tmp/9jah81227269248.ps tmp/9jah81227269248.png") > system("convert tmp/10ld511227269248.ps tmp/10ld511227269248.png") > > > proc.time() user system elapsed 2.342 1.523 2.800