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(9.3,96.8,9.3,114.1,8.7,110.3,8.2,103.9,8.3,101.6,8.5,94.6,8.6,95.9,8.5,104.7,8.2,102.8,8.1,98.1,7.9,113.9,8.6,80.9,8.7,95.7,8.7,113.2,8.5,105.9,8.4,108.8,8.5,102.3,8.7,99,8.7,100.7,8.6,115.5,8.5,100.7,8.3,109.9,8,114.6,8.2,85.4,8.1,100.5,8.1,114.8,8,116.5,7.9,112.9,7.9,102,8,106,8,105.3,7.9,118.8,8,106.1,7.7,109.3,7.2,117.2,7.5,92.5,7.3,104.2,7,112.5,7,122.4,7,113.3,7.2,100,7.3,110.7,7.1,112.8,6.8,109.8,6.4,117.3,6.1,109.1,6.5,115.9,7.7,96,7.9,99.8,7.5,116.8,6.9,115.7,6.6,99.4,6.9,94.3,7.7,91,8,93.2,8,103.1,7.7,94.1,7.3,91.8,7.4,102.7,8.1,82.6),dim=c(2,60),dimnames=list(c('werklh','ecogr'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('werklh','ecogr'),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 = '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 werklh ecogr M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 9.3 96.8 1 0 0 0 0 0 0 0 0 0 0 1 2 9.3 114.1 0 1 0 0 0 0 0 0 0 0 0 2 3 8.7 110.3 0 0 1 0 0 0 0 0 0 0 0 3 4 8.2 103.9 0 0 0 1 0 0 0 0 0 0 0 4 5 8.3 101.6 0 0 0 0 1 0 0 0 0 0 0 5 6 8.5 94.6 0 0 0 0 0 1 0 0 0 0 0 6 7 8.6 95.9 0 0 0 0 0 0 1 0 0 0 0 7 8 8.5 104.7 0 0 0 0 0 0 0 1 0 0 0 8 9 8.2 102.8 0 0 0 0 0 0 0 0 1 0 0 9 10 8.1 98.1 0 0 0 0 0 0 0 0 0 1 0 10 11 7.9 113.9 0 0 0 0 0 0 0 0 0 0 1 11 12 8.6 80.9 0 0 0 0 0 0 0 0 0 0 0 12 13 8.7 95.7 1 0 0 0 0 0 0 0 0 0 0 13 14 8.7 113.2 0 1 0 0 0 0 0 0 0 0 0 14 15 8.5 105.9 0 0 1 0 0 0 0 0 0 0 0 15 16 8.4 108.8 0 0 0 1 0 0 0 0 0 0 0 16 17 8.5 102.3 0 0 0 0 1 0 0 0 0 0 0 17 18 8.7 99.0 0 0 0 0 0 1 0 0 0 0 0 18 19 8.7 100.7 0 0 0 0 0 0 1 0 0 0 0 19 20 8.6 115.5 0 0 0 0 0 0 0 1 0 0 0 20 21 8.5 100.7 0 0 0 0 0 0 0 0 1 0 0 21 22 8.3 109.9 0 0 0 0 0 0 0 0 0 1 0 22 23 8.0 114.6 0 0 0 0 0 0 0 0 0 0 1 23 24 8.2 85.4 0 0 0 0 0 0 0 0 0 0 0 24 25 8.1 100.5 1 0 0 0 0 0 0 0 0 0 0 25 26 8.1 114.8 0 1 0 0 0 0 0 0 0 0 0 26 27 8.0 116.5 0 0 1 0 0 0 0 0 0 0 0 27 28 7.9 112.9 0 0 0 1 0 0 0 0 0 0 0 28 29 7.9 102.0 0 0 0 0 1 0 0 0 0 0 0 29 30 8.0 106.0 0 0 0 0 0 1 0 0 0 0 0 30 31 8.0 105.3 0 0 0 0 0 0 1 0 0 0 0 31 32 7.9 118.8 0 0 0 0 0 0 0 1 0 0 0 32 33 8.0 106.1 0 0 0 0 0 0 0 0 1 0 0 33 34 7.7 109.3 0 0 0 0 0 0 0 0 0 1 0 34 35 7.2 117.2 0 0 0 0 0 0 0 0 0 0 1 35 36 7.5 92.5 0 0 0 0 0 0 0 0 0 0 0 36 37 7.3 104.2 1 0 0 0 0 0 0 0 0 0 0 37 38 7.0 112.5 0 1 0 0 0 0 0 0 0 0 0 38 39 7.0 122.4 0 0 1 0 0 0 0 0 0 0 0 39 40 7.0 113.3 0 0 0 1 0 0 0 0 0 0 0 40 41 7.2 100.0 0 0 0 0 1 0 0 0 0 0 0 41 42 7.3 110.7 0 0 0 0 0 1 0 0 0 0 0 42 43 7.1 112.8 0 0 0 0 0 0 1 0 0 0 0 43 44 6.8 109.8 0 0 0 0 0 0 0 1 0 0 0 44 45 6.4 117.3 0 0 0 0 0 0 0 0 1 0 0 45 46 6.1 109.1 0 0 0 0 0 0 0 0 0 1 0 46 47 6.5 115.9 0 0 0 0 0 0 0 0 0 0 1 47 48 7.7 96.0 0 0 0 0 0 0 0 0 0 0 0 48 49 7.9 99.8 1 0 0 0 0 0 0 0 0 0 0 49 50 7.5 116.8 0 1 0 0 0 0 0 0 0 0 0 50 51 6.9 115.7 0 0 1 0 0 0 0 0 0 0 0 51 52 6.6 99.4 0 0 0 1 0 0 0 0 0 0 0 52 53 6.9 94.3 0 0 0 0 1 0 0 0 0 0 0 53 54 7.7 91.0 0 0 0 0 0 1 0 0 0 0 0 54 55 8.0 93.2 0 0 0 0 0 0 1 0 0 0 0 55 56 8.0 103.1 0 0 0 0 0 0 0 1 0 0 0 56 57 7.7 94.1 0 0 0 0 0 0 0 0 1 0 0 57 58 7.3 91.8 0 0 0 0 0 0 0 0 0 1 0 58 59 7.4 102.7 0 0 0 0 0 0 0 0 0 0 1 59 60 8.1 82.6 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) ecogr M1 M2 M3 M4 12.12811 -0.03479 0.32937 0.73662 0.46202 0.06546 M5 M6 M7 M8 M9 M10 -0.03006 0.28716 0.40266 0.61839 0.23296 -0.01695 M11 t 0.23339 -0.02957 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.85515 -0.27109 0.03683 0.30022 0.66289 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 12.128108 0.858555 14.126 < 2e-16 *** ecogr -0.034790 0.009502 -3.661 0.000646 *** M1 0.329371 0.291257 1.131 0.263975 M2 0.736619 0.369783 1.992 0.052323 . M3 0.462019 0.368707 1.253 0.216509 M4 0.065460 0.328953 0.199 0.843144 M5 -0.030064 0.292363 -0.103 0.918545 M6 0.287165 0.292981 0.980 0.332140 M7 0.402662 0.298202 1.350 0.183526 M8 0.618387 0.343869 1.798 0.078690 . M9 0.232961 0.309896 0.752 0.456037 M10 -0.016946 0.307097 -0.055 0.956232 M11 0.233391 0.358960 0.650 0.518806 t -0.029575 0.003198 -9.249 4.59e-12 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4203 on 46 degrees of freedom Multiple R-squared: 0.7253, Adjusted R-squared: 0.6477 F-statistic: 9.342 on 13 and 46 DF, p-value: 5.097e-09 > 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.232798536 0.46559707 0.7672015 [2,] 0.111478298 0.22295660 0.8885217 [3,] 0.048142432 0.09628486 0.9518576 [4,] 0.031377778 0.06275556 0.9686222 [5,] 0.037795812 0.07559162 0.9622042 [6,] 0.021610684 0.04322137 0.9783893 [7,] 0.010844560 0.02168912 0.9891554 [8,] 0.012532711 0.02506542 0.9874673 [9,] 0.048504213 0.09700843 0.9514958 [10,] 0.053357418 0.10671484 0.9466426 [11,] 0.040888656 0.08177731 0.9591113 [12,] 0.034721794 0.06944359 0.9652782 [13,] 0.023395938 0.04679188 0.9766041 [14,] 0.016329722 0.03265944 0.9836703 [15,] 0.010044024 0.02008805 0.9899560 [16,] 0.009388348 0.01877670 0.9906117 [17,] 0.007835311 0.01567062 0.9921647 [18,] 0.035379631 0.07075926 0.9646204 [19,] 0.051756802 0.10351360 0.9482432 [20,] 0.044996730 0.08999346 0.9550033 [21,] 0.064191691 0.12838338 0.9358083 [22,] 0.115895538 0.23179108 0.8841045 [23,] 0.119364852 0.23872970 0.8806351 [24,] 0.274358600 0.54871720 0.7256414 [25,] 0.532463514 0.93507297 0.4675365 [26,] 0.619650560 0.76069888 0.3803494 [27,] 0.487709818 0.97541964 0.5122902 > postscript(file="/var/www/html/rcomp/tmp/1otyu1261058326.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/2e2kq1261058326.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/34gxr1261058326.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/4w5ps1261058326.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/54wbd1261058326.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.239750100 0.463941464 0.035914927 -0.260606091 -0.115524249 -0.446706749 7 8 9 10 11 12 -0.387402546 -0.367402546 -0.318502116 -0.302531971 -0.173614956 -0.358713384 13 14 15 16 17 18 -0.043620518 0.187528810 0.037737903 0.464762211 0.463726809 0.261266643 19 20 21 22 23 24 0.234486774 0.463225694 0.263337446 0.662886089 0.305636103 -0.247261010 25 26 27 28 29 30 -0.121731198 -0.001909294 0.261408179 0.462298657 0.208188047 0.159693567 31 32 33 34 35 36 0.049418130 0.232930284 0.306100658 0.396910381 -0.049012181 -0.345355104 37 38 39 40 41 42 -0.438110680 -0.827027695 -0.178433699 -0.068887231 -0.206493409 -0.021896095 43 44 45 46 47 48 -0.234760036 -0.825279911 -0.549355174 -0.855149399 -0.439340763 0.331307450 49 50 51 52 53 54 0.363712296 0.177466715 -0.156627309 -0.597567545 -0.349897198 0.047642635 55 56 57 58 59 60 0.338257677 0.496526479 0.298419186 0.097884900 0.356331797 0.620022047 > postscript(file="/var/www/html/rcomp/tmp/6uj8r1261058326.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.239750100 NA 1 0.463941464 0.239750100 2 0.035914927 0.463941464 3 -0.260606091 0.035914927 4 -0.115524249 -0.260606091 5 -0.446706749 -0.115524249 6 -0.387402546 -0.446706749 7 -0.367402546 -0.387402546 8 -0.318502116 -0.367402546 9 -0.302531971 -0.318502116 10 -0.173614956 -0.302531971 11 -0.358713384 -0.173614956 12 -0.043620518 -0.358713384 13 0.187528810 -0.043620518 14 0.037737903 0.187528810 15 0.464762211 0.037737903 16 0.463726809 0.464762211 17 0.261266643 0.463726809 18 0.234486774 0.261266643 19 0.463225694 0.234486774 20 0.263337446 0.463225694 21 0.662886089 0.263337446 22 0.305636103 0.662886089 23 -0.247261010 0.305636103 24 -0.121731198 -0.247261010 25 -0.001909294 -0.121731198 26 0.261408179 -0.001909294 27 0.462298657 0.261408179 28 0.208188047 0.462298657 29 0.159693567 0.208188047 30 0.049418130 0.159693567 31 0.232930284 0.049418130 32 0.306100658 0.232930284 33 0.396910381 0.306100658 34 -0.049012181 0.396910381 35 -0.345355104 -0.049012181 36 -0.438110680 -0.345355104 37 -0.827027695 -0.438110680 38 -0.178433699 -0.827027695 39 -0.068887231 -0.178433699 40 -0.206493409 -0.068887231 41 -0.021896095 -0.206493409 42 -0.234760036 -0.021896095 43 -0.825279911 -0.234760036 44 -0.549355174 -0.825279911 45 -0.855149399 -0.549355174 46 -0.439340763 -0.855149399 47 0.331307450 -0.439340763 48 0.363712296 0.331307450 49 0.177466715 0.363712296 50 -0.156627309 0.177466715 51 -0.597567545 -0.156627309 52 -0.349897198 -0.597567545 53 0.047642635 -0.349897198 54 0.338257677 0.047642635 55 0.496526479 0.338257677 56 0.298419186 0.496526479 57 0.097884900 0.298419186 58 0.356331797 0.097884900 59 0.620022047 0.356331797 60 NA 0.620022047 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.463941464 0.239750100 [2,] 0.035914927 0.463941464 [3,] -0.260606091 0.035914927 [4,] -0.115524249 -0.260606091 [5,] -0.446706749 -0.115524249 [6,] -0.387402546 -0.446706749 [7,] -0.367402546 -0.387402546 [8,] -0.318502116 -0.367402546 [9,] -0.302531971 -0.318502116 [10,] -0.173614956 -0.302531971 [11,] -0.358713384 -0.173614956 [12,] -0.043620518 -0.358713384 [13,] 0.187528810 -0.043620518 [14,] 0.037737903 0.187528810 [15,] 0.464762211 0.037737903 [16,] 0.463726809 0.464762211 [17,] 0.261266643 0.463726809 [18,] 0.234486774 0.261266643 [19,] 0.463225694 0.234486774 [20,] 0.263337446 0.463225694 [21,] 0.662886089 0.263337446 [22,] 0.305636103 0.662886089 [23,] -0.247261010 0.305636103 [24,] -0.121731198 -0.247261010 [25,] -0.001909294 -0.121731198 [26,] 0.261408179 -0.001909294 [27,] 0.462298657 0.261408179 [28,] 0.208188047 0.462298657 [29,] 0.159693567 0.208188047 [30,] 0.049418130 0.159693567 [31,] 0.232930284 0.049418130 [32,] 0.306100658 0.232930284 [33,] 0.396910381 0.306100658 [34,] -0.049012181 0.396910381 [35,] -0.345355104 -0.049012181 [36,] -0.438110680 -0.345355104 [37,] -0.827027695 -0.438110680 [38,] -0.178433699 -0.827027695 [39,] -0.068887231 -0.178433699 [40,] -0.206493409 -0.068887231 [41,] -0.021896095 -0.206493409 [42,] -0.234760036 -0.021896095 [43,] -0.825279911 -0.234760036 [44,] -0.549355174 -0.825279911 [45,] -0.855149399 -0.549355174 [46,] -0.439340763 -0.855149399 [47,] 0.331307450 -0.439340763 [48,] 0.363712296 0.331307450 [49,] 0.177466715 0.363712296 [50,] -0.156627309 0.177466715 [51,] -0.597567545 -0.156627309 [52,] -0.349897198 -0.597567545 [53,] 0.047642635 -0.349897198 [54,] 0.338257677 0.047642635 [55,] 0.496526479 0.338257677 [56,] 0.298419186 0.496526479 [57,] 0.097884900 0.298419186 [58,] 0.356331797 0.097884900 [59,] 0.620022047 0.356331797 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.463941464 0.239750100 2 0.035914927 0.463941464 3 -0.260606091 0.035914927 4 -0.115524249 -0.260606091 5 -0.446706749 -0.115524249 6 -0.387402546 -0.446706749 7 -0.367402546 -0.387402546 8 -0.318502116 -0.367402546 9 -0.302531971 -0.318502116 10 -0.173614956 -0.302531971 11 -0.358713384 -0.173614956 12 -0.043620518 -0.358713384 13 0.187528810 -0.043620518 14 0.037737903 0.187528810 15 0.464762211 0.037737903 16 0.463726809 0.464762211 17 0.261266643 0.463726809 18 0.234486774 0.261266643 19 0.463225694 0.234486774 20 0.263337446 0.463225694 21 0.662886089 0.263337446 22 0.305636103 0.662886089 23 -0.247261010 0.305636103 24 -0.121731198 -0.247261010 25 -0.001909294 -0.121731198 26 0.261408179 -0.001909294 27 0.462298657 0.261408179 28 0.208188047 0.462298657 29 0.159693567 0.208188047 30 0.049418130 0.159693567 31 0.232930284 0.049418130 32 0.306100658 0.232930284 33 0.396910381 0.306100658 34 -0.049012181 0.396910381 35 -0.345355104 -0.049012181 36 -0.438110680 -0.345355104 37 -0.827027695 -0.438110680 38 -0.178433699 -0.827027695 39 -0.068887231 -0.178433699 40 -0.206493409 -0.068887231 41 -0.021896095 -0.206493409 42 -0.234760036 -0.021896095 43 -0.825279911 -0.234760036 44 -0.549355174 -0.825279911 45 -0.855149399 -0.549355174 46 -0.439340763 -0.855149399 47 0.331307450 -0.439340763 48 0.363712296 0.331307450 49 0.177466715 0.363712296 50 -0.156627309 0.177466715 51 -0.597567545 -0.156627309 52 -0.349897198 -0.597567545 53 0.047642635 -0.349897198 54 0.338257677 0.047642635 55 0.496526479 0.338257677 56 0.298419186 0.496526479 57 0.097884900 0.298419186 58 0.356331797 0.097884900 59 0.620022047 0.356331797 > 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/7g4da1261058326.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/8d30r1261058326.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/9861h1261058326.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/10s1t71261058326.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/11zxhy1261058326.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/12uh2c1261058326.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/13jp6v1261058326.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/143kr21261058326.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/15cc2k1261058326.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/16xup41261058326.tab") + } > > try(system("convert tmp/1otyu1261058326.ps tmp/1otyu1261058326.png",intern=TRUE)) character(0) > try(system("convert tmp/2e2kq1261058326.ps tmp/2e2kq1261058326.png",intern=TRUE)) character(0) > try(system("convert tmp/34gxr1261058326.ps tmp/34gxr1261058326.png",intern=TRUE)) character(0) > try(system("convert tmp/4w5ps1261058326.ps tmp/4w5ps1261058326.png",intern=TRUE)) character(0) > try(system("convert tmp/54wbd1261058326.ps tmp/54wbd1261058326.png",intern=TRUE)) character(0) > try(system("convert tmp/6uj8r1261058326.ps tmp/6uj8r1261058326.png",intern=TRUE)) character(0) > try(system("convert tmp/7g4da1261058326.ps tmp/7g4da1261058326.png",intern=TRUE)) character(0) > try(system("convert tmp/8d30r1261058326.ps tmp/8d30r1261058326.png",intern=TRUE)) character(0) > try(system("convert tmp/9861h1261058326.ps tmp/9861h1261058326.png",intern=TRUE)) character(0) > try(system("convert tmp/10s1t71261058326.ps tmp/10s1t71261058326.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.348 1.521 3.547