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(106.1,97.89,106,98.69,105.9,99.01,105.8,99.18,105.7,98.45,105.6,98.13,105.4,98.29,105.4,99.1,105.5,99.26,105.6,98.85,105.7,98.05,105.9,98.53,106.1,99.34,106,100.14,105.8,100.3,105.8,100.22,105.7,99.9,105.5,99.58,105.3,99.9,105.2,100.78,105.2,100.78,105,100.46,105.1,100.06,105.1,100.28,105.2,100.78,104.9,101.58,104.8,102.06,104.5,102.02,104.5,101.68,104.4,101.32,104.4,101.81,104.2,102.3,104.1,102.12,103.9,102.1,103.8,101.75,103.9,101.5,104.2,102.16,104.1,103.47,103.8,104.05,103.6,104.09,103.7,103.55,103.5,102.77,103.4,102.89,103.1,103.6,103.1,103.76,103.1,103.92,103.2,103.35,103.3,103.32,103.5,104.2,103.6,105.44,103.5,105.81,103.3,106.25,103.2,105.94,103.1,105.82,103.2,105.96,103,106.49,103,106.32,103.1,105.88,103.4,105.07),dim=c(2,59),dimnames=list(c('Werkl','Infl'),1:59)) > y <- array(NA,dim=c(2,59),dimnames=list(c('Werkl','Infl'),1:59)) > 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 Werkl Infl M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 106.1 97.89 1 0 0 0 0 0 0 0 0 0 0 1 2 106.0 98.69 0 1 0 0 0 0 0 0 0 0 0 2 3 105.9 99.01 0 0 1 0 0 0 0 0 0 0 0 3 4 105.8 99.18 0 0 0 1 0 0 0 0 0 0 0 4 5 105.7 98.45 0 0 0 0 1 0 0 0 0 0 0 5 6 105.6 98.13 0 0 0 0 0 1 0 0 0 0 0 6 7 105.4 98.29 0 0 0 0 0 0 1 0 0 0 0 7 8 105.4 99.10 0 0 0 0 0 0 0 1 0 0 0 8 9 105.5 99.26 0 0 0 0 0 0 0 0 1 0 0 9 10 105.6 98.85 0 0 0 0 0 0 0 0 0 1 0 10 11 105.7 98.05 0 0 0 0 0 0 0 0 0 0 1 11 12 105.9 98.53 0 0 0 0 0 0 0 0 0 0 0 12 13 106.1 99.34 1 0 0 0 0 0 0 0 0 0 0 13 14 106.0 100.14 0 1 0 0 0 0 0 0 0 0 0 14 15 105.8 100.30 0 0 1 0 0 0 0 0 0 0 0 15 16 105.8 100.22 0 0 0 1 0 0 0 0 0 0 0 16 17 105.7 99.90 0 0 0 0 1 0 0 0 0 0 0 17 18 105.5 99.58 0 0 0 0 0 1 0 0 0 0 0 18 19 105.3 99.90 0 0 0 0 0 0 1 0 0 0 0 19 20 105.2 100.78 0 0 0 0 0 0 0 1 0 0 0 20 21 105.2 100.78 0 0 0 0 0 0 0 0 1 0 0 21 22 105.0 100.46 0 0 0 0 0 0 0 0 0 1 0 22 23 105.1 100.06 0 0 0 0 0 0 0 0 0 0 1 23 24 105.1 100.28 0 0 0 0 0 0 0 0 0 0 0 24 25 105.2 100.78 1 0 0 0 0 0 0 0 0 0 0 25 26 104.9 101.58 0 1 0 0 0 0 0 0 0 0 0 26 27 104.8 102.06 0 0 1 0 0 0 0 0 0 0 0 27 28 104.5 102.02 0 0 0 1 0 0 0 0 0 0 0 28 29 104.5 101.68 0 0 0 0 1 0 0 0 0 0 0 29 30 104.4 101.32 0 0 0 0 0 1 0 0 0 0 0 30 31 104.4 101.81 0 0 0 0 0 0 1 0 0 0 0 31 32 104.2 102.30 0 0 0 0 0 0 0 1 0 0 0 32 33 104.1 102.12 0 0 0 0 0 0 0 0 1 0 0 33 34 103.9 102.10 0 0 0 0 0 0 0 0 0 1 0 34 35 103.8 101.75 0 0 0 0 0 0 0 0 0 0 1 35 36 103.9 101.50 0 0 0 0 0 0 0 0 0 0 0 36 37 104.2 102.16 1 0 0 0 0 0 0 0 0 0 0 37 38 104.1 103.47 0 1 0 0 0 0 0 0 0 0 0 38 39 103.8 104.05 0 0 1 0 0 0 0 0 0 0 0 39 40 103.6 104.09 0 0 0 1 0 0 0 0 0 0 0 40 41 103.7 103.55 0 0 0 0 1 0 0 0 0 0 0 41 42 103.5 102.77 0 0 0 0 0 1 0 0 0 0 0 42 43 103.4 102.89 0 0 0 0 0 0 1 0 0 0 0 43 44 103.1 103.60 0 0 0 0 0 0 0 1 0 0 0 44 45 103.1 103.76 0 0 0 0 0 0 0 0 1 0 0 45 46 103.1 103.92 0 0 0 0 0 0 0 0 0 1 0 46 47 103.2 103.35 0 0 0 0 0 0 0 0 0 0 1 47 48 103.3 103.32 0 0 0 0 0 0 0 0 0 0 0 48 49 103.5 104.20 1 0 0 0 0 0 0 0 0 0 0 49 50 103.6 105.44 0 1 0 0 0 0 0 0 0 0 0 50 51 103.5 105.81 0 0 1 0 0 0 0 0 0 0 0 51 52 103.3 106.25 0 0 0 1 0 0 0 0 0 0 0 52 53 103.2 105.94 0 0 0 0 1 0 0 0 0 0 0 53 54 103.1 105.82 0 0 0 0 0 1 0 0 0 0 0 54 55 103.2 105.96 0 0 0 0 0 0 1 0 0 0 0 55 56 103.0 106.49 0 0 0 0 0 0 0 1 0 0 0 56 57 103.0 106.32 0 0 0 0 0 0 0 0 1 0 0 57 58 103.1 105.88 0 0 0 0 0 0 0 0 0 1 0 58 59 103.4 105.07 0 0 0 0 0 0 0 0 0 0 1 59 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Infl M1 M2 M3 M4 91.49138 0.15327 0.07394 -0.09756 -0.23587 -0.33187 M5 M6 M7 M8 M9 M10 -0.22297 -0.22449 -0.26195 -0.44655 -0.36539 -0.29358 M11 t -0.02352 -0.08024 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.45441 -0.22190 -0.02567 0.15852 0.56389 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 91.49138 12.23189 7.480 1.99e-09 *** Infl 0.15327 0.12668 1.210 0.233 M1 0.07394 0.21532 0.343 0.733 M2 -0.09756 0.27668 -0.353 0.726 M3 -0.23587 0.29849 -0.790 0.434 M4 -0.33187 0.29472 -1.126 0.266 M5 -0.22297 0.24383 -0.914 0.365 M6 -0.22449 0.21125 -1.063 0.294 M7 -0.26195 0.21630 -1.211 0.232 M8 -0.44655 0.25270 -1.767 0.084 . M9 -0.36539 0.24115 -1.515 0.137 M10 -0.29358 0.21844 -1.344 0.186 M11 -0.02352 0.19663 -0.120 0.905 t -0.08024 0.01855 -4.327 8.32e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2926 on 45 degrees of freedom Multiple R-squared: 0.9402, Adjusted R-squared: 0.923 F-statistic: 54.44 on 13 and 45 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.0047582694 0.0095165387 0.995241731 [2,] 0.0018938585 0.0037877171 0.998106141 [3,] 0.0004261113 0.0008522227 0.999573889 [4,] 0.0003125930 0.0006251861 0.999687407 [5,] 0.0013573243 0.0027146485 0.998642676 [6,] 0.0303172594 0.0606345187 0.969682741 [7,] 0.0177926154 0.0355852308 0.982207385 [8,] 0.0585337692 0.1170675385 0.941466231 [9,] 0.2871854526 0.5743709052 0.712814547 [10,] 0.5406677243 0.9186645513 0.459332276 [11,] 0.5644975457 0.8710049087 0.435502454 [12,] 0.6914249601 0.6171500798 0.308575040 [13,] 0.6774482178 0.6451035644 0.322551782 [14,] 0.6751011361 0.6497977279 0.324898864 [15,] 0.6603805552 0.6792388897 0.339619445 [16,] 0.7421458605 0.5157082791 0.257854140 [17,] 0.8873186665 0.2253626670 0.112681334 [18,] 0.9069343114 0.1861313772 0.093065689 [19,] 0.8745288971 0.2509422059 0.125471103 [20,] 0.9257428919 0.1485142162 0.074257108 [21,] 0.9635572144 0.0728855711 0.036442786 [22,] 0.9672718211 0.0654563578 0.032728179 [23,] 0.9559871609 0.0880256781 0.044012839 [24,] 0.9353366056 0.1293267888 0.064663394 [25,] 0.9910214550 0.0179570900 0.008978545 [26,] 0.9935780917 0.0128438165 0.006421908 > postscript(file="/var/www/html/rcomp/tmp/114zy1258706860.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/24uvl1258706860.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/3qj3e1258706860.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/422561258706860.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/5o6wp1258706860.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 = 59 Frequency = 1 1 2 3 4 5 6 -0.38840443 -0.35928366 -0.28978109 -0.23959019 -0.25636883 -0.22556486 7 8 9 10 11 12 -0.33238388 -0.19169555 -0.11713792 0.05412860 0.08692779 0.27007746 13 14 15 16 17 18 0.35223501 0.38135578 0.37538111 0.56388882 0.48427061 0.41507458 19 20 21 22 23 24 0.28373280 0.31369242 0.31277282 0.17024528 0.14173758 0.16473672 25 26 27 28 29 30 0.19440712 0.02352790 0.06850771 -0.04911528 -0.02566814 0.01126652 31 32 33 34 35 36 0.05386931 0.04360315 -0.02972835 -0.21823605 -0.45440712 -0.25937237 37 38 39 40 41 42 -0.05422473 -0.10327025 -0.27361716 -0.30350152 -0.14940094 -0.14809404 43 44 45 46 47 48 -0.14878237 -0.29276732 -0.31820968 -0.33430549 -0.33675777 -0.17544181 49 50 51 52 53 54 -0.10401296 0.05767023 0.11950943 0.02831818 -0.05283270 -0.05268218 55 56 57 58 59 0.14356414 0.12716730 0.15230313 0.32816766 0.56249952 > postscript(file="/var/www/html/rcomp/tmp/6jw251258706860.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 = 59 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.38840443 NA 1 -0.35928366 -0.38840443 2 -0.28978109 -0.35928366 3 -0.23959019 -0.28978109 4 -0.25636883 -0.23959019 5 -0.22556486 -0.25636883 6 -0.33238388 -0.22556486 7 -0.19169555 -0.33238388 8 -0.11713792 -0.19169555 9 0.05412860 -0.11713792 10 0.08692779 0.05412860 11 0.27007746 0.08692779 12 0.35223501 0.27007746 13 0.38135578 0.35223501 14 0.37538111 0.38135578 15 0.56388882 0.37538111 16 0.48427061 0.56388882 17 0.41507458 0.48427061 18 0.28373280 0.41507458 19 0.31369242 0.28373280 20 0.31277282 0.31369242 21 0.17024528 0.31277282 22 0.14173758 0.17024528 23 0.16473672 0.14173758 24 0.19440712 0.16473672 25 0.02352790 0.19440712 26 0.06850771 0.02352790 27 -0.04911528 0.06850771 28 -0.02566814 -0.04911528 29 0.01126652 -0.02566814 30 0.05386931 0.01126652 31 0.04360315 0.05386931 32 -0.02972835 0.04360315 33 -0.21823605 -0.02972835 34 -0.45440712 -0.21823605 35 -0.25937237 -0.45440712 36 -0.05422473 -0.25937237 37 -0.10327025 -0.05422473 38 -0.27361716 -0.10327025 39 -0.30350152 -0.27361716 40 -0.14940094 -0.30350152 41 -0.14809404 -0.14940094 42 -0.14878237 -0.14809404 43 -0.29276732 -0.14878237 44 -0.31820968 -0.29276732 45 -0.33430549 -0.31820968 46 -0.33675777 -0.33430549 47 -0.17544181 -0.33675777 48 -0.10401296 -0.17544181 49 0.05767023 -0.10401296 50 0.11950943 0.05767023 51 0.02831818 0.11950943 52 -0.05283270 0.02831818 53 -0.05268218 -0.05283270 54 0.14356414 -0.05268218 55 0.12716730 0.14356414 56 0.15230313 0.12716730 57 0.32816766 0.15230313 58 0.56249952 0.32816766 59 NA 0.56249952 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.35928366 -0.38840443 [2,] -0.28978109 -0.35928366 [3,] -0.23959019 -0.28978109 [4,] -0.25636883 -0.23959019 [5,] -0.22556486 -0.25636883 [6,] -0.33238388 -0.22556486 [7,] -0.19169555 -0.33238388 [8,] -0.11713792 -0.19169555 [9,] 0.05412860 -0.11713792 [10,] 0.08692779 0.05412860 [11,] 0.27007746 0.08692779 [12,] 0.35223501 0.27007746 [13,] 0.38135578 0.35223501 [14,] 0.37538111 0.38135578 [15,] 0.56388882 0.37538111 [16,] 0.48427061 0.56388882 [17,] 0.41507458 0.48427061 [18,] 0.28373280 0.41507458 [19,] 0.31369242 0.28373280 [20,] 0.31277282 0.31369242 [21,] 0.17024528 0.31277282 [22,] 0.14173758 0.17024528 [23,] 0.16473672 0.14173758 [24,] 0.19440712 0.16473672 [25,] 0.02352790 0.19440712 [26,] 0.06850771 0.02352790 [27,] -0.04911528 0.06850771 [28,] -0.02566814 -0.04911528 [29,] 0.01126652 -0.02566814 [30,] 0.05386931 0.01126652 [31,] 0.04360315 0.05386931 [32,] -0.02972835 0.04360315 [33,] -0.21823605 -0.02972835 [34,] -0.45440712 -0.21823605 [35,] -0.25937237 -0.45440712 [36,] -0.05422473 -0.25937237 [37,] -0.10327025 -0.05422473 [38,] -0.27361716 -0.10327025 [39,] -0.30350152 -0.27361716 [40,] -0.14940094 -0.30350152 [41,] -0.14809404 -0.14940094 [42,] -0.14878237 -0.14809404 [43,] -0.29276732 -0.14878237 [44,] -0.31820968 -0.29276732 [45,] -0.33430549 -0.31820968 [46,] -0.33675777 -0.33430549 [47,] -0.17544181 -0.33675777 [48,] -0.10401296 -0.17544181 [49,] 0.05767023 -0.10401296 [50,] 0.11950943 0.05767023 [51,] 0.02831818 0.11950943 [52,] -0.05283270 0.02831818 [53,] -0.05268218 -0.05283270 [54,] 0.14356414 -0.05268218 [55,] 0.12716730 0.14356414 [56,] 0.15230313 0.12716730 [57,] 0.32816766 0.15230313 [58,] 0.56249952 0.32816766 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.35928366 -0.38840443 2 -0.28978109 -0.35928366 3 -0.23959019 -0.28978109 4 -0.25636883 -0.23959019 5 -0.22556486 -0.25636883 6 -0.33238388 -0.22556486 7 -0.19169555 -0.33238388 8 -0.11713792 -0.19169555 9 0.05412860 -0.11713792 10 0.08692779 0.05412860 11 0.27007746 0.08692779 12 0.35223501 0.27007746 13 0.38135578 0.35223501 14 0.37538111 0.38135578 15 0.56388882 0.37538111 16 0.48427061 0.56388882 17 0.41507458 0.48427061 18 0.28373280 0.41507458 19 0.31369242 0.28373280 20 0.31277282 0.31369242 21 0.17024528 0.31277282 22 0.14173758 0.17024528 23 0.16473672 0.14173758 24 0.19440712 0.16473672 25 0.02352790 0.19440712 26 0.06850771 0.02352790 27 -0.04911528 0.06850771 28 -0.02566814 -0.04911528 29 0.01126652 -0.02566814 30 0.05386931 0.01126652 31 0.04360315 0.05386931 32 -0.02972835 0.04360315 33 -0.21823605 -0.02972835 34 -0.45440712 -0.21823605 35 -0.25937237 -0.45440712 36 -0.05422473 -0.25937237 37 -0.10327025 -0.05422473 38 -0.27361716 -0.10327025 39 -0.30350152 -0.27361716 40 -0.14940094 -0.30350152 41 -0.14809404 -0.14940094 42 -0.14878237 -0.14809404 43 -0.29276732 -0.14878237 44 -0.31820968 -0.29276732 45 -0.33430549 -0.31820968 46 -0.33675777 -0.33430549 47 -0.17544181 -0.33675777 48 -0.10401296 -0.17544181 49 0.05767023 -0.10401296 50 0.11950943 0.05767023 51 0.02831818 0.11950943 52 -0.05283270 0.02831818 53 -0.05268218 -0.05283270 54 0.14356414 -0.05268218 55 0.12716730 0.14356414 56 0.15230313 0.12716730 57 0.32816766 0.15230313 58 0.56249952 0.32816766 > 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/7quk51258706860.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/8pgbl1258706860.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/9a7381258706860.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/10obzo1258706860.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/11d1gp1258706860.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/12esrk1258706860.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/13dgf71258706860.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/14plgn1258706860.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/15ibt31258706860.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/16vdwh1258706860.tab") + } > > system("convert tmp/114zy1258706860.ps tmp/114zy1258706860.png") > system("convert tmp/24uvl1258706860.ps tmp/24uvl1258706860.png") > system("convert tmp/3qj3e1258706860.ps tmp/3qj3e1258706860.png") > system("convert tmp/422561258706860.ps tmp/422561258706860.png") > system("convert tmp/5o6wp1258706860.ps tmp/5o6wp1258706860.png") > system("convert tmp/6jw251258706860.ps tmp/6jw251258706860.png") > system("convert tmp/7quk51258706860.ps tmp/7quk51258706860.png") > system("convert tmp/8pgbl1258706860.ps tmp/8pgbl1258706860.png") > system("convert tmp/9a7381258706860.ps tmp/9a7381258706860.png") > system("convert tmp/10obzo1258706860.ps tmp/10obzo1258706860.png") > > > proc.time() user system elapsed 2.367 1.531 2.949