R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. Natural language support but running in an English locale 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(141 + ,9.3 + ,16 + ,6 + ,7 + ,4 + ,136 + ,14.2 + ,20 + ,20 + ,0 + ,5 + ,246 + ,17.3 + ,7 + ,12 + ,0 + ,6 + ,309 + ,23 + ,8 + ,15 + ,0 + ,7 + ,95 + ,16.3 + ,21 + ,25 + ,0 + ,8 + ,161 + ,18.4 + ,7 + ,4 + ,0 + ,9 + ,108 + ,14.2 + ,17 + ,6 + ,0 + ,10 + ,79 + ,9.1 + ,20 + ,2 + ,0 + ,11 + ,40 + ,5.9 + ,18 + ,1 + ,1 + ,12 + ,35 + ,7.2 + ,26 + ,4 + ,2 + ,1 + ,49 + ,6.8 + ,18 + ,4 + ,2 + ,2 + ,145 + ,8 + ,20 + ,8 + ,2 + ,3 + ,284 + ,14.3 + ,0 + ,3 + ,0 + ,4 + ,164 + ,14.6 + ,22 + ,14 + ,0 + ,5 + ,130 + ,17.5 + ,19 + ,17 + ,0 + ,6 + ,178 + ,17.2 + ,18 + ,14 + ,0 + ,7 + ,150 + ,17.2 + ,13 + ,10 + ,0 + ,8 + ,104 + ,14.1 + ,16 + ,7 + ,0 + ,9 + ,111 + ,10.4 + ,11 + ,4 + ,0 + ,10 + ,51 + ,6.8 + ,22 + ,1 + ,1 + ,11 + ,70 + ,4.1 + ,19 + ,6 + ,0 + ,12 + ,42 + ,6.5 + ,23 + ,2 + ,1 + ,1 + ,126 + ,6.1 + ,11 + ,2 + ,0 + ,2 + ,68 + ,6.3 + ,24 + ,8 + ,7 + ,3 + ,135 + ,9.3 + ,14 + ,10 + ,0 + ,4 + ,231 + ,16.4 + ,11 + ,13 + ,0 + ,5 + ,185 + ,16.1 + ,17 + ,10 + ,0 + ,6 + ,181 + ,18 + ,20 + ,14 + ,0 + ,7 + ,138 + ,17.6 + ,19 + ,13 + ,0 + ,8 + ,158 + ,14 + ,12 + ,6 + ,0 + ,9 + ,122 + ,10.5 + ,19 + ,6 + ,2 + ,10 + ,40 + ,6.9 + ,26 + ,9 + ,3 + ,11 + ,62 + ,2.8 + ,13 + ,2 + ,5 + ,12 + ,89 + ,0.7 + ,12 + ,4 + ,5 + ,1 + ,33 + ,3.6 + ,20 + ,3 + ,7 + ,2 + ,150 + ,6.7 + ,15 + ,4 + ,2 + ,3 + ,196 + ,12.5 + ,15 + ,10 + ,0 + ,4 + ,196 + ,14.4 + ,17 + ,15 + ,0 + ,5 + ,225 + ,16.5 + ,11 + ,14 + ,0 + ,6 + ,213 + ,18.7 + ,20 + ,18 + ,0 + ,7 + ,258 + ,19.4 + ,9 + ,10 + ,0 + ,8 + ,156 + ,15.8 + ,10 + ,5 + ,0 + ,9 + ,90 + ,11.3 + ,17 + ,5 + ,0 + ,10 + ,48 + ,9.7 + ,25 + ,7 + ,0 + ,11 + ,46 + ,2.9 + ,19 + ,2 + ,7 + ,12 + ,49 + ,0.1 + ,18 + ,0 + ,14 + ,1 + ,29 + ,2.5 + ,24 + ,4 + ,10 + ,2 + ,118 + ,6.7 + ,13 + ,7 + ,2 + ,3 + ,223 + ,10.3 + ,6 + ,8 + ,0 + ,4 + ,172 + ,11.2 + ,14 + ,6 + ,0 + ,5 + ,259 + ,17.4 + ,9 + ,3 + ,0 + ,6 + ,252 + ,20.5 + ,13 + ,12 + ,0 + ,7 + ,136 + ,17 + ,23 + ,15 + ,0 + ,8 + ,143 + ,14.2 + ,18 + ,8 + ,0 + ,9 + ,119 + ,10.6 + ,16 + ,6 + ,0 + ,10 + ,24 + ,6.1 + ,21 + ,1 + ,6 + ,11) + ,dim=c(6 + ,56) + ,dimnames=list(c('UrenZonneschijn' + ,'GemiddeldeTemperatuur' + ,'Neerslagdagen' + ,'Onweersdagen' + ,'Sneeuwdagen' + ,'Maand') + ,1:56)) > y <- array(NA,dim=c(6,56),dimnames=list(c('UrenZonneschijn','GemiddeldeTemperatuur','Neerslagdagen','Onweersdagen','Sneeuwdagen','Maand'),1:56)) > 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 = 'Do not include Seasonal 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 GemiddeldeTemperatuur UrenZonneschijn Neerslagdagen Onweersdagen Sneeuwdagen 1 9.3 141 16 6 7 2 14.2 136 20 20 0 3 17.3 246 7 12 0 4 23.0 309 8 15 0 5 16.3 95 21 25 0 6 18.4 161 7 4 0 7 14.2 108 17 6 0 8 9.1 79 20 2 0 9 5.9 40 18 1 1 10 7.2 35 26 4 2 11 6.8 49 18 4 2 12 8.0 145 20 8 2 13 14.3 284 0 3 0 14 14.6 164 22 14 0 15 17.5 130 19 17 0 16 17.2 178 18 14 0 17 17.2 150 13 10 0 18 14.1 104 16 7 0 19 10.4 111 11 4 0 20 6.8 51 22 1 1 21 4.1 70 19 6 0 22 6.5 42 23 2 1 23 6.1 126 11 2 0 24 6.3 68 24 8 7 25 9.3 135 14 10 0 26 16.4 231 11 13 0 27 16.1 185 17 10 0 28 18.0 181 20 14 0 29 17.6 138 19 13 0 30 14.0 158 12 6 0 31 10.5 122 19 6 2 32 6.9 40 26 9 3 33 2.8 62 13 2 5 34 0.7 89 12 4 5 35 3.6 33 20 3 7 36 6.7 150 15 4 2 37 12.5 196 15 10 0 38 14.4 196 17 15 0 39 16.5 225 11 14 0 40 18.7 213 20 18 0 41 19.4 258 9 10 0 42 15.8 156 10 5 0 43 11.3 90 17 5 0 44 9.7 48 25 7 0 45 2.9 46 19 2 7 46 0.1 49 18 0 14 47 2.5 29 24 4 10 48 6.7 118 13 7 2 49 10.3 223 6 8 0 50 11.2 172 14 6 0 51 17.4 259 9 3 0 52 20.5 252 13 12 0 53 17.0 136 23 15 0 54 14.2 143 18 8 0 55 10.6 119 16 6 0 56 6.1 24 21 1 6 Maand 1 4 2 5 3 6 4 7 5 8 6 9 7 10 8 11 9 12 10 1 11 2 12 3 13 4 14 5 15 6 16 7 17 8 18 9 19 10 20 11 21 12 22 1 23 2 24 3 25 4 26 5 27 6 28 7 29 8 30 9 31 10 32 11 33 12 34 1 35 2 36 3 37 4 38 5 39 6 40 7 41 8 42 9 43 10 44 11 45 12 46 1 47 2 48 3 49 4 50 5 51 6 52 7 53 8 54 9 55 10 56 11 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) UrenZonneschijn Neerslagdagen Onweersdagen -1.68681 0.05166 0.15219 0.27900 Sneeuwdagen Maand -0.39177 0.33085 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.3649 -1.4268 0.2579 1.5185 6.6110 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.686811 2.733139 -0.617 0.53992 UrenZonneschijn 0.051658 0.009481 5.449 1.55e-06 *** Neerslagdagen 0.152185 0.106599 1.428 0.15961 Onweersdagen 0.279004 0.089398 3.121 0.00299 ** Sneeuwdagen -0.391769 0.145934 -2.685 0.00983 ** Maand 0.330848 0.107591 3.075 0.00341 ** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 2.418 on 50 degrees of freedom Multiple R-squared: 0.831, Adjusted R-squared: 0.8141 F-statistic: 49.18 on 5 and 50 DF, p-value: < 2.2e-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.7673816 0.46523688 0.23261844 [2,] 0.6969361 0.60612777 0.30306388 [3,] 0.6385470 0.72290607 0.36145304 [4,] 0.6953227 0.60935461 0.30467730 [5,] 0.7834694 0.43306130 0.21653065 [6,] 0.7054028 0.58919433 0.29459716 [7,] 0.7134701 0.57305973 0.28652987 [8,] 0.6385546 0.72289087 0.36144544 [9,] 0.6942800 0.61144004 0.30572002 [10,] 0.7110043 0.57799150 0.28899575 [11,] 0.7206938 0.55861237 0.27930619 [12,] 0.6633725 0.67325497 0.33662748 [13,] 0.9577133 0.08457345 0.04228673 [14,] 0.9438478 0.11230448 0.05615224 [15,] 0.9516645 0.09667106 0.04833553 [16,] 0.9254567 0.14908670 0.07454335 [17,] 0.9214598 0.15708043 0.07854022 [18,] 0.8878143 0.22437133 0.11218566 [19,] 0.8503321 0.29933584 0.14966792 [20,] 0.8104001 0.37919986 0.18959993 [21,] 0.8734356 0.25312885 0.12656442 [22,] 0.8462937 0.30741267 0.15370634 [23,] 0.8112608 0.37747844 0.18873922 [24,] 0.8100604 0.37987914 0.18993957 [25,] 0.8420560 0.31588799 0.15794399 [26,] 0.8443712 0.31125767 0.15562884 [27,] 0.8576789 0.28464229 0.14232115 [28,] 0.8715363 0.25692746 0.12846373 [29,] 0.8600808 0.27983834 0.13991917 [30,] 0.8407113 0.31857750 0.15928875 [31,] 0.7728858 0.45422832 0.22711416 [32,] 0.7142826 0.57143473 0.28571736 [33,] 0.6229680 0.75406407 0.37703204 [34,] 0.9233137 0.15337260 0.07668630 [35,] 0.9525422 0.09491551 0.04745776 [36,] 0.9209894 0.15802117 0.07901058 [37,] 0.9818569 0.03628628 0.01814314 [38,] 0.9510899 0.09782024 0.04891012 [39,] 0.9503153 0.09936950 0.04968475 > postscript(file="/var/www/html/freestat/rcomp/tmp/1i8qt1293353851.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/2i8qt1293353851.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/3bzpw1293353851.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/4bzpw1293353851.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/5bzpw1293353851.ps",horizontal=F,onefile=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 = 56 Frequency = 1 1 2 3 4 5 6 7 1.0130966 -1.4166394 -0.1193804 1.0061484 0.2615722 6.6109990 2.7381417 8 9 10 11 12 13 14 -0.5351774 -1.0762374 2.4586538 2.2220819 -3.2882779 -0.8443405 -1.0933986 15 16 17 18 19 20 21 2.8516547 0.7304405 3.7229458 3.0488014 0.2542881 -1.0223635 -6.3649374 22 23 24 25 26 27 28 2.0198456 -1.6157835 0.3394570 -2.2309840 -0.8014138 0.8678861 1.0710973 29 30 31 32 33 34 35 2.9927136 1.0470378 -1.2058972 -2.4113646 -3.2637065 -3.5249550 1.7820799 36 37 38 39 40 41 42 -2.9696242 -2.3342805 -2.4645182 -1.0013202 -0.9979600 0.9526700 3.5337273 43 44 45 46 47 48 49 1.0469817 -0.4897383 -2.4667595 1.6701700 1.1762715 -1.8492232 -4.0013599 50 51 52 53 54 55 56 -1.4571465 1.5157353 1.5267148 1.3292800 0.5507821 -1.2779062 1.7834195 > postscript(file="/var/www/html/freestat/rcomp/tmp/64roh1293353851.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 56 Frequency = 1 lag(myerror, k = 1) myerror 0 1.0130966 NA 1 -1.4166394 1.0130966 2 -0.1193804 -1.4166394 3 1.0061484 -0.1193804 4 0.2615722 1.0061484 5 6.6109990 0.2615722 6 2.7381417 6.6109990 7 -0.5351774 2.7381417 8 -1.0762374 -0.5351774 9 2.4586538 -1.0762374 10 2.2220819 2.4586538 11 -3.2882779 2.2220819 12 -0.8443405 -3.2882779 13 -1.0933986 -0.8443405 14 2.8516547 -1.0933986 15 0.7304405 2.8516547 16 3.7229458 0.7304405 17 3.0488014 3.7229458 18 0.2542881 3.0488014 19 -1.0223635 0.2542881 20 -6.3649374 -1.0223635 21 2.0198456 -6.3649374 22 -1.6157835 2.0198456 23 0.3394570 -1.6157835 24 -2.2309840 0.3394570 25 -0.8014138 -2.2309840 26 0.8678861 -0.8014138 27 1.0710973 0.8678861 28 2.9927136 1.0710973 29 1.0470378 2.9927136 30 -1.2058972 1.0470378 31 -2.4113646 -1.2058972 32 -3.2637065 -2.4113646 33 -3.5249550 -3.2637065 34 1.7820799 -3.5249550 35 -2.9696242 1.7820799 36 -2.3342805 -2.9696242 37 -2.4645182 -2.3342805 38 -1.0013202 -2.4645182 39 -0.9979600 -1.0013202 40 0.9526700 -0.9979600 41 3.5337273 0.9526700 42 1.0469817 3.5337273 43 -0.4897383 1.0469817 44 -2.4667595 -0.4897383 45 1.6701700 -2.4667595 46 1.1762715 1.6701700 47 -1.8492232 1.1762715 48 -4.0013599 -1.8492232 49 -1.4571465 -4.0013599 50 1.5157353 -1.4571465 51 1.5267148 1.5157353 52 1.3292800 1.5267148 53 0.5507821 1.3292800 54 -1.2779062 0.5507821 55 1.7834195 -1.2779062 56 NA 1.7834195 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.4166394 1.0130966 [2,] -0.1193804 -1.4166394 [3,] 1.0061484 -0.1193804 [4,] 0.2615722 1.0061484 [5,] 6.6109990 0.2615722 [6,] 2.7381417 6.6109990 [7,] -0.5351774 2.7381417 [8,] -1.0762374 -0.5351774 [9,] 2.4586538 -1.0762374 [10,] 2.2220819 2.4586538 [11,] -3.2882779 2.2220819 [12,] -0.8443405 -3.2882779 [13,] -1.0933986 -0.8443405 [14,] 2.8516547 -1.0933986 [15,] 0.7304405 2.8516547 [16,] 3.7229458 0.7304405 [17,] 3.0488014 3.7229458 [18,] 0.2542881 3.0488014 [19,] -1.0223635 0.2542881 [20,] -6.3649374 -1.0223635 [21,] 2.0198456 -6.3649374 [22,] -1.6157835 2.0198456 [23,] 0.3394570 -1.6157835 [24,] -2.2309840 0.3394570 [25,] -0.8014138 -2.2309840 [26,] 0.8678861 -0.8014138 [27,] 1.0710973 0.8678861 [28,] 2.9927136 1.0710973 [29,] 1.0470378 2.9927136 [30,] -1.2058972 1.0470378 [31,] -2.4113646 -1.2058972 [32,] -3.2637065 -2.4113646 [33,] -3.5249550 -3.2637065 [34,] 1.7820799 -3.5249550 [35,] -2.9696242 1.7820799 [36,] -2.3342805 -2.9696242 [37,] -2.4645182 -2.3342805 [38,] -1.0013202 -2.4645182 [39,] -0.9979600 -1.0013202 [40,] 0.9526700 -0.9979600 [41,] 3.5337273 0.9526700 [42,] 1.0469817 3.5337273 [43,] -0.4897383 1.0469817 [44,] -2.4667595 -0.4897383 [45,] 1.6701700 -2.4667595 [46,] 1.1762715 1.6701700 [47,] -1.8492232 1.1762715 [48,] -4.0013599 -1.8492232 [49,] -1.4571465 -4.0013599 [50,] 1.5157353 -1.4571465 [51,] 1.5267148 1.5157353 [52,] 1.3292800 1.5267148 [53,] 0.5507821 1.3292800 [54,] -1.2779062 0.5507821 [55,] 1.7834195 -1.2779062 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.4166394 1.0130966 2 -0.1193804 -1.4166394 3 1.0061484 -0.1193804 4 0.2615722 1.0061484 5 6.6109990 0.2615722 6 2.7381417 6.6109990 7 -0.5351774 2.7381417 8 -1.0762374 -0.5351774 9 2.4586538 -1.0762374 10 2.2220819 2.4586538 11 -3.2882779 2.2220819 12 -0.8443405 -3.2882779 13 -1.0933986 -0.8443405 14 2.8516547 -1.0933986 15 0.7304405 2.8516547 16 3.7229458 0.7304405 17 3.0488014 3.7229458 18 0.2542881 3.0488014 19 -1.0223635 0.2542881 20 -6.3649374 -1.0223635 21 2.0198456 -6.3649374 22 -1.6157835 2.0198456 23 0.3394570 -1.6157835 24 -2.2309840 0.3394570 25 -0.8014138 -2.2309840 26 0.8678861 -0.8014138 27 1.0710973 0.8678861 28 2.9927136 1.0710973 29 1.0470378 2.9927136 30 -1.2058972 1.0470378 31 -2.4113646 -1.2058972 32 -3.2637065 -2.4113646 33 -3.5249550 -3.2637065 34 1.7820799 -3.5249550 35 -2.9696242 1.7820799 36 -2.3342805 -2.9696242 37 -2.4645182 -2.3342805 38 -1.0013202 -2.4645182 39 -0.9979600 -1.0013202 40 0.9526700 -0.9979600 41 3.5337273 0.9526700 42 1.0469817 3.5337273 43 -0.4897383 1.0469817 44 -2.4667595 -0.4897383 45 1.6701700 -2.4667595 46 1.1762715 1.6701700 47 -1.8492232 1.1762715 48 -4.0013599 -1.8492232 49 -1.4571465 -4.0013599 50 1.5157353 -1.4571465 51 1.5267148 1.5157353 52 1.3292800 1.5267148 53 0.5507821 1.3292800 54 -1.2779062 0.5507821 55 1.7834195 -1.2779062 > 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/freestat/rcomp/tmp/7w0621293353851.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/8w0621293353851.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/9w0621293353851.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/10p9nn1293353851.ps",horizontal=F,onefile=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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11a9lt1293353851.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/freestat/rcomp/tmp/12wskh1293353851.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/freestat/rcomp/tmp/13kbzs1293353851.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/freestat/rcomp/tmp/14dlgd1293353851.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/freestat/rcomp/tmp/15hle11293353851.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/freestat/rcomp/tmp/16vdcs1293353851.tab") + } > > try(system("convert tmp/1i8qt1293353851.ps tmp/1i8qt1293353851.png",intern=TRUE)) character(0) > try(system("convert tmp/2i8qt1293353851.ps tmp/2i8qt1293353851.png",intern=TRUE)) character(0) > try(system("convert tmp/3bzpw1293353851.ps tmp/3bzpw1293353851.png",intern=TRUE)) character(0) > try(system("convert tmp/4bzpw1293353851.ps tmp/4bzpw1293353851.png",intern=TRUE)) character(0) > try(system("convert tmp/5bzpw1293353851.ps tmp/5bzpw1293353851.png",intern=TRUE)) character(0) > try(system("convert tmp/64roh1293353851.ps tmp/64roh1293353851.png",intern=TRUE)) character(0) > try(system("convert tmp/7w0621293353851.ps tmp/7w0621293353851.png",intern=TRUE)) character(0) > try(system("convert tmp/8w0621293353851.ps tmp/8w0621293353851.png",intern=TRUE)) character(0) > try(system("convert tmp/9w0621293353851.ps tmp/9w0621293353851.png",intern=TRUE)) character(0) > try(system("convert tmp/10p9nn1293353851.ps tmp/10p9nn1293353851.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.874 2.487 4.639