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(107.1,32.5,115.6,100.6,33.5,111.9,99.2,31.5,107,108.4,31.2,107.1,103,27,100.6,99.8,26.7,99.2,115,26.5,108.4,90.8,26,103,95.9,27.2,99.8,114.4,30.5,115,108.2,33.7,90.8,112.6,34.2,95.9,109.1,36.7,114.4,105,36.2,108.2,105,38.5,112.6,118.5,40,109.1,103.7,42.5,105,112.5,43.5,105,116.6,43.3,118.5,96.6,45.5,103.7,101.9,44.3,112.5,116.5,43,116.6,119.3,43.5,96.6,115.4,41.5,101.9,108.5,42.5,116.5,111.5,41.3,119.3,108.8,39.5,115.4,121.8,38.5,108.5,109.6,41,111.5,112.2,44.5,108.8,119.6,46,121.8,104.1,44,109.6,105.3,41.5,112.2,115,41.3,119.6,124.1,38,104.1,116.8,38,105.3,107.5,36.2,115,115.6,38.7,124.1,116.2,38.7,116.8,116.3,39.2,107.5,119,35.7,115.6,111.9,36.5,116.2,118.6,36.7,116.3,106.9,34.7,119,103.2,35,111.9,118.6,28.2,118.6,118.7,23.7,106.9,102.8,15,103.2,100.6,8.7,118.6,94.9,11,118.7,94.5,7.5,102.8,102.9,5.7,100.6,95.3,9.3,94.9,92.5,10.2,94.5,102.7,15.7,102.9,91.5,18.1,95.3,89.5,20.8,92.5),dim=c(3,57),dimnames=list(c('Ipzb','Cvn','Y3'),1:57)) > y <- array(NA,dim=c(3,57),dimnames=list(c('Ipzb','Cvn','Y3'),1:57)) > 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 Ipzb Cvn Y3 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 107.1 32.5 115.6 1 0 0 0 0 0 0 0 0 0 0 1 2 100.6 33.5 111.9 0 1 0 0 0 0 0 0 0 0 0 2 3 99.2 31.5 107.0 0 0 1 0 0 0 0 0 0 0 0 3 4 108.4 31.2 107.1 0 0 0 1 0 0 0 0 0 0 0 4 5 103.0 27.0 100.6 0 0 0 0 1 0 0 0 0 0 0 5 6 99.8 26.7 99.2 0 0 0 0 0 1 0 0 0 0 0 6 7 115.0 26.5 108.4 0 0 0 0 0 0 1 0 0 0 0 7 8 90.8 26.0 103.0 0 0 0 0 0 0 0 1 0 0 0 8 9 95.9 27.2 99.8 0 0 0 0 0 0 0 0 1 0 0 9 10 114.4 30.5 115.0 0 0 0 0 0 0 0 0 0 1 0 10 11 108.2 33.7 90.8 0 0 0 0 0 0 0 0 0 0 1 11 12 112.6 34.2 95.9 0 0 0 0 0 0 0 0 0 0 0 12 13 109.1 36.7 114.4 1 0 0 0 0 0 0 0 0 0 0 13 14 105.0 36.2 108.2 0 1 0 0 0 0 0 0 0 0 0 14 15 105.0 38.5 112.6 0 0 1 0 0 0 0 0 0 0 0 15 16 118.5 40.0 109.1 0 0 0 1 0 0 0 0 0 0 0 16 17 103.7 42.5 105.0 0 0 0 0 1 0 0 0 0 0 0 17 18 112.5 43.5 105.0 0 0 0 0 0 1 0 0 0 0 0 18 19 116.6 43.3 118.5 0 0 0 0 0 0 1 0 0 0 0 19 20 96.6 45.5 103.7 0 0 0 0 0 0 0 1 0 0 0 20 21 101.9 44.3 112.5 0 0 0 0 0 0 0 0 1 0 0 21 22 116.5 43.0 116.6 0 0 0 0 0 0 0 0 0 1 0 22 23 119.3 43.5 96.6 0 0 0 0 0 0 0 0 0 0 1 23 24 115.4 41.5 101.9 0 0 0 0 0 0 0 0 0 0 0 24 25 108.5 42.5 116.5 1 0 0 0 0 0 0 0 0 0 0 25 26 111.5 41.3 119.3 0 1 0 0 0 0 0 0 0 0 0 26 27 108.8 39.5 115.4 0 0 1 0 0 0 0 0 0 0 0 27 28 121.8 38.5 108.5 0 0 0 1 0 0 0 0 0 0 0 28 29 109.6 41.0 111.5 0 0 0 0 1 0 0 0 0 0 0 29 30 112.2 44.5 108.8 0 0 0 0 0 1 0 0 0 0 0 30 31 119.6 46.0 121.8 0 0 0 0 0 0 1 0 0 0 0 31 32 104.1 44.0 109.6 0 0 0 0 0 0 0 1 0 0 0 32 33 105.3 41.5 112.2 0 0 0 0 0 0 0 0 1 0 0 33 34 115.0 41.3 119.6 0 0 0 0 0 0 0 0 0 1 0 34 35 124.1 38.0 104.1 0 0 0 0 0 0 0 0 0 0 1 35 36 116.8 38.0 105.3 0 0 0 0 0 0 0 0 0 0 0 36 37 107.5 36.2 115.0 1 0 0 0 0 0 0 0 0 0 0 37 38 115.6 38.7 124.1 0 1 0 0 0 0 0 0 0 0 0 38 39 116.2 38.7 116.8 0 0 1 0 0 0 0 0 0 0 0 39 40 116.3 39.2 107.5 0 0 0 1 0 0 0 0 0 0 0 40 41 119.0 35.7 115.6 0 0 0 0 1 0 0 0 0 0 0 41 42 111.9 36.5 116.2 0 0 0 0 0 1 0 0 0 0 0 42 43 118.6 36.7 116.3 0 0 0 0 0 0 1 0 0 0 0 43 44 106.9 34.7 119.0 0 0 0 0 0 0 0 1 0 0 0 44 45 103.2 35.0 111.9 0 0 0 0 0 0 0 0 1 0 0 45 46 118.6 28.2 118.6 0 0 0 0 0 0 0 0 0 1 0 46 47 118.7 23.7 106.9 0 0 0 0 0 0 0 0 0 0 1 47 48 102.8 15.0 103.2 0 0 0 0 0 0 0 0 0 0 0 48 49 100.6 8.7 118.6 1 0 0 0 0 0 0 0 0 0 0 49 50 94.9 11.0 118.7 0 1 0 0 0 0 0 0 0 0 0 50 51 94.5 7.5 102.8 0 0 1 0 0 0 0 0 0 0 0 51 52 102.9 5.7 100.6 0 0 0 1 0 0 0 0 0 0 0 52 53 95.3 9.3 94.9 0 0 0 0 1 0 0 0 0 0 0 53 54 92.5 10.2 94.5 0 0 0 0 0 1 0 0 0 0 0 54 55 102.7 15.7 102.9 0 0 0 0 0 0 1 0 0 0 0 55 56 91.5 18.1 95.3 0 0 0 0 0 0 0 1 0 0 0 56 57 89.5 20.8 92.5 0 0 0 0 0 0 0 0 1 0 0 57 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Cvn Y3 M1 M2 M3 51.00218 0.35852 0.46914 -11.52516 -13.11318 -11.00202 M4 M5 M6 M7 M8 M9 -0.09471 -7.18834 -7.64246 -3.61421 -16.69862 -15.45196 M10 M11 t -4.39026 5.74431 0.05700 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -5.5792 -1.9278 0.1342 2.0260 6.8579 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 51.00218 8.63695 5.905 5.44e-07 *** Cvn 0.35852 0.06060 5.917 5.24e-07 *** Y3 0.46914 0.09786 4.794 2.07e-05 *** M1 -11.52516 2.71509 -4.245 0.000118 *** M2 -13.11318 2.70851 -4.841 1.78e-05 *** M3 -11.00202 2.45663 -4.478 5.67e-05 *** M4 -0.09471 2.31307 -0.041 0.967533 M5 -7.18834 2.28449 -3.147 0.003034 ** M6 -7.64246 2.26065 -3.381 0.001573 ** M7 -3.61421 2.49769 -1.447 0.155314 M8 -16.69862 2.27069 -7.354 4.55e-09 *** M9 -15.45196 2.26478 -6.823 2.61e-08 *** M10 -4.39026 2.77136 -1.584 0.120660 M11 5.74431 2.37975 2.414 0.020224 * t 0.05700 0.03452 1.651 0.106214 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.339 on 42 degrees of freedom Multiple R-squared: 0.8938, Adjusted R-squared: 0.8584 F-statistic: 25.24 on 14 and 42 DF, p-value: 5.53e-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.8738480 0.2523041 0.1261520 [2,] 0.8744281 0.2511438 0.1255719 [3,] 0.8040843 0.3918314 0.1959157 [4,] 0.6986596 0.6026808 0.3013404 [5,] 0.6278730 0.7442540 0.3721270 [6,] 0.6396550 0.7206900 0.3603450 [7,] 0.5857424 0.8285152 0.4142576 [8,] 0.6243791 0.7512419 0.3756209 [9,] 0.5720575 0.8558849 0.4279425 [10,] 0.4885695 0.9771391 0.5114305 [11,] 0.5901489 0.8197023 0.4098511 [12,] 0.5941704 0.8116593 0.4058296 [13,] 0.5128899 0.9742202 0.4871101 [14,] 0.4705284 0.9410568 0.5294716 [15,] 0.4088327 0.8176653 0.5911673 [16,] 0.3304283 0.6608566 0.6695717 [17,] 0.6603174 0.6793651 0.3396826 [18,] 0.5679478 0.8641043 0.4320522 [19,] 0.5253237 0.9493526 0.4746763 [20,] 0.5698879 0.8602241 0.4301121 [21,] 0.7321494 0.5357012 0.2678506 [22,] 0.6834626 0.6330748 0.3165374 > postscript(file="/var/www/html/rcomp/tmp/1d6ct1258729285.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/2mlgh1258729285.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/3ez2b1258729285.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/4iway1258729285.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/59a3e1258729285.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 = 57 Frequency = 1 1 2 3 4 5 6 1.68187474 -1.90981693 -2.46216028 -4.16582713 2.02598092 -0.01254304 7 8 9 10 11 12 6.85786099 -1.60212904 3.26522782 2.33254021 -3.85319562 3.66226318 13 14 15 16 17 18 2.05510299 2.57403430 -2.48291935 1.15696676 -5.57924500 3.25936239 19 20 21 22 23 24 -2.98752030 -3.80563511 -3.50746460 -1.48353993 0.32835853 0.34629316 25 26 27 28 29 30 -2.29345303 1.35421515 -1.03896890 4.59228425 -2.87479628 0.13417640 31 32 33 34 35 36 -3.18762419 0.78029548 0.35318957 -4.46540940 2.89775579 0.72210736 37 38 39 40 41 42 -1.01501076 3.45056920 5.30711083 -1.37349043 5.81796064 -1.45320958 43 44 45 46 47 48 1.04292760 1.82071423 0.04037236 3.61640912 0.62708131 -4.73066370 49 50 51 52 53 54 -0.42851394 -5.46900172 0.67693770 -0.20993345 0.61009972 -1.92778618 55 56 57 -1.72564410 2.80675444 -0.15132515 > postscript(file="/var/www/html/rcomp/tmp/6badh1258729285.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 = 57 Frequency = 1 lag(myerror, k = 1) myerror 0 1.68187474 NA 1 -1.90981693 1.68187474 2 -2.46216028 -1.90981693 3 -4.16582713 -2.46216028 4 2.02598092 -4.16582713 5 -0.01254304 2.02598092 6 6.85786099 -0.01254304 7 -1.60212904 6.85786099 8 3.26522782 -1.60212904 9 2.33254021 3.26522782 10 -3.85319562 2.33254021 11 3.66226318 -3.85319562 12 2.05510299 3.66226318 13 2.57403430 2.05510299 14 -2.48291935 2.57403430 15 1.15696676 -2.48291935 16 -5.57924500 1.15696676 17 3.25936239 -5.57924500 18 -2.98752030 3.25936239 19 -3.80563511 -2.98752030 20 -3.50746460 -3.80563511 21 -1.48353993 -3.50746460 22 0.32835853 -1.48353993 23 0.34629316 0.32835853 24 -2.29345303 0.34629316 25 1.35421515 -2.29345303 26 -1.03896890 1.35421515 27 4.59228425 -1.03896890 28 -2.87479628 4.59228425 29 0.13417640 -2.87479628 30 -3.18762419 0.13417640 31 0.78029548 -3.18762419 32 0.35318957 0.78029548 33 -4.46540940 0.35318957 34 2.89775579 -4.46540940 35 0.72210736 2.89775579 36 -1.01501076 0.72210736 37 3.45056920 -1.01501076 38 5.30711083 3.45056920 39 -1.37349043 5.30711083 40 5.81796064 -1.37349043 41 -1.45320958 5.81796064 42 1.04292760 -1.45320958 43 1.82071423 1.04292760 44 0.04037236 1.82071423 45 3.61640912 0.04037236 46 0.62708131 3.61640912 47 -4.73066370 0.62708131 48 -0.42851394 -4.73066370 49 -5.46900172 -0.42851394 50 0.67693770 -5.46900172 51 -0.20993345 0.67693770 52 0.61009972 -0.20993345 53 -1.92778618 0.61009972 54 -1.72564410 -1.92778618 55 2.80675444 -1.72564410 56 -0.15132515 2.80675444 57 NA -0.15132515 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.90981693 1.68187474 [2,] -2.46216028 -1.90981693 [3,] -4.16582713 -2.46216028 [4,] 2.02598092 -4.16582713 [5,] -0.01254304 2.02598092 [6,] 6.85786099 -0.01254304 [7,] -1.60212904 6.85786099 [8,] 3.26522782 -1.60212904 [9,] 2.33254021 3.26522782 [10,] -3.85319562 2.33254021 [11,] 3.66226318 -3.85319562 [12,] 2.05510299 3.66226318 [13,] 2.57403430 2.05510299 [14,] -2.48291935 2.57403430 [15,] 1.15696676 -2.48291935 [16,] -5.57924500 1.15696676 [17,] 3.25936239 -5.57924500 [18,] -2.98752030 3.25936239 [19,] -3.80563511 -2.98752030 [20,] -3.50746460 -3.80563511 [21,] -1.48353993 -3.50746460 [22,] 0.32835853 -1.48353993 [23,] 0.34629316 0.32835853 [24,] -2.29345303 0.34629316 [25,] 1.35421515 -2.29345303 [26,] -1.03896890 1.35421515 [27,] 4.59228425 -1.03896890 [28,] -2.87479628 4.59228425 [29,] 0.13417640 -2.87479628 [30,] -3.18762419 0.13417640 [31,] 0.78029548 -3.18762419 [32,] 0.35318957 0.78029548 [33,] -4.46540940 0.35318957 [34,] 2.89775579 -4.46540940 [35,] 0.72210736 2.89775579 [36,] -1.01501076 0.72210736 [37,] 3.45056920 -1.01501076 [38,] 5.30711083 3.45056920 [39,] -1.37349043 5.30711083 [40,] 5.81796064 -1.37349043 [41,] -1.45320958 5.81796064 [42,] 1.04292760 -1.45320958 [43,] 1.82071423 1.04292760 [44,] 0.04037236 1.82071423 [45,] 3.61640912 0.04037236 [46,] 0.62708131 3.61640912 [47,] -4.73066370 0.62708131 [48,] -0.42851394 -4.73066370 [49,] -5.46900172 -0.42851394 [50,] 0.67693770 -5.46900172 [51,] -0.20993345 0.67693770 [52,] 0.61009972 -0.20993345 [53,] -1.92778618 0.61009972 [54,] -1.72564410 -1.92778618 [55,] 2.80675444 -1.72564410 [56,] -0.15132515 2.80675444 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.90981693 1.68187474 2 -2.46216028 -1.90981693 3 -4.16582713 -2.46216028 4 2.02598092 -4.16582713 5 -0.01254304 2.02598092 6 6.85786099 -0.01254304 7 -1.60212904 6.85786099 8 3.26522782 -1.60212904 9 2.33254021 3.26522782 10 -3.85319562 2.33254021 11 3.66226318 -3.85319562 12 2.05510299 3.66226318 13 2.57403430 2.05510299 14 -2.48291935 2.57403430 15 1.15696676 -2.48291935 16 -5.57924500 1.15696676 17 3.25936239 -5.57924500 18 -2.98752030 3.25936239 19 -3.80563511 -2.98752030 20 -3.50746460 -3.80563511 21 -1.48353993 -3.50746460 22 0.32835853 -1.48353993 23 0.34629316 0.32835853 24 -2.29345303 0.34629316 25 1.35421515 -2.29345303 26 -1.03896890 1.35421515 27 4.59228425 -1.03896890 28 -2.87479628 4.59228425 29 0.13417640 -2.87479628 30 -3.18762419 0.13417640 31 0.78029548 -3.18762419 32 0.35318957 0.78029548 33 -4.46540940 0.35318957 34 2.89775579 -4.46540940 35 0.72210736 2.89775579 36 -1.01501076 0.72210736 37 3.45056920 -1.01501076 38 5.30711083 3.45056920 39 -1.37349043 5.30711083 40 5.81796064 -1.37349043 41 -1.45320958 5.81796064 42 1.04292760 -1.45320958 43 1.82071423 1.04292760 44 0.04037236 1.82071423 45 3.61640912 0.04037236 46 0.62708131 3.61640912 47 -4.73066370 0.62708131 48 -0.42851394 -4.73066370 49 -5.46900172 -0.42851394 50 0.67693770 -5.46900172 51 -0.20993345 0.67693770 52 0.61009972 -0.20993345 53 -1.92778618 0.61009972 54 -1.72564410 -1.92778618 55 2.80675444 -1.72564410 56 -0.15132515 2.80675444 > 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/70oak1258729285.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/81cf71258729285.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/9vzby1258729285.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/10pqtb1258729285.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/113f2j1258729285.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/12t6z91258729285.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/13vz4v1258729285.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/140rvi1258729285.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/15inon1258729285.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/166zz91258729285.tab") + } > > system("convert tmp/1d6ct1258729285.ps tmp/1d6ct1258729285.png") > system("convert tmp/2mlgh1258729285.ps tmp/2mlgh1258729285.png") > system("convert tmp/3ez2b1258729285.ps tmp/3ez2b1258729285.png") > system("convert tmp/4iway1258729285.ps tmp/4iway1258729285.png") > system("convert tmp/59a3e1258729285.ps tmp/59a3e1258729285.png") > system("convert tmp/6badh1258729285.ps tmp/6badh1258729285.png") > system("convert tmp/70oak1258729285.ps tmp/70oak1258729285.png") > system("convert tmp/81cf71258729285.ps tmp/81cf71258729285.png") > system("convert tmp/9vzby1258729285.ps tmp/9vzby1258729285.png") > system("convert tmp/10pqtb1258729285.ps tmp/10pqtb1258729285.png") > > > proc.time() user system elapsed 2.337 1.557 2.748