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.00,96.80,8.10,114.10,7.70,110.30,7.50,103.90,7.60,101.60,7.80,94.60,7.80,95.90,7.80,104.70,7.50,102.80,7.50,98.10,7.10,113.90,7.50,80.90,7.50,95.70,7.60,113.20,7.70,105.90,7.70,108.80,7.90,102.30,8.10,99.00,8.20,100.70,8.20,115.50,8.20,100.70,7.90,109.90,7.30,114.60,6.90,85.40,6.60,100.50,6.70,114.80,6.90,116.50,7.00,112.90,7.10,102.00,7.20,106.00,7.10,105.30,6.90,118.80,7.00,106.10,6.80,109.30,6.40,117.20,6.70,92.50,6.60,104.20,6.40,112.50,6.30,122.40,6.20,113.30,6.50,100.00,6.80,110.70,6.80,112.80,6.40,109.80,6.10,117.30,5.80,109.10,6.10,115.90,7.20,96.00,7.30,99.80,6.90,116.80,6.10,115.70,5.80,99.40,6.20,94.30,7.10,91.00,7.70,93.20,7.90,103.10,7.70,94.10,7.40,91.80,7.50,102.70,8.00,82.60),dim=c(2,60),dimnames=list(c('Wman','Ecogr'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Wman','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 = '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 Wman Ecogr M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 8.0 96.8 1 0 0 0 0 0 0 0 0 0 0 2 8.1 114.1 0 1 0 0 0 0 0 0 0 0 0 3 7.7 110.3 0 0 1 0 0 0 0 0 0 0 0 4 7.5 103.9 0 0 0 1 0 0 0 0 0 0 0 5 7.6 101.6 0 0 0 0 1 0 0 0 0 0 0 6 7.8 94.6 0 0 0 0 0 1 0 0 0 0 0 7 7.8 95.9 0 0 0 0 0 0 1 0 0 0 0 8 7.8 104.7 0 0 0 0 0 0 0 1 0 0 0 9 7.5 102.8 0 0 0 0 0 0 0 0 1 0 0 10 7.5 98.1 0 0 0 0 0 0 0 0 0 1 0 11 7.1 113.9 0 0 0 0 0 0 0 0 0 0 1 12 7.5 80.9 0 0 0 0 0 0 0 0 0 0 0 13 7.5 95.7 1 0 0 0 0 0 0 0 0 0 0 14 7.6 113.2 0 1 0 0 0 0 0 0 0 0 0 15 7.7 105.9 0 0 1 0 0 0 0 0 0 0 0 16 7.7 108.8 0 0 0 1 0 0 0 0 0 0 0 17 7.9 102.3 0 0 0 0 1 0 0 0 0 0 0 18 8.1 99.0 0 0 0 0 0 1 0 0 0 0 0 19 8.2 100.7 0 0 0 0 0 0 1 0 0 0 0 20 8.2 115.5 0 0 0 0 0 0 0 1 0 0 0 21 8.2 100.7 0 0 0 0 0 0 0 0 1 0 0 22 7.9 109.9 0 0 0 0 0 0 0 0 0 1 0 23 7.3 114.6 0 0 0 0 0 0 0 0 0 0 1 24 6.9 85.4 0 0 0 0 0 0 0 0 0 0 0 25 6.6 100.5 1 0 0 0 0 0 0 0 0 0 0 26 6.7 114.8 0 1 0 0 0 0 0 0 0 0 0 27 6.9 116.5 0 0 1 0 0 0 0 0 0 0 0 28 7.0 112.9 0 0 0 1 0 0 0 0 0 0 0 29 7.1 102.0 0 0 0 0 1 0 0 0 0 0 0 30 7.2 106.0 0 0 0 0 0 1 0 0 0 0 0 31 7.1 105.3 0 0 0 0 0 0 1 0 0 0 0 32 6.9 118.8 0 0 0 0 0 0 0 1 0 0 0 33 7.0 106.1 0 0 0 0 0 0 0 0 1 0 0 34 6.8 109.3 0 0 0 0 0 0 0 0 0 1 0 35 6.4 117.2 0 0 0 0 0 0 0 0 0 0 1 36 6.7 92.5 0 0 0 0 0 0 0 0 0 0 0 37 6.6 104.2 1 0 0 0 0 0 0 0 0 0 0 38 6.4 112.5 0 1 0 0 0 0 0 0 0 0 0 39 6.3 122.4 0 0 1 0 0 0 0 0 0 0 0 40 6.2 113.3 0 0 0 1 0 0 0 0 0 0 0 41 6.5 100.0 0 0 0 0 1 0 0 0 0 0 0 42 6.8 110.7 0 0 0 0 0 1 0 0 0 0 0 43 6.8 112.8 0 0 0 0 0 0 1 0 0 0 0 44 6.4 109.8 0 0 0 0 0 0 0 1 0 0 0 45 6.1 117.3 0 0 0 0 0 0 0 0 1 0 0 46 5.8 109.1 0 0 0 0 0 0 0 0 0 1 0 47 6.1 115.9 0 0 0 0 0 0 0 0 0 0 1 48 7.2 96.0 0 0 0 0 0 0 0 0 0 0 0 49 7.3 99.8 1 0 0 0 0 0 0 0 0 0 0 50 6.9 116.8 0 1 0 0 0 0 0 0 0 0 0 51 6.1 115.7 0 0 1 0 0 0 0 0 0 0 0 52 5.8 99.4 0 0 0 1 0 0 0 0 0 0 0 53 6.2 94.3 0 0 0 0 1 0 0 0 0 0 0 54 7.1 91.0 0 0 0 0 0 1 0 0 0 0 0 55 7.7 93.2 0 0 0 0 0 0 1 0 0 0 0 56 7.9 103.1 0 0 0 0 0 0 0 1 0 0 0 57 7.7 94.1 0 0 0 0 0 0 0 0 1 0 0 58 7.4 91.8 0 0 0 0 0 0 0 0 0 1 0 59 7.5 102.7 0 0 0 0 0 0 0 0 0 0 1 60 8.0 82.6 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) Ecogr M1 M2 M3 M4 11.19775 -0.04501 0.47656 1.08635 0.88095 0.48837 M5 M6 M7 M8 M9 M10 0.36537 0.71527 0.89469 1.21080 0.79262 0.54741 M11 0.76243 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.41181 -0.34651 0.04135 0.39975 1.10178 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 11.19775 1.28399 8.721 2.19e-11 *** Ecogr -0.04501 0.01432 -3.144 0.00288 ** M1 0.47656 0.43538 1.095 0.27928 M2 1.08635 0.55465 1.959 0.05610 . M3 0.88095 0.55346 1.592 0.11815 M4 0.48837 0.49386 0.989 0.32778 M5 0.36537 0.43905 0.832 0.40952 M6 0.71527 0.44035 1.624 0.11099 M7 0.89469 0.44853 1.995 0.05189 . M8 1.21080 0.51760 2.339 0.02362 * M9 0.79262 0.46661 1.699 0.09599 . M10 0.54741 0.46255 1.183 0.24258 M11 0.76243 0.54079 1.410 0.16516 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.6333 on 47 degrees of freedom Multiple R-squared: 0.2614, Adjusted R-squared: 0.0728 F-statistic: 1.386 on 12 and 47 DF, p-value: 0.2062 > 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.090621455 0.181242910 0.90937854 [2,] 0.048450619 0.096901239 0.95154938 [3,] 0.019063501 0.038127002 0.98093650 [4,] 0.007572517 0.015145034 0.99242748 [5,] 0.004101843 0.008203687 0.99589816 [6,] 0.021210295 0.042420590 0.97878970 [7,] 0.019651113 0.039302226 0.98034889 [8,] 0.012237330 0.024474660 0.98776267 [9,] 0.027694877 0.055389755 0.97230512 [10,] 0.191691293 0.383382587 0.80830871 [11,] 0.341134295 0.682268589 0.65886571 [12,] 0.370354927 0.740709855 0.62964507 [13,] 0.481795752 0.963591503 0.51820425 [14,] 0.571941010 0.856117979 0.42805899 [15,] 0.544887194 0.910225612 0.45511281 [16,] 0.502840000 0.994320000 0.49716000 [17,] 0.483894945 0.967789890 0.51610505 [18,] 0.431344118 0.862688236 0.56865588 [19,] 0.437176036 0.874352072 0.56282396 [20,] 0.376368445 0.752736890 0.62363155 [21,] 0.365178718 0.730357435 0.63482128 [22,] 0.308219659 0.616439319 0.69178034 [23,] 0.397525721 0.795051442 0.60247428 [24,] 0.344145099 0.688290197 0.65585490 [25,] 0.526467417 0.947065166 0.47353258 [26,] 0.569721144 0.860557712 0.43027886 [27,] 0.701517996 0.596964009 0.29848200 [28,] 0.685379726 0.629240548 0.31462027 [29,] 0.919813542 0.160372916 0.08018646 > postscript(file="/var/www/html/rcomp/tmp/14pg91258561866.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/25ehh1258561866.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/31e8y1258561866.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/4x4br1258561866.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/5rjov1258561866.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.68296583 0.95189763 0.58624927 0.49075058 0.61022050 0.14522561 7 8 9 10 11 12 0.02432535 0.10432535 0.13698160 0.17062719 0.26681367 -0.05618648 13 14 15 16 17 18 0.13345137 0.41138581 0.38819144 0.91131498 0.94172970 0.64328344 19 20 21 22 23 24 0.64038843 0.99046729 0.74245400 1.10178227 0.49832287 -0.45362734 25 26 27 28 29 30 -0.55048554 -0.41659317 0.06533075 0.39586887 0.12822576 0.05837544 31 32 33 34 35 36 -0.25255111 -0.16098934 -0.21447503 -0.02522561 -0.28464296 -0.33403402 37 38 39 40 41 42 -0.38393692 -0.82012339 -0.26909170 -0.38612588 -0.56180053 -0.13006279 43 44 45 46 47 48 -0.21495254 -1.06610762 -0.61032783 -1.03422824 -0.64316005 0.32351198 49 50 51 52 53 54 0.11800526 -0.12656688 -0.77067976 -1.41180856 -1.11837544 -0.71682170 55 56 57 58 59 60 -0.19721014 0.13230432 -0.05463274 -0.21295561 0.16266647 0.52033586 > postscript(file="/var/www/html/rcomp/tmp/60rja1258561866.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.68296583 NA 1 0.95189763 0.68296583 2 0.58624927 0.95189763 3 0.49075058 0.58624927 4 0.61022050 0.49075058 5 0.14522561 0.61022050 6 0.02432535 0.14522561 7 0.10432535 0.02432535 8 0.13698160 0.10432535 9 0.17062719 0.13698160 10 0.26681367 0.17062719 11 -0.05618648 0.26681367 12 0.13345137 -0.05618648 13 0.41138581 0.13345137 14 0.38819144 0.41138581 15 0.91131498 0.38819144 16 0.94172970 0.91131498 17 0.64328344 0.94172970 18 0.64038843 0.64328344 19 0.99046729 0.64038843 20 0.74245400 0.99046729 21 1.10178227 0.74245400 22 0.49832287 1.10178227 23 -0.45362734 0.49832287 24 -0.55048554 -0.45362734 25 -0.41659317 -0.55048554 26 0.06533075 -0.41659317 27 0.39586887 0.06533075 28 0.12822576 0.39586887 29 0.05837544 0.12822576 30 -0.25255111 0.05837544 31 -0.16098934 -0.25255111 32 -0.21447503 -0.16098934 33 -0.02522561 -0.21447503 34 -0.28464296 -0.02522561 35 -0.33403402 -0.28464296 36 -0.38393692 -0.33403402 37 -0.82012339 -0.38393692 38 -0.26909170 -0.82012339 39 -0.38612588 -0.26909170 40 -0.56180053 -0.38612588 41 -0.13006279 -0.56180053 42 -0.21495254 -0.13006279 43 -1.06610762 -0.21495254 44 -0.61032783 -1.06610762 45 -1.03422824 -0.61032783 46 -0.64316005 -1.03422824 47 0.32351198 -0.64316005 48 0.11800526 0.32351198 49 -0.12656688 0.11800526 50 -0.77067976 -0.12656688 51 -1.41180856 -0.77067976 52 -1.11837544 -1.41180856 53 -0.71682170 -1.11837544 54 -0.19721014 -0.71682170 55 0.13230432 -0.19721014 56 -0.05463274 0.13230432 57 -0.21295561 -0.05463274 58 0.16266647 -0.21295561 59 0.52033586 0.16266647 60 NA 0.52033586 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.95189763 0.68296583 [2,] 0.58624927 0.95189763 [3,] 0.49075058 0.58624927 [4,] 0.61022050 0.49075058 [5,] 0.14522561 0.61022050 [6,] 0.02432535 0.14522561 [7,] 0.10432535 0.02432535 [8,] 0.13698160 0.10432535 [9,] 0.17062719 0.13698160 [10,] 0.26681367 0.17062719 [11,] -0.05618648 0.26681367 [12,] 0.13345137 -0.05618648 [13,] 0.41138581 0.13345137 [14,] 0.38819144 0.41138581 [15,] 0.91131498 0.38819144 [16,] 0.94172970 0.91131498 [17,] 0.64328344 0.94172970 [18,] 0.64038843 0.64328344 [19,] 0.99046729 0.64038843 [20,] 0.74245400 0.99046729 [21,] 1.10178227 0.74245400 [22,] 0.49832287 1.10178227 [23,] -0.45362734 0.49832287 [24,] -0.55048554 -0.45362734 [25,] -0.41659317 -0.55048554 [26,] 0.06533075 -0.41659317 [27,] 0.39586887 0.06533075 [28,] 0.12822576 0.39586887 [29,] 0.05837544 0.12822576 [30,] -0.25255111 0.05837544 [31,] -0.16098934 -0.25255111 [32,] -0.21447503 -0.16098934 [33,] -0.02522561 -0.21447503 [34,] -0.28464296 -0.02522561 [35,] -0.33403402 -0.28464296 [36,] -0.38393692 -0.33403402 [37,] -0.82012339 -0.38393692 [38,] -0.26909170 -0.82012339 [39,] -0.38612588 -0.26909170 [40,] -0.56180053 -0.38612588 [41,] -0.13006279 -0.56180053 [42,] -0.21495254 -0.13006279 [43,] -1.06610762 -0.21495254 [44,] -0.61032783 -1.06610762 [45,] -1.03422824 -0.61032783 [46,] -0.64316005 -1.03422824 [47,] 0.32351198 -0.64316005 [48,] 0.11800526 0.32351198 [49,] -0.12656688 0.11800526 [50,] -0.77067976 -0.12656688 [51,] -1.41180856 -0.77067976 [52,] -1.11837544 -1.41180856 [53,] -0.71682170 -1.11837544 [54,] -0.19721014 -0.71682170 [55,] 0.13230432 -0.19721014 [56,] -0.05463274 0.13230432 [57,] -0.21295561 -0.05463274 [58,] 0.16266647 -0.21295561 [59,] 0.52033586 0.16266647 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.95189763 0.68296583 2 0.58624927 0.95189763 3 0.49075058 0.58624927 4 0.61022050 0.49075058 5 0.14522561 0.61022050 6 0.02432535 0.14522561 7 0.10432535 0.02432535 8 0.13698160 0.10432535 9 0.17062719 0.13698160 10 0.26681367 0.17062719 11 -0.05618648 0.26681367 12 0.13345137 -0.05618648 13 0.41138581 0.13345137 14 0.38819144 0.41138581 15 0.91131498 0.38819144 16 0.94172970 0.91131498 17 0.64328344 0.94172970 18 0.64038843 0.64328344 19 0.99046729 0.64038843 20 0.74245400 0.99046729 21 1.10178227 0.74245400 22 0.49832287 1.10178227 23 -0.45362734 0.49832287 24 -0.55048554 -0.45362734 25 -0.41659317 -0.55048554 26 0.06533075 -0.41659317 27 0.39586887 0.06533075 28 0.12822576 0.39586887 29 0.05837544 0.12822576 30 -0.25255111 0.05837544 31 -0.16098934 -0.25255111 32 -0.21447503 -0.16098934 33 -0.02522561 -0.21447503 34 -0.28464296 -0.02522561 35 -0.33403402 -0.28464296 36 -0.38393692 -0.33403402 37 -0.82012339 -0.38393692 38 -0.26909170 -0.82012339 39 -0.38612588 -0.26909170 40 -0.56180053 -0.38612588 41 -0.13006279 -0.56180053 42 -0.21495254 -0.13006279 43 -1.06610762 -0.21495254 44 -0.61032783 -1.06610762 45 -1.03422824 -0.61032783 46 -0.64316005 -1.03422824 47 0.32351198 -0.64316005 48 0.11800526 0.32351198 49 -0.12656688 0.11800526 50 -0.77067976 -0.12656688 51 -1.41180856 -0.77067976 52 -1.11837544 -1.41180856 53 -0.71682170 -1.11837544 54 -0.19721014 -0.71682170 55 0.13230432 -0.19721014 56 -0.05463274 0.13230432 57 -0.21295561 -0.05463274 58 0.16266647 -0.21295561 59 0.52033586 0.16266647 > 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/7isbz1258561866.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/85ki81258561866.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/9jfq61258561866.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/10uhg41258561866.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/117c3b1258561866.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/121cmw1258561866.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/13nsoc1258561866.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/14hfjo1258561866.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/155pvf1258561866.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/16z7e31258561866.tab") + } > > system("convert tmp/14pg91258561866.ps tmp/14pg91258561866.png") > system("convert tmp/25ehh1258561866.ps tmp/25ehh1258561866.png") > system("convert tmp/31e8y1258561866.ps tmp/31e8y1258561866.png") > system("convert tmp/4x4br1258561866.ps tmp/4x4br1258561866.png") > system("convert tmp/5rjov1258561866.ps tmp/5rjov1258561866.png") > system("convert tmp/60rja1258561866.ps tmp/60rja1258561866.png") > system("convert tmp/7isbz1258561866.ps tmp/7isbz1258561866.png") > system("convert tmp/85ki81258561866.ps tmp/85ki81258561866.png") > system("convert tmp/9jfq61258561866.ps tmp/9jfq61258561866.png") > system("convert tmp/10uhg41258561866.ps tmp/10uhg41258561866.png") > > > proc.time() user system elapsed 2.461 1.610 3.905