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(8,11.1,8.1,10.9,7.7,10,7.5,9.2,7.6,9.2,7.8,9.5,7.8,9.6,7.8,9.5,7.5,9.1,7.5,8.9,7.1,9,7.5,10.1,7.5,10.3,7.6,10.2,7.7,9.6,7.7,9.2,7.9,9.3,8.1,9.4,8.2,9.4,8.2,9.2,8.2,9,7.9,9,7.3,9,6.9,9.8,6.6,10,6.7,9.8,6.9,9.3,7,9,7.1,9,7.2,9.1,7.1,9.1,6.9,9.1,7,9.2,6.8,8.8,6.4,8.3,6.7,8.4,6.6,8.1,6.4,7.7,6.3,7.9,6.2,7.9,6.5,8,6.8,7.9,6.8,7.6,6.4,7.1,6.1,6.8,5.8,6.5,6.1,6.9,7.2,8.2,7.3,8.7,6.9,8.3,6.1,7.9,5.8,7.5,6.2,7.8,7.1,8.3,7.7,8.4,7.9,8.2,7.7,7.7,7.4,7.2,7.5,7.3,8,8.1),dim=c(2,60),dimnames=list(c('X','Y'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('X','Y'),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 = '2' > #'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 Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 11.1 8.0 1 0 0 0 0 0 0 0 0 0 0 2 10.9 8.1 0 1 0 0 0 0 0 0 0 0 0 3 10.0 7.7 0 0 1 0 0 0 0 0 0 0 0 4 9.2 7.5 0 0 0 1 0 0 0 0 0 0 0 5 9.2 7.6 0 0 0 0 1 0 0 0 0 0 0 6 9.5 7.8 0 0 0 0 0 1 0 0 0 0 0 7 9.6 7.8 0 0 0 0 0 0 1 0 0 0 0 8 9.5 7.8 0 0 0 0 0 0 0 1 0 0 0 9 9.1 7.5 0 0 0 0 0 0 0 0 1 0 0 10 8.9 7.5 0 0 0 0 0 0 0 0 0 1 0 11 9.0 7.1 0 0 0 0 0 0 0 0 0 0 1 12 10.1 7.5 0 0 0 0 0 0 0 0 0 0 0 13 10.3 7.5 1 0 0 0 0 0 0 0 0 0 0 14 10.2 7.6 0 1 0 0 0 0 0 0 0 0 0 15 9.6 7.7 0 0 1 0 0 0 0 0 0 0 0 16 9.2 7.7 0 0 0 1 0 0 0 0 0 0 0 17 9.3 7.9 0 0 0 0 1 0 0 0 0 0 0 18 9.4 8.1 0 0 0 0 0 1 0 0 0 0 0 19 9.4 8.2 0 0 0 0 0 0 1 0 0 0 0 20 9.2 8.2 0 0 0 0 0 0 0 1 0 0 0 21 9.0 8.2 0 0 0 0 0 0 0 0 1 0 0 22 9.0 7.9 0 0 0 0 0 0 0 0 0 1 0 23 9.0 7.3 0 0 0 0 0 0 0 0 0 0 1 24 9.8 6.9 0 0 0 0 0 0 0 0 0 0 0 25 10.0 6.6 1 0 0 0 0 0 0 0 0 0 0 26 9.8 6.7 0 1 0 0 0 0 0 0 0 0 0 27 9.3 6.9 0 0 1 0 0 0 0 0 0 0 0 28 9.0 7.0 0 0 0 1 0 0 0 0 0 0 0 29 9.0 7.1 0 0 0 0 1 0 0 0 0 0 0 30 9.1 7.2 0 0 0 0 0 1 0 0 0 0 0 31 9.1 7.1 0 0 0 0 0 0 1 0 0 0 0 32 9.1 6.9 0 0 0 0 0 0 0 1 0 0 0 33 9.2 7.0 0 0 0 0 0 0 0 0 1 0 0 34 8.8 6.8 0 0 0 0 0 0 0 0 0 1 0 35 8.3 6.4 0 0 0 0 0 0 0 0 0 0 1 36 8.4 6.7 0 0 0 0 0 0 0 0 0 0 0 37 8.1 6.6 1 0 0 0 0 0 0 0 0 0 0 38 7.7 6.4 0 1 0 0 0 0 0 0 0 0 0 39 7.9 6.3 0 0 1 0 0 0 0 0 0 0 0 40 7.9 6.2 0 0 0 1 0 0 0 0 0 0 0 41 8.0 6.5 0 0 0 0 1 0 0 0 0 0 0 42 7.9 6.8 0 0 0 0 0 1 0 0 0 0 0 43 7.6 6.8 0 0 0 0 0 0 1 0 0 0 0 44 7.1 6.4 0 0 0 0 0 0 0 1 0 0 0 45 6.8 6.1 0 0 0 0 0 0 0 0 1 0 0 46 6.5 5.8 0 0 0 0 0 0 0 0 0 1 0 47 6.9 6.1 0 0 0 0 0 0 0 0 0 0 1 48 8.2 7.2 0 0 0 0 0 0 0 0 0 0 0 49 8.7 7.3 1 0 0 0 0 0 0 0 0 0 0 50 8.3 6.9 0 1 0 0 0 0 0 0 0 0 0 51 7.9 6.1 0 0 1 0 0 0 0 0 0 0 0 52 7.5 5.8 0 0 0 1 0 0 0 0 0 0 0 53 7.8 6.2 0 0 0 0 1 0 0 0 0 0 0 54 8.3 7.1 0 0 0 0 0 1 0 0 0 0 0 55 8.4 7.7 0 0 0 0 0 0 1 0 0 0 0 56 8.2 7.9 0 0 0 0 0 0 0 1 0 0 0 57 7.7 7.7 0 0 0 0 0 0 0 0 1 0 0 58 7.2 7.4 0 0 0 0 0 0 0 0 0 1 0 59 7.3 7.5 0 0 0 0 0 0 0 0 0 0 1 60 8.1 8.0 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) X M1 M2 M3 M4 1.81401 0.97879 0.77873 0.57745 0.33321 0.05109 M5 M6 M7 M8 M9 M10 -0.06424 -0.21703 -0.35448 -0.47618 -0.59915 -0.66382 M11 -0.44806 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.54430 -0.39249 -0.02591 0.49317 1.23236 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.81401 1.16410 1.558 0.126 X 0.97879 0.15382 6.363 7.58e-08 *** M1 0.77873 0.46479 1.675 0.100 M2 0.57745 0.46507 1.242 0.221 M3 0.33321 0.46730 0.713 0.479 M4 0.05109 0.46917 0.109 0.914 M5 -0.06424 0.46572 -0.138 0.891 M6 -0.21703 0.46520 -0.467 0.643 M7 -0.35448 0.46642 -0.760 0.451 M8 -0.47618 0.46552 -1.023 0.312 M9 -0.59915 0.46474 -1.289 0.204 M10 -0.66382 0.46552 -1.426 0.160 M11 -0.44806 0.46836 -0.957 0.344 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.7348 on 47 degrees of freedom Multiple R-squared: 0.5698, Adjusted R-squared: 0.46 F-statistic: 5.189 on 12 and 47 DF, p-value: 1.873e-05 > 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,] 2.231807e-02 4.463615e-02 0.977681927 [2,] 7.975156e-03 1.595031e-02 0.992024844 [3,] 4.951862e-03 9.903725e-03 0.995048138 [4,] 4.310934e-03 8.621868e-03 0.995689066 [5,] 3.220398e-03 6.440797e-03 0.996779602 [6,] 1.488596e-03 2.977192e-03 0.998511404 [7,] 4.736565e-04 9.473130e-04 0.999526343 [8,] 1.684731e-04 3.369462e-04 0.999831527 [9,] 9.483922e-05 1.896784e-04 0.999905161 [10,] 7.601792e-05 1.520358e-04 0.999923982 [11,] 6.691148e-05 1.338230e-04 0.999933089 [12,] 2.876500e-05 5.753000e-05 0.999971235 [13,] 1.127625e-05 2.255251e-05 0.999988724 [14,] 4.178655e-06 8.357310e-06 0.999995821 [15,] 1.671173e-06 3.342347e-06 0.999998329 [16,] 9.681473e-07 1.936295e-06 0.999999032 [17,] 2.416550e-06 4.833101e-06 0.999997583 [18,] 1.059736e-04 2.119472e-04 0.999894026 [19,] 7.155767e-03 1.431153e-02 0.992844233 [20,] 2.838112e-01 5.676223e-01 0.716188847 [21,] 9.378330e-01 1.243339e-01 0.062166959 [22,] 9.946583e-01 1.068348e-02 0.005341740 [23,] 9.983123e-01 3.375315e-03 0.001687657 [24,] 9.961536e-01 7.692756e-03 0.003846378 [25,] 9.909155e-01 1.816890e-02 0.009084451 [26,] 9.762772e-01 4.744558e-02 0.023722790 [27,] 9.552751e-01 8.944987e-02 0.044724935 [28,] 9.367943e-01 1.264114e-01 0.063205710 [29,] 9.300107e-01 1.399786e-01 0.069989304 > postscript(file="/var/www/html/rcomp/tmp/1hosn1258486329.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/2wp991258486329.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/3b67q1258486329.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/4boxd1258486329.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/5cscb1258486329.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 0.676970547 0.580364656 0.316122020 -0.005999299 0.011455119 0.268485273 7 8 9 10 11 12 0.505939691 0.527636746 0.544242637 0.408909537 0.684666900 0.945091164 13 14 15 16 17 18 0.366363955 0.369758065 -0.083877980 -0.201756662 -0.182180926 -0.125150771 19 20 21 22 23 24 -0.085575035 -0.163877980 -0.240908135 0.117394811 0.488909537 1.232363254 25 26 27 28 29 30 0.947272090 0.850666199 0.399151473 0.283394109 0.300848527 0.455757363 31 32 33 34 35 36 0.691090463 1.008544881 1.133636045 0.994060309 0.669817672 0.028120617 37 38 39 40 41 42 -0.952727910 -0.955697756 -0.413576438 -0.033576438 -0.111879383 -0.352727910 43 44 45 46 47 48 -0.515273492 -0.502061711 -0.385455820 -0.327152875 -0.436546283 -0.661272791 49 50 51 52 53 54 -1.037878682 -0.845091164 -0.217819074 -0.042061711 -0.018243338 -0.246363955 55 56 57 58 59 60 -0.596181627 -0.870241935 -1.051514727 -1.193211781 -1.406847826 -1.544302244 > postscript(file="/var/www/html/rcomp/tmp/6drf01258486329.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 0.676970547 NA 1 0.580364656 0.676970547 2 0.316122020 0.580364656 3 -0.005999299 0.316122020 4 0.011455119 -0.005999299 5 0.268485273 0.011455119 6 0.505939691 0.268485273 7 0.527636746 0.505939691 8 0.544242637 0.527636746 9 0.408909537 0.544242637 10 0.684666900 0.408909537 11 0.945091164 0.684666900 12 0.366363955 0.945091164 13 0.369758065 0.366363955 14 -0.083877980 0.369758065 15 -0.201756662 -0.083877980 16 -0.182180926 -0.201756662 17 -0.125150771 -0.182180926 18 -0.085575035 -0.125150771 19 -0.163877980 -0.085575035 20 -0.240908135 -0.163877980 21 0.117394811 -0.240908135 22 0.488909537 0.117394811 23 1.232363254 0.488909537 24 0.947272090 1.232363254 25 0.850666199 0.947272090 26 0.399151473 0.850666199 27 0.283394109 0.399151473 28 0.300848527 0.283394109 29 0.455757363 0.300848527 30 0.691090463 0.455757363 31 1.008544881 0.691090463 32 1.133636045 1.008544881 33 0.994060309 1.133636045 34 0.669817672 0.994060309 35 0.028120617 0.669817672 36 -0.952727910 0.028120617 37 -0.955697756 -0.952727910 38 -0.413576438 -0.955697756 39 -0.033576438 -0.413576438 40 -0.111879383 -0.033576438 41 -0.352727910 -0.111879383 42 -0.515273492 -0.352727910 43 -0.502061711 -0.515273492 44 -0.385455820 -0.502061711 45 -0.327152875 -0.385455820 46 -0.436546283 -0.327152875 47 -0.661272791 -0.436546283 48 -1.037878682 -0.661272791 49 -0.845091164 -1.037878682 50 -0.217819074 -0.845091164 51 -0.042061711 -0.217819074 52 -0.018243338 -0.042061711 53 -0.246363955 -0.018243338 54 -0.596181627 -0.246363955 55 -0.870241935 -0.596181627 56 -1.051514727 -0.870241935 57 -1.193211781 -1.051514727 58 -1.406847826 -1.193211781 59 -1.544302244 -1.406847826 60 NA -1.544302244 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.580364656 0.676970547 [2,] 0.316122020 0.580364656 [3,] -0.005999299 0.316122020 [4,] 0.011455119 -0.005999299 [5,] 0.268485273 0.011455119 [6,] 0.505939691 0.268485273 [7,] 0.527636746 0.505939691 [8,] 0.544242637 0.527636746 [9,] 0.408909537 0.544242637 [10,] 0.684666900 0.408909537 [11,] 0.945091164 0.684666900 [12,] 0.366363955 0.945091164 [13,] 0.369758065 0.366363955 [14,] -0.083877980 0.369758065 [15,] -0.201756662 -0.083877980 [16,] -0.182180926 -0.201756662 [17,] -0.125150771 -0.182180926 [18,] -0.085575035 -0.125150771 [19,] -0.163877980 -0.085575035 [20,] -0.240908135 -0.163877980 [21,] 0.117394811 -0.240908135 [22,] 0.488909537 0.117394811 [23,] 1.232363254 0.488909537 [24,] 0.947272090 1.232363254 [25,] 0.850666199 0.947272090 [26,] 0.399151473 0.850666199 [27,] 0.283394109 0.399151473 [28,] 0.300848527 0.283394109 [29,] 0.455757363 0.300848527 [30,] 0.691090463 0.455757363 [31,] 1.008544881 0.691090463 [32,] 1.133636045 1.008544881 [33,] 0.994060309 1.133636045 [34,] 0.669817672 0.994060309 [35,] 0.028120617 0.669817672 [36,] -0.952727910 0.028120617 [37,] -0.955697756 -0.952727910 [38,] -0.413576438 -0.955697756 [39,] -0.033576438 -0.413576438 [40,] -0.111879383 -0.033576438 [41,] -0.352727910 -0.111879383 [42,] -0.515273492 -0.352727910 [43,] -0.502061711 -0.515273492 [44,] -0.385455820 -0.502061711 [45,] -0.327152875 -0.385455820 [46,] -0.436546283 -0.327152875 [47,] -0.661272791 -0.436546283 [48,] -1.037878682 -0.661272791 [49,] -0.845091164 -1.037878682 [50,] -0.217819074 -0.845091164 [51,] -0.042061711 -0.217819074 [52,] -0.018243338 -0.042061711 [53,] -0.246363955 -0.018243338 [54,] -0.596181627 -0.246363955 [55,] -0.870241935 -0.596181627 [56,] -1.051514727 -0.870241935 [57,] -1.193211781 -1.051514727 [58,] -1.406847826 -1.193211781 [59,] -1.544302244 -1.406847826 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.580364656 0.676970547 2 0.316122020 0.580364656 3 -0.005999299 0.316122020 4 0.011455119 -0.005999299 5 0.268485273 0.011455119 6 0.505939691 0.268485273 7 0.527636746 0.505939691 8 0.544242637 0.527636746 9 0.408909537 0.544242637 10 0.684666900 0.408909537 11 0.945091164 0.684666900 12 0.366363955 0.945091164 13 0.369758065 0.366363955 14 -0.083877980 0.369758065 15 -0.201756662 -0.083877980 16 -0.182180926 -0.201756662 17 -0.125150771 -0.182180926 18 -0.085575035 -0.125150771 19 -0.163877980 -0.085575035 20 -0.240908135 -0.163877980 21 0.117394811 -0.240908135 22 0.488909537 0.117394811 23 1.232363254 0.488909537 24 0.947272090 1.232363254 25 0.850666199 0.947272090 26 0.399151473 0.850666199 27 0.283394109 0.399151473 28 0.300848527 0.283394109 29 0.455757363 0.300848527 30 0.691090463 0.455757363 31 1.008544881 0.691090463 32 1.133636045 1.008544881 33 0.994060309 1.133636045 34 0.669817672 0.994060309 35 0.028120617 0.669817672 36 -0.952727910 0.028120617 37 -0.955697756 -0.952727910 38 -0.413576438 -0.955697756 39 -0.033576438 -0.413576438 40 -0.111879383 -0.033576438 41 -0.352727910 -0.111879383 42 -0.515273492 -0.352727910 43 -0.502061711 -0.515273492 44 -0.385455820 -0.502061711 45 -0.327152875 -0.385455820 46 -0.436546283 -0.327152875 47 -0.661272791 -0.436546283 48 -1.037878682 -0.661272791 49 -0.845091164 -1.037878682 50 -0.217819074 -0.845091164 51 -0.042061711 -0.217819074 52 -0.018243338 -0.042061711 53 -0.246363955 -0.018243338 54 -0.596181627 -0.246363955 55 -0.870241935 -0.596181627 56 -1.051514727 -0.870241935 57 -1.193211781 -1.051514727 58 -1.406847826 -1.193211781 59 -1.544302244 -1.406847826 > 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/7b7fk1258486329.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/8j7m21258486329.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/9kik21258486329.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/10ic421258486329.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/11sjgj1258486329.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/12k1e81258486329.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/13upci1258486329.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/142pkf1258486329.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/15htoy1258486329.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/163ugc1258486329.tab") + } > > system("convert tmp/1hosn1258486329.ps tmp/1hosn1258486329.png") > system("convert tmp/2wp991258486329.ps tmp/2wp991258486329.png") > system("convert tmp/3b67q1258486329.ps tmp/3b67q1258486329.png") > system("convert tmp/4boxd1258486329.ps tmp/4boxd1258486329.png") > system("convert tmp/5cscb1258486329.ps tmp/5cscb1258486329.png") > system("convert tmp/6drf01258486329.ps tmp/6drf01258486329.png") > system("convert tmp/7b7fk1258486329.ps tmp/7b7fk1258486329.png") > system("convert tmp/8j7m21258486329.ps tmp/8j7m21258486329.png") > system("convert tmp/9kik21258486329.ps tmp/9kik21258486329.png") > system("convert tmp/10ic421258486329.ps tmp/10ic421258486329.png") > > > proc.time() user system elapsed 2.469 1.574 3.521