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(156.3,0,151.5,0,159.1,0,166.9,0,160.5,0,162.8,0,178.9,0,148.5,0,184.1,0,197,0,186.8,0,139.2,0,162.7,0,187.5,0,235.8,0,219.4,0,212.4,1,220.2,1,197.5,1,185.6,1,232.4,1,223.8,1,219.4,1,191.4,1,210.4,1,212.6,1,274.4,1,256,1,227.6,1,261.7,1,237,1,234.9,1,310.6,1,274.2,1,288.1,1,242.5,1,271.7,1,282.2,1,317.4,1,280.3,1,322.6,1,328.2,1,280.7,1,288.8,1,347.9,1,360.1,1,348,1,275.7,1,332.6,1,340.8,1,390.5,1,351.2,1,377.4,1,413.5,1,366.9,1,364.8,1,388,1,429.8,1,423.6,1,326.4,1),dim=c(2,60),dimnames=list(c('Poland','Dummy'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Poland','Dummy'),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 = '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 Poland Dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 156.3 0 1 0 0 0 0 0 0 0 0 0 0 2 151.5 0 0 1 0 0 0 0 0 0 0 0 0 3 159.1 0 0 0 1 0 0 0 0 0 0 0 0 4 166.9 0 0 0 0 1 0 0 0 0 0 0 0 5 160.5 0 0 0 0 0 1 0 0 0 0 0 0 6 162.8 0 0 0 0 0 0 1 0 0 0 0 0 7 178.9 0 0 0 0 0 0 0 1 0 0 0 0 8 148.5 0 0 0 0 0 0 0 0 1 0 0 0 9 184.1 0 0 0 0 0 0 0 0 0 1 0 0 10 197.0 0 0 0 0 0 0 0 0 0 0 1 0 11 186.8 0 0 0 0 0 0 0 0 0 0 0 1 12 139.2 0 0 0 0 0 0 0 0 0 0 0 0 13 162.7 0 1 0 0 0 0 0 0 0 0 0 0 14 187.5 0 0 1 0 0 0 0 0 0 0 0 0 15 235.8 0 0 0 1 0 0 0 0 0 0 0 0 16 219.4 0 0 0 0 1 0 0 0 0 0 0 0 17 212.4 1 0 0 0 0 1 0 0 0 0 0 0 18 220.2 1 0 0 0 0 0 1 0 0 0 0 0 19 197.5 1 0 0 0 0 0 0 1 0 0 0 0 20 185.6 1 0 0 0 0 0 0 0 1 0 0 0 21 232.4 1 0 0 0 0 0 0 0 0 1 0 0 22 223.8 1 0 0 0 0 0 0 0 0 0 1 0 23 219.4 1 0 0 0 0 0 0 0 0 0 0 1 24 191.4 1 0 0 0 0 0 0 0 0 0 0 0 25 210.4 1 1 0 0 0 0 0 0 0 0 0 0 26 212.6 1 0 1 0 0 0 0 0 0 0 0 0 27 274.4 1 0 0 1 0 0 0 0 0 0 0 0 28 256.0 1 0 0 0 1 0 0 0 0 0 0 0 29 227.6 1 0 0 0 0 1 0 0 0 0 0 0 30 261.7 1 0 0 0 0 0 1 0 0 0 0 0 31 237.0 1 0 0 0 0 0 0 1 0 0 0 0 32 234.9 1 0 0 0 0 0 0 0 1 0 0 0 33 310.6 1 0 0 0 0 0 0 0 0 1 0 0 34 274.2 1 0 0 0 0 0 0 0 0 0 1 0 35 288.1 1 0 0 0 0 0 0 0 0 0 0 1 36 242.5 1 0 0 0 0 0 0 0 0 0 0 0 37 271.7 1 1 0 0 0 0 0 0 0 0 0 0 38 282.2 1 0 1 0 0 0 0 0 0 0 0 0 39 317.4 1 0 0 1 0 0 0 0 0 0 0 0 40 280.3 1 0 0 0 1 0 0 0 0 0 0 0 41 322.6 1 0 0 0 0 1 0 0 0 0 0 0 42 328.2 1 0 0 0 0 0 1 0 0 0 0 0 43 280.7 1 0 0 0 0 0 0 1 0 0 0 0 44 288.8 1 0 0 0 0 0 0 0 1 0 0 0 45 347.9 1 0 0 0 0 0 0 0 0 1 0 0 46 360.1 1 0 0 0 0 0 0 0 0 0 1 0 47 348.0 1 0 0 0 0 0 0 0 0 0 0 1 48 275.7 1 0 0 0 0 0 0 0 0 0 0 0 49 332.6 1 1 0 0 0 0 0 0 0 0 0 0 50 340.8 1 0 1 0 0 0 0 0 0 0 0 0 51 390.5 1 0 0 1 0 0 0 0 0 0 0 0 52 351.2 1 0 0 0 1 0 0 0 0 0 0 0 53 377.4 1 0 0 0 0 1 0 0 0 0 0 0 54 413.5 1 0 0 0 0 0 1 0 0 0 0 0 55 366.9 1 0 0 0 0 0 0 1 0 0 0 0 56 364.8 1 0 0 0 0 0 0 0 1 0 0 0 57 388.0 1 0 0 0 0 0 0 0 0 1 0 0 58 429.8 1 0 0 0 0 0 0 0 0 0 1 0 59 423.6 1 0 0 0 0 0 0 0 0 0 0 1 60 326.4 1 0 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) Dummy M1 M2 M3 M4 139.42 119.52 15.60 23.78 64.30 43.62 M5 M6 M7 M8 M9 M10 25.06 42.24 17.16 9.48 57.56 61.94 M11 58.14 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -97.684 -40.770 -3.416 33.142 112.316 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 139.42 31.25 4.461 5.06e-05 *** Dummy 119.52 18.42 6.490 4.86e-08 *** M1 15.60 39.15 0.399 0.692 M2 23.78 39.15 0.607 0.546 M3 64.30 39.15 1.642 0.107 M4 43.62 39.15 1.114 0.271 M5 25.06 38.98 0.643 0.523 M6 42.24 38.98 1.084 0.284 M7 17.16 38.98 0.440 0.662 M8 9.48 38.98 0.243 0.809 M9 57.56 38.98 1.477 0.146 M10 61.94 38.98 1.589 0.119 M11 58.14 38.98 1.492 0.142 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 61.63 on 47 degrees of freedom Multiple R-squared: 0.5202, Adjusted R-squared: 0.3977 F-statistic: 4.246 on 12 and 47 DF, p-value: 0.0001607 > 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.753958e-01 3.507917e-01 0.8246042 [2,] 7.922710e-02 1.584542e-01 0.9207729 [3,] 3.497805e-02 6.995610e-02 0.9650220 [4,] 1.771986e-02 3.543972e-02 0.9822801 [5,] 7.661904e-03 1.532381e-02 0.9923381 [6,] 3.419315e-03 6.838630e-03 0.9965807 [7,] 1.818469e-03 3.636938e-03 0.9981815 [8,] 1.025178e-03 2.050355e-03 0.9989748 [9,] 4.736851e-04 9.473701e-04 0.9995263 [10,] 2.155348e-04 4.310696e-04 0.9997845 [11,] 1.008590e-04 2.017181e-04 0.9998991 [12,] 8.341774e-05 1.668355e-04 0.9999166 [13,] 3.673259e-05 7.346518e-05 0.9999633 [14,] 3.389208e-05 6.778417e-05 0.9999661 [15,] 8.789126e-05 1.757825e-04 0.9999121 [16,] 7.465990e-05 1.493198e-04 0.9999253 [17,] 1.379036e-04 2.758071e-04 0.9998621 [18,] 6.685753e-04 1.337151e-03 0.9993314 [19,] 1.905884e-03 3.811767e-03 0.9980941 [20,] 6.156049e-03 1.231210e-02 0.9938440 [21,] 7.543037e-03 1.508607e-02 0.9924570 [22,] 9.930346e-03 1.986069e-02 0.9900697 [23,] 1.223813e-02 2.447625e-02 0.9877619 [24,] 1.610651e-02 3.221303e-02 0.9838935 [25,] 1.539358e-02 3.078716e-02 0.9846064 [26,] 3.588501e-02 7.177002e-02 0.9641150 [27,] 8.009852e-02 1.601970e-01 0.9199015 [28,] 1.202268e-01 2.404536e-01 0.8797732 [29,] 1.686560e-01 3.373119e-01 0.8313440 > postscript(file="/var/www/html/freestat/rcomp/tmp/1zn531228378080.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/freestat/rcomp/tmp/2mwri1228378080.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/freestat/rcomp/tmp/3ou6f1228378080.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/freestat/rcomp/tmp/4gzng1228378080.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/freestat/rcomp/tmp/5qcgg1228378080.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 1.2717857 -11.7082143 -44.6282143 -16.1482143 -3.9842857 -18.8642857 7 8 9 10 11 12 22.3157143 -0.4042857 -12.8842857 -4.3642857 -10.7642857 -0.2242857 13 14 15 16 17 18 7.6717857 24.2917857 32.0717857 36.3517857 -71.6039286 -80.9839286 19 20 21 22 23 24 -78.6039286 -82.8239286 -84.1039286 -97.0839286 -97.6839286 -67.5439286 25 26 27 28 29 30 -64.1478571 -70.1278571 -48.8478571 -46.5678571 -56.4039286 -39.4839286 31 32 33 34 35 36 -39.1039286 -33.5239286 -5.9039286 -46.6839286 -28.9839286 -16.4439286 37 38 39 40 41 42 -2.8478571 -0.5278571 -5.8478571 -22.2678571 38.5960714 27.0160714 43 44 45 46 47 48 4.5960714 20.3760714 31.3960714 39.2160714 30.9160714 16.7560714 49 50 51 52 53 54 58.0521429 58.0721429 67.2521429 48.6321429 93.3960714 112.3160714 55 56 57 58 59 60 90.7960714 96.3760714 71.4960714 108.9160714 106.5160714 67.4560714 > postscript(file="/var/www/html/freestat/rcomp/tmp/635d61228378080.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 1.2717857 NA 1 -11.7082143 1.2717857 2 -44.6282143 -11.7082143 3 -16.1482143 -44.6282143 4 -3.9842857 -16.1482143 5 -18.8642857 -3.9842857 6 22.3157143 -18.8642857 7 -0.4042857 22.3157143 8 -12.8842857 -0.4042857 9 -4.3642857 -12.8842857 10 -10.7642857 -4.3642857 11 -0.2242857 -10.7642857 12 7.6717857 -0.2242857 13 24.2917857 7.6717857 14 32.0717857 24.2917857 15 36.3517857 32.0717857 16 -71.6039286 36.3517857 17 -80.9839286 -71.6039286 18 -78.6039286 -80.9839286 19 -82.8239286 -78.6039286 20 -84.1039286 -82.8239286 21 -97.0839286 -84.1039286 22 -97.6839286 -97.0839286 23 -67.5439286 -97.6839286 24 -64.1478571 -67.5439286 25 -70.1278571 -64.1478571 26 -48.8478571 -70.1278571 27 -46.5678571 -48.8478571 28 -56.4039286 -46.5678571 29 -39.4839286 -56.4039286 30 -39.1039286 -39.4839286 31 -33.5239286 -39.1039286 32 -5.9039286 -33.5239286 33 -46.6839286 -5.9039286 34 -28.9839286 -46.6839286 35 -16.4439286 -28.9839286 36 -2.8478571 -16.4439286 37 -0.5278571 -2.8478571 38 -5.8478571 -0.5278571 39 -22.2678571 -5.8478571 40 38.5960714 -22.2678571 41 27.0160714 38.5960714 42 4.5960714 27.0160714 43 20.3760714 4.5960714 44 31.3960714 20.3760714 45 39.2160714 31.3960714 46 30.9160714 39.2160714 47 16.7560714 30.9160714 48 58.0521429 16.7560714 49 58.0721429 58.0521429 50 67.2521429 58.0721429 51 48.6321429 67.2521429 52 93.3960714 48.6321429 53 112.3160714 93.3960714 54 90.7960714 112.3160714 55 96.3760714 90.7960714 56 71.4960714 96.3760714 57 108.9160714 71.4960714 58 106.5160714 108.9160714 59 67.4560714 106.5160714 60 NA 67.4560714 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -11.7082143 1.2717857 [2,] -44.6282143 -11.7082143 [3,] -16.1482143 -44.6282143 [4,] -3.9842857 -16.1482143 [5,] -18.8642857 -3.9842857 [6,] 22.3157143 -18.8642857 [7,] -0.4042857 22.3157143 [8,] -12.8842857 -0.4042857 [9,] -4.3642857 -12.8842857 [10,] -10.7642857 -4.3642857 [11,] -0.2242857 -10.7642857 [12,] 7.6717857 -0.2242857 [13,] 24.2917857 7.6717857 [14,] 32.0717857 24.2917857 [15,] 36.3517857 32.0717857 [16,] -71.6039286 36.3517857 [17,] -80.9839286 -71.6039286 [18,] -78.6039286 -80.9839286 [19,] -82.8239286 -78.6039286 [20,] -84.1039286 -82.8239286 [21,] -97.0839286 -84.1039286 [22,] -97.6839286 -97.0839286 [23,] -67.5439286 -97.6839286 [24,] -64.1478571 -67.5439286 [25,] -70.1278571 -64.1478571 [26,] -48.8478571 -70.1278571 [27,] -46.5678571 -48.8478571 [28,] -56.4039286 -46.5678571 [29,] -39.4839286 -56.4039286 [30,] -39.1039286 -39.4839286 [31,] -33.5239286 -39.1039286 [32,] -5.9039286 -33.5239286 [33,] -46.6839286 -5.9039286 [34,] -28.9839286 -46.6839286 [35,] -16.4439286 -28.9839286 [36,] -2.8478571 -16.4439286 [37,] -0.5278571 -2.8478571 [38,] -5.8478571 -0.5278571 [39,] -22.2678571 -5.8478571 [40,] 38.5960714 -22.2678571 [41,] 27.0160714 38.5960714 [42,] 4.5960714 27.0160714 [43,] 20.3760714 4.5960714 [44,] 31.3960714 20.3760714 [45,] 39.2160714 31.3960714 [46,] 30.9160714 39.2160714 [47,] 16.7560714 30.9160714 [48,] 58.0521429 16.7560714 [49,] 58.0721429 58.0521429 [50,] 67.2521429 58.0721429 [51,] 48.6321429 67.2521429 [52,] 93.3960714 48.6321429 [53,] 112.3160714 93.3960714 [54,] 90.7960714 112.3160714 [55,] 96.3760714 90.7960714 [56,] 71.4960714 96.3760714 [57,] 108.9160714 71.4960714 [58,] 106.5160714 108.9160714 [59,] 67.4560714 106.5160714 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -11.7082143 1.2717857 2 -44.6282143 -11.7082143 3 -16.1482143 -44.6282143 4 -3.9842857 -16.1482143 5 -18.8642857 -3.9842857 6 22.3157143 -18.8642857 7 -0.4042857 22.3157143 8 -12.8842857 -0.4042857 9 -4.3642857 -12.8842857 10 -10.7642857 -4.3642857 11 -0.2242857 -10.7642857 12 7.6717857 -0.2242857 13 24.2917857 7.6717857 14 32.0717857 24.2917857 15 36.3517857 32.0717857 16 -71.6039286 36.3517857 17 -80.9839286 -71.6039286 18 -78.6039286 -80.9839286 19 -82.8239286 -78.6039286 20 -84.1039286 -82.8239286 21 -97.0839286 -84.1039286 22 -97.6839286 -97.0839286 23 -67.5439286 -97.6839286 24 -64.1478571 -67.5439286 25 -70.1278571 -64.1478571 26 -48.8478571 -70.1278571 27 -46.5678571 -48.8478571 28 -56.4039286 -46.5678571 29 -39.4839286 -56.4039286 30 -39.1039286 -39.4839286 31 -33.5239286 -39.1039286 32 -5.9039286 -33.5239286 33 -46.6839286 -5.9039286 34 -28.9839286 -46.6839286 35 -16.4439286 -28.9839286 36 -2.8478571 -16.4439286 37 -0.5278571 -2.8478571 38 -5.8478571 -0.5278571 39 -22.2678571 -5.8478571 40 38.5960714 -22.2678571 41 27.0160714 38.5960714 42 4.5960714 27.0160714 43 20.3760714 4.5960714 44 31.3960714 20.3760714 45 39.2160714 31.3960714 46 30.9160714 39.2160714 47 16.7560714 30.9160714 48 58.0521429 16.7560714 49 58.0721429 58.0521429 50 67.2521429 58.0721429 51 48.6321429 67.2521429 52 93.3960714 48.6321429 53 112.3160714 93.3960714 54 90.7960714 112.3160714 55 96.3760714 90.7960714 56 71.4960714 96.3760714 57 108.9160714 71.4960714 58 106.5160714 108.9160714 59 67.4560714 106.5160714 > 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/freestat/rcomp/tmp/7owx01228378080.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/freestat/rcomp/tmp/8xqxf1228378080.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/freestat/rcomp/tmp/962oj1228378080.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/freestat/rcomp/tmp/1045za1228378080.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11hd771228378080.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/freestat/rcomp/tmp/12hro51228378080.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/freestat/rcomp/tmp/138u9e1228378080.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/freestat/rcomp/tmp/1408kz1228378080.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/freestat/rcomp/tmp/1599lp1228378080.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/freestat/rcomp/tmp/16i9e11228378080.tab") + } > > system("convert tmp/1zn531228378080.ps tmp/1zn531228378080.png") > system("convert tmp/2mwri1228378080.ps tmp/2mwri1228378080.png") > system("convert tmp/3ou6f1228378080.ps tmp/3ou6f1228378080.png") > system("convert tmp/4gzng1228378080.ps tmp/4gzng1228378080.png") > system("convert tmp/5qcgg1228378080.ps tmp/5qcgg1228378080.png") > system("convert tmp/635d61228378080.ps tmp/635d61228378080.png") > system("convert tmp/7owx01228378080.ps tmp/7owx01228378080.png") > system("convert tmp/8xqxf1228378080.ps tmp/8xqxf1228378080.png") > system("convert tmp/962oj1228378080.ps tmp/962oj1228378080.png") > system("convert tmp/1045za1228378080.ps tmp/1045za1228378080.png") > > > proc.time() user system elapsed 3.642 2.488 4.096