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(105.4,102.7,105.4,102.5,105.6,102.2,105.7,102.9,105.8,103.1,105.8,103,105.8,102.8,105.9,102.5,106.1,101.9,106.4,101.9,106.4,101.8,106.3,102,106.2,102.6,106.2,102.5,106.3,102.5,106.4,101.6,106.5,101.4,106.6,100.8,106.6,101.1,106.6,101.3,106.8,101.2,107,101.3,107.2,101.1,107.3,101.3,107.5,101.2,107.6,101.6,107.6,101.7,107.7,101.5,107.7,100.9,107.7,101.5,107.7,101.4,107.6,101.6,107.7,101.7,107.9,101.4,107.9,101.8,107.9,101.7,107.8,101.4,107.6,101.2,107.4,101,107,101.7,107,102.4,107.2,102,107.5,102.1,107.8,102,107.8,101.8,107.7,102.7,107.6,102.3,107.6,101.9,107.5,102,107.5,102.3,107.6,102.8,107.6,102.4,107.9,102.3,107.6,102.7,107.5,102.7,107.5,102.9,107.6,103,107.7,102.2,107.8,102.3,107.9,102.8,107.9,102.8),dim=c(2,61),dimnames=list(c('Werkl','Inflatie'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('Werkl','Inflatie'),1:61)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Werkl Inflatie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 105.4 102.7 1 0 0 0 0 0 0 0 0 0 0 2 105.4 102.5 0 1 0 0 0 0 0 0 0 0 0 3 105.6 102.2 0 0 1 0 0 0 0 0 0 0 0 4 105.7 102.9 0 0 0 1 0 0 0 0 0 0 0 5 105.8 103.1 0 0 0 0 1 0 0 0 0 0 0 6 105.8 103.0 0 0 0 0 0 1 0 0 0 0 0 7 105.8 102.8 0 0 0 0 0 0 1 0 0 0 0 8 105.9 102.5 0 0 0 0 0 0 0 1 0 0 0 9 106.1 101.9 0 0 0 0 0 0 0 0 1 0 0 10 106.4 101.9 0 0 0 0 0 0 0 0 0 1 0 11 106.4 101.8 0 0 0 0 0 0 0 0 0 0 1 12 106.3 102.0 0 0 0 0 0 0 0 0 0 0 0 13 106.2 102.6 1 0 0 0 0 0 0 0 0 0 0 14 106.2 102.5 0 1 0 0 0 0 0 0 0 0 0 15 106.3 102.5 0 0 1 0 0 0 0 0 0 0 0 16 106.4 101.6 0 0 0 1 0 0 0 0 0 0 0 17 106.5 101.4 0 0 0 0 1 0 0 0 0 0 0 18 106.6 100.8 0 0 0 0 0 1 0 0 0 0 0 19 106.6 101.1 0 0 0 0 0 0 1 0 0 0 0 20 106.6 101.3 0 0 0 0 0 0 0 1 0 0 0 21 106.8 101.2 0 0 0 0 0 0 0 0 1 0 0 22 107.0 101.3 0 0 0 0 0 0 0 0 0 1 0 23 107.2 101.1 0 0 0 0 0 0 0 0 0 0 1 24 107.3 101.3 0 0 0 0 0 0 0 0 0 0 0 25 107.5 101.2 1 0 0 0 0 0 0 0 0 0 0 26 107.6 101.6 0 1 0 0 0 0 0 0 0 0 0 27 107.6 101.7 0 0 1 0 0 0 0 0 0 0 0 28 107.7 101.5 0 0 0 1 0 0 0 0 0 0 0 29 107.7 100.9 0 0 0 0 1 0 0 0 0 0 0 30 107.7 101.5 0 0 0 0 0 1 0 0 0 0 0 31 107.7 101.4 0 0 0 0 0 0 1 0 0 0 0 32 107.6 101.6 0 0 0 0 0 0 0 1 0 0 0 33 107.7 101.7 0 0 0 0 0 0 0 0 1 0 0 34 107.9 101.4 0 0 0 0 0 0 0 0 0 1 0 35 107.9 101.8 0 0 0 0 0 0 0 0 0 0 1 36 107.9 101.7 0 0 0 0 0 0 0 0 0 0 0 37 107.8 101.4 1 0 0 0 0 0 0 0 0 0 0 38 107.6 101.2 0 1 0 0 0 0 0 0 0 0 0 39 107.4 101.0 0 0 1 0 0 0 0 0 0 0 0 40 107.0 101.7 0 0 0 1 0 0 0 0 0 0 0 41 107.0 102.4 0 0 0 0 1 0 0 0 0 0 0 42 107.2 102.0 0 0 0 0 0 1 0 0 0 0 0 43 107.5 102.1 0 0 0 0 0 0 1 0 0 0 0 44 107.8 102.0 0 0 0 0 0 0 0 1 0 0 0 45 107.8 101.8 0 0 0 0 0 0 0 0 1 0 0 46 107.7 102.7 0 0 0 0 0 0 0 0 0 1 0 47 107.6 102.3 0 0 0 0 0 0 0 0 0 0 1 48 107.6 101.9 0 0 0 0 0 0 0 0 0 0 0 49 107.5 102.0 1 0 0 0 0 0 0 0 0 0 0 50 107.5 102.3 0 1 0 0 0 0 0 0 0 0 0 51 107.6 102.8 0 0 1 0 0 0 0 0 0 0 0 52 107.6 102.4 0 0 0 1 0 0 0 0 0 0 0 53 107.9 102.3 0 0 0 0 1 0 0 0 0 0 0 54 107.6 102.7 0 0 0 0 0 1 0 0 0 0 0 55 107.5 102.7 0 0 0 0 0 0 1 0 0 0 0 56 107.5 102.9 0 0 0 0 0 0 0 1 0 0 0 57 107.6 103.0 0 0 0 0 0 0 0 0 1 0 0 58 107.7 102.2 0 0 0 0 0 0 0 0 0 1 0 59 107.8 102.3 0 0 0 0 0 0 0 0 0 0 1 60 107.9 102.8 0 0 0 0 0 0 0 0 0 0 0 61 107.9 102.8 1 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Inflatie M1 M2 M3 M4 136.68335 -0.28726 -0.29925 -0.51702 -0.47127 -0.49702 M5 M6 M7 M8 M9 M10 -0.39702 -0.40276 -0.35702 -0.28553 -0.20575 -0.07149 M11 -0.04298 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.4824 -0.6843 0.3464 0.5764 1.0463 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 136.68335 17.19068 7.951 2.61e-10 *** Inflatie -0.28726 0.16860 -1.704 0.0949 . M1 -0.29925 0.48792 -0.613 0.5426 M2 -0.51702 0.50885 -1.016 0.3147 M3 -0.47127 0.50895 -0.926 0.3591 M4 -0.49702 0.50885 -0.977 0.3336 M5 -0.39702 0.50885 -0.780 0.4391 M6 -0.40276 0.50877 -0.792 0.4325 M7 -0.35702 0.50885 -0.702 0.4863 M8 -0.28553 0.50907 -0.561 0.5775 M9 -0.20575 0.50868 -0.404 0.6877 M10 -0.07149 0.50871 -0.141 0.8888 M11 -0.04298 0.50885 -0.084 0.9330 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.8043 on 48 degrees of freedom Multiple R-squared: 0.1134, Adjusted R-squared: -0.1082 F-statistic: 0.5118 on 12 and 48 DF, p-value: 0.8967 > 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.8946317 0.2107366842 0.1053683421 [2,] 0.8587072 0.2825855741 0.1412927871 [3,] 0.8007833 0.3984334233 0.1992167117 [4,] 0.7739988 0.4520024311 0.2260012156 [5,] 0.8043854 0.3912291498 0.1956145749 [6,] 0.8643026 0.2713947512 0.1356973756 [7,] 0.9079625 0.1840749900 0.0920374950 [8,] 0.9386690 0.1226620835 0.0613310417 [9,] 0.9721161 0.0557677182 0.0278838591 [10,] 0.9913577 0.0172846994 0.0086423497 [11,] 0.9984279 0.0031441657 0.0015720829 [12,] 0.9994349 0.0011301896 0.0005650948 [13,] 0.9997731 0.0004537059 0.0002268530 [14,] 0.9996084 0.0007831708 0.0003915854 [15,] 0.9997811 0.0004378312 0.0002189156 [16,] 0.9997760 0.0004479174 0.0002239587 [17,] 0.9997114 0.0005771590 0.0002885795 [18,] 0.9997107 0.0005785672 0.0002892836 [19,] 0.9995956 0.0008087129 0.0004043565 [20,] 0.9995621 0.0008758592 0.0004379296 [21,] 0.9992913 0.0014174790 0.0007087395 [22,] 0.9985421 0.0029157634 0.0014578817 [23,] 0.9966422 0.0067156797 0.0033578398 [24,] 0.9915919 0.0168162768 0.0084081384 [25,] 0.9891379 0.0217242905 0.0108621452 [26,] 0.9985539 0.0028922493 0.0014461246 [27,] 0.9978108 0.0043783455 0.0021891727 [28,] 0.9929279 0.0141442044 0.0070721022 [29,] 0.9891056 0.0217888869 0.0108944434 [30,] 0.9932980 0.0134039899 0.0067019949 > postscript(file="/var/www/html/rcomp/tmp/10hh71258722060.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/2dthh1258722060.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/3jjpo1258722060.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/4mahb1258722060.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/5qg7t1258722060.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 61 Frequency = 1 1 2 3 4 5 6 -1.48243126 -1.32211487 -1.25403829 -0.92721059 -0.86975846 -0.89273931 7 8 9 10 11 12 -0.99593666 -1.05360530 -1.10574521 -0.94000000 -0.99723564 -1.08276436 13 14 15 16 17 18 -0.71115733 -0.52211487 -0.46786008 -0.60064949 -0.65810163 -0.72471283 19 20 21 22 23 24 -0.68427983 -0.69831812 -0.60682770 -0.51235641 -0.39831812 -0.28384684 25 26 27 28 29 30 0.18667770 0.61935051 0.60233137 0.67062444 0.39826803 0.57636966 31 32 33 34 35 36 0.50189837 0.38786008 0.43680265 0.41636966 0.50276436 0.43105743 37 38 39 40 41 42 0.54412984 0.50444623 0.20124888 0.02807658 0.12915906 0.22000000 43 44 45 46 47 48 0.50298086 0.70276436 0.56552872 0.58980855 0.34639470 0.18850957 49 50 51 52 53 54 0.41648625 0.72043299 0.91831812 0.82915906 1.00043299 0.82108248 55 56 57 58 59 60 0.67533727 0.66129898 0.71024154 0.44617821 0.54639470 0.74704419 61 1.04629480 > postscript(file="/var/www/html/rcomp/tmp/60kft1258722060.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.48243126 NA 1 -1.32211487 -1.48243126 2 -1.25403829 -1.32211487 3 -0.92721059 -1.25403829 4 -0.86975846 -0.92721059 5 -0.89273931 -0.86975846 6 -0.99593666 -0.89273931 7 -1.05360530 -0.99593666 8 -1.10574521 -1.05360530 9 -0.94000000 -1.10574521 10 -0.99723564 -0.94000000 11 -1.08276436 -0.99723564 12 -0.71115733 -1.08276436 13 -0.52211487 -0.71115733 14 -0.46786008 -0.52211487 15 -0.60064949 -0.46786008 16 -0.65810163 -0.60064949 17 -0.72471283 -0.65810163 18 -0.68427983 -0.72471283 19 -0.69831812 -0.68427983 20 -0.60682770 -0.69831812 21 -0.51235641 -0.60682770 22 -0.39831812 -0.51235641 23 -0.28384684 -0.39831812 24 0.18667770 -0.28384684 25 0.61935051 0.18667770 26 0.60233137 0.61935051 27 0.67062444 0.60233137 28 0.39826803 0.67062444 29 0.57636966 0.39826803 30 0.50189837 0.57636966 31 0.38786008 0.50189837 32 0.43680265 0.38786008 33 0.41636966 0.43680265 34 0.50276436 0.41636966 35 0.43105743 0.50276436 36 0.54412984 0.43105743 37 0.50444623 0.54412984 38 0.20124888 0.50444623 39 0.02807658 0.20124888 40 0.12915906 0.02807658 41 0.22000000 0.12915906 42 0.50298086 0.22000000 43 0.70276436 0.50298086 44 0.56552872 0.70276436 45 0.58980855 0.56552872 46 0.34639470 0.58980855 47 0.18850957 0.34639470 48 0.41648625 0.18850957 49 0.72043299 0.41648625 50 0.91831812 0.72043299 51 0.82915906 0.91831812 52 1.00043299 0.82915906 53 0.82108248 1.00043299 54 0.67533727 0.82108248 55 0.66129898 0.67533727 56 0.71024154 0.66129898 57 0.44617821 0.71024154 58 0.54639470 0.44617821 59 0.74704419 0.54639470 60 1.04629480 0.74704419 61 NA 1.04629480 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.32211487 -1.48243126 [2,] -1.25403829 -1.32211487 [3,] -0.92721059 -1.25403829 [4,] -0.86975846 -0.92721059 [5,] -0.89273931 -0.86975846 [6,] -0.99593666 -0.89273931 [7,] -1.05360530 -0.99593666 [8,] -1.10574521 -1.05360530 [9,] -0.94000000 -1.10574521 [10,] -0.99723564 -0.94000000 [11,] -1.08276436 -0.99723564 [12,] -0.71115733 -1.08276436 [13,] -0.52211487 -0.71115733 [14,] -0.46786008 -0.52211487 [15,] -0.60064949 -0.46786008 [16,] -0.65810163 -0.60064949 [17,] -0.72471283 -0.65810163 [18,] -0.68427983 -0.72471283 [19,] -0.69831812 -0.68427983 [20,] -0.60682770 -0.69831812 [21,] -0.51235641 -0.60682770 [22,] -0.39831812 -0.51235641 [23,] -0.28384684 -0.39831812 [24,] 0.18667770 -0.28384684 [25,] 0.61935051 0.18667770 [26,] 0.60233137 0.61935051 [27,] 0.67062444 0.60233137 [28,] 0.39826803 0.67062444 [29,] 0.57636966 0.39826803 [30,] 0.50189837 0.57636966 [31,] 0.38786008 0.50189837 [32,] 0.43680265 0.38786008 [33,] 0.41636966 0.43680265 [34,] 0.50276436 0.41636966 [35,] 0.43105743 0.50276436 [36,] 0.54412984 0.43105743 [37,] 0.50444623 0.54412984 [38,] 0.20124888 0.50444623 [39,] 0.02807658 0.20124888 [40,] 0.12915906 0.02807658 [41,] 0.22000000 0.12915906 [42,] 0.50298086 0.22000000 [43,] 0.70276436 0.50298086 [44,] 0.56552872 0.70276436 [45,] 0.58980855 0.56552872 [46,] 0.34639470 0.58980855 [47,] 0.18850957 0.34639470 [48,] 0.41648625 0.18850957 [49,] 0.72043299 0.41648625 [50,] 0.91831812 0.72043299 [51,] 0.82915906 0.91831812 [52,] 1.00043299 0.82915906 [53,] 0.82108248 1.00043299 [54,] 0.67533727 0.82108248 [55,] 0.66129898 0.67533727 [56,] 0.71024154 0.66129898 [57,] 0.44617821 0.71024154 [58,] 0.54639470 0.44617821 [59,] 0.74704419 0.54639470 [60,] 1.04629480 0.74704419 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.32211487 -1.48243126 2 -1.25403829 -1.32211487 3 -0.92721059 -1.25403829 4 -0.86975846 -0.92721059 5 -0.89273931 -0.86975846 6 -0.99593666 -0.89273931 7 -1.05360530 -0.99593666 8 -1.10574521 -1.05360530 9 -0.94000000 -1.10574521 10 -0.99723564 -0.94000000 11 -1.08276436 -0.99723564 12 -0.71115733 -1.08276436 13 -0.52211487 -0.71115733 14 -0.46786008 -0.52211487 15 -0.60064949 -0.46786008 16 -0.65810163 -0.60064949 17 -0.72471283 -0.65810163 18 -0.68427983 -0.72471283 19 -0.69831812 -0.68427983 20 -0.60682770 -0.69831812 21 -0.51235641 -0.60682770 22 -0.39831812 -0.51235641 23 -0.28384684 -0.39831812 24 0.18667770 -0.28384684 25 0.61935051 0.18667770 26 0.60233137 0.61935051 27 0.67062444 0.60233137 28 0.39826803 0.67062444 29 0.57636966 0.39826803 30 0.50189837 0.57636966 31 0.38786008 0.50189837 32 0.43680265 0.38786008 33 0.41636966 0.43680265 34 0.50276436 0.41636966 35 0.43105743 0.50276436 36 0.54412984 0.43105743 37 0.50444623 0.54412984 38 0.20124888 0.50444623 39 0.02807658 0.20124888 40 0.12915906 0.02807658 41 0.22000000 0.12915906 42 0.50298086 0.22000000 43 0.70276436 0.50298086 44 0.56552872 0.70276436 45 0.58980855 0.56552872 46 0.34639470 0.58980855 47 0.18850957 0.34639470 48 0.41648625 0.18850957 49 0.72043299 0.41648625 50 0.91831812 0.72043299 51 0.82915906 0.91831812 52 1.00043299 0.82915906 53 0.82108248 1.00043299 54 0.67533727 0.82108248 55 0.66129898 0.67533727 56 0.71024154 0.66129898 57 0.44617821 0.71024154 58 0.54639470 0.44617821 59 0.74704419 0.54639470 60 1.04629480 0.74704419 > 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/7zn4s1258722060.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/8al731258722060.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/93g6b1258722060.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/1041721258722060.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/11drlo1258722060.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/12cf8n1258722060.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/13sci41258722060.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/14wlfw1258722060.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/15bafj1258722060.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/16afcj1258722060.tab") + } > > system("convert tmp/10hh71258722060.ps tmp/10hh71258722060.png") > system("convert tmp/2dthh1258722060.ps tmp/2dthh1258722060.png") > system("convert tmp/3jjpo1258722060.ps tmp/3jjpo1258722060.png") > system("convert tmp/4mahb1258722060.ps tmp/4mahb1258722060.png") > system("convert tmp/5qg7t1258722060.ps tmp/5qg7t1258722060.png") > system("convert tmp/60kft1258722060.ps tmp/60kft1258722060.png") > system("convert tmp/7zn4s1258722060.ps tmp/7zn4s1258722060.png") > system("convert tmp/8al731258722060.ps tmp/8al731258722060.png") > system("convert tmp/93g6b1258722060.ps tmp/93g6b1258722060.png") > system("convert tmp/1041721258722060.ps tmp/1041721258722060.png") > > > proc.time() user system elapsed 2.415 1.554 3.388