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 + ,-999.00 + ,38.60 + ,6654.00 + ,5712.00 + ,645.00 + ,3.00 + ,5.00 + ,3.00 + ,6.30 + ,2.00 + ,4.50 + ,1.00 + ,6600.00 + ,42.00 + ,3.00 + ,1.00 + ,3.00 + ,-999.00 + ,-999.00 + ,14.00 + ,3.39 + ,44.50 + ,60.00 + ,1.00 + ,1.00 + ,1.00 + ,-999.00 + ,-999.00 + ,-999.00 + ,0.92 + ,5.70 + ,25.00 + ,5.00 + ,2.00 + ,3.00 + ,2.10 + ,1.80 + ,69.00 + ,2547.00 + ,4603.00 + ,624.00 + ,3.00 + ,5.00 + ,4.00 + ,9.10 + ,0.70 + ,27.00 + ,10.55 + ,179.50 + ,180.00 + ,4.00 + ,4.00 + ,4.00 + ,15.80 + ,3.90 + ,19.00 + ,0.02 + ,0.30 + ,35.00 + ,1.00 + ,1.00 + ,1.00 + ,5.20 + ,1.00 + ,30.40 + ,160.00 + ,169.00 + ,392.00 + ,4.00 + ,5.00 + ,4.00 + ,10.90 + ,3.60 + ,28.00 + ,3.30 + ,25.60 + ,63.00 + ,1.00 + ,2.00 + ,1.00 + ,8.30 + ,1.40 + ,50.00 + ,52.16 + ,440.00 + ,230.00 + ,1.00 + ,1.00 + ,1.00 + ,11.00 + ,1.50 + ,7.00 + ,0.43 + ,6.40 + ,112.00 + ,5.00 + ,4.00 + ,4.00 + ,3.20 + ,0.70 + ,30.00 + ,465.00 + ,423.00 + ,281.00 + ,5.00 + ,5.00 + ,5.00 + ,7.60 + ,2.70 + ,-999.00 + ,0.55 + ,2.40 + ,-999.00 + ,2.00 + ,1.00 + ,2.00 + ,-999.00 + ,-999.00 + ,40.00 + ,187.10 + ,419.00 + ,365.00 + ,5.00 + ,5.00 + ,5.00 + ,6.30 + ,2.10 + ,3.50 + ,0.08 + ,1.20 + ,42.00 + ,1.00 + ,1.00 + ,1.00 + ,8.60 + ,0.00 + ,50.00 + ,3.00 + ,25.00 + ,28.00 + ,2.00 + ,2.00 + ,2.00 + ,6.60 + ,4.10 + ,6.00 + ,0.79 + ,3500.00 + ,42.00 + ,2.00 + ,2.00 + ,2.00 + ,9.50 + ,1.20 + ,10.40 + ,0.20 + ,5.00 + ,120.00 + ,2.00 + ,2.00 + ,2.00 + ,4.80 + ,1.30 + ,34.00 + ,1.41 + ,17.50 + ,-999.00 + ,1.00 + ,2.00 + ,1.00 + ,12.00 + ,6.10 + ,7.00 + ,60.00 + ,81.00 + ,-999.00 + ,1.00 + ,1.00 + ,1.00 + ,-999.00 + ,0.30 + ,28.00 + ,529.00 + ,680.00 + ,400.00 + ,5.00 + ,5.00 + ,5.00 + ,3.30 + ,0.50 + ,20.00 + ,27.66 + ,115.00 + ,148.00 + ,5.00 + ,5.00 + ,5.00 + ,11.00 + ,3.40 + ,3.90 + ,0.12 + ,1.00 + ,16.00 + ,3.00 + ,1.00 + ,2.00 + ,-999.00 + ,-999.00 + ,39.30 + ,207.00 + ,406.00 + ,252.00 + ,1.00 + ,4.00 + ,1.00 + ,4.70 + ,1.50 + ,41.00 + ,85.00 + ,325.00 + ,310.00 + ,1.00 + ,3.00 + ,1.00 + ,-999.00 + ,-999.00 + ,16.20 + ,36.33 + ,119.50 + ,63.00 + ,1.00 + ,1.00 + ,1.00 + ,10.40 + ,3.40 + ,9.00 + ,0.10 + ,4.00 + ,28.00 + ,5.00 + ,1.00 + ,3.00 + ,7.40 + ,0.80 + ,7.60 + ,1.04 + ,5.50 + ,68.00 + ,5.00 + ,3.00 + ,4.00 + ,2.10 + ,0.80 + ,46.00 + ,521.00 + ,655.00 + ,336.00 + ,5.00 + ,5.00 + ,5.00 + ,-999.00 + ,-999.00 + ,22.40 + ,100.00 + ,157.00 + ,100.00 + ,1.00 + ,1.00 + ,1.00 + ,-999.00 + ,-999.00 + ,16.30 + ,35.00 + ,56.00 + ,33.00 + ,3.00 + ,5.00 + ,4.00 + ,7.70 + ,1.40 + ,2.60 + ,0.01 + ,0.14 + ,21.50 + ,5.00 + ,2.00 + ,4.00 + ,17.90 + ,2.00 + ,24.00 + ,0.01 + ,0.25 + ,50.00 + ,1.00 + ,1.00 + ,1.00 + ,6.10 + ,1.90 + ,100.00 + ,62.00 + ,1320.00 + ,267.00 + ,1.00 + ,1.00 + ,1.00 + ,8.20 + ,2.40 + ,-999.00 + ,0.12 + ,3.00 + ,30.00 + ,2.00 + ,1.00 + ,1.00 + ,8.40 + ,2.80 + ,-999.00 + ,1.35 + ,8.10 + ,45.00 + ,3.00 + ,1.00 + ,3.00 + ,11.90 + ,1.30 + ,3.20 + ,0.02 + ,0.40 + ,19.00 + ,4.00 + ,1.00 + ,3.00 + ,10.80 + ,2.00 + ,2.00 + ,0.05 + ,0.33 + ,30.00 + ,4.00 + ,1.00 + ,3.00 + ,13.80 + ,5.60 + ,5.00 + ,1.70 + ,6.30 + ,12.00 + ,2.00 + ,1.00 + ,1.00 + ,14.30 + ,3.10 + ,6.50 + ,3.50 + ,10.80 + ,120.00 + ,2.00 + ,1.00 + ,1.00 + ,-999.00 + ,1.00 + ,23.60 + ,250.00 + ,490.00 + ,440.00 + ,5.00 + ,5.00 + ,5.00 + ,15.20 + ,1.80 + ,12.00 + ,0.48 + ,15.50 + ,140.00 + ,2.00 + ,2.00 + ,2.00 + ,10.00 + ,0.90 + ,20.20 + ,10.00 + ,115.00 + ,170.00 + ,4.00 + ,4.00 + ,4.00 + ,11.90 + ,1.80 + ,13.00 + ,1.62 + ,11.40 + ,17.00 + ,2.00 + ,1.00 + ,2.00 + ,6.50 + ,1.90 + ,27.00 + ,192.00 + ,180.00 + ,115.00 + ,4.00 + ,4.00 + ,4.00 + ,7.50 + ,0.90 + ,18.00 + ,2.50 + ,12.10 + ,31.00 + ,5.00 + ,5.00 + ,5.00 + ,-999.00 + ,-999.00 + ,13.70 + ,4.29 + ,39.20 + ,63.00 + ,2.00 + ,2.00 + ,2.00 + ,10.60 + ,2.60 + ,4.70 + ,0.28 + ,1.90 + ,21.00 + ,3.00 + ,1.00 + ,3.00 + ,7.40 + ,2.40 + ,9.80 + ,4.24 + ,50.40 + ,52.00 + ,1.00 + ,1.00 + ,1.00 + ,8.40 + ,1.20 + ,29.00 + ,6.80 + ,179.00 + ,164.00 + ,2.00 + ,3.00 + ,2.00 + ,5.70 + ,0.90 + ,7.00 + ,0.75 + ,12.30 + ,225.00 + ,2.00 + ,2.00 + ,2.00 + ,4.90 + ,0.50 + ,6.00 + ,3.60 + ,21.00 + ,225.00 + ,3.00 + ,2.00 + ,3.00 + ,-999.00 + ,-999.00 + ,17.00 + ,14.83 + ,98.20 + ,150.00 + ,5.00 + ,5.00 + ,5.00 + ,3.20 + ,0.60 + ,20.00 + ,55.50 + ,175.00 + ,151.00 + ,5.00 + ,5.00 + ,5.00 + ,-999.00 + ,-999.00 + ,12.70 + ,1.40 + ,12.50 + ,90.00 + ,2.00 + ,2.00 + ,2.00 + ,8.10 + ,2.20 + ,3.50 + ,0.06 + ,1.00 + ,-999.00 + ,3.00 + ,1.00 + ,2.00 + ,11.00 + ,2.30 + ,4.50 + ,0.90 + ,2.60 + ,60.00 + ,2.00 + ,1.00 + ,2.00 + ,4.90 + ,0.50 + ,7.50 + ,2.00 + ,12.30 + ,200.00 + ,3.00 + ,1.00 + ,3.00 + ,13.20 + ,2.60 + ,2.30 + ,0.10 + ,2.50 + ,46.00 + ,3.00 + ,2.00 + ,2.00 + ,9.70 + ,0.60 + ,24.00 + ,4.19 + ,58.00 + ,210.00 + ,4.00 + ,3.00 + ,4.00 + ,12.80 + ,6.60 + ,3.00 + ,3.50 + ,3.90 + ,14.00 + ,2.00 + ,1.00 + ,1.00 + ,-999.00 + ,-999.00 + ,13.00 + ,4.05 + ,17.00 + ,38.00 + ,3.00 + ,1.00 + ,1.00) + ,dim=c(9 + ,62) + ,dimnames=list(c('SWS' + ,'PS' + ,'L' + ,'Wb' + ,'Wbr' + ,'Tg' + ,'P' + ,'S' + ,'D ') + ,1:62)) > y <- array(NA,dim=c(9,62),dimnames=list(c('SWS','PS','L','Wb','Wbr','Tg','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 PS L Wb Wbr Tg P S D\r 1 -999.0 -999.0 38.6 6654.00 5712.00 645.0 3 5 3 2 6.3 2.0 4.5 1.00 6600.00 42.0 3 1 3 3 -999.0 -999.0 14.0 3.39 44.50 60.0 1 1 1 4 -999.0 -999.0 -999.0 0.92 5.70 25.0 5 2 3 5 2.1 1.8 69.0 2547.00 4603.00 624.0 3 5 4 6 9.1 0.7 27.0 10.55 179.50 180.0 4 4 4 7 15.8 3.9 19.0 0.02 0.30 35.0 1 1 1 8 5.2 1.0 30.4 160.00 169.00 392.0 4 5 4 9 10.9 3.6 28.0 3.30 25.60 63.0 1 2 1 10 8.3 1.4 50.0 52.16 440.00 230.0 1 1 1 11 11.0 1.5 7.0 0.43 6.40 112.0 5 4 4 12 3.2 0.7 30.0 465.00 423.00 281.0 5 5 5 13 7.6 2.7 -999.0 0.55 2.40 -999.0 2 1 2 14 -999.0 -999.0 40.0 187.10 419.00 365.0 5 5 5 15 6.3 2.1 3.5 0.08 1.20 42.0 1 1 1 16 8.6 0.0 50.0 3.00 25.00 28.0 2 2 2 17 6.6 4.1 6.0 0.79 3500.00 42.0 2 2 2 18 9.5 1.2 10.4 0.20 5.00 120.0 2 2 2 19 4.8 1.3 34.0 1.41 17.50 -999.0 1 2 1 20 12.0 6.1 7.0 60.00 81.00 -999.0 1 1 1 21 -999.0 0.3 28.0 529.00 680.00 400.0 5 5 5 22 3.3 0.5 20.0 27.66 115.00 148.0 5 5 5 23 11.0 3.4 3.9 0.12 1.00 16.0 3 1 2 24 -999.0 -999.0 39.3 207.00 406.00 252.0 1 4 1 25 4.7 1.5 41.0 85.00 325.00 310.0 1 3 1 26 -999.0 -999.0 16.2 36.33 119.50 63.0 1 1 1 27 10.4 3.4 9.0 0.10 4.00 28.0 5 1 3 28 7.4 0.8 7.6 1.04 5.50 68.0 5 3 4 29 2.1 0.8 46.0 521.00 655.00 336.0 5 5 5 30 -999.0 -999.0 22.4 100.00 157.00 100.0 1 1 1 31 -999.0 -999.0 16.3 35.00 56.00 33.0 3 5 4 32 7.7 1.4 2.6 0.01 0.14 21.5 5 2 4 33 17.9 2.0 24.0 0.01 0.25 50.0 1 1 1 34 6.1 1.9 100.0 62.00 1320.00 267.0 1 1 1 35 8.2 2.4 -999.0 0.12 3.00 30.0 2 1 1 36 8.4 2.8 -999.0 1.35 8.10 45.0 3 1 3 37 11.9 1.3 3.2 0.02 0.40 19.0 4 1 3 38 10.8 2.0 2.0 0.05 0.33 30.0 4 1 3 39 13.8 5.6 5.0 1.70 6.30 12.0 2 1 1 40 14.3 3.1 6.5 3.50 10.80 120.0 2 1 1 41 -999.0 1.0 23.6 250.00 490.00 440.0 5 5 5 42 15.2 1.8 12.0 0.48 15.50 140.0 2 2 2 43 10.0 0.9 20.2 10.00 115.00 170.0 4 4 4 44 11.9 1.8 13.0 1.62 11.40 17.0 2 1 2 45 6.5 1.9 27.0 192.00 180.00 115.0 4 4 4 46 7.5 0.9 18.0 2.50 12.10 31.0 5 5 5 47 -999.0 -999.0 13.7 4.29 39.20 63.0 2 2 2 48 10.6 2.6 4.7 0.28 1.90 21.0 3 1 3 49 7.4 2.4 9.8 4.24 50.40 52.0 1 1 1 50 8.4 1.2 29.0 6.80 179.00 164.0 2 3 2 51 5.7 0.9 7.0 0.75 12.30 225.0 2 2 2 52 4.9 0.5 6.0 3.60 21.00 225.0 3 2 3 53 -999.0 -999.0 17.0 14.83 98.20 150.0 5 5 5 54 3.2 0.6 20.0 55.50 175.00 151.0 5 5 5 55 -999.0 -999.0 12.7 1.40 12.50 90.0 2 2 2 56 8.1 2.2 3.5 0.06 1.00 -999.0 3 1 2 57 11.0 2.3 4.5 0.90 2.60 60.0 2 1 2 58 4.9 0.5 7.5 2.00 12.30 200.0 3 1 3 59 13.2 2.6 2.3 0.10 2.50 46.0 3 2 2 60 9.7 0.6 24.0 4.19 58.00 210.0 4 3 4 61 12.8 6.6 3.0 3.50 3.90 14.0 2 1 1 62 -999.0 -999.0 13.0 4.05 17.00 38.0 3 1 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) PS L Wb Wbr Tg 58.596203 0.955259 0.019899 0.007974 0.002622 -0.067620 P S `D\r` -2.794662 -22.090214 -11.483472 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -855.551 -9.767 17.882 60.586 140.515 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 58.596203 55.685707 1.052 0.297 PS 0.955259 0.062235 15.349 <2e-16 *** L 0.019899 0.098519 0.202 0.841 Wb 0.007974 0.037502 0.213 0.832 Wbr 0.002622 0.024641 0.106 0.916 Tg -0.067620 0.086431 -0.782 0.437 P -2.794662 44.714931 -0.062 0.950 S -22.090214 29.839333 -0.740 0.462 `D\r` -11.483472 59.599358 -0.193 0.848 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 179.9 on 53 degrees of freedom Multiple R-squared: 0.8442, Adjusted R-squared: 0.8207 F-statistic: 35.89 on 8 and 53 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,] 4.996589e-06 9.993178e-06 9.999950e-01 [2,] 9.034865e-08 1.806973e-07 9.999999e-01 [3,] 2.454728e-09 4.909457e-09 1.000000e+00 [4,] 1.020820e-10 2.041640e-10 1.000000e+00 [5,] 1.556277e-12 3.112553e-12 1.000000e+00 [6,] 3.091300e-14 6.182601e-14 1.000000e+00 [7,] 4.426300e-16 8.852600e-16 1.000000e+00 [8,] 1.184976e-17 2.369952e-17 1.000000e+00 [9,] 1.752603e-19 3.505207e-19 1.000000e+00 [10,] 9.838936e-01 3.221287e-02 1.610644e-02 [11,] 9.794727e-01 4.105451e-02 2.052726e-02 [12,] 9.668577e-01 6.628460e-02 3.314230e-02 [13,] 9.526235e-01 9.475300e-02 4.737650e-02 [14,] 9.281155e-01 1.437691e-01 7.188453e-02 [15,] 8.943758e-01 2.112483e-01 1.056242e-01 [16,] 8.500860e-01 2.998280e-01 1.499140e-01 [17,] 8.025176e-01 3.949649e-01 1.974824e-01 [18,] 9.822010e-01 3.559808e-02 1.779904e-02 [19,] 9.800692e-01 3.986164e-02 1.993082e-02 [20,] 9.682550e-01 6.349006e-02 3.174503e-02 [21,] 9.502853e-01 9.942941e-02 4.971471e-02 [22,] 9.238990e-01 1.522020e-01 7.610099e-02 [23,] 9.946817e-01 1.063655e-02 5.318277e-03 [24,] 9.901487e-01 1.970250e-02 9.851252e-03 [25,] 9.979375e-01 4.125074e-03 2.062537e-03 [26,] 9.959463e-01 8.107345e-03 4.053672e-03 [27,] 9.932876e-01 1.342479e-02 6.712395e-03 [28,] 9.867930e-01 2.641393e-02 1.320697e-02 [29,] 9.751566e-01 4.968673e-02 2.484336e-02 [30,] 1.000000e+00 3.452881e-21 1.726440e-21 [31,] 1.000000e+00 3.811945e-20 1.905972e-20 [32,] 1.000000e+00 1.764170e-18 8.820850e-19 [33,] 1.000000e+00 9.632183e-17 4.816091e-17 [34,] 1.000000e+00 3.420674e-15 1.710337e-15 [35,] 1.000000e+00 2.196635e-13 1.098317e-13 [36,] 1.000000e+00 1.997124e-11 9.985620e-12 [37,] 1.000000e+00 1.193116e-09 5.965581e-10 [38,] 9.999999e-01 1.117211e-07 5.586054e-08 [39,] 9.999958e-01 8.469404e-06 4.234702e-06 > postscript(file="/var/www/html/rcomp/tmp/1ikap1292933509.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/2ikap1292933509.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/3bcrs1292933509.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/4bcrs1292933509.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/5bcrs1292933509.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 24.8021573 -3.8434031 -63.2896141 10.8583831 114.9964386 106.3881807 7 8 9 10 11 12 -8.1656706 137.3954447 10.9329167 -2.2769916 106.6529565 139.3641137 13 14 15 16 17 18 -50.6135112 99.8438030 -15.1672689 23.5494592 10.3620213 30.3869854 19 20 21 22 23 24 -64.8659739 -84.4378671 -855.5513179 135.1556826 3.5978070 12.8892615 25 26 27 28 29 30 43.8362612 -63.5898423 20.7728598 78.6416801 140.5145070 -61.8173076 31 32 33 34 35 36 62.9572441 53.2557209 -3.3356560 -5.8332517 8.3728762 34.9435070 37 38 39 40 41 42 21.0011458 20.0001125 -10.3007623 -0.1656093 -850.7046218 36.8046392 43 44 45 46 47 48 106.7297281 3.0788713 96.7982722 131.5722051 -26.7057155 15.7640339 49 50 51 52 53 54 -13.9651704 53.4735578 34.0178394 47.8524398 87.9779075 134.7837025 55 56 57 58 59 60 -24.7670170 -66.7821851 4.8068738 24.0774352 30.7089060 87.4510670 61 62 -12.0890440 -59.1012037 > postscript(file="/var/www/html/rcomp/tmp/6l39v1292933509.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 24.8021573 NA 1 -3.8434031 24.8021573 2 -63.2896141 -3.8434031 3 10.8583831 -63.2896141 4 114.9964386 10.8583831 5 106.3881807 114.9964386 6 -8.1656706 106.3881807 7 137.3954447 -8.1656706 8 10.9329167 137.3954447 9 -2.2769916 10.9329167 10 106.6529565 -2.2769916 11 139.3641137 106.6529565 12 -50.6135112 139.3641137 13 99.8438030 -50.6135112 14 -15.1672689 99.8438030 15 23.5494592 -15.1672689 16 10.3620213 23.5494592 17 30.3869854 10.3620213 18 -64.8659739 30.3869854 19 -84.4378671 -64.8659739 20 -855.5513179 -84.4378671 21 135.1556826 -855.5513179 22 3.5978070 135.1556826 23 12.8892615 3.5978070 24 43.8362612 12.8892615 25 -63.5898423 43.8362612 26 20.7728598 -63.5898423 27 78.6416801 20.7728598 28 140.5145070 78.6416801 29 -61.8173076 140.5145070 30 62.9572441 -61.8173076 31 53.2557209 62.9572441 32 -3.3356560 53.2557209 33 -5.8332517 -3.3356560 34 8.3728762 -5.8332517 35 34.9435070 8.3728762 36 21.0011458 34.9435070 37 20.0001125 21.0011458 38 -10.3007623 20.0001125 39 -0.1656093 -10.3007623 40 -850.7046218 -0.1656093 41 36.8046392 -850.7046218 42 106.7297281 36.8046392 43 3.0788713 106.7297281 44 96.7982722 3.0788713 45 131.5722051 96.7982722 46 -26.7057155 131.5722051 47 15.7640339 -26.7057155 48 -13.9651704 15.7640339 49 53.4735578 -13.9651704 50 34.0178394 53.4735578 51 47.8524398 34.0178394 52 87.9779075 47.8524398 53 134.7837025 87.9779075 54 -24.7670170 134.7837025 55 -66.7821851 -24.7670170 56 4.8068738 -66.7821851 57 24.0774352 4.8068738 58 30.7089060 24.0774352 59 87.4510670 30.7089060 60 -12.0890440 87.4510670 61 -59.1012037 -12.0890440 62 NA -59.1012037 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -3.8434031 24.8021573 [2,] -63.2896141 -3.8434031 [3,] 10.8583831 -63.2896141 [4,] 114.9964386 10.8583831 [5,] 106.3881807 114.9964386 [6,] -8.1656706 106.3881807 [7,] 137.3954447 -8.1656706 [8,] 10.9329167 137.3954447 [9,] -2.2769916 10.9329167 [10,] 106.6529565 -2.2769916 [11,] 139.3641137 106.6529565 [12,] -50.6135112 139.3641137 [13,] 99.8438030 -50.6135112 [14,] -15.1672689 99.8438030 [15,] 23.5494592 -15.1672689 [16,] 10.3620213 23.5494592 [17,] 30.3869854 10.3620213 [18,] -64.8659739 30.3869854 [19,] -84.4378671 -64.8659739 [20,] -855.5513179 -84.4378671 [21,] 135.1556826 -855.5513179 [22,] 3.5978070 135.1556826 [23,] 12.8892615 3.5978070 [24,] 43.8362612 12.8892615 [25,] -63.5898423 43.8362612 [26,] 20.7728598 -63.5898423 [27,] 78.6416801 20.7728598 [28,] 140.5145070 78.6416801 [29,] -61.8173076 140.5145070 [30,] 62.9572441 -61.8173076 [31,] 53.2557209 62.9572441 [32,] -3.3356560 53.2557209 [33,] -5.8332517 -3.3356560 [34,] 8.3728762 -5.8332517 [35,] 34.9435070 8.3728762 [36,] 21.0011458 34.9435070 [37,] 20.0001125 21.0011458 [38,] -10.3007623 20.0001125 [39,] -0.1656093 -10.3007623 [40,] -850.7046218 -0.1656093 [41,] 36.8046392 -850.7046218 [42,] 106.7297281 36.8046392 [43,] 3.0788713 106.7297281 [44,] 96.7982722 3.0788713 [45,] 131.5722051 96.7982722 [46,] -26.7057155 131.5722051 [47,] 15.7640339 -26.7057155 [48,] -13.9651704 15.7640339 [49,] 53.4735578 -13.9651704 [50,] 34.0178394 53.4735578 [51,] 47.8524398 34.0178394 [52,] 87.9779075 47.8524398 [53,] 134.7837025 87.9779075 [54,] -24.7670170 134.7837025 [55,] -66.7821851 -24.7670170 [56,] 4.8068738 -66.7821851 [57,] 24.0774352 4.8068738 [58,] 30.7089060 24.0774352 [59,] 87.4510670 30.7089060 [60,] -12.0890440 87.4510670 [61,] -59.1012037 -12.0890440 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -3.8434031 24.8021573 2 -63.2896141 -3.8434031 3 10.8583831 -63.2896141 4 114.9964386 10.8583831 5 106.3881807 114.9964386 6 -8.1656706 106.3881807 7 137.3954447 -8.1656706 8 10.9329167 137.3954447 9 -2.2769916 10.9329167 10 106.6529565 -2.2769916 11 139.3641137 106.6529565 12 -50.6135112 139.3641137 13 99.8438030 -50.6135112 14 -15.1672689 99.8438030 15 23.5494592 -15.1672689 16 10.3620213 23.5494592 17 30.3869854 10.3620213 18 -64.8659739 30.3869854 19 -84.4378671 -64.8659739 20 -855.5513179 -84.4378671 21 135.1556826 -855.5513179 22 3.5978070 135.1556826 23 12.8892615 3.5978070 24 43.8362612 12.8892615 25 -63.5898423 43.8362612 26 20.7728598 -63.5898423 27 78.6416801 20.7728598 28 140.5145070 78.6416801 29 -61.8173076 140.5145070 30 62.9572441 -61.8173076 31 53.2557209 62.9572441 32 -3.3356560 53.2557209 33 -5.8332517 -3.3356560 34 8.3728762 -5.8332517 35 34.9435070 8.3728762 36 21.0011458 34.9435070 37 20.0001125 21.0011458 38 -10.3007623 20.0001125 39 -0.1656093 -10.3007623 40 -850.7046218 -0.1656093 41 36.8046392 -850.7046218 42 106.7297281 36.8046392 43 3.0788713 106.7297281 44 96.7982722 3.0788713 45 131.5722051 96.7982722 46 -26.7057155 131.5722051 47 15.7640339 -26.7057155 48 -13.9651704 15.7640339 49 53.4735578 -13.9651704 50 34.0178394 53.4735578 51 47.8524398 34.0178394 52 87.9779075 47.8524398 53 134.7837025 87.9779075 54 -24.7670170 134.7837025 55 -66.7821851 -24.7670170 56 4.8068738 -66.7821851 57 24.0774352 4.8068738 58 30.7089060 24.0774352 59 87.4510670 30.7089060 60 -12.0890440 87.4510670 61 -59.1012037 -12.0890440 > 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/7wc8g1292933509.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/8plp11292933509.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/9plp11292933509.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/10hd6m1292933509.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/11lv5a1292933509.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/126w3x1292933509.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/13k5j61292933509.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/1466hu1292933509.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/1597y01292933509.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/16iamc1292933509.tab") + } > > try(system("convert tmp/1ikap1292933509.ps tmp/1ikap1292933509.png",intern=TRUE)) character(0) > try(system("convert tmp/2ikap1292933509.ps tmp/2ikap1292933509.png",intern=TRUE)) character(0) > try(system("convert tmp/3bcrs1292933509.ps tmp/3bcrs1292933509.png",intern=TRUE)) character(0) > try(system("convert tmp/4bcrs1292933509.ps tmp/4bcrs1292933509.png",intern=TRUE)) character(0) > try(system("convert tmp/5bcrs1292933509.ps tmp/5bcrs1292933509.png",intern=TRUE)) character(0) > try(system("convert tmp/6l39v1292933509.ps tmp/6l39v1292933509.png",intern=TRUE)) character(0) > try(system("convert tmp/7wc8g1292933509.ps tmp/7wc8g1292933509.png",intern=TRUE)) character(0) > try(system("convert tmp/8plp11292933509.ps tmp/8plp11292933509.png",intern=TRUE)) character(0) > try(system("convert tmp/9plp11292933509.ps tmp/9plp11292933509.png",intern=TRUE)) character(0) > try(system("convert tmp/10hd6m1292933509.ps tmp/10hd6m1292933509.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.607 1.628 8.033