R version 2.12.1 (2010-12-16) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-redhat-linux-gnu (64-bit) 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(6654.00 + ,5712.00 + ,3.30 + ,38.60 + ,645.00 + ,3.00 + ,5.00 + ,3.00 + ,1.00 + ,6.60 + ,8.30 + ,4.50 + ,42.00 + ,3.00 + ,1.00 + ,3.00 + ,3.39 + ,44.50 + ,12.50 + ,14.00 + ,60.00 + ,1.00 + ,1.00 + ,1.00 + ,0.92 + ,5.70 + ,16.50 + ,25.00 + ,5.00 + ,2.00 + ,3.00 + ,2547.00 + ,4603.00 + ,3.90 + ,69.00 + ,624.00 + ,3.00 + ,5.00 + ,4.00 + ,10.55 + ,179.50 + ,9.80 + ,27.00 + ,180.00 + ,4.00 + ,4.00 + ,4.00 + ,0.02 + ,0.30 + ,19.70 + ,19.00 + ,35.00 + ,1.00 + ,1.00 + ,1.00 + ,160.00 + ,169.00 + ,6.20 + ,30.40 + ,392.00 + ,4.00 + ,5.00 + ,4.00 + ,3.30 + ,25.60 + ,14.50 + ,28.00 + ,63.00 + ,1.00 + ,2.00 + ,1.00 + ,52.16 + ,440.00 + ,9.70 + ,50.00 + ,230.00 + ,1.00 + ,1.00 + ,1.00 + ,0.43 + ,6.40 + ,12.50 + ,7.00 + ,112.00 + ,5.00 + ,4.00 + ,4.00 + ,465.00 + ,423.00 + ,3.90 + ,30.00 + ,281.00 + ,5.00 + ,5.00 + ,5.00 + ,0.55 + ,2.40 + ,10.30 + ,2.00 + ,1.00 + ,2.00 + ,187.10 + ,419.00 + ,3.10 + ,40.00 + ,365.00 + ,5.00 + ,5.00 + ,5.00 + ,0.08 + ,1.20 + ,8.40 + ,3.50 + ,42.00 + ,1.00 + ,1.00 + ,1.00 + ,3.00 + ,25.00 + ,8.60 + ,50.00 + ,28.00 + ,2.00 + ,2.00 + ,2.00 + ,0.79 + ,3.50 + ,10.70 + ,6.00 + ,42.00 + ,2.00 + ,2.00 + ,2.00 + ,0.20 + ,5.00 + ,10.70 + ,10.40 + ,120.00 + ,2.00 + ,2.00 + ,2.00 + ,1.41 + ,17.50 + ,6.10 + ,34.00 + ,1.00 + ,2.00 + ,1.00 + ,60.00 + ,81.00 + ,18.10 + ,7.00 + ,1.00 + ,1.00 + ,1.00 + ,529.00 + ,680.00 + ,28.00 + ,400.00 + ,5.00 + ,5.00 + ,5.00 + ,27.66 + ,115.00 + ,3.80 + ,20.00 + ,148.00 + ,5.00 + ,5.00 + ,5.00 + ,0.12 + ,1.00 + ,14.40 + ,3.90 + ,16.00 + ,3.00 + ,1.00 + ,2.00 + ,207.00 + ,406.00 + ,12.00 + ,39.30 + ,252.00 + ,1.00 + ,4.00 + ,1.00 + ,85.00 + ,325.00 + ,6.20 + ,41.00 + ,310.00 + ,1.00 + ,3.00 + ,1.00 + ,36.33 + ,119.50 + ,13.00 + ,16.20 + ,63.00 + ,1.00 + ,1.00 + ,1.00 + ,0.10 + ,4.00 + ,13.80 + ,9.00 + ,28.00 + ,5.00 + ,1.00 + ,3.00 + ,1.04 + ,5.50 + ,8.20 + ,7.60 + ,68.00 + ,5.00 + ,3.00 + ,4.00 + ,521.00 + ,655.00 + ,2.90 + ,46.00 + ,336.00 + ,5.00 + ,5.00 + ,5.00 + ,100.00 + ,157.00 + ,10.80 + ,22.40 + ,100.00 + ,1.00 + ,1.00 + ,1.00 + ,35.00 + ,56.00 + ,16.30 + ,33.00 + ,3.00 + ,5.00 + ,4.00 + ,0.01 + ,0.14 + ,9.10 + ,2.60 + ,21.50 + ,5.00 + ,2.00 + ,4.00 + ,0.01 + ,0.25 + ,19.90 + ,24.00 + ,50.00 + ,1.00 + ,1.00 + ,1.00 + ,62.00 + ,1320.00 + ,8.00 + ,100.00 + ,267.00 + ,1.00 + ,1.00 + ,1.00 + ,0.12 + ,3.00 + ,10.60 + ,30.00 + ,2.00 + ,1.00 + ,1.00 + ,1.35 + ,8.10 + ,11.20 + ,45.00 + ,3.00 + ,1.00 + ,3.00 + ,0.02 + ,0.40 + ,13.20 + ,3.20 + ,19.00 + ,4.00 + ,1.00 + ,3.00 + ,0.05 + ,0.33 + ,12.80 + ,2.00 + ,30.00 + ,4.00 + ,1.00 + ,3.00 + ,1.70 + ,6.30 + ,19.40 + ,5.00 + ,12.00 + ,2.00 + ,1.00 + ,1.00 + ,3.50 + ,10.80 + ,17.40 + ,6.50 + ,120.00 + ,2.00 + ,1.00 + ,1.00 + ,250.00 + ,490.00 + ,23.60 + ,440.00 + ,5.00 + ,5.00 + ,5.00 + ,0.48 + ,15.50 + ,17.00 + ,12.00 + ,140.00 + ,2.00 + ,2.00 + ,2.00 + ,10.00 + ,115.00 + ,10.90 + ,20.20 + ,170.00 + ,4.00 + ,4.00 + ,4.00 + ,1.62 + ,11.40 + ,13.70 + ,13.00 + ,17.00 + ,2.00 + ,1.00 + ,2.00 + ,192.00 + ,180.00 + ,8.40 + ,27.00 + ,115.00 + ,4.00 + ,4.00 + ,4.00 + ,2.50 + ,12.10 + ,8.40 + ,18.00 + ,31.00 + ,5.00 + ,5.00 + ,5.00 + ,4.29 + ,39.20 + ,12.50 + ,13.70 + ,63.00 + ,2.00 + ,2.00 + ,2.00 + ,0.28 + ,1.90 + ,13.20 + ,4.70 + ,21.00 + ,3.00 + ,1.00 + ,3.00 + ,4.24 + ,50.40 + ,9.80 + ,9.80 + ,52.00 + ,1.00 + ,1.00 + ,1.00 + ,6.80 + ,179.00 + ,9.60 + ,29.00 + ,164.00 + ,2.00 + ,3.00 + ,2.00 + ,0.75 + ,12.30 + ,6.60 + ,7.00 + ,225.00 + ,2.00 + ,2.00 + ,2.00 + ,3.60 + ,21.00 + ,5.40 + ,6.00 + ,225.00 + ,3.00 + ,2.00 + ,3.00 + ,14.83 + ,98.20 + ,2.60 + ,17.00 + ,150.00 + ,5.00 + ,5.00 + ,5.00 + ,55.50 + ,175.00 + ,3.80 + ,20.00 + ,151.00 + ,5.00 + ,5.00 + ,5.00 + ,1.40 + ,12.50 + ,11.00 + ,12.70 + ,90.00 + ,2.00 + ,2.00 + ,2.00 + ,0.06 + ,1.00 + ,10.30 + ,3.50 + ,3.00 + ,1.00 + ,2.00 + ,0.90 + ,2.60 + ,13.30 + ,4.50 + ,60.00 + ,2.00 + ,1.00 + ,2.00 + ,2.00 + ,12.30 + ,5.40 + ,7.50 + ,200.00 + ,3.00 + ,1.00 + ,3.00 + ,0.10 + ,2.50 + ,15.80 + ,2.30 + ,46.00 + ,3.00 + ,2.00 + ,2.00 + ,4.19 + ,58.00 + ,10.30 + ,24.00 + ,210.00 + ,4.00 + ,3.00 + ,4.00 + ,3.50 + ,3.90 + ,19.40 + ,3.00 + ,14.00 + ,2.00 + ,1.00 + ,1.00 + ,4.05 + ,17.00 + ,13.00 + ,38.00 + ,3.00 + ,1.00 + ,1.00) + ,dim=c(8 + ,62) + ,dimnames=list(c('G' + ,'H' + ,'Y' + ,'J' + ,'Z' + ,'P' + ,'B' + ,'D') + ,1:62)) > y <- array(NA,dim=c(8,62),dimnames=list(c('G','H','Y','J','Z','P','B','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 = '3' > library(lattice) > library(lmtest) Loading required package: zoo > 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 Y G H J Z P B D 1 3.30 6654.00 5712.00 38.6 645.0 3.00 5.00 3.00 2 8.30 1.00 6.60 4.5 42.0 3.00 1.00 3.00 3 12.50 3.39 44.50 14.0 60.0 1.00 1.00 1.00 4 16.50 0.92 5.70 25.0 5.0 2.00 3.00 2547.00 5 69.00 4603.00 3.90 624.0 3.0 5.00 4.00 10.55 6 27.00 179.50 9.80 180.0 4.0 4.00 4.00 0.02 7 19.00 0.30 19.70 35.0 1.0 1.00 1.00 160.00 8 30.40 169.00 6.20 392.0 4.0 5.00 4.00 3.30 9 28.00 25.60 14.50 63.0 1.0 2.00 1.00 52.16 10 50.00 440.00 9.70 230.0 1.0 1.00 1.00 0.43 11 7.00 6.40 12.50 112.0 5.0 4.00 4.00 465.00 12 30.00 423.00 3.90 281.0 5.0 5.00 5.00 0.55 13 2.00 2.40 10.30 1.0 2.0 187.10 419.00 3.10 14 5.00 40.00 365.00 5.0 5.0 0.08 1.20 8.40 15 1.00 3.50 42.00 1.0 1.0 3.00 25.00 8.60 16 2.00 50.00 28.00 2.0 2.0 0.79 3.50 10.70 17 2.00 6.00 42.00 2.0 2.0 0.20 5.00 10.70 18 2.00 10.40 120.00 2.0 2.0 1.41 17.50 6.10 19 2.00 34.00 1.00 1.0 60.0 81.00 18.10 7.00 20 1.00 1.00 1.00 529.0 680.0 28.00 400.00 5.00 21 27.66 5.00 5.00 115.0 3.8 20.00 148.00 5.00 22 0.12 5.00 5.00 1.0 14.4 3.90 16.00 3.00 23 207.00 1.00 2.00 406.0 12.0 39.30 252.00 1.00 24 85.00 4.00 1.00 325.0 6.2 41.00 310.00 1.00 25 36.33 3.00 1.00 119.5 13.0 16.20 63.00 1.00 26 0.10 1.00 1.00 4.0 13.8 9.00 28.00 5.00 27 1.04 1.00 3.00 5.5 8.2 7.60 68.00 5.00 28 521.00 3.00 4.00 655.0 2.9 46.00 336.00 5.00 29 100.00 5.00 5.00 157.0 10.8 22.40 100.00 1.00 30 35.00 1.00 1.00 56.0 16.3 33.00 3.00 5.00 31 0.14 4.00 0.01 9.1 2.6 21.50 5.00 2.00 32 0.25 4.00 0.01 19.9 24.0 50.00 1.00 1.00 33 1320.00 1.00 62.00 8.0 100.0 267.00 1.00 1.00 34 3.00 1.00 0.12 10.6 30.0 2.00 1.00 1.00 35 11.20 1.35 8.10 45.0 3.0 1.00 3.00 0.02 36 3.20 0.40 13.20 19.0 4.0 1.00 3.00 0.05 37 2.00 0.33 12.80 30.0 4.0 1.00 3.00 1.70 38 5.00 6.30 19.40 12.0 2.0 1.00 1.00 3.50 39 6.50 10.80 17.40 120.0 2.0 1.00 1.00 250.00 40 440.00 490.00 23.60 5.0 5.0 5.00 0.48 15.50 41 140.00 17.00 12.00 2.0 2.0 2.00 10.00 115.00 42 170.00 10.90 20.20 4.0 4.0 4.00 1.62 11.40 43 17.00 13.70 13.00 2.0 1.0 2.00 192.00 180.00 44 115.00 8.40 27.00 4.0 4.0 4.00 2.50 12.10 45 31.00 8.40 18.00 5.0 5.0 5.00 4.29 39.20 46 63.00 12.50 13.70 2.0 2.0 2.00 0.28 1.90 47 21.00 13.20 4.70 3.0 1.0 3.00 4.24 50.40 48 52.00 9.80 9.80 1.0 1.0 1.00 6.80 179.00 49 164.00 9.60 29.00 2.0 3.0 2.00 0.75 12.30 50 225.00 6.60 7.00 2.0 2.0 2.00 3.60 21.00 51 225.00 5.40 6.00 3.0 2.0 3.00 14.83 98.20 52 150.00 2.60 17.00 5.0 5.0 5.00 55.50 175.00 53 151.00 3.80 20.00 5.0 5.0 5.00 1.40 12.50 54 90.00 11.00 12.70 2.0 2.0 2.00 0.06 1.00 55 3.00 10.30 3.50 1.0 2.0 0.90 2.60 13.30 56 2.00 4.50 60.00 1.0 2.0 2.00 12.30 5.40 57 3.00 7.50 200.00 1.0 3.0 0.10 2.50 15.80 58 3.00 2.30 46.00 2.0 2.0 4.19 58.00 10.30 59 4.00 24.00 210.00 3.0 4.0 3.50 3.90 19.40 60 2.00 3.00 14.00 1.0 1.0 4.05 17.00 13.00 61 1.00 38.00 3.00 1.0 6654.0 5712.00 3.30 38.60 62 5.00 645.00 3.00 3.0 1.0 6.60 8.30 4.50 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) G H J Z P 52.80072 -0.05309 0.14195 0.43153 -0.81883 0.95260 B D -0.05945 -0.02267 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -204.18 -68.45 -49.48 2.16 1082.62 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 52.80072 28.46177 1.855 0.06904 . G -0.05309 0.05066 -1.048 0.29928 H 0.14195 0.07702 1.843 0.07080 . J 0.43153 0.24170 1.785 0.07982 . Z -0.81883 0.26945 -3.039 0.00365 ** P 0.95260 0.31567 3.018 0.00388 ** B -0.05945 0.31613 -0.188 0.85154 D -0.02267 0.07165 -0.316 0.75291 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 182.9 on 54 degrees of freedom Multiple R-squared: 0.1672, Adjusted R-squared: 0.05922 F-statistic: 1.549 on 7 and 54 DF, p-value: 0.171 > 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,] 9.349804e-05 1.869961e-04 0.999906502 [2,] 4.992873e-06 9.985746e-06 0.999995007 [3,] 3.303216e-07 6.606432e-07 0.999999670 [4,] 1.088605e-07 2.177211e-07 0.999999891 [5,] 1.860494e-08 3.720989e-08 0.999999981 [6,] 1.399832e-09 2.799664e-09 0.999999999 [7,] 8.693670e-11 1.738734e-10 1.000000000 [8,] 4.412420e-12 8.824839e-12 1.000000000 [9,] 3.207233e-13 6.414467e-13 1.000000000 [10,] 2.844342e-11 5.688684e-11 1.000000000 [11,] 4.514594e-12 9.029189e-12 1.000000000 [12,] 5.027174e-13 1.005435e-12 1.000000000 [13,] 7.786121e-07 1.557224e-06 0.999999221 [14,] 5.544970e-07 1.108994e-06 0.999999446 [15,] 1.480371e-07 2.960742e-07 0.999999852 [16,] 3.517560e-08 7.035120e-08 0.999999965 [17,] 8.662488e-09 1.732498e-08 0.999999991 [18,] 1.558496e-03 3.116991e-03 0.998441504 [19,] 1.631488e-03 3.262976e-03 0.998368512 [20,] 9.401832e-04 1.880366e-03 0.999059817 [21,] 9.693694e-04 1.938739e-03 0.999030631 [22,] 2.745403e-03 5.490806e-03 0.997254597 [23,] 8.570349e-01 2.859301e-01 0.142965058 [24,] 8.677464e-01 2.645072e-01 0.132253591 [25,] 8.169109e-01 3.661783e-01 0.183089150 [26,] 7.961112e-01 4.077777e-01 0.203888838 [27,] 7.901758e-01 4.196483e-01 0.209824161 [28,] 7.901090e-01 4.197821e-01 0.209891040 [29,] 9.020431e-01 1.959138e-01 0.097956924 [30,] 9.968725e-01 6.254942e-03 0.003127471 [31,] 9.949512e-01 1.009755e-02 0.005048776 [32,] 9.924082e-01 1.518368e-02 0.007591842 [33,] 9.877997e-01 2.440057e-02 0.012200287 [34,] 9.763254e-01 4.734926e-02 0.023674628 [35,] 9.817487e-01 3.650268e-02 0.018251339 [36,] 9.648503e-01 7.029941e-02 0.035149704 [37,] 9.596181e-01 8.076376e-02 0.040381880 [38,] 9.426107e-01 1.147787e-01 0.057389327 [39,] 9.117877e-01 1.764246e-01 0.088212311 [40,] 9.598323e-01 8.033546e-02 0.040167728 [41,] 9.856878e-01 2.862443e-02 0.014312217 > postscript(file="/var/www/wessaorg/rcomp/tmp/1ay9r1296221163.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/wessaorg/rcomp/tmp/2215z1296221163.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/wessaorg/rcomp/tmp/36pj21296221163.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/wessaorg/rcomp/tmp/4escd1296221163.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/wessaorg/rcomp/tmp/56m6l1296221163.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 1.959551 -15.665661 -4.219348 12.258273 -11.068138 -95.633493 7 8 9 10 11 12 -48.131855 -184.642252 -52.530561 -80.132625 -84.503437 -122.514393 13 14 15 16 17 18 -204.180824 -95.366922 -58.366126 -51.647964 -55.320185 -66.672547 19 20 21 22 23 24 -76.364602 273.859447 -82.239382 -44.461253 -33.839402 -123.504977 25 26 27 28 29 30 -69.040331 -50.011230 -50.876307 163.782854 -27.522199 -59.852183 31 32 33 34 35 36 -74.385958 -88.822893 1082.621327 -31.596901 -60.414923 -57.150053 37 38 39 40 41 42 -63.006398 -54.574551 -93.568694 407.418539 88.469404 113.004175 43 44 45 46 47 48 -23.373355 56.974360 -25.592608 7.847362 -33.705970 2.225349 49 50 51 52 53 54 107.604086 171.115545 172.227382 99.364345 93.102168 34.876191 55 56 57 58 59 60 -48.945803 -58.924259 -75.356150 -55.743575 -78.017828 -54.794121 61 62 -42.279430 -20.148692 > postscript(file="/var/www/wessaorg/rcomp/tmp/678zf1296221163.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 1.959551 NA 1 -15.665661 1.959551 2 -4.219348 -15.665661 3 12.258273 -4.219348 4 -11.068138 12.258273 5 -95.633493 -11.068138 6 -48.131855 -95.633493 7 -184.642252 -48.131855 8 -52.530561 -184.642252 9 -80.132625 -52.530561 10 -84.503437 -80.132625 11 -122.514393 -84.503437 12 -204.180824 -122.514393 13 -95.366922 -204.180824 14 -58.366126 -95.366922 15 -51.647964 -58.366126 16 -55.320185 -51.647964 17 -66.672547 -55.320185 18 -76.364602 -66.672547 19 273.859447 -76.364602 20 -82.239382 273.859447 21 -44.461253 -82.239382 22 -33.839402 -44.461253 23 -123.504977 -33.839402 24 -69.040331 -123.504977 25 -50.011230 -69.040331 26 -50.876307 -50.011230 27 163.782854 -50.876307 28 -27.522199 163.782854 29 -59.852183 -27.522199 30 -74.385958 -59.852183 31 -88.822893 -74.385958 32 1082.621327 -88.822893 33 -31.596901 1082.621327 34 -60.414923 -31.596901 35 -57.150053 -60.414923 36 -63.006398 -57.150053 37 -54.574551 -63.006398 38 -93.568694 -54.574551 39 407.418539 -93.568694 40 88.469404 407.418539 41 113.004175 88.469404 42 -23.373355 113.004175 43 56.974360 -23.373355 44 -25.592608 56.974360 45 7.847362 -25.592608 46 -33.705970 7.847362 47 2.225349 -33.705970 48 107.604086 2.225349 49 171.115545 107.604086 50 172.227382 171.115545 51 99.364345 172.227382 52 93.102168 99.364345 53 34.876191 93.102168 54 -48.945803 34.876191 55 -58.924259 -48.945803 56 -75.356150 -58.924259 57 -55.743575 -75.356150 58 -78.017828 -55.743575 59 -54.794121 -78.017828 60 -42.279430 -54.794121 61 -20.148692 -42.279430 62 NA -20.148692 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -15.665661 1.959551 [2,] -4.219348 -15.665661 [3,] 12.258273 -4.219348 [4,] -11.068138 12.258273 [5,] -95.633493 -11.068138 [6,] -48.131855 -95.633493 [7,] -184.642252 -48.131855 [8,] -52.530561 -184.642252 [9,] -80.132625 -52.530561 [10,] -84.503437 -80.132625 [11,] -122.514393 -84.503437 [12,] -204.180824 -122.514393 [13,] -95.366922 -204.180824 [14,] -58.366126 -95.366922 [15,] -51.647964 -58.366126 [16,] -55.320185 -51.647964 [17,] -66.672547 -55.320185 [18,] -76.364602 -66.672547 [19,] 273.859447 -76.364602 [20,] -82.239382 273.859447 [21,] -44.461253 -82.239382 [22,] -33.839402 -44.461253 [23,] -123.504977 -33.839402 [24,] -69.040331 -123.504977 [25,] -50.011230 -69.040331 [26,] -50.876307 -50.011230 [27,] 163.782854 -50.876307 [28,] -27.522199 163.782854 [29,] -59.852183 -27.522199 [30,] -74.385958 -59.852183 [31,] -88.822893 -74.385958 [32,] 1082.621327 -88.822893 [33,] -31.596901 1082.621327 [34,] -60.414923 -31.596901 [35,] -57.150053 -60.414923 [36,] -63.006398 -57.150053 [37,] -54.574551 -63.006398 [38,] -93.568694 -54.574551 [39,] 407.418539 -93.568694 [40,] 88.469404 407.418539 [41,] 113.004175 88.469404 [42,] -23.373355 113.004175 [43,] 56.974360 -23.373355 [44,] -25.592608 56.974360 [45,] 7.847362 -25.592608 [46,] -33.705970 7.847362 [47,] 2.225349 -33.705970 [48,] 107.604086 2.225349 [49,] 171.115545 107.604086 [50,] 172.227382 171.115545 [51,] 99.364345 172.227382 [52,] 93.102168 99.364345 [53,] 34.876191 93.102168 [54,] -48.945803 34.876191 [55,] -58.924259 -48.945803 [56,] -75.356150 -58.924259 [57,] -55.743575 -75.356150 [58,] -78.017828 -55.743575 [59,] -54.794121 -78.017828 [60,] -42.279430 -54.794121 [61,] -20.148692 -42.279430 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -15.665661 1.959551 2 -4.219348 -15.665661 3 12.258273 -4.219348 4 -11.068138 12.258273 5 -95.633493 -11.068138 6 -48.131855 -95.633493 7 -184.642252 -48.131855 8 -52.530561 -184.642252 9 -80.132625 -52.530561 10 -84.503437 -80.132625 11 -122.514393 -84.503437 12 -204.180824 -122.514393 13 -95.366922 -204.180824 14 -58.366126 -95.366922 15 -51.647964 -58.366126 16 -55.320185 -51.647964 17 -66.672547 -55.320185 18 -76.364602 -66.672547 19 273.859447 -76.364602 20 -82.239382 273.859447 21 -44.461253 -82.239382 22 -33.839402 -44.461253 23 -123.504977 -33.839402 24 -69.040331 -123.504977 25 -50.011230 -69.040331 26 -50.876307 -50.011230 27 163.782854 -50.876307 28 -27.522199 163.782854 29 -59.852183 -27.522199 30 -74.385958 -59.852183 31 -88.822893 -74.385958 32 1082.621327 -88.822893 33 -31.596901 1082.621327 34 -60.414923 -31.596901 35 -57.150053 -60.414923 36 -63.006398 -57.150053 37 -54.574551 -63.006398 38 -93.568694 -54.574551 39 407.418539 -93.568694 40 88.469404 407.418539 41 113.004175 88.469404 42 -23.373355 113.004175 43 56.974360 -23.373355 44 -25.592608 56.974360 45 7.847362 -25.592608 46 -33.705970 7.847362 47 2.225349 -33.705970 48 107.604086 2.225349 49 171.115545 107.604086 50 172.227382 171.115545 51 99.364345 172.227382 52 93.102168 99.364345 53 34.876191 93.102168 54 -48.945803 34.876191 55 -58.924259 -48.945803 56 -75.356150 -58.924259 57 -55.743575 -75.356150 58 -78.017828 -55.743575 59 -54.794121 -78.017828 60 -42.279430 -54.794121 61 -20.148692 -42.279430 > 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/wessaorg/rcomp/tmp/72fpo1296221163.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/wessaorg/rcomp/tmp/856ab1296221163.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/wessaorg/rcomp/tmp/9w0yj1296221163.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') Warning messages: 1: In sqrt(crit * p * (1 - hh)/hh) : NaNs produced 2: In sqrt(crit * p * (1 - hh)/hh) : NaNs produced > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/wessaorg/rcomp/tmp/106hrc1296221163.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/wessaorg/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/wessaorg/rcomp/tmp/11qks61296221163.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/wessaorg/rcomp/tmp/12cfnb1296221163.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/wessaorg/rcomp/tmp/13i0dt1296221163.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/wessaorg/rcomp/tmp/144d1u1296221163.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/wessaorg/rcomp/tmp/157blt1296221163.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/wessaorg/rcomp/tmp/16ism31296221163.tab") + } > > try(system("convert tmp/1ay9r1296221163.ps tmp/1ay9r1296221163.png",intern=TRUE)) character(0) > try(system("convert tmp/2215z1296221163.ps tmp/2215z1296221163.png",intern=TRUE)) character(0) > try(system("convert tmp/36pj21296221163.ps tmp/36pj21296221163.png",intern=TRUE)) character(0) > try(system("convert tmp/4escd1296221163.ps tmp/4escd1296221163.png",intern=TRUE)) character(0) > try(system("convert tmp/56m6l1296221163.ps tmp/56m6l1296221163.png",intern=TRUE)) character(0) > try(system("convert tmp/678zf1296221163.ps tmp/678zf1296221163.png",intern=TRUE)) character(0) > try(system("convert tmp/72fpo1296221163.ps tmp/72fpo1296221163.png",intern=TRUE)) character(0) > try(system("convert tmp/856ab1296221163.ps tmp/856ab1296221163.png",intern=TRUE)) character(0) > try(system("convert tmp/9w0yj1296221163.ps tmp/9w0yj1296221163.png",intern=TRUE)) character(0) > try(system("convert tmp/106hrc1296221163.ps tmp/106hrc1296221163.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.300 0.400 3.876