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(4716.99 + ,0 + ,4926.65 + ,0 + ,4920.10 + ,0 + ,5170.09 + ,0 + ,5246.24 + ,0 + ,5283.61 + ,0 + ,4979.05 + ,0 + ,4825.20 + ,0 + ,4695.12 + ,0 + ,4711.54 + ,0 + ,4727.22 + ,0 + ,4384.96 + ,0 + ,4378.75 + ,0 + ,4472.93 + ,0 + ,4564.07 + ,0 + ,4310.54 + ,0 + ,4171.38 + ,0 + ,4049.38 + ,0 + ,3591.37 + ,0 + ,3720.46 + ,0 + ,4107.23 + ,0 + ,4101.71 + ,0 + ,4162.34 + ,0 + ,4136.22 + ,0 + ,4125.88 + ,0 + ,4031.48 + ,0 + ,3761.36 + ,0 + ,3408.56 + ,0 + ,3228.47 + ,0 + ,3090.45 + ,0 + ,2741.14 + ,0 + ,2980.44 + ,0 + ,3104.33 + ,0 + ,3181.57 + ,0 + ,2863.86 + ,0 + ,2898.01 + ,0 + ,3112.33 + ,0 + ,3254.33 + ,0 + ,3513.47 + ,0 + ,3587.61 + ,0 + ,3727.45 + ,0 + ,3793.34 + ,0 + ,3817.58 + ,0 + ,3845.13 + ,0 + ,3931.86 + ,0 + ,4197.52 + ,0 + ,4307.13 + ,0 + ,4229.43 + ,0 + ,4362.28 + ,0 + ,4217.34 + ,0 + ,4361.28 + ,0 + ,4327.74 + ,0 + ,4417.65 + ,0 + ,4557.68 + ,0 + ,4650.35 + ,0 + ,4967.18 + ,0 + ,5123.42 + ,0 + ,5290.85 + ,0 + ,5535.66 + ,0 + ,5514.06 + ,0 + ,5493.88 + ,0 + ,5694.83 + ,0 + ,5850.41 + ,0 + ,6116.64 + ,0 + ,6175.00 + ,0 + ,6513.58 + ,0 + ,6383.78 + ,0 + ,6673.66 + ,0 + ,6936.61 + ,0 + ,7300.68 + ,0 + ,7392.93 + ,0 + ,7497.31 + ,0 + ,7584.71 + ,0 + ,7160.79 + ,0 + ,7196.19 + ,0 + ,7245.63 + ,0 + ,7347.51 + ,0 + ,7425.75 + ,0 + ,7778.51 + ,0 + ,7822.33 + ,0 + ,8181.22 + ,0 + ,8371.47 + ,0 + ,8347.71 + ,0 + ,8672.11 + ,0 + ,8802.79 + ,0 + ,9138.46 + ,0 + ,9123.29 + ,0 + ,9023.21 + ,1 + ,8850.41 + ,1 + ,8864.58 + ,1 + ,9163.74 + ,1 + ,8516.66 + ,1 + ,8553.44 + ,1 + ,7555.20 + ,1 + ,7851.22 + ,1 + ,7442.00 + ,1 + ,7992.53 + ,1 + ,8264.04 + ,1 + ,7517.39 + ,1 + ,7200.40 + ,1 + ,7193.69 + ,1 + ,6193.58 + ,1 + ,5104.21 + ,1 + ,4800.46 + ,1 + ,4461.61 + ,1 + ,4398.59 + ,1 + ,4243.63 + ,1 + ,4293.82 + ,1) + ,dim=c(2 + ,108) + ,dimnames=list(c('Y' + ,'X') + ,1:108)) > y <- array(NA,dim=c(2,108),dimnames=list(c('Y','X'),1:108)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 4716.99 0 1 0 0 0 0 0 0 0 0 0 0 1 2 4926.65 0 0 1 0 0 0 0 0 0 0 0 0 2 3 4920.10 0 0 0 1 0 0 0 0 0 0 0 0 3 4 5170.09 0 0 0 0 1 0 0 0 0 0 0 0 4 5 5246.24 0 0 0 0 0 1 0 0 0 0 0 0 5 6 5283.61 0 0 0 0 0 0 1 0 0 0 0 0 6 7 4979.05 0 0 0 0 0 0 0 1 0 0 0 0 7 8 4825.20 0 0 0 0 0 0 0 0 1 0 0 0 8 9 4695.12 0 0 0 0 0 0 0 0 0 1 0 0 9 10 4711.54 0 0 0 0 0 0 0 0 0 0 1 0 10 11 4727.22 0 0 0 0 0 0 0 0 0 0 0 1 11 12 4384.96 0 0 0 0 0 0 0 0 0 0 0 0 12 13 4378.75 0 1 0 0 0 0 0 0 0 0 0 0 13 14 4472.93 0 0 1 0 0 0 0 0 0 0 0 0 14 15 4564.07 0 0 0 1 0 0 0 0 0 0 0 0 15 16 4310.54 0 0 0 0 1 0 0 0 0 0 0 0 16 17 4171.38 0 0 0 0 0 1 0 0 0 0 0 0 17 18 4049.38 0 0 0 0 0 0 1 0 0 0 0 0 18 19 3591.37 0 0 0 0 0 0 0 1 0 0 0 0 19 20 3720.46 0 0 0 0 0 0 0 0 1 0 0 0 20 21 4107.23 0 0 0 0 0 0 0 0 0 1 0 0 21 22 4101.71 0 0 0 0 0 0 0 0 0 0 1 0 22 23 4162.34 0 0 0 0 0 0 0 0 0 0 0 1 23 24 4136.22 0 0 0 0 0 0 0 0 0 0 0 0 24 25 4125.88 0 1 0 0 0 0 0 0 0 0 0 0 25 26 4031.48 0 0 1 0 0 0 0 0 0 0 0 0 26 27 3761.36 0 0 0 1 0 0 0 0 0 0 0 0 27 28 3408.56 0 0 0 0 1 0 0 0 0 0 0 0 28 29 3228.47 0 0 0 0 0 1 0 0 0 0 0 0 29 30 3090.45 0 0 0 0 0 0 1 0 0 0 0 0 30 31 2741.14 0 0 0 0 0 0 0 1 0 0 0 0 31 32 2980.44 0 0 0 0 0 0 0 0 1 0 0 0 32 33 3104.33 0 0 0 0 0 0 0 0 0 1 0 0 33 34 3181.57 0 0 0 0 0 0 0 0 0 0 1 0 34 35 2863.86 0 0 0 0 0 0 0 0 0 0 0 1 35 36 2898.01 0 0 0 0 0 0 0 0 0 0 0 0 36 37 3112.33 0 1 0 0 0 0 0 0 0 0 0 0 37 38 3254.33 0 0 1 0 0 0 0 0 0 0 0 0 38 39 3513.47 0 0 0 1 0 0 0 0 0 0 0 0 39 40 3587.61 0 0 0 0 1 0 0 0 0 0 0 0 40 41 3727.45 0 0 0 0 0 1 0 0 0 0 0 0 41 42 3793.34 0 0 0 0 0 0 1 0 0 0 0 0 42 43 3817.58 0 0 0 0 0 0 0 1 0 0 0 0 43 44 3845.13 0 0 0 0 0 0 0 0 1 0 0 0 44 45 3931.86 0 0 0 0 0 0 0 0 0 1 0 0 45 46 4197.52 0 0 0 0 0 0 0 0 0 0 1 0 46 47 4307.13 0 0 0 0 0 0 0 0 0 0 0 1 47 48 4229.43 0 0 0 0 0 0 0 0 0 0 0 0 48 49 4362.28 0 1 0 0 0 0 0 0 0 0 0 0 49 50 4217.34 0 0 1 0 0 0 0 0 0 0 0 0 50 51 4361.28 0 0 0 1 0 0 0 0 0 0 0 0 51 52 4327.74 0 0 0 0 1 0 0 0 0 0 0 0 52 53 4417.65 0 0 0 0 0 1 0 0 0 0 0 0 53 54 4557.68 0 0 0 0 0 0 1 0 0 0 0 0 54 55 4650.35 0 0 0 0 0 0 0 1 0 0 0 0 55 56 4967.18 0 0 0 0 0 0 0 0 1 0 0 0 56 57 5123.42 0 0 0 0 0 0 0 0 0 1 0 0 57 58 5290.85 0 0 0 0 0 0 0 0 0 0 1 0 58 59 5535.66 0 0 0 0 0 0 0 0 0 0 0 1 59 60 5514.06 0 0 0 0 0 0 0 0 0 0 0 0 60 61 5493.88 0 1 0 0 0 0 0 0 0 0 0 0 61 62 5694.83 0 0 1 0 0 0 0 0 0 0 0 0 62 63 5850.41 0 0 0 1 0 0 0 0 0 0 0 0 63 64 6116.64 0 0 0 0 1 0 0 0 0 0 0 0 64 65 6175.00 0 0 0 0 0 1 0 0 0 0 0 0 65 66 6513.58 0 0 0 0 0 0 1 0 0 0 0 0 66 67 6383.78 0 0 0 0 0 0 0 1 0 0 0 0 67 68 6673.66 0 0 0 0 0 0 0 0 1 0 0 0 68 69 6936.61 0 0 0 0 0 0 0 0 0 1 0 0 69 70 7300.68 0 0 0 0 0 0 0 0 0 0 1 0 70 71 7392.93 0 0 0 0 0 0 0 0 0 0 0 1 71 72 7497.31 0 0 0 0 0 0 0 0 0 0 0 0 72 73 7584.71 0 1 0 0 0 0 0 0 0 0 0 0 73 74 7160.79 0 0 1 0 0 0 0 0 0 0 0 0 74 75 7196.19 0 0 0 1 0 0 0 0 0 0 0 0 75 76 7245.63 0 0 0 0 1 0 0 0 0 0 0 0 76 77 7347.51 0 0 0 0 0 1 0 0 0 0 0 0 77 78 7425.75 0 0 0 0 0 0 1 0 0 0 0 0 78 79 7778.51 0 0 0 0 0 0 0 1 0 0 0 0 79 80 7822.33 0 0 0 0 0 0 0 0 1 0 0 0 80 81 8181.22 0 0 0 0 0 0 0 0 0 1 0 0 81 82 8371.47 0 0 0 0 0 0 0 0 0 0 1 0 82 83 8347.71 0 0 0 0 0 0 0 0 0 0 0 1 83 84 8672.11 0 0 0 0 0 0 0 0 0 0 0 0 84 85 8802.79 0 1 0 0 0 0 0 0 0 0 0 0 85 86 9138.46 0 0 1 0 0 0 0 0 0 0 0 0 86 87 9123.29 0 0 0 1 0 0 0 0 0 0 0 0 87 88 9023.21 1 0 0 0 1 0 0 0 0 0 0 0 88 89 8850.41 1 0 0 0 0 1 0 0 0 0 0 0 89 90 8864.58 1 0 0 0 0 0 1 0 0 0 0 0 90 91 9163.74 1 0 0 0 0 0 0 1 0 0 0 0 91 92 8516.66 1 0 0 0 0 0 0 0 1 0 0 0 92 93 8553.44 1 0 0 0 0 0 0 0 0 1 0 0 93 94 7555.20 1 0 0 0 0 0 0 0 0 0 1 0 94 95 7851.22 1 0 0 0 0 0 0 0 0 0 0 1 95 96 7442.00 1 0 0 0 0 0 0 0 0 0 0 0 96 97 7992.53 1 1 0 0 0 0 0 0 0 0 0 0 97 98 8264.04 1 0 1 0 0 0 0 0 0 0 0 0 98 99 7517.39 1 0 0 1 0 0 0 0 0 0 0 0 99 100 7200.40 1 0 0 0 1 0 0 0 0 0 0 0 100 101 7193.69 1 0 0 0 0 1 0 0 0 0 0 0 101 102 6193.58 1 0 0 0 0 0 1 0 0 0 0 0 102 103 5104.21 1 0 0 0 0 0 0 1 0 0 0 0 103 104 4800.46 1 0 0 0 0 0 0 0 1 0 0 0 104 105 4461.61 1 0 0 0 0 0 0 0 0 1 0 0 105 106 4398.59 1 0 0 0 0 0 0 0 0 0 1 0 106 107 4243.63 1 0 0 0 0 0 0 0 0 0 0 1 107 108 4293.82 1 0 0 0 0 0 0 0 0 0 0 0 108 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 2850.80 -529.24 606.55 626.88 542.31 509.45 M5 M6 M7 M8 M9 M10 460.51 350.11 131.21 79.43 138.93 95.21 M11 t 85.73 45.31 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3012.2 -1103.3 124.3 1214.9 2587.5 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2850.80 559.73 5.093 1.81e-06 *** X -529.24 476.40 -1.111 0.269 M1 606.55 670.05 0.905 0.368 M2 626.88 669.80 0.936 0.352 M3 542.31 669.61 0.810 0.420 M4 509.45 670.00 0.760 0.449 M5 460.51 669.59 0.688 0.493 M6 350.11 669.24 0.523 0.602 M7 131.21 668.94 0.196 0.845 M8 79.43 668.69 0.119 0.906 M9 138.93 668.50 0.208 0.836 M10 95.20 668.37 0.142 0.887 M11 85.73 668.28 0.128 0.898 t 45.31 6.04 7.502 3.49e-11 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1418 on 94 degrees of freedom Multiple R-squared: 0.4817, Adjusted R-squared: 0.4101 F-statistic: 6.721 on 13 and 94 DF, p-value: 6.172e-09 > 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,] 1.179294e-02 2.358589e-02 0.988207056 [2,] 5.755069e-03 1.151014e-02 0.994244931 [3,] 3.076121e-03 6.152241e-03 0.996923879 [4,] 8.419920e-04 1.683984e-03 0.999158008 [5,] 2.255850e-04 4.511700e-04 0.999774415 [6,] 5.684470e-05 1.136894e-04 0.999943155 [7,] 1.482838e-05 2.965676e-05 0.999985172 [8,] 7.534649e-06 1.506930e-05 0.999992465 [9,] 6.563082e-06 1.312616e-05 0.999993437 [10,] 2.015212e-06 4.030425e-06 0.999997985 [11,] 4.698586e-07 9.397172e-07 0.999999530 [12,] 1.726918e-07 3.453836e-07 0.999999827 [13,] 8.382406e-08 1.676481e-07 0.999999916 [14,] 4.547209e-08 9.094419e-08 0.999999955 [15,] 1.888506e-08 3.777011e-08 0.999999981 [16,] 4.536262e-09 9.072524e-09 0.999999995 [17,] 1.053821e-09 2.107643e-09 0.999999999 [18,] 2.245755e-10 4.491510e-10 1.000000000 [19,] 8.520597e-11 1.704119e-10 1.000000000 [20,] 1.924879e-11 3.849758e-11 1.000000000 [21,] 5.699715e-12 1.139943e-11 1.000000000 [22,] 1.848856e-12 3.697712e-12 1.000000000 [23,] 1.656168e-12 3.312337e-12 1.000000000 [24,] 2.642906e-12 5.285812e-12 1.000000000 [25,] 7.345649e-12 1.469130e-11 1.000000000 [26,] 2.052486e-11 4.104972e-11 1.000000000 [27,] 1.742649e-10 3.485298e-10 1.000000000 [28,] 4.954726e-10 9.909452e-10 1.000000000 [29,] 7.816474e-10 1.563295e-09 0.999999999 [30,] 1.752580e-09 3.505159e-09 0.999999998 [31,] 4.557732e-09 9.115463e-09 0.999999995 [32,] 8.798441e-09 1.759688e-08 0.999999991 [33,] 1.775638e-08 3.551277e-08 0.999999982 [34,] 1.911192e-08 3.822384e-08 0.999999981 [35,] 2.125197e-08 4.250393e-08 0.999999979 [36,] 2.681495e-08 5.362989e-08 0.999999973 [37,] 3.728719e-08 7.457438e-08 0.999999963 [38,] 5.790494e-08 1.158099e-07 0.999999942 [39,] 1.391652e-07 2.783305e-07 0.999999861 [40,] 3.639062e-07 7.278124e-07 0.999999636 [41,] 7.848110e-07 1.569622e-06 0.999999215 [42,] 1.455954e-06 2.911908e-06 0.999998544 [43,] 3.245674e-06 6.491349e-06 0.999996754 [44,] 6.839304e-06 1.367861e-05 0.999993161 [45,] 1.854629e-05 3.709257e-05 0.999981454 [46,] 5.994384e-05 1.198877e-04 0.999940056 [47,] 1.883759e-04 3.767517e-04 0.999811624 [48,] 5.566705e-04 1.113341e-03 0.999443329 [49,] 1.597317e-03 3.194633e-03 0.998402683 [50,] 3.883267e-03 7.766534e-03 0.996116733 [51,] 9.267979e-03 1.853596e-02 0.990732021 [52,] 1.737173e-02 3.474347e-02 0.982628266 [53,] 3.012746e-02 6.025493e-02 0.969872536 [54,] 4.407093e-02 8.814187e-02 0.955929066 [55,] 6.238071e-02 1.247614e-01 0.937619292 [56,] 8.942970e-02 1.788594e-01 0.910570298 [57,] 1.678093e-01 3.356186e-01 0.832190689 [58,] 4.322500e-01 8.645001e-01 0.567749954 [59,] 8.152526e-01 3.694948e-01 0.184747416 [60,] 9.113474e-01 1.773053e-01 0.088652627 [61,] 9.748563e-01 5.028733e-02 0.025143666 [62,] 9.939874e-01 1.202512e-02 0.006012560 [63,] 9.977832e-01 4.433688e-03 0.002216844 [64,] 9.986739e-01 2.652215e-03 0.001326107 [65,] 9.986322e-01 2.735617e-03 0.001367809 [66,] 9.973702e-01 5.259687e-03 0.002629843 [67,] 9.952302e-01 9.539620e-03 0.004769810 [68,] 9.909957e-01 1.800851e-02 0.009004257 [69,] 9.835506e-01 3.289890e-02 0.016449449 [70,] 9.728879e-01 5.422427e-02 0.027112135 [71,] 9.488441e-01 1.023118e-01 0.051155919 [72,] 9.542021e-01 9.159580e-02 0.045797899 [73,] 9.891956e-01 2.160878e-02 0.010804388 [74,] 9.896909e-01 2.061827e-02 0.010309136 [75,] 9.733198e-01 5.336039e-02 0.026680195 > postscript(file="/var/www/html/rcomp/tmp/11ayr1258650477.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2rwab1258650477.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3deou1258650477.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4duew1258650477.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5xu341258650477.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 108 Frequency = 1 1 2 3 4 5 6 1214.31781 1358.34336 1391.04781 1628.58198 1708.35642 1810.82087 7 8 9 10 11 12 1679.84087 1532.45864 1297.56531 1312.39753 1292.23642 990.39642 13 14 15 16 17 18 332.31856 360.86412 491.25856 225.27274 89.73718 32.83162 19 20 21 22 23 24 -251.59838 -116.04060 165.91607 158.80829 183.59718 197.89718 25 26 27 28 29 30 -464.31068 -624.34512 -855.21068 -1220.46651 -1396.93206 -1469.85762 31 32 33 34 35 36 -1645.58762 -1399.81984 -1380.74317 -1305.09095 -1658.64206 -1584.07206 37 38 39 40 41 42 -2021.61992 -1945.25436 -1646.85992 -1585.17575 -1441.71130 -1310.72686 43 44 45 46 47 48 -1112.90686 -1078.88908 -1096.97241 -832.90019 -759.13130 -796.41130 49 50 51 52 53 54 -1315.42916 -1526.00361 -1342.80916 -1388.80499 -1295.27055 -1090.14610 55 56 57 58 59 60 -823.89610 -500.59832 -449.17166 -283.32943 -74.36055 -55.54055 61 62 63 64 65 66 -727.58840 -592.27285 -397.43840 -143.66423 -81.67979 321.99466 67 68 69 70 71 72 365.77466 662.12243 820.25910 1182.74132 1239.15021 1383.95021 73 74 75 76 77 78 819.48235 329.92791 404.58235 441.56653 547.07097 690.40542 79 80 81 82 83 84 1216.74542 1267.03319 1521.10986 1709.77208 1650.17097 2014.99097 85 86 87 88 89 90 1493.80311 1763.83867 1787.92311 2204.62974 2035.45418 2114.71863 91 92 93 94 95 96 2587.45863 1946.84641 1878.81307 878.98529 1139.16418 770.36418 97 98 99 100 101 102 669.02633 874.90188 167.50633 -161.93950 -165.02506 -1100.04061 103 104 105 106 107 108 -2015.83061 -2313.11284 -2756.77617 -2821.38395 -3012.18506 -2921.57506 > postscript(file="/var/www/html/rcomp/tmp/6iulg1258650477.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 108 Frequency = 1 lag(myerror, k = 1) myerror 0 1214.31781 NA 1 1358.34336 1214.31781 2 1391.04781 1358.34336 3 1628.58198 1391.04781 4 1708.35642 1628.58198 5 1810.82087 1708.35642 6 1679.84087 1810.82087 7 1532.45864 1679.84087 8 1297.56531 1532.45864 9 1312.39753 1297.56531 10 1292.23642 1312.39753 11 990.39642 1292.23642 12 332.31856 990.39642 13 360.86412 332.31856 14 491.25856 360.86412 15 225.27274 491.25856 16 89.73718 225.27274 17 32.83162 89.73718 18 -251.59838 32.83162 19 -116.04060 -251.59838 20 165.91607 -116.04060 21 158.80829 165.91607 22 183.59718 158.80829 23 197.89718 183.59718 24 -464.31068 197.89718 25 -624.34512 -464.31068 26 -855.21068 -624.34512 27 -1220.46651 -855.21068 28 -1396.93206 -1220.46651 29 -1469.85762 -1396.93206 30 -1645.58762 -1469.85762 31 -1399.81984 -1645.58762 32 -1380.74317 -1399.81984 33 -1305.09095 -1380.74317 34 -1658.64206 -1305.09095 35 -1584.07206 -1658.64206 36 -2021.61992 -1584.07206 37 -1945.25436 -2021.61992 38 -1646.85992 -1945.25436 39 -1585.17575 -1646.85992 40 -1441.71130 -1585.17575 41 -1310.72686 -1441.71130 42 -1112.90686 -1310.72686 43 -1078.88908 -1112.90686 44 -1096.97241 -1078.88908 45 -832.90019 -1096.97241 46 -759.13130 -832.90019 47 -796.41130 -759.13130 48 -1315.42916 -796.41130 49 -1526.00361 -1315.42916 50 -1342.80916 -1526.00361 51 -1388.80499 -1342.80916 52 -1295.27055 -1388.80499 53 -1090.14610 -1295.27055 54 -823.89610 -1090.14610 55 -500.59832 -823.89610 56 -449.17166 -500.59832 57 -283.32943 -449.17166 58 -74.36055 -283.32943 59 -55.54055 -74.36055 60 -727.58840 -55.54055 61 -592.27285 -727.58840 62 -397.43840 -592.27285 63 -143.66423 -397.43840 64 -81.67979 -143.66423 65 321.99466 -81.67979 66 365.77466 321.99466 67 662.12243 365.77466 68 820.25910 662.12243 69 1182.74132 820.25910 70 1239.15021 1182.74132 71 1383.95021 1239.15021 72 819.48235 1383.95021 73 329.92791 819.48235 74 404.58235 329.92791 75 441.56653 404.58235 76 547.07097 441.56653 77 690.40542 547.07097 78 1216.74542 690.40542 79 1267.03319 1216.74542 80 1521.10986 1267.03319 81 1709.77208 1521.10986 82 1650.17097 1709.77208 83 2014.99097 1650.17097 84 1493.80311 2014.99097 85 1763.83867 1493.80311 86 1787.92311 1763.83867 87 2204.62974 1787.92311 88 2035.45418 2204.62974 89 2114.71863 2035.45418 90 2587.45863 2114.71863 91 1946.84641 2587.45863 92 1878.81307 1946.84641 93 878.98529 1878.81307 94 1139.16418 878.98529 95 770.36418 1139.16418 96 669.02633 770.36418 97 874.90188 669.02633 98 167.50633 874.90188 99 -161.93950 167.50633 100 -165.02506 -161.93950 101 -1100.04061 -165.02506 102 -2015.83061 -1100.04061 103 -2313.11284 -2015.83061 104 -2756.77617 -2313.11284 105 -2821.38395 -2756.77617 106 -3012.18506 -2821.38395 107 -2921.57506 -3012.18506 108 NA -2921.57506 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1358.34336 1214.31781 [2,] 1391.04781 1358.34336 [3,] 1628.58198 1391.04781 [4,] 1708.35642 1628.58198 [5,] 1810.82087 1708.35642 [6,] 1679.84087 1810.82087 [7,] 1532.45864 1679.84087 [8,] 1297.56531 1532.45864 [9,] 1312.39753 1297.56531 [10,] 1292.23642 1312.39753 [11,] 990.39642 1292.23642 [12,] 332.31856 990.39642 [13,] 360.86412 332.31856 [14,] 491.25856 360.86412 [15,] 225.27274 491.25856 [16,] 89.73718 225.27274 [17,] 32.83162 89.73718 [18,] -251.59838 32.83162 [19,] -116.04060 -251.59838 [20,] 165.91607 -116.04060 [21,] 158.80829 165.91607 [22,] 183.59718 158.80829 [23,] 197.89718 183.59718 [24,] -464.31068 197.89718 [25,] -624.34512 -464.31068 [26,] -855.21068 -624.34512 [27,] -1220.46651 -855.21068 [28,] -1396.93206 -1220.46651 [29,] -1469.85762 -1396.93206 [30,] -1645.58762 -1469.85762 [31,] -1399.81984 -1645.58762 [32,] -1380.74317 -1399.81984 [33,] -1305.09095 -1380.74317 [34,] -1658.64206 -1305.09095 [35,] -1584.07206 -1658.64206 [36,] -2021.61992 -1584.07206 [37,] -1945.25436 -2021.61992 [38,] -1646.85992 -1945.25436 [39,] -1585.17575 -1646.85992 [40,] -1441.71130 -1585.17575 [41,] -1310.72686 -1441.71130 [42,] -1112.90686 -1310.72686 [43,] -1078.88908 -1112.90686 [44,] -1096.97241 -1078.88908 [45,] -832.90019 -1096.97241 [46,] -759.13130 -832.90019 [47,] -796.41130 -759.13130 [48,] -1315.42916 -796.41130 [49,] -1526.00361 -1315.42916 [50,] -1342.80916 -1526.00361 [51,] -1388.80499 -1342.80916 [52,] -1295.27055 -1388.80499 [53,] -1090.14610 -1295.27055 [54,] -823.89610 -1090.14610 [55,] -500.59832 -823.89610 [56,] -449.17166 -500.59832 [57,] -283.32943 -449.17166 [58,] -74.36055 -283.32943 [59,] -55.54055 -74.36055 [60,] -727.58840 -55.54055 [61,] -592.27285 -727.58840 [62,] -397.43840 -592.27285 [63,] -143.66423 -397.43840 [64,] -81.67979 -143.66423 [65,] 321.99466 -81.67979 [66,] 365.77466 321.99466 [67,] 662.12243 365.77466 [68,] 820.25910 662.12243 [69,] 1182.74132 820.25910 [70,] 1239.15021 1182.74132 [71,] 1383.95021 1239.15021 [72,] 819.48235 1383.95021 [73,] 329.92791 819.48235 [74,] 404.58235 329.92791 [75,] 441.56653 404.58235 [76,] 547.07097 441.56653 [77,] 690.40542 547.07097 [78,] 1216.74542 690.40542 [79,] 1267.03319 1216.74542 [80,] 1521.10986 1267.03319 [81,] 1709.77208 1521.10986 [82,] 1650.17097 1709.77208 [83,] 2014.99097 1650.17097 [84,] 1493.80311 2014.99097 [85,] 1763.83867 1493.80311 [86,] 1787.92311 1763.83867 [87,] 2204.62974 1787.92311 [88,] 2035.45418 2204.62974 [89,] 2114.71863 2035.45418 [90,] 2587.45863 2114.71863 [91,] 1946.84641 2587.45863 [92,] 1878.81307 1946.84641 [93,] 878.98529 1878.81307 [94,] 1139.16418 878.98529 [95,] 770.36418 1139.16418 [96,] 669.02633 770.36418 [97,] 874.90188 669.02633 [98,] 167.50633 874.90188 [99,] -161.93950 167.50633 [100,] -165.02506 -161.93950 [101,] -1100.04061 -165.02506 [102,] -2015.83061 -1100.04061 [103,] -2313.11284 -2015.83061 [104,] -2756.77617 -2313.11284 [105,] -2821.38395 -2756.77617 [106,] -3012.18506 -2821.38395 [107,] -2921.57506 -3012.18506 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1358.34336 1214.31781 2 1391.04781 1358.34336 3 1628.58198 1391.04781 4 1708.35642 1628.58198 5 1810.82087 1708.35642 6 1679.84087 1810.82087 7 1532.45864 1679.84087 8 1297.56531 1532.45864 9 1312.39753 1297.56531 10 1292.23642 1312.39753 11 990.39642 1292.23642 12 332.31856 990.39642 13 360.86412 332.31856 14 491.25856 360.86412 15 225.27274 491.25856 16 89.73718 225.27274 17 32.83162 89.73718 18 -251.59838 32.83162 19 -116.04060 -251.59838 20 165.91607 -116.04060 21 158.80829 165.91607 22 183.59718 158.80829 23 197.89718 183.59718 24 -464.31068 197.89718 25 -624.34512 -464.31068 26 -855.21068 -624.34512 27 -1220.46651 -855.21068 28 -1396.93206 -1220.46651 29 -1469.85762 -1396.93206 30 -1645.58762 -1469.85762 31 -1399.81984 -1645.58762 32 -1380.74317 -1399.81984 33 -1305.09095 -1380.74317 34 -1658.64206 -1305.09095 35 -1584.07206 -1658.64206 36 -2021.61992 -1584.07206 37 -1945.25436 -2021.61992 38 -1646.85992 -1945.25436 39 -1585.17575 -1646.85992 40 -1441.71130 -1585.17575 41 -1310.72686 -1441.71130 42 -1112.90686 -1310.72686 43 -1078.88908 -1112.90686 44 -1096.97241 -1078.88908 45 -832.90019 -1096.97241 46 -759.13130 -832.90019 47 -796.41130 -759.13130 48 -1315.42916 -796.41130 49 -1526.00361 -1315.42916 50 -1342.80916 -1526.00361 51 -1388.80499 -1342.80916 52 -1295.27055 -1388.80499 53 -1090.14610 -1295.27055 54 -823.89610 -1090.14610 55 -500.59832 -823.89610 56 -449.17166 -500.59832 57 -283.32943 -449.17166 58 -74.36055 -283.32943 59 -55.54055 -74.36055 60 -727.58840 -55.54055 61 -592.27285 -727.58840 62 -397.43840 -592.27285 63 -143.66423 -397.43840 64 -81.67979 -143.66423 65 321.99466 -81.67979 66 365.77466 321.99466 67 662.12243 365.77466 68 820.25910 662.12243 69 1182.74132 820.25910 70 1239.15021 1182.74132 71 1383.95021 1239.15021 72 819.48235 1383.95021 73 329.92791 819.48235 74 404.58235 329.92791 75 441.56653 404.58235 76 547.07097 441.56653 77 690.40542 547.07097 78 1216.74542 690.40542 79 1267.03319 1216.74542 80 1521.10986 1267.03319 81 1709.77208 1521.10986 82 1650.17097 1709.77208 83 2014.99097 1650.17097 84 1493.80311 2014.99097 85 1763.83867 1493.80311 86 1787.92311 1763.83867 87 2204.62974 1787.92311 88 2035.45418 2204.62974 89 2114.71863 2035.45418 90 2587.45863 2114.71863 91 1946.84641 2587.45863 92 1878.81307 1946.84641 93 878.98529 1878.81307 94 1139.16418 878.98529 95 770.36418 1139.16418 96 669.02633 770.36418 97 874.90188 669.02633 98 167.50633 874.90188 99 -161.93950 167.50633 100 -165.02506 -161.93950 101 -1100.04061 -165.02506 102 -2015.83061 -1100.04061 103 -2313.11284 -2015.83061 104 -2756.77617 -2313.11284 105 -2821.38395 -2756.77617 106 -3012.18506 -2821.38395 107 -2921.57506 -3012.18506 > 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/7qoa11258650477.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/8fc3x1258650477.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/9k2t41258650477.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10t5kx1258650477.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/111jl61258650477.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/126akf1258650477.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/13t9y91258650477.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/14hxj21258650477.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/155rjp1258650477.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/16arez1258650477.tab") + } > > system("convert tmp/11ayr1258650477.ps tmp/11ayr1258650477.png") > system("convert tmp/2rwab1258650477.ps tmp/2rwab1258650477.png") > system("convert tmp/3deou1258650477.ps tmp/3deou1258650477.png") > system("convert tmp/4duew1258650477.ps tmp/4duew1258650477.png") > system("convert tmp/5xu341258650477.ps tmp/5xu341258650477.png") > system("convert tmp/6iulg1258650477.ps tmp/6iulg1258650477.png") > system("convert tmp/7qoa11258650477.ps tmp/7qoa11258650477.png") > system("convert tmp/8fc3x1258650477.ps tmp/8fc3x1258650477.png") > system("convert tmp/9k2t41258650477.ps tmp/9k2t41258650477.png") > system("convert tmp/10t5kx1258650477.ps tmp/10t5kx1258650477.png") > > > proc.time() user system elapsed 3.167 1.642 8.763