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(-999.00 + ,38.60 + ,6654.00 + ,5712.00 + ,645.00 + ,3.30 + ,3.00 + ,5.00 + ,3.00 + ,6.30 + ,4.50 + ,1.00 + ,6600.00 + ,42.00 + ,8.30 + ,3.00 + ,1.00 + ,3.00 + ,-999.00 + ,14.00 + ,3.39 + ,44.50 + ,60.00 + ,12.50 + ,1.00 + ,1.00 + ,1.00 + ,-999.00 + ,-999.00 + ,0.92 + ,5.70 + ,25.00 + ,16.50 + ,5.00 + ,2.00 + ,3.00 + ,2.10 + ,69.00 + ,2547.00 + ,4603.00 + ,624.00 + ,3.90 + ,3.00 + ,5.00 + ,4.00 + ,9.10 + ,27.00 + ,10.55 + ,179.50 + ,180.00 + ,9.80 + ,4.00 + ,4.00 + ,4.00 + ,15.80 + ,19.00 + ,0.02 + ,0.30 + ,35.00 + ,19.70 + ,1.00 + ,1.00 + ,1.00 + ,5.20 + ,30.40 + ,160.00 + ,169.00 + ,392.00 + ,6.20 + ,4.00 + ,5.00 + ,4.00 + ,10.90 + ,28.00 + ,3.30 + ,25.60 + ,63.00 + ,14.50 + ,1.00 + ,2.00 + ,1.00 + ,8.30 + ,50.00 + ,52.16 + ,440.00 + ,230.00 + ,9.70 + ,1.00 + ,1.00 + ,1.00 + ,11.00 + ,7.00 + ,0.43 + ,6.40 + ,112.00 + ,12.50 + ,5.00 + ,4.00 + ,4.00 + ,3.20 + ,30.00 + ,465.00 + ,423.00 + ,281.00 + ,3.90 + ,5.00 + ,5.00 + ,5.00 + ,7.60 + ,-999.00 + ,0.55 + ,2.40 + ,-999.00 + ,10.30 + ,2.00 + ,1.00 + ,2.00 + ,-999.00 + ,40.00 + ,187.10 + ,419.00 + ,365.00 + ,3.10 + ,5.00 + ,5.00 + ,5.00 + ,6.30 + ,3.50 + ,0.08 + ,1.20 + ,42.00 + ,8.40 + ,1.00 + ,1.00 + ,1.00 + ,8.60 + ,50.00 + ,3.00 + ,25.00 + ,28.00 + ,8.60 + ,2.00 + ,2.00 + ,2.00 + ,6.60 + ,6.00 + ,0.79 + ,3500.00 + ,42.00 + ,10.70 + ,2.00 + ,2.00 + ,2.00 + ,9.50 + ,10.40 + ,0.20 + ,5.00 + ,120.00 + ,10.70 + ,2.00 + ,2.00 + ,2.00 + ,4.80 + ,34.00 + ,1.41 + ,17.50 + ,-999.00 + ,6.10 + ,1.00 + ,2.00 + ,1.00 + ,12.00 + ,7.00 + ,60.00 + ,81.00 + ,-999.00 + ,18.10 + ,1.00 + ,1.00 + ,1.00 + ,-999.00 + ,28.00 + ,529.00 + ,680.00 + ,400.00 + ,-999.00 + ,5.00 + ,5.00 + ,5.00 + ,3.30 + ,20.00 + ,27.66 + ,115.00 + ,148.00 + ,3.80 + ,5.00 + ,5.00 + ,5.00 + ,11.00 + ,3.90 + ,0.12 + ,1.00 + ,16.00 + ,14.40 + ,3.00 + ,1.00 + ,2.00 + ,-999.00 + ,39.30 + ,207.00 + ,406.00 + ,252.00 + ,12.00 + ,1.00 + ,4.00 + ,1.00 + ,4.70 + ,41.00 + ,85.00 + ,325.00 + ,310.00 + ,6.20 + ,1.00 + ,3.00 + ,1.00 + ,-999.00 + ,16.20 + ,36.33 + ,119.50 + ,63.00 + ,13.00 + ,1.00 + ,1.00 + ,1.00 + ,10.40 + ,9.00 + ,0.10 + ,4.00 + ,28.00 + ,13.80 + ,5.00 + ,1.00 + ,3.00 + ,7.40 + ,7.60 + ,1.04 + ,5.50 + ,68.00 + ,8.20 + ,5.00 + ,3.00 + ,4.00 + ,2.10 + ,46.00 + ,521.00 + ,655.00 + ,336.00 + ,2.90 + ,5.00 + ,5.00 + ,5.00 + ,-999.00 + ,22.40 + ,100.00 + ,157.00 + ,100.00 + ,10.80 + ,1.00 + ,1.00 + ,1.00 + ,-999.00 + ,16.30 + ,35.00 + ,56.00 + ,33.00 + ,-999.00 + ,3.00 + ,5.00 + ,4.00 + ,7.70 + ,2.60 + ,0.01 + ,0.14 + ,21.50 + ,9.10 + ,5.00 + ,2.00 + ,4.00 + ,17.90 + ,24.00 + ,0.01 + ,0.25 + ,50.00 + ,19.90 + ,1.00 + ,1.00 + ,1.00 + ,6.10 + ,100.00 + ,62.00 + ,1320.00 + ,267.00 + ,8.00 + ,1.00 + ,1.00 + ,1.00 + ,8.20 + ,-999.00 + ,0.12 + ,3.00 + ,30.00 + ,10.60 + ,2.00 + ,1.00 + ,1.00 + ,8.40 + ,-999.00 + ,1.35 + ,8.10 + ,45.00 + ,11.20 + ,3.00 + ,1.00 + ,3.00 + ,11.90 + ,3.20 + ,0.02 + ,0.40 + ,19.00 + ,13.20 + ,4.00 + ,1.00 + ,3.00 + ,10.80 + ,2.00 + ,0.05 + ,0.33 + ,30.00 + ,12.80 + ,4.00 + ,1.00 + ,3.00 + ,13.80 + ,5.00 + ,1.70 + ,6.30 + ,12.00 + ,19.40 + ,2.00 + ,1.00 + ,1.00 + ,14.30 + ,6.50 + ,3.50 + ,10.80 + ,120.00 + ,17.40 + ,2.00 + ,1.00 + ,1.00 + ,-999.00 + ,23.60 + ,250.00 + ,490.00 + ,440.00 + ,-999.00 + ,5.00 + ,5.00 + ,5.00 + ,15.20 + ,12.00 + ,0.48 + ,15.50 + ,140.00 + ,17.00 + ,2.00 + ,2.00 + ,2.00 + ,10.00 + ,20.20 + ,10.00 + ,115.00 + ,170.00 + ,10.90 + ,4.00 + ,4.00 + ,4.00 + ,11.90 + ,13.00 + ,1.62 + ,11.40 + ,17.00 + ,13.70 + ,2.00 + ,1.00 + ,2.00 + ,6.50 + ,27.00 + ,192.00 + ,180.00 + ,115.00 + ,8.40 + ,4.00 + ,4.00 + ,4.00 + ,7.50 + ,18.00 + ,2.50 + ,12.10 + ,31.00 + ,8.40 + ,5.00 + ,5.00 + ,5.00 + ,-999.00 + ,13.70 + ,4.29 + ,39.20 + ,63.00 + ,12.50 + ,2.00 + ,2.00 + ,2.00 + ,10.60 + ,4.70 + ,0.28 + ,1.90 + ,21.00 + ,13.20 + ,3.00 + ,1.00 + ,3.00 + ,7.40 + ,9.80 + ,4.24 + ,50.40 + ,52.00 + ,9.80 + ,1.00 + ,1.00 + ,1.00 + ,8.40 + ,29.00 + ,6.80 + ,179.00 + ,164.00 + ,9.60 + ,2.00 + ,3.00 + ,2.00 + ,5.70 + ,7.00 + ,0.75 + ,12.30 + ,225.00 + ,6.60 + ,2.00 + ,2.00 + ,2.00 + ,4.90 + ,6.00 + ,3.60 + ,21.00 + ,225.00 + ,5.40 + ,3.00 + ,2.00 + ,3.00 + ,-999.00 + ,17.00 + ,14.83 + ,98.20 + ,150.00 + ,2.60 + ,5.00 + ,5.00 + ,5.00 + ,3.20 + ,20.00 + ,55.50 + ,175.00 + ,151.00 + ,3.80 + ,5.00 + ,5.00 + ,5.00 + ,-999.00 + ,12.70 + ,1.40 + ,12.50 + ,90.00 + ,11.00 + ,2.00 + ,2.00 + ,2.00 + ,8.10 + ,3.50 + ,0.06 + ,1.00 + ,-999.00 + ,10.30 + ,3.00 + ,1.00 + ,2.00 + ,11.00 + ,4.50 + ,0.90 + ,2.60 + ,60.00 + ,13.30 + ,2.00 + ,1.00 + ,2.00 + ,4.90 + ,7.50 + ,2.00 + ,12.30 + ,200.00 + ,5.40 + ,3.00 + ,1.00 + ,3.00 + ,13.20 + ,2.30 + ,0.10 + ,2.50 + ,46.00 + ,15.80 + ,3.00 + ,2.00 + ,2.00 + ,9.70 + ,24.00 + ,4.19 + ,58.00 + ,210.00 + ,10.30 + ,4.00 + ,3.00 + ,4.00 + ,12.80 + ,3.00 + ,3.50 + ,3.90 + ,14.00 + ,19.40 + ,2.00 + ,1.00 + ,1.00 + ,-999.00 + ,13.00 + ,4.05 + ,17.00 + ,38.00 + ,-999.00 + ,3.00 + ,1.00 + ,1.00) + ,dim=c(9 + ,62) + ,dimnames=list(c('SWS' + ,'L' + ,'Wb' + ,'Wbr' + ,'Tg' + ,'Ts' + ,'P' + ,'S' + ,'D') + ,1:62)) > y <- array(NA,dim=c(9,62),dimnames=list(c('SWS','L','Wb','Wbr','Tg','Ts','P','S','D'),1:62)) > 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 = '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 SWS L Wb Wbr Tg Ts P S D 1 -999.0 38.6 6654.00 5712.00 645.0 3.3 3 5 3 2 6.3 4.5 1.00 6600.00 42.0 8.3 3 1 3 3 -999.0 14.0 3.39 44.50 60.0 12.5 1 1 1 4 -999.0 -999.0 0.92 5.70 25.0 16.5 5 2 3 5 2.1 69.0 2547.00 4603.00 624.0 3.9 3 5 4 6 9.1 27.0 10.55 179.50 180.0 9.8 4 4 4 7 15.8 19.0 0.02 0.30 35.0 19.7 1 1 1 8 5.2 30.4 160.00 169.00 392.0 6.2 4 5 4 9 10.9 28.0 3.30 25.60 63.0 14.5 1 2 1 10 8.3 50.0 52.16 440.00 230.0 9.7 1 1 1 11 11.0 7.0 0.43 6.40 112.0 12.5 5 4 4 12 3.2 30.0 465.00 423.00 281.0 3.9 5 5 5 13 7.6 -999.0 0.55 2.40 -999.0 10.3 2 1 2 14 -999.0 40.0 187.10 419.00 365.0 3.1 5 5 5 15 6.3 3.5 0.08 1.20 42.0 8.4 1 1 1 16 8.6 50.0 3.00 25.00 28.0 8.6 2 2 2 17 6.6 6.0 0.79 3500.00 42.0 10.7 2 2 2 18 9.5 10.4 0.20 5.00 120.0 10.7 2 2 2 19 4.8 34.0 1.41 17.50 -999.0 6.1 1 2 1 20 12.0 7.0 60.00 81.00 -999.0 18.1 1 1 1 21 -999.0 28.0 529.00 680.00 400.0 -999.0 5 5 5 22 3.3 20.0 27.66 115.00 148.0 3.8 5 5 5 23 11.0 3.9 0.12 1.00 16.0 14.4 3 1 2 24 -999.0 39.3 207.00 406.00 252.0 12.0 1 4 1 25 4.7 41.0 85.00 325.00 310.0 6.2 1 3 1 26 -999.0 16.2 36.33 119.50 63.0 13.0 1 1 1 27 10.4 9.0 0.10 4.00 28.0 13.8 5 1 3 28 7.4 7.6 1.04 5.50 68.0 8.2 5 3 4 29 2.1 46.0 521.00 655.00 336.0 2.9 5 5 5 30 -999.0 22.4 100.00 157.00 100.0 10.8 1 1 1 31 -999.0 16.3 35.00 56.00 33.0 -999.0 3 5 4 32 7.7 2.6 0.01 0.14 21.5 9.1 5 2 4 33 17.9 24.0 0.01 0.25 50.0 19.9 1 1 1 34 6.1 100.0 62.00 1320.00 267.0 8.0 1 1 1 35 8.2 -999.0 0.12 3.00 30.0 10.6 2 1 1 36 8.4 -999.0 1.35 8.10 45.0 11.2 3 1 3 37 11.9 3.2 0.02 0.40 19.0 13.2 4 1 3 38 10.8 2.0 0.05 0.33 30.0 12.8 4 1 3 39 13.8 5.0 1.70 6.30 12.0 19.4 2 1 1 40 14.3 6.5 3.50 10.80 120.0 17.4 2 1 1 41 -999.0 23.6 250.00 490.00 440.0 -999.0 5 5 5 42 15.2 12.0 0.48 15.50 140.0 17.0 2 2 2 43 10.0 20.2 10.00 115.00 170.0 10.9 4 4 4 44 11.9 13.0 1.62 11.40 17.0 13.7 2 1 2 45 6.5 27.0 192.00 180.00 115.0 8.4 4 4 4 46 7.5 18.0 2.50 12.10 31.0 8.4 5 5 5 47 -999.0 13.7 4.29 39.20 63.0 12.5 2 2 2 48 10.6 4.7 0.28 1.90 21.0 13.2 3 1 3 49 7.4 9.8 4.24 50.40 52.0 9.8 1 1 1 50 8.4 29.0 6.80 179.00 164.0 9.6 2 3 2 51 5.7 7.0 0.75 12.30 225.0 6.6 2 2 2 52 4.9 6.0 3.60 21.00 225.0 5.4 3 2 3 53 -999.0 17.0 14.83 98.20 150.0 2.6 5 5 5 54 3.2 20.0 55.50 175.00 151.0 3.8 5 5 5 55 -999.0 12.7 1.40 12.50 90.0 11.0 2 2 2 56 8.1 3.5 0.06 1.00 -999.0 10.3 3 1 2 57 11.0 4.5 0.90 2.60 60.0 13.3 2 1 2 58 4.9 7.5 2.00 12.30 200.0 5.4 3 1 3 59 13.2 2.3 0.10 2.50 46.0 15.8 3 2 2 60 9.7 24.0 4.19 58.00 210.0 10.3 4 3 4 61 12.8 3.0 3.50 3.90 14.0 19.4 2 1 1 62 -999.0 13.0 4.05 17.00 38.0 -999.0 3 1 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) L Wb Wbr Tg Ts -192.39825 0.19698 -0.08943 0.02707 -0.16299 0.78501 P S D -25.97234 -83.02757 121.61624 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -851.957 3.688 114.611 188.283 407.236 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -192.39825 111.81220 -1.721 0.091134 . L 0.19698 0.20084 0.981 0.331151 Wb -0.08943 0.07648 -1.169 0.247484 Wbr 0.02707 0.05041 0.537 0.593488 Tg -0.16299 0.17656 -0.923 0.360124 Ts 0.78501 0.19829 3.959 0.000226 *** P -25.97234 91.79060 -0.283 0.778316 S -83.02757 60.60128 -1.370 0.176443 D 121.61624 120.37882 1.010 0.316952 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 368.8 on 53 degrees of freedom Multiple R-squared: 0.3452, Adjusted R-squared: 0.2464 F-statistic: 3.493 on 8 and 53 DF, p-value: 0.002625 > 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.73461087 0.5307783 0.26538913 [2,] 0.75864345 0.4827131 0.24135655 [3,] 0.93230065 0.1353987 0.06769935 [4,] 0.92593842 0.1481232 0.07406158 [5,] 0.88872832 0.2225434 0.11127168 [6,] 0.84788168 0.3042366 0.15211832 [7,] 0.80122798 0.3975440 0.19877202 [8,] 0.76698337 0.4660333 0.23301663 [9,] 0.71415845 0.5716831 0.28584155 [10,] 0.65102201 0.6979560 0.34897799 [11,] 0.56829259 0.8634148 0.43170741 [12,] 0.54946647 0.9010671 0.45053353 [13,] 0.61993452 0.7601310 0.38006548 [14,] 0.64303910 0.7139218 0.35696090 [15,] 0.85981524 0.2803695 0.14018476 [16,] 0.82073360 0.3585328 0.17926640 [17,] 0.76004692 0.4799062 0.23995308 [18,] 0.70042461 0.5991508 0.29957539 [19,] 0.89105564 0.2178887 0.10894436 [20,] 0.86995915 0.2600817 0.13004085 [21,] 0.81856413 0.3628717 0.18143587 [22,] 0.78047471 0.4390506 0.21952529 [23,] 0.73897768 0.5220446 0.26102232 [24,] 0.74779711 0.5044058 0.25220289 [25,] 0.68196664 0.6360667 0.31803336 [26,] 0.61043179 0.7791364 0.38956821 [27,] 0.55275421 0.8944916 0.44724579 [28,] 0.47776692 0.9555338 0.52223308 [29,] 0.40347374 0.8069475 0.59652626 [30,] 0.31412605 0.6282521 0.68587395 [31,] 0.27469638 0.5493928 0.72530362 [32,] 0.21191109 0.4238222 0.78808891 [33,] 0.15040704 0.3008141 0.84959296 [34,] 0.09775267 0.1955053 0.90224733 [35,] 0.32907888 0.6581578 0.67092112 [36,] 0.52523455 0.9495309 0.47476545 [37,] 0.40316565 0.8063313 0.59683435 [38,] 0.27407763 0.5481553 0.72592237 [39,] 0.16656039 0.3331208 0.83343961 > postscript(file="/var/www/html/rcomp/tmp/12z3a1292961589.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/rcomp/tmp/22z3a1292961589.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/rcomp/tmp/3dq2v1292961589.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/rcomp/tmp/4dq2v1292961589.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/rcomp/tmp/5dq2v1292961589.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 = 62 Frequency = 1 1 2 3 4 5 6 -143.026588 -184.347521 -822.910460 -687.700039 389.308038 163.443835 7 8 9 10 11 12 182.073016 292.931392 266.681952 200.859302 185.833989 199.479734 13 14 15 16 17 18 117.592093 -815.115186 185.618723 163.320743 76.348657 185.658865 19 20 21 22 23 24 92.947900 16.539378 3.118505 149.176976 111.629548 -538.702198 25 26 27 28 29 30 386.924225 -822.331910 42.697271 95.371072 203.704965 -811.116682 31 32 33 34 35 36 -12.008608 5.395811 185.476437 173.232156 407.235910 192.121561 37 38 39 40 41 42 18.461811 19.709670 205.277597 224.694321 -9.302503 189.098763 43 44 45 46 47 48 164.886838 85.329784 167.562002 131.625594 -834.754761 -8.797368 49 50 51 52 53 54 185.048738 267.837432 202.712745 107.427179 -851.956674 150.431371 55 56 57 58 59 60 -828.515146 -53.414403 93.600578 20.121803 200.920610 88.824900 61 62 205.223487 20.482772 > postscript(file="/var/www/html/rcomp/tmp/6o0jy1292961589.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 = 62 Frequency = 1 lag(myerror, k = 1) myerror 0 -143.026588 NA 1 -184.347521 -143.026588 2 -822.910460 -184.347521 3 -687.700039 -822.910460 4 389.308038 -687.700039 5 163.443835 389.308038 6 182.073016 163.443835 7 292.931392 182.073016 8 266.681952 292.931392 9 200.859302 266.681952 10 185.833989 200.859302 11 199.479734 185.833989 12 117.592093 199.479734 13 -815.115186 117.592093 14 185.618723 -815.115186 15 163.320743 185.618723 16 76.348657 163.320743 17 185.658865 76.348657 18 92.947900 185.658865 19 16.539378 92.947900 20 3.118505 16.539378 21 149.176976 3.118505 22 111.629548 149.176976 23 -538.702198 111.629548 24 386.924225 -538.702198 25 -822.331910 386.924225 26 42.697271 -822.331910 27 95.371072 42.697271 28 203.704965 95.371072 29 -811.116682 203.704965 30 -12.008608 -811.116682 31 5.395811 -12.008608 32 185.476437 5.395811 33 173.232156 185.476437 34 407.235910 173.232156 35 192.121561 407.235910 36 18.461811 192.121561 37 19.709670 18.461811 38 205.277597 19.709670 39 224.694321 205.277597 40 -9.302503 224.694321 41 189.098763 -9.302503 42 164.886838 189.098763 43 85.329784 164.886838 44 167.562002 85.329784 45 131.625594 167.562002 46 -834.754761 131.625594 47 -8.797368 -834.754761 48 185.048738 -8.797368 49 267.837432 185.048738 50 202.712745 267.837432 51 107.427179 202.712745 52 -851.956674 107.427179 53 150.431371 -851.956674 54 -828.515146 150.431371 55 -53.414403 -828.515146 56 93.600578 -53.414403 57 20.121803 93.600578 58 200.920610 20.121803 59 88.824900 200.920610 60 205.223487 88.824900 61 20.482772 205.223487 62 NA 20.482772 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -184.347521 -143.026588 [2,] -822.910460 -184.347521 [3,] -687.700039 -822.910460 [4,] 389.308038 -687.700039 [5,] 163.443835 389.308038 [6,] 182.073016 163.443835 [7,] 292.931392 182.073016 [8,] 266.681952 292.931392 [9,] 200.859302 266.681952 [10,] 185.833989 200.859302 [11,] 199.479734 185.833989 [12,] 117.592093 199.479734 [13,] -815.115186 117.592093 [14,] 185.618723 -815.115186 [15,] 163.320743 185.618723 [16,] 76.348657 163.320743 [17,] 185.658865 76.348657 [18,] 92.947900 185.658865 [19,] 16.539378 92.947900 [20,] 3.118505 16.539378 [21,] 149.176976 3.118505 [22,] 111.629548 149.176976 [23,] -538.702198 111.629548 [24,] 386.924225 -538.702198 [25,] -822.331910 386.924225 [26,] 42.697271 -822.331910 [27,] 95.371072 42.697271 [28,] 203.704965 95.371072 [29,] -811.116682 203.704965 [30,] -12.008608 -811.116682 [31,] 5.395811 -12.008608 [32,] 185.476437 5.395811 [33,] 173.232156 185.476437 [34,] 407.235910 173.232156 [35,] 192.121561 407.235910 [36,] 18.461811 192.121561 [37,] 19.709670 18.461811 [38,] 205.277597 19.709670 [39,] 224.694321 205.277597 [40,] -9.302503 224.694321 [41,] 189.098763 -9.302503 [42,] 164.886838 189.098763 [43,] 85.329784 164.886838 [44,] 167.562002 85.329784 [45,] 131.625594 167.562002 [46,] -834.754761 131.625594 [47,] -8.797368 -834.754761 [48,] 185.048738 -8.797368 [49,] 267.837432 185.048738 [50,] 202.712745 267.837432 [51,] 107.427179 202.712745 [52,] -851.956674 107.427179 [53,] 150.431371 -851.956674 [54,] -828.515146 150.431371 [55,] -53.414403 -828.515146 [56,] 93.600578 -53.414403 [57,] 20.121803 93.600578 [58,] 200.920610 20.121803 [59,] 88.824900 200.920610 [60,] 205.223487 88.824900 [61,] 20.482772 205.223487 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -184.347521 -143.026588 2 -822.910460 -184.347521 3 -687.700039 -822.910460 4 389.308038 -687.700039 5 163.443835 389.308038 6 182.073016 163.443835 7 292.931392 182.073016 8 266.681952 292.931392 9 200.859302 266.681952 10 185.833989 200.859302 11 199.479734 185.833989 12 117.592093 199.479734 13 -815.115186 117.592093 14 185.618723 -815.115186 15 163.320743 185.618723 16 76.348657 163.320743 17 185.658865 76.348657 18 92.947900 185.658865 19 16.539378 92.947900 20 3.118505 16.539378 21 149.176976 3.118505 22 111.629548 149.176976 23 -538.702198 111.629548 24 386.924225 -538.702198 25 -822.331910 386.924225 26 42.697271 -822.331910 27 95.371072 42.697271 28 203.704965 95.371072 29 -811.116682 203.704965 30 -12.008608 -811.116682 31 5.395811 -12.008608 32 185.476437 5.395811 33 173.232156 185.476437 34 407.235910 173.232156 35 192.121561 407.235910 36 18.461811 192.121561 37 19.709670 18.461811 38 205.277597 19.709670 39 224.694321 205.277597 40 -9.302503 224.694321 41 189.098763 -9.302503 42 164.886838 189.098763 43 85.329784 164.886838 44 167.562002 85.329784 45 131.625594 167.562002 46 -834.754761 131.625594 47 -8.797368 -834.754761 48 185.048738 -8.797368 49 267.837432 185.048738 50 202.712745 267.837432 51 107.427179 202.712745 52 -851.956674 107.427179 53 150.431371 -851.956674 54 -828.515146 150.431371 55 -53.414403 -828.515146 56 93.600578 -53.414403 57 20.121803 93.600578 58 200.920610 20.121803 59 88.824900 200.920610 60 205.223487 88.824900 61 20.482772 205.223487 > 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/7yr111292961589.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/rcomp/tmp/8yr111292961589.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/rcomp/tmp/9yr111292961589.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/rcomp/tmp/10r00m1292961589.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/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/11cjys1292961589.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/12yjff1292961589.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/13m2c91292961589.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/14xtbc1292961589.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/15jca01292961589.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/16mv861292961589.tab") + } > > try(system("convert tmp/12z3a1292961589.ps tmp/12z3a1292961589.png",intern=TRUE)) character(0) > try(system("convert tmp/22z3a1292961589.ps tmp/22z3a1292961589.png",intern=TRUE)) character(0) > try(system("convert tmp/3dq2v1292961589.ps tmp/3dq2v1292961589.png",intern=TRUE)) character(0) > try(system("convert tmp/4dq2v1292961589.ps tmp/4dq2v1292961589.png",intern=TRUE)) character(0) > try(system("convert tmp/5dq2v1292961589.ps tmp/5dq2v1292961589.png",intern=TRUE)) character(0) > try(system("convert tmp/6o0jy1292961589.ps tmp/6o0jy1292961589.png",intern=TRUE)) character(0) > try(system("convert tmp/7yr111292961589.ps tmp/7yr111292961589.png",intern=TRUE)) character(0) > try(system("convert tmp/8yr111292961589.ps tmp/8yr111292961589.png",intern=TRUE)) character(0) > try(system("convert tmp/9yr111292961589.ps tmp/9yr111292961589.png",intern=TRUE)) character(0) > try(system("convert tmp/10r00m1292961589.ps tmp/10r00m1292961589.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.583 1.661 8.141