R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(216234,213587,209465,204045,200237,203666,241476,260307,243324,244460,233575,237217,235243,230354,227184,221678,217142,219452,256446,265845,248624,241114,229245,231805,219277,219313,212610,214771,211142,211457,240048,240636,230580,208795,197922,194596,194581,185686,178106,172608,167302,168053,202300,202388,182516,173476,166444,171297,169701,164182,161914,159612,151001,158114,186530,187069,174330,169362,166827,178037,186412,189226,191563,188906,186005,195309,223532,226899,214126),dim=c(1,69),dimnames=list(c('Werkl'),1:69)) > y <- array(NA,dim=c(1,69),dimnames=list(c('Werkl'),1:69)) > 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 Werkl M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 216234 1 0 0 0 0 0 0 0 0 0 0 2 213587 0 1 0 0 0 0 0 0 0 0 0 3 209465 0 0 1 0 0 0 0 0 0 0 0 4 204045 0 0 0 1 0 0 0 0 0 0 0 5 200237 0 0 0 0 1 0 0 0 0 0 0 6 203666 0 0 0 0 0 1 0 0 0 0 0 7 241476 0 0 0 0 0 0 1 0 0 0 0 8 260307 0 0 0 0 0 0 0 1 0 0 0 9 243324 0 0 0 0 0 0 0 0 1 0 0 10 244460 0 0 0 0 0 0 0 0 0 1 0 11 233575 0 0 0 0 0 0 0 0 0 0 1 12 237217 0 0 0 0 0 0 0 0 0 0 0 13 235243 1 0 0 0 0 0 0 0 0 0 0 14 230354 0 1 0 0 0 0 0 0 0 0 0 15 227184 0 0 1 0 0 0 0 0 0 0 0 16 221678 0 0 0 1 0 0 0 0 0 0 0 17 217142 0 0 0 0 1 0 0 0 0 0 0 18 219452 0 0 0 0 0 1 0 0 0 0 0 19 256446 0 0 0 0 0 0 1 0 0 0 0 20 265845 0 0 0 0 0 0 0 1 0 0 0 21 248624 0 0 0 0 0 0 0 0 1 0 0 22 241114 0 0 0 0 0 0 0 0 0 1 0 23 229245 0 0 0 0 0 0 0 0 0 0 1 24 231805 0 0 0 0 0 0 0 0 0 0 0 25 219277 1 0 0 0 0 0 0 0 0 0 0 26 219313 0 1 0 0 0 0 0 0 0 0 0 27 212610 0 0 1 0 0 0 0 0 0 0 0 28 214771 0 0 0 1 0 0 0 0 0 0 0 29 211142 0 0 0 0 1 0 0 0 0 0 0 30 211457 0 0 0 0 0 1 0 0 0 0 0 31 240048 0 0 0 0 0 0 1 0 0 0 0 32 240636 0 0 0 0 0 0 0 1 0 0 0 33 230580 0 0 0 0 0 0 0 0 1 0 0 34 208795 0 0 0 0 0 0 0 0 0 1 0 35 197922 0 0 0 0 0 0 0 0 0 0 1 36 194596 0 0 0 0 0 0 0 0 0 0 0 37 194581 1 0 0 0 0 0 0 0 0 0 0 38 185686 0 1 0 0 0 0 0 0 0 0 0 39 178106 0 0 1 0 0 0 0 0 0 0 0 40 172608 0 0 0 1 0 0 0 0 0 0 0 41 167302 0 0 0 0 1 0 0 0 0 0 0 42 168053 0 0 0 0 0 1 0 0 0 0 0 43 202300 0 0 0 0 0 0 1 0 0 0 0 44 202388 0 0 0 0 0 0 0 1 0 0 0 45 182516 0 0 0 0 0 0 0 0 1 0 0 46 173476 0 0 0 0 0 0 0 0 0 1 0 47 166444 0 0 0 0 0 0 0 0 0 0 1 48 171297 0 0 0 0 0 0 0 0 0 0 0 49 169701 1 0 0 0 0 0 0 0 0 0 0 50 164182 0 1 0 0 0 0 0 0 0 0 0 51 161914 0 0 1 0 0 0 0 0 0 0 0 52 159612 0 0 0 1 0 0 0 0 0 0 0 53 151001 0 0 0 0 1 0 0 0 0 0 0 54 158114 0 0 0 0 0 1 0 0 0 0 0 55 186530 0 0 0 0 0 0 1 0 0 0 0 56 187069 0 0 0 0 0 0 0 1 0 0 0 57 174330 0 0 0 0 0 0 0 0 1 0 0 58 169362 0 0 0 0 0 0 0 0 0 1 0 59 166827 0 0 0 0 0 0 0 0 0 0 1 60 178037 0 0 0 0 0 0 0 0 0 0 0 61 186412 1 0 0 0 0 0 0 0 0 0 0 62 189226 0 1 0 0 0 0 0 0 0 0 0 63 191563 0 0 1 0 0 0 0 0 0 0 0 64 188906 0 0 0 1 0 0 0 0 0 0 0 65 186005 0 0 0 0 1 0 0 0 0 0 0 66 195309 0 0 0 0 0 1 0 0 0 0 0 67 223532 0 0 0 0 0 0 1 0 0 0 0 68 226899 0 0 0 0 0 0 0 1 0 0 0 69 214126 0 0 0 0 0 0 0 0 1 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) M1 M2 M3 M4 M5 202590.4 984.3 -2199.1 -5783.4 -8987.1 -13785.6 M6 M7 M8 M9 M10 M11 -9915.2 22464.9 27933.6 12992.9 4851.0 -3787.8 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -43455 -24553 1354 22337 37019 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 202590.4 12502.3 16.204 <2e-16 *** M1 984.3 16928.2 0.058 0.954 M2 -2199.1 16928.2 -0.130 0.897 M3 -5783.4 16928.2 -0.342 0.734 M4 -8987.1 16928.2 -0.531 0.598 M5 -13785.6 16928.2 -0.814 0.419 M6 -9915.2 16928.2 -0.586 0.560 M7 22464.9 16928.2 1.327 0.190 M8 27933.6 16928.2 1.650 0.104 M9 12992.9 16928.2 0.768 0.446 M10 4851.0 17681.0 0.274 0.785 M11 -3787.8 17681.0 -0.214 0.831 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 27960 on 57 degrees of freedom Multiple R-squared: 0.1987, Adjusted R-squared: 0.04407 F-statistic: 1.285 on 11 and 57 DF, p-value: 0.2567 > 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.1090192616 0.2180385233 0.8909807 [2,] 0.0675551524 0.1351103047 0.9324448 [3,] 0.0423156532 0.0846313064 0.9576843 [4,] 0.0258775438 0.0517550875 0.9741225 [5,] 0.0164839116 0.0329678232 0.9835161 [6,] 0.0088508433 0.0177016866 0.9911492 [7,] 0.0047456769 0.0094913538 0.9952543 [8,] 0.0028903818 0.0057807636 0.9971096 [9,] 0.0017993816 0.0035987632 0.9982006 [10,] 0.0012195412 0.0024390825 0.9987805 [11,] 0.0007163082 0.0014326163 0.9992837 [12,] 0.0004228453 0.0008456906 0.9995772 [13,] 0.0002620368 0.0005240736 0.9997380 [14,] 0.0001802463 0.0003604927 0.9998198 [15,] 0.0001490247 0.0002980495 0.9998510 [16,] 0.0001117728 0.0002235457 0.9998882 [17,] 0.0001214860 0.0002429719 0.9998785 [18,] 0.0006275651 0.0012551302 0.9993724 [19,] 0.0016577499 0.0033154998 0.9983423 [20,] 0.0203014104 0.0406028207 0.9796986 [21,] 0.0791467689 0.1582935378 0.9208532 [22,] 0.1986362085 0.3972724169 0.8013638 [23,] 0.2557347325 0.5114694650 0.7442653 [24,] 0.3311772735 0.6623545471 0.6688227 [25,] 0.4005720303 0.8011440607 0.5994280 [26,] 0.4643599641 0.9287199282 0.5356400 [27,] 0.5115953618 0.9768092763 0.4884046 [28,] 0.5520540695 0.8958918610 0.4479459 [29,] 0.5664493560 0.8671012881 0.4335506 [30,] 0.6062470146 0.7875059708 0.3937530 [31,] 0.6525117158 0.6949765684 0.3474883 [32,] 0.6600261008 0.6799477985 0.3399739 [33,] 0.6366220530 0.7267558941 0.3633779 [34,] 0.5935927608 0.8128144783 0.4064072 [35,] 0.5516872784 0.8966254432 0.4483127 [36,] 0.5261646660 0.9476706680 0.4738353 [37,] 0.5025203900 0.9949592200 0.4974796 [38,] 0.4641636879 0.9283273757 0.5358363 [39,] 0.4486218162 0.8972436323 0.5513782 [40,] 0.4274801957 0.8549603914 0.5725198 > postscript(file="/var/www/html/rcomp/tmp/1f26t1259924351.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/29sm31259924351.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/3ahrq1259924351.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/45akz1259924351.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/5nrsb1259924351.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 = 69 Frequency = 1 1 2 3 4 5 6 7 12659.333 13195.667 12658.000 10441.667 11432.167 10990.833 16420.667 8 9 10 11 12 13 14 29783.000 27740.667 37018.600 34772.400 34626.600 31668.333 29962.667 15 16 17 18 19 20 21 30377.000 28074.667 28337.167 26776.833 31390.667 35321.000 33040.667 22 23 24 25 26 27 28 33672.600 30442.400 29214.600 15702.333 18921.667 15803.000 21167.667 29 30 31 32 33 34 35 22337.167 18781.833 14992.667 10112.000 14996.667 1353.600 -880.600 36 37 38 39 40 41 42 -7994.400 -8993.667 -14705.333 -18701.000 -20995.333 -21502.833 -24622.167 43 44 45 46 47 48 49 -22755.333 -28136.000 -33067.333 -33965.400 -32358.600 -31293.400 -33873.667 50 51 52 53 54 55 56 -36209.333 -34893.000 -33991.333 -37803.833 -34561.167 -38525.333 -43455.000 57 58 59 60 61 62 63 -41253.333 -38079.400 -31975.600 -24553.400 -17162.667 -11165.333 -5244.000 64 65 66 67 68 69 -4697.333 -2799.833 2633.833 -1523.333 -3625.000 -1457.333 > postscript(file="/var/www/html/rcomp/tmp/6fzts1259924351.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 = 69 Frequency = 1 lag(myerror, k = 1) myerror 0 12659.333 NA 1 13195.667 12659.333 2 12658.000 13195.667 3 10441.667 12658.000 4 11432.167 10441.667 5 10990.833 11432.167 6 16420.667 10990.833 7 29783.000 16420.667 8 27740.667 29783.000 9 37018.600 27740.667 10 34772.400 37018.600 11 34626.600 34772.400 12 31668.333 34626.600 13 29962.667 31668.333 14 30377.000 29962.667 15 28074.667 30377.000 16 28337.167 28074.667 17 26776.833 28337.167 18 31390.667 26776.833 19 35321.000 31390.667 20 33040.667 35321.000 21 33672.600 33040.667 22 30442.400 33672.600 23 29214.600 30442.400 24 15702.333 29214.600 25 18921.667 15702.333 26 15803.000 18921.667 27 21167.667 15803.000 28 22337.167 21167.667 29 18781.833 22337.167 30 14992.667 18781.833 31 10112.000 14992.667 32 14996.667 10112.000 33 1353.600 14996.667 34 -880.600 1353.600 35 -7994.400 -880.600 36 -8993.667 -7994.400 37 -14705.333 -8993.667 38 -18701.000 -14705.333 39 -20995.333 -18701.000 40 -21502.833 -20995.333 41 -24622.167 -21502.833 42 -22755.333 -24622.167 43 -28136.000 -22755.333 44 -33067.333 -28136.000 45 -33965.400 -33067.333 46 -32358.600 -33965.400 47 -31293.400 -32358.600 48 -33873.667 -31293.400 49 -36209.333 -33873.667 50 -34893.000 -36209.333 51 -33991.333 -34893.000 52 -37803.833 -33991.333 53 -34561.167 -37803.833 54 -38525.333 -34561.167 55 -43455.000 -38525.333 56 -41253.333 -43455.000 57 -38079.400 -41253.333 58 -31975.600 -38079.400 59 -24553.400 -31975.600 60 -17162.667 -24553.400 61 -11165.333 -17162.667 62 -5244.000 -11165.333 63 -4697.333 -5244.000 64 -2799.833 -4697.333 65 2633.833 -2799.833 66 -1523.333 2633.833 67 -3625.000 -1523.333 68 -1457.333 -3625.000 69 NA -1457.333 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 13195.667 12659.333 [2,] 12658.000 13195.667 [3,] 10441.667 12658.000 [4,] 11432.167 10441.667 [5,] 10990.833 11432.167 [6,] 16420.667 10990.833 [7,] 29783.000 16420.667 [8,] 27740.667 29783.000 [9,] 37018.600 27740.667 [10,] 34772.400 37018.600 [11,] 34626.600 34772.400 [12,] 31668.333 34626.600 [13,] 29962.667 31668.333 [14,] 30377.000 29962.667 [15,] 28074.667 30377.000 [16,] 28337.167 28074.667 [17,] 26776.833 28337.167 [18,] 31390.667 26776.833 [19,] 35321.000 31390.667 [20,] 33040.667 35321.000 [21,] 33672.600 33040.667 [22,] 30442.400 33672.600 [23,] 29214.600 30442.400 [24,] 15702.333 29214.600 [25,] 18921.667 15702.333 [26,] 15803.000 18921.667 [27,] 21167.667 15803.000 [28,] 22337.167 21167.667 [29,] 18781.833 22337.167 [30,] 14992.667 18781.833 [31,] 10112.000 14992.667 [32,] 14996.667 10112.000 [33,] 1353.600 14996.667 [34,] -880.600 1353.600 [35,] -7994.400 -880.600 [36,] -8993.667 -7994.400 [37,] -14705.333 -8993.667 [38,] -18701.000 -14705.333 [39,] -20995.333 -18701.000 [40,] -21502.833 -20995.333 [41,] -24622.167 -21502.833 [42,] -22755.333 -24622.167 [43,] -28136.000 -22755.333 [44,] -33067.333 -28136.000 [45,] -33965.400 -33067.333 [46,] -32358.600 -33965.400 [47,] -31293.400 -32358.600 [48,] -33873.667 -31293.400 [49,] -36209.333 -33873.667 [50,] -34893.000 -36209.333 [51,] -33991.333 -34893.000 [52,] -37803.833 -33991.333 [53,] -34561.167 -37803.833 [54,] -38525.333 -34561.167 [55,] -43455.000 -38525.333 [56,] -41253.333 -43455.000 [57,] -38079.400 -41253.333 [58,] -31975.600 -38079.400 [59,] -24553.400 -31975.600 [60,] -17162.667 -24553.400 [61,] -11165.333 -17162.667 [62,] -5244.000 -11165.333 [63,] -4697.333 -5244.000 [64,] -2799.833 -4697.333 [65,] 2633.833 -2799.833 [66,] -1523.333 2633.833 [67,] -3625.000 -1523.333 [68,] -1457.333 -3625.000 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 13195.667 12659.333 2 12658.000 13195.667 3 10441.667 12658.000 4 11432.167 10441.667 5 10990.833 11432.167 6 16420.667 10990.833 7 29783.000 16420.667 8 27740.667 29783.000 9 37018.600 27740.667 10 34772.400 37018.600 11 34626.600 34772.400 12 31668.333 34626.600 13 29962.667 31668.333 14 30377.000 29962.667 15 28074.667 30377.000 16 28337.167 28074.667 17 26776.833 28337.167 18 31390.667 26776.833 19 35321.000 31390.667 20 33040.667 35321.000 21 33672.600 33040.667 22 30442.400 33672.600 23 29214.600 30442.400 24 15702.333 29214.600 25 18921.667 15702.333 26 15803.000 18921.667 27 21167.667 15803.000 28 22337.167 21167.667 29 18781.833 22337.167 30 14992.667 18781.833 31 10112.000 14992.667 32 14996.667 10112.000 33 1353.600 14996.667 34 -880.600 1353.600 35 -7994.400 -880.600 36 -8993.667 -7994.400 37 -14705.333 -8993.667 38 -18701.000 -14705.333 39 -20995.333 -18701.000 40 -21502.833 -20995.333 41 -24622.167 -21502.833 42 -22755.333 -24622.167 43 -28136.000 -22755.333 44 -33067.333 -28136.000 45 -33965.400 -33067.333 46 -32358.600 -33965.400 47 -31293.400 -32358.600 48 -33873.667 -31293.400 49 -36209.333 -33873.667 50 -34893.000 -36209.333 51 -33991.333 -34893.000 52 -37803.833 -33991.333 53 -34561.167 -37803.833 54 -38525.333 -34561.167 55 -43455.000 -38525.333 56 -41253.333 -43455.000 57 -38079.400 -41253.333 58 -31975.600 -38079.400 59 -24553.400 -31975.600 60 -17162.667 -24553.400 61 -11165.333 -17162.667 62 -5244.000 -11165.333 63 -4697.333 -5244.000 64 -2799.833 -4697.333 65 2633.833 -2799.833 66 -1523.333 2633.833 67 -3625.000 -1523.333 68 -1457.333 -3625.000 > 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/7uy991259924351.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/8o73j1259924351.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/9luo01259924351.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/10t1q91259924351.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/11qhn41259924351.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/12md5s1259924351.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/13vwd81259924351.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/14xxfp1259924351.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/15co761259924351.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/16yv4m1259924351.tab") + } > > system("convert tmp/1f26t1259924351.ps tmp/1f26t1259924351.png") > system("convert tmp/29sm31259924351.ps tmp/29sm31259924351.png") > system("convert tmp/3ahrq1259924351.ps tmp/3ahrq1259924351.png") > system("convert tmp/45akz1259924351.ps tmp/45akz1259924351.png") > system("convert tmp/5nrsb1259924351.ps tmp/5nrsb1259924351.png") > system("convert tmp/6fzts1259924351.ps tmp/6fzts1259924351.png") > system("convert tmp/7uy991259924351.ps tmp/7uy991259924351.png") > system("convert tmp/8o73j1259924351.ps tmp/8o73j1259924351.png") > system("convert tmp/9luo01259924351.ps tmp/9luo01259924351.png") > system("convert tmp/10t1q91259924351.ps tmp/10t1q91259924351.png") > > > proc.time() user system elapsed 2.462 1.600 3.017