R version 2.6.2 (2008-02-08) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. 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(99.2,96.7,101.0,56421,53152,53536,52408,41454,38271,35306,26414,31917,38030,27534,18387,50556,43901,48572,43899,37532,40357,35489,29027,34485,42598,30306,26451,47460,50104,61465,53726,39477,43895,31481,29896,33842,39120,33702,25094,51442,45594,52518,48564,41745,49585,32747,33379,35645,37034,35681,20972,58552,54955,65540,51570,51145,46641,35704,33253,35193,41668,34865,21210,56126,49231,59723,48103,47472,50497,40059,34149,36860,46356,36577),dim=c(3,72),dimnames=list(c('Cons','Inc','Price'),1:72)) > y <- array(NA,dim=c(3,72),dimnames=list(c('Cons','Inc','Price'),1:72)) > 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 > 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 Cons Inc Price M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 99.2 96.7 101.0 1 0 0 0 0 0 0 0 0 0 0 1 2 56421.0 53152.0 53536.0 0 1 0 0 0 0 0 0 0 0 0 2 3 52408.0 41454.0 38271.0 0 0 1 0 0 0 0 0 0 0 0 3 4 35306.0 26414.0 31917.0 0 0 0 1 0 0 0 0 0 0 0 4 5 38030.0 27534.0 18387.0 0 0 0 0 1 0 0 0 0 0 0 5 6 50556.0 43901.0 48572.0 0 0 0 0 0 1 0 0 0 0 0 6 7 43899.0 37532.0 40357.0 0 0 0 0 0 0 1 0 0 0 0 7 8 35489.0 29027.0 34485.0 0 0 0 0 0 0 0 1 0 0 0 8 9 42598.0 30306.0 26451.0 0 0 0 0 0 0 0 0 1 0 0 9 10 47460.0 50104.0 61465.0 0 0 0 0 0 0 0 0 0 1 0 10 11 53726.0 39477.0 43895.0 0 0 0 0 0 0 0 0 0 0 1 11 12 31481.0 29896.0 33842.0 0 0 0 0 0 0 0 0 0 0 0 12 13 39120.0 33702.0 25094.0 1 0 0 0 0 0 0 0 0 0 0 13 14 51442.0 45594.0 52518.0 0 1 0 0 0 0 0 0 0 0 0 14 15 48564.0 41745.0 49585.0 0 0 1 0 0 0 0 0 0 0 0 15 16 32747.0 33379.0 35645.0 0 0 0 1 0 0 0 0 0 0 0 16 17 37034.0 35681.0 20972.0 0 0 0 0 1 0 0 0 0 0 0 17 18 58552.0 54955.0 65540.0 0 0 0 0 0 1 0 0 0 0 0 18 19 51570.0 51145.0 46641.0 0 0 0 0 0 0 1 0 0 0 0 19 20 35704.0 33253.0 35193.0 0 0 0 0 0 0 0 1 0 0 0 20 21 41668.0 34865.0 21210.0 0 0 0 0 0 0 0 0 1 0 0 21 22 56126.0 49231.0 59723.0 0 0 0 0 0 0 0 0 0 1 0 22 23 48103.0 47472.0 50497.0 0 0 0 0 0 0 0 0 0 0 1 23 24 40059.0 34149.0 36860.0 0 0 0 0 0 0 0 0 0 0 0 24 25 46356.0 36577.0 99.2 1 0 0 0 0 0 0 0 0 0 0 25 26 96.7 101.0 56421.0 0 1 0 0 0 0 0 0 0 0 0 26 27 53152.0 53536.0 52408.0 0 0 1 0 0 0 0 0 0 0 0 27 28 41454.0 38271.0 35306.0 0 0 0 1 0 0 0 0 0 0 0 28 29 26414.0 31917.0 38030.0 0 0 0 0 1 0 0 0 0 0 0 29 30 27534.0 18387.0 50556.0 0 0 0 0 0 1 0 0 0 0 0 30 31 43901.0 48572.0 43899.0 0 0 0 0 0 0 1 0 0 0 0 31 32 37532.0 40357.0 35489.0 0 0 0 0 0 0 0 1 0 0 0 32 33 29027.0 34485.0 42598.0 0 0 0 0 0 0 0 0 1 0 0 33 34 30306.0 26451.0 47460.0 0 0 0 0 0 0 0 0 0 1 0 34 35 50104.0 61465.0 53726.0 0 0 0 0 0 0 0 0 0 0 1 35 36 39477.0 43895.0 31481.0 0 0 0 0 0 0 0 0 0 0 0 36 37 29896.0 33842.0 39120.0 1 0 0 0 0 0 0 0 0 0 0 37 38 33702.0 25094.0 51442.0 0 1 0 0 0 0 0 0 0 0 0 38 39 45594.0 52518.0 48564.0 0 0 1 0 0 0 0 0 0 0 0 39 40 41745.0 49585.0 32747.0 0 0 0 1 0 0 0 0 0 0 0 40 41 33379.0 35645.0 37034.0 0 0 0 0 1 0 0 0 0 0 0 41 42 35681.0 20972.0 58552.0 0 0 0 0 0 1 0 0 0 0 0 42 43 54955.0 65540.0 51570.0 0 0 0 0 0 0 1 0 0 0 0 43 44 51145.0 46641.0 35704.0 0 0 0 0 0 0 0 1 0 0 0 44 45 33253.0 35193.0 41668.0 0 0 0 0 0 0 0 0 1 0 0 45 46 34865.0 21210.0 56126.0 0 0 0 0 0 0 0 0 0 1 0 46 47 49231.0 59723.0 48103.0 0 0 0 0 0 0 0 0 0 0 1 47 48 47472.0 50497.0 40059.0 0 0 0 0 0 0 0 0 0 0 0 48 49 34149.0 36860.0 46356.0 1 0 0 0 0 0 0 0 0 0 0 49 50 36577.0 99.2 96.7 0 1 0 0 0 0 0 0 0 0 0 50 51 101.0 56421.0 53152.0 0 0 1 0 0 0 0 0 0 0 0 51 52 53536.0 52408.0 41454.0 0 0 0 1 0 0 0 0 0 0 0 52 53 38271.0 35306.0 26414.0 0 0 0 0 1 0 0 0 0 0 0 53 54 31917.0 38030.0 27534.0 0 0 0 0 0 1 0 0 0 0 0 54 55 18387.0 50556.0 43901.0 0 0 0 0 0 0 1 0 0 0 0 55 56 48572.0 43899.0 37532.0 0 0 0 0 0 0 0 1 0 0 0 56 57 40357.0 35489.0 29027.0 0 0 0 0 0 0 0 0 1 0 0 57 58 34485.0 42598.0 30306.0 0 0 0 0 0 0 0 0 0 1 0 58 59 26451.0 47460.0 50104.0 0 0 0 0 0 0 0 0 0 0 1 59 60 61465.0 53726.0 39477.0 0 0 0 0 0 0 0 0 0 0 0 60 61 43895.0 31481.0 29896.0 1 0 0 0 0 0 0 0 0 0 0 61 62 33842.0 39120.0 33702.0 0 1 0 0 0 0 0 0 0 0 0 62 63 25094.0 51442.0 45594.0 0 0 1 0 0 0 0 0 0 0 0 63 64 52518.0 48564.0 41745.0 0 0 0 1 0 0 0 0 0 0 0 64 65 49585.0 32747.0 33379.0 0 0 0 0 1 0 0 0 0 0 0 65 66 35645.0 37034.0 35681.0 0 0 0 0 0 1 0 0 0 0 0 66 67 20972.0 58552.0 54955.0 0 0 0 0 0 0 1 0 0 0 0 67 68 65540.0 51570.0 51145.0 0 0 0 0 0 0 0 1 0 0 0 68 69 46641.0 35704.0 33253.0 0 0 0 0 0 0 0 0 1 0 0 69 70 35193.0 41668.0 34865.0 0 0 0 0 0 0 0 0 0 1 0 70 71 21210.0 56126.0 49231.0 0 0 0 0 0 0 0 0 0 0 1 71 72 59723.0 48103.0 47472.0 0 0 0 0 0 0 0 0 0 0 0 72 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Inc Price M1 M2 M3 2.430e+04 7.388e-01 -8.985e-02 -6.537e+03 -5.320e+02 -1.414e+04 M4 M5 M6 M7 M8 M9 -3.651e+03 -3.803e+03 -8.893e+02 -1.399e+04 3.669e+02 -1.986e+03 M10 M11 t -2.693e+03 -1.063e+04 -1.501e+02 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -39313.05 -6520.18 -60.45 6965.99 20248.40 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.430e+04 8.122e+03 2.992 0.00409 ** Inc 7.388e-01 1.470e-01 5.024 5.31e-06 *** Price -8.985e-02 1.430e-01 -0.629 0.53218 M1 -6.537e+03 7.042e+03 -0.928 0.35720 M2 -5.320e+02 7.098e+03 -0.075 0.94052 M3 -1.414e+04 6.819e+03 -2.074 0.04263 * M4 -3.651e+03 6.668e+03 -0.547 0.58620 M5 -3.803e+03 6.820e+03 -0.558 0.57933 M6 -8.893e+02 6.957e+03 -0.128 0.89873 M7 -1.399e+04 6.809e+03 -2.055 0.04448 * M8 3.669e+02 6.657e+03 0.055 0.95624 M9 -1.986e+03 6.757e+03 -0.294 0.76991 M10 -2.693e+03 6.891e+03 -0.391 0.69745 M11 -1.063e+04 6.836e+03 -1.556 0.12530 t -1.501e+02 6.871e+01 -2.184 0.03308 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 11510 on 57 degrees of freedom Multiple R-squared: 0.389, Adjusted R-squared: 0.2389 F-statistic: 2.592 on 14 and 57 DF, p-value: 0.005816 > 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,] 7.345487e-02 0.1469097468 0.92654513 [2,] 2.457061e-02 0.0491412127 0.97542939 [3,] 7.864819e-03 0.0157296375 0.99213518 [4,] 2.285423e-03 0.0045708460 0.99771458 [5,] 8.883984e-03 0.0177679683 0.99111602 [6,] 9.584040e-03 0.0191680791 0.99041596 [7,] 5.846264e-03 0.0116925286 0.99415374 [8,] 4.015246e-03 0.0080304926 0.99598475 [9,] 2.604757e-03 0.0052095144 0.99739524 [10,] 3.201278e-03 0.0064025560 0.99679872 [11,] 1.358992e-03 0.0027179836 0.99864101 [12,] 7.831021e-04 0.0015662041 0.99921690 [13,] 4.540608e-04 0.0009081215 0.99954594 [14,] 3.602927e-04 0.0007205854 0.99963971 [15,] 2.364328e-04 0.0004728657 0.99976357 [16,] 1.690126e-04 0.0003380253 0.99983099 [17,] 6.581286e-05 0.0001316257 0.99993419 [18,] 2.275949e-04 0.0004551898 0.99977241 [19,] 1.766739e-04 0.0003533478 0.99982333 [20,] 1.112221e-04 0.0002224441 0.99988878 [21,] 1.070896e-04 0.0002141792 0.99989291 [22,] 6.636770e-04 0.0013273539 0.99933632 [23,] 4.964004e-04 0.0009928007 0.99950360 [24,] 3.370562e-04 0.0006741124 0.99966294 [25,] 5.028876e-04 0.0010057751 0.99949711 [26,] 1.184249e-02 0.0236849721 0.98815751 [27,] 9.390353e-03 0.0187807063 0.99060965 [28,] 5.685705e-03 0.0113714109 0.99431429 [29,] 7.847972e-03 0.0156959437 0.99215203 [30,] 3.301142e-01 0.6602283649 0.66988582 [31,] 2.563556e-01 0.5127111080 0.74364445 [32,] 1.914662e-01 0.3829323554 0.80853382 [33,] 1.922175e-01 0.3844349254 0.80778254 [34,] 9.811228e-01 0.0377543277 0.01887716 [35,] 9.559128e-01 0.0881744205 0.04408721 [36,] 9.479017e-01 0.1041966636 0.05209833 [37,] 8.760260e-01 0.2479480162 0.12397401 > postscript(file="/var/www/html/rcomp/tmp/18bhm1210362330.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/27w0g1210362330.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/3dgxr1210362330.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/4eugf1210362330.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/5pzdp1210362330.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 = 72 Frequency = 1 1 2 3 4 5 6 -17575.91705 -1506.09258 15511.45042 -1390.22917 -407.17282 -24.63646 7 8 9 10 11 12 10539.42154 -6324.15039 1620.89970 -4141.62227 16489.23436 -10064.81467 13 14 15 16 17 18 662.98312 808.32359 14269.88579 -6959.32318 -5389.25781 3129.85382 19 20 21 22 23 24 10518.28407 -7366.95670 -1347.46321 6813.70019 7353.38517 -2557.01168 25 26 27 28 29 30 5329.88691 -14774.09657 12200.90945 -96.26131 -9894.78107 -416.30408 31 32 33 34 35 36 6304.75624 -8960.11851 -9985.11011 -1476.88176 1106.99734 -9022.05623 37 38 39 40 41 42 -3802.49055 1719.24413 6850.49306 -6593.40056 -3972.76021 8340.14002 43 44 45 46 47 48 7312.48734 1830.27768 -4564.90938 9533.80268 2816.64354 -3333.17598 49 50 51 52 53 54 671.75526 20248.39724 -39313.04816 5695.08794 2016.32615 -9012.89757 55 56 57 58 59 60 -17073.19059 3248.23368 2985.43310 -7167.29510 -8922.50910 10022.71687 61 62 63 64 65 66 14713.78230 -6495.77581 -9519.69056 9344.12627 17647.64575 -2016.15572 67 68 69 70 71 72 -17601.75860 17572.71424 11291.14990 -3561.70375 -18843.75131 14954.34170 > postscript(file="/var/www/html/rcomp/tmp/6f9vs1210362330.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 = 72 Frequency = 1 lag(myerror, k = 1) myerror 0 -17575.91705 NA 1 -1506.09258 -17575.91705 2 15511.45042 -1506.09258 3 -1390.22917 15511.45042 4 -407.17282 -1390.22917 5 -24.63646 -407.17282 6 10539.42154 -24.63646 7 -6324.15039 10539.42154 8 1620.89970 -6324.15039 9 -4141.62227 1620.89970 10 16489.23436 -4141.62227 11 -10064.81467 16489.23436 12 662.98312 -10064.81467 13 808.32359 662.98312 14 14269.88579 808.32359 15 -6959.32318 14269.88579 16 -5389.25781 -6959.32318 17 3129.85382 -5389.25781 18 10518.28407 3129.85382 19 -7366.95670 10518.28407 20 -1347.46321 -7366.95670 21 6813.70019 -1347.46321 22 7353.38517 6813.70019 23 -2557.01168 7353.38517 24 5329.88691 -2557.01168 25 -14774.09657 5329.88691 26 12200.90945 -14774.09657 27 -96.26131 12200.90945 28 -9894.78107 -96.26131 29 -416.30408 -9894.78107 30 6304.75624 -416.30408 31 -8960.11851 6304.75624 32 -9985.11011 -8960.11851 33 -1476.88176 -9985.11011 34 1106.99734 -1476.88176 35 -9022.05623 1106.99734 36 -3802.49055 -9022.05623 37 1719.24413 -3802.49055 38 6850.49306 1719.24413 39 -6593.40056 6850.49306 40 -3972.76021 -6593.40056 41 8340.14002 -3972.76021 42 7312.48734 8340.14002 43 1830.27768 7312.48734 44 -4564.90938 1830.27768 45 9533.80268 -4564.90938 46 2816.64354 9533.80268 47 -3333.17598 2816.64354 48 671.75526 -3333.17598 49 20248.39724 671.75526 50 -39313.04816 20248.39724 51 5695.08794 -39313.04816 52 2016.32615 5695.08794 53 -9012.89757 2016.32615 54 -17073.19059 -9012.89757 55 3248.23368 -17073.19059 56 2985.43310 3248.23368 57 -7167.29510 2985.43310 58 -8922.50910 -7167.29510 59 10022.71687 -8922.50910 60 14713.78230 10022.71687 61 -6495.77581 14713.78230 62 -9519.69056 -6495.77581 63 9344.12627 -9519.69056 64 17647.64575 9344.12627 65 -2016.15572 17647.64575 66 -17601.75860 -2016.15572 67 17572.71424 -17601.75860 68 11291.14990 17572.71424 69 -3561.70375 11291.14990 70 -18843.75131 -3561.70375 71 14954.34170 -18843.75131 72 NA 14954.34170 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1506.09258 -17575.91705 [2,] 15511.45042 -1506.09258 [3,] -1390.22917 15511.45042 [4,] -407.17282 -1390.22917 [5,] -24.63646 -407.17282 [6,] 10539.42154 -24.63646 [7,] -6324.15039 10539.42154 [8,] 1620.89970 -6324.15039 [9,] -4141.62227 1620.89970 [10,] 16489.23436 -4141.62227 [11,] -10064.81467 16489.23436 [12,] 662.98312 -10064.81467 [13,] 808.32359 662.98312 [14,] 14269.88579 808.32359 [15,] -6959.32318 14269.88579 [16,] -5389.25781 -6959.32318 [17,] 3129.85382 -5389.25781 [18,] 10518.28407 3129.85382 [19,] -7366.95670 10518.28407 [20,] -1347.46321 -7366.95670 [21,] 6813.70019 -1347.46321 [22,] 7353.38517 6813.70019 [23,] -2557.01168 7353.38517 [24,] 5329.88691 -2557.01168 [25,] -14774.09657 5329.88691 [26,] 12200.90945 -14774.09657 [27,] -96.26131 12200.90945 [28,] -9894.78107 -96.26131 [29,] -416.30408 -9894.78107 [30,] 6304.75624 -416.30408 [31,] -8960.11851 6304.75624 [32,] -9985.11011 -8960.11851 [33,] -1476.88176 -9985.11011 [34,] 1106.99734 -1476.88176 [35,] -9022.05623 1106.99734 [36,] -3802.49055 -9022.05623 [37,] 1719.24413 -3802.49055 [38,] 6850.49306 1719.24413 [39,] -6593.40056 6850.49306 [40,] -3972.76021 -6593.40056 [41,] 8340.14002 -3972.76021 [42,] 7312.48734 8340.14002 [43,] 1830.27768 7312.48734 [44,] -4564.90938 1830.27768 [45,] 9533.80268 -4564.90938 [46,] 2816.64354 9533.80268 [47,] -3333.17598 2816.64354 [48,] 671.75526 -3333.17598 [49,] 20248.39724 671.75526 [50,] -39313.04816 20248.39724 [51,] 5695.08794 -39313.04816 [52,] 2016.32615 5695.08794 [53,] -9012.89757 2016.32615 [54,] -17073.19059 -9012.89757 [55,] 3248.23368 -17073.19059 [56,] 2985.43310 3248.23368 [57,] -7167.29510 2985.43310 [58,] -8922.50910 -7167.29510 [59,] 10022.71687 -8922.50910 [60,] 14713.78230 10022.71687 [61,] -6495.77581 14713.78230 [62,] -9519.69056 -6495.77581 [63,] 9344.12627 -9519.69056 [64,] 17647.64575 9344.12627 [65,] -2016.15572 17647.64575 [66,] -17601.75860 -2016.15572 [67,] 17572.71424 -17601.75860 [68,] 11291.14990 17572.71424 [69,] -3561.70375 11291.14990 [70,] -18843.75131 -3561.70375 [71,] 14954.34170 -18843.75131 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1506.09258 -17575.91705 2 15511.45042 -1506.09258 3 -1390.22917 15511.45042 4 -407.17282 -1390.22917 5 -24.63646 -407.17282 6 10539.42154 -24.63646 7 -6324.15039 10539.42154 8 1620.89970 -6324.15039 9 -4141.62227 1620.89970 10 16489.23436 -4141.62227 11 -10064.81467 16489.23436 12 662.98312 -10064.81467 13 808.32359 662.98312 14 14269.88579 808.32359 15 -6959.32318 14269.88579 16 -5389.25781 -6959.32318 17 3129.85382 -5389.25781 18 10518.28407 3129.85382 19 -7366.95670 10518.28407 20 -1347.46321 -7366.95670 21 6813.70019 -1347.46321 22 7353.38517 6813.70019 23 -2557.01168 7353.38517 24 5329.88691 -2557.01168 25 -14774.09657 5329.88691 26 12200.90945 -14774.09657 27 -96.26131 12200.90945 28 -9894.78107 -96.26131 29 -416.30408 -9894.78107 30 6304.75624 -416.30408 31 -8960.11851 6304.75624 32 -9985.11011 -8960.11851 33 -1476.88176 -9985.11011 34 1106.99734 -1476.88176 35 -9022.05623 1106.99734 36 -3802.49055 -9022.05623 37 1719.24413 -3802.49055 38 6850.49306 1719.24413 39 -6593.40056 6850.49306 40 -3972.76021 -6593.40056 41 8340.14002 -3972.76021 42 7312.48734 8340.14002 43 1830.27768 7312.48734 44 -4564.90938 1830.27768 45 9533.80268 -4564.90938 46 2816.64354 9533.80268 47 -3333.17598 2816.64354 48 671.75526 -3333.17598 49 20248.39724 671.75526 50 -39313.04816 20248.39724 51 5695.08794 -39313.04816 52 2016.32615 5695.08794 53 -9012.89757 2016.32615 54 -17073.19059 -9012.89757 55 3248.23368 -17073.19059 56 2985.43310 3248.23368 57 -7167.29510 2985.43310 58 -8922.50910 -7167.29510 59 10022.71687 -8922.50910 60 14713.78230 10022.71687 61 -6495.77581 14713.78230 62 -9519.69056 -6495.77581 63 9344.12627 -9519.69056 64 17647.64575 9344.12627 65 -2016.15572 17647.64575 66 -17601.75860 -2016.15572 67 17572.71424 -17601.75860 68 11291.14990 17572.71424 69 -3561.70375 11291.14990 70 -18843.75131 -3561.70375 71 14954.34170 -18843.75131 > 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/7k7xv1210362330.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/8dfru1210362330.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/9yhue1210362330.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/10vx0v1210362330.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/11uu9j1210362330.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/129h8r1210362330.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/13wu761210362330.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/14pzu81210362330.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/15s7u71210362330.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/16l5tc1210362331.tab") + } > > system("convert tmp/18bhm1210362330.ps tmp/18bhm1210362330.png") > system("convert tmp/27w0g1210362330.ps tmp/27w0g1210362330.png") > system("convert tmp/3dgxr1210362330.ps tmp/3dgxr1210362330.png") > system("convert tmp/4eugf1210362330.ps tmp/4eugf1210362330.png") > system("convert tmp/5pzdp1210362330.ps tmp/5pzdp1210362330.png") > system("convert tmp/6f9vs1210362330.ps tmp/6f9vs1210362330.png") > system("convert tmp/7k7xv1210362330.ps tmp/7k7xv1210362330.png") > system("convert tmp/8dfru1210362330.ps tmp/8dfru1210362330.png") > system("convert tmp/9yhue1210362330.ps tmp/9yhue1210362330.png") > system("convert tmp/10vx0v1210362330.ps tmp/10vx0v1210362330.png") > > > proc.time() user system elapsed 2.915 1.637 3.469