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(3,0,3.21,0,3.37,0,3.51,0,3.75,0,4.11,0,4.25,0,4.25,0,4.5,0,4.7,0,4.75,0,4.75,0,4.75,0,4.75,0,4.75,0,4.75,0,4.58,0,4.5,0,4.5,0,4.49,0,4.03,0,3.75,0,3.39,0,3.25,0,3.25,0,3.25,0,3.25,0,3.25,0,3.25,0,3.25,0,3.25,0,3.25,0,3.25,0,3.25,0,3.25,0,2.85,0,2.75,0,2.75,0,2.55,0,2.5,0,2.5,0,2.1,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2.21,0,2.25,0,2.25,0,2.45,0,2.5,0,2.5,0,2.64,0,2.75,0,2.93,0,3,0,3.17,0,3.25,0,3.39,0,3.5,0,3.5,0,3.65,0,3.75,0,3.75,0,3.9,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4.18,0,4.25,0,4.25,0,3.97,1,3.42,1,2.75,1,2.31,1,2,1,1.66,1,1.31,1,1.09,1,1,1,1,1,1,1,1,1,1,1),dim=c(2,118),dimnames=list(c('Rente','Crisis'),1:118)) > y <- array(NA,dim=c(2,118),dimnames=list(c('Rente','Crisis'),1:118)) > 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 = '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 Rente Crisis t 1 3.00 0 1 2 3.21 0 2 3 3.37 0 3 4 3.51 0 4 5 3.75 0 5 6 4.11 0 6 7 4.25 0 7 8 4.25 0 8 9 4.50 0 9 10 4.70 0 10 11 4.75 0 11 12 4.75 0 12 13 4.75 0 13 14 4.75 0 14 15 4.75 0 15 16 4.75 0 16 17 4.58 0 17 18 4.50 0 18 19 4.50 0 19 20 4.49 0 20 21 4.03 0 21 22 3.75 0 22 23 3.39 0 23 24 3.25 0 24 25 3.25 0 25 26 3.25 0 26 27 3.25 0 27 28 3.25 0 28 29 3.25 0 29 30 3.25 0 30 31 3.25 0 31 32 3.25 0 32 33 3.25 0 33 34 3.25 0 34 35 3.25 0 35 36 2.85 0 36 37 2.75 0 37 38 2.75 0 38 39 2.55 0 39 40 2.50 0 40 41 2.50 0 41 42 2.10 0 42 43 2.00 0 43 44 2.00 0 44 45 2.00 0 45 46 2.00 0 46 47 2.00 0 47 48 2.00 0 48 49 2.00 0 49 50 2.00 0 50 51 2.00 0 51 52 2.00 0 52 53 2.00 0 53 54 2.00 0 54 55 2.00 0 55 56 2.00 0 56 57 2.00 0 57 58 2.00 0 58 59 2.00 0 59 60 2.00 0 60 61 2.00 0 61 62 2.00 0 62 63 2.00 0 63 64 2.00 0 64 65 2.00 0 65 66 2.00 0 66 67 2.00 0 67 68 2.00 0 68 69 2.00 0 69 70 2.00 0 70 71 2.00 0 71 72 2.21 0 72 73 2.25 0 73 74 2.25 0 74 75 2.45 0 75 76 2.50 0 76 77 2.50 0 77 78 2.64 0 78 79 2.75 0 79 80 2.93 0 80 81 3.00 0 81 82 3.17 0 82 83 3.25 0 83 84 3.39 0 84 85 3.50 0 85 86 3.50 0 86 87 3.65 0 87 88 3.75 0 88 89 3.75 0 89 90 3.90 0 90 91 4.00 0 91 92 4.00 0 92 93 4.00 0 93 94 4.00 0 94 95 4.00 0 95 96 4.00 0 96 97 4.00 0 97 98 4.00 0 98 99 4.00 0 99 100 4.00 0 100 101 4.00 0 101 102 4.00 0 102 103 4.18 0 103 104 4.25 0 104 105 4.25 0 105 106 3.97 1 106 107 3.42 1 107 108 2.75 1 108 109 2.31 1 109 110 2.00 1 110 111 1.66 1 111 112 1.31 1 112 113 1.09 1 113 114 1.00 1 114 115 1.00 1 115 116 1.00 1 116 117 1.00 1 117 118 1.00 1 118 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Crisis t 3.412367 -1.022501 -0.005191 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.1891 -0.9900 -0.0245 0.9463 2.1304 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.412367 0.184609 18.484 < 2e-16 *** Crisis -1.022501 0.328870 -3.109 0.00237 ** t -0.005191 0.003023 -1.717 0.08863 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.9398 on 115 degrees of freedom Multiple R-squared: 0.1848, Adjusted R-squared: 0.1707 F-statistic: 13.04 on 2 and 115 DF, p-value: 7.88e-06 > 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.713879e-04 1.942776e-03 9.990286e-01 [2,] 7.355153e-05 1.471031e-04 9.999264e-01 [3,] 2.824103e-05 5.648207e-05 9.999718e-01 [4,] 2.940065e-06 5.880129e-06 9.999971e-01 [5,] 2.729793e-07 5.459585e-07 9.999997e-01 [6,] 8.085320e-08 1.617064e-07 9.999999e-01 [7,] 1.473572e-07 2.947144e-07 9.999999e-01 [8,] 3.904278e-07 7.808557e-07 9.999996e-01 [9,] 9.329115e-07 1.865823e-06 9.999991e-01 [10,] 1.942740e-06 3.885480e-06 9.999981e-01 [11,] 3.679537e-06 7.359073e-06 9.999963e-01 [12,] 1.699419e-05 3.398838e-05 9.999830e-01 [13,] 6.323852e-05 1.264770e-04 9.999368e-01 [14,] 1.497119e-04 2.994239e-04 9.998503e-01 [15,] 3.024678e-04 6.049356e-04 9.996975e-01 [16,] 2.058197e-03 4.116394e-03 9.979418e-01 [17,] 1.144756e-02 2.289513e-02 9.885524e-01 [18,] 5.127604e-02 1.025521e-01 9.487240e-01 [19,] 1.209522e-01 2.419043e-01 8.790478e-01 [20,] 1.846310e-01 3.692619e-01 8.153690e-01 [21,] 2.318652e-01 4.637305e-01 7.681348e-01 [22,] 2.636810e-01 5.273620e-01 7.363190e-01 [23,] 2.842492e-01 5.684985e-01 7.157508e-01 [24,] 2.978907e-01 5.957815e-01 7.021093e-01 [25,] 3.083836e-01 6.167671e-01 6.916164e-01 [26,] 3.190013e-01 6.380026e-01 6.809987e-01 [27,] 3.327626e-01 6.655251e-01 6.672374e-01 [28,] 3.527540e-01 7.055081e-01 6.472460e-01 [29,] 3.824996e-01 7.649992e-01 6.175004e-01 [30,] 4.263306e-01 8.526613e-01 5.736694e-01 [31,] 4.627877e-01 9.255755e-01 5.372123e-01 [32,] 4.984920e-01 9.969840e-01 5.015080e-01 [33,] 5.336337e-01 9.327327e-01 4.663663e-01 [34,] 5.656829e-01 8.686341e-01 4.343171e-01 [35,] 5.926231e-01 8.147537e-01 4.073769e-01 [36,] 6.163239e-01 7.673523e-01 3.836761e-01 [37,] 6.402951e-01 7.194098e-01 3.597049e-01 [38,] 6.544127e-01 6.911746e-01 3.455873e-01 [39,] 6.540370e-01 6.919259e-01 3.459630e-01 [40,] 6.428259e-01 7.143482e-01 3.571741e-01 [41,] 6.231530e-01 7.536939e-01 3.768470e-01 [42,] 5.967168e-01 8.065664e-01 4.032832e-01 [43,] 5.648871e-01 8.702258e-01 4.351129e-01 [44,] 5.288886e-01 9.422228e-01 4.711114e-01 [45,] 4.898830e-01 9.797660e-01 5.101170e-01 [46,] 4.489897e-01 8.979794e-01 5.510103e-01 [47,] 4.072715e-01 8.145430e-01 5.927285e-01 [48,] 3.657055e-01 7.314110e-01 6.342945e-01 [49,] 3.251519e-01 6.503038e-01 6.748481e-01 [50,] 2.863303e-01 5.726607e-01 7.136697e-01 [51,] 2.498070e-01 4.996140e-01 7.501930e-01 [52,] 2.159938e-01 4.319876e-01 7.840062e-01 [53,] 1.851574e-01 3.703149e-01 8.148426e-01 [54,] 1.574353e-01 3.148705e-01 8.425647e-01 [55,] 1.328550e-01 2.657100e-01 8.671450e-01 [56,] 1.113554e-01 2.227108e-01 8.886446e-01 [57,] 9.280655e-02 1.856131e-01 9.071934e-01 [58,] 7.702798e-02 1.540560e-01 9.229720e-01 [59,] 6.380565e-02 1.276113e-01 9.361943e-01 [60,] 5.290736e-02 1.058147e-01 9.470926e-01 [61,] 4.409761e-02 8.819521e-02 9.559024e-01 [62,] 3.715318e-02 7.430635e-02 9.628468e-01 [63,] 3.188120e-02 6.376239e-02 9.681188e-01 [64,] 2.814352e-02 5.628703e-02 9.718565e-01 [65,] 2.589601e-02 5.179201e-02 9.741040e-01 [66,] 2.526373e-02 5.052746e-02 9.747363e-01 [67,] 2.668144e-02 5.336288e-02 9.733186e-01 [68,] 2.965880e-02 5.931760e-02 9.703412e-01 [69,] 3.481615e-02 6.963231e-02 9.651838e-01 [70,] 4.400628e-02 8.801256e-02 9.559937e-01 [71,] 5.750030e-02 1.150006e-01 9.424997e-01 [72,] 7.784213e-02 1.556843e-01 9.221579e-01 [73,] 1.089297e-01 2.178594e-01 8.910703e-01 [74,] 1.542750e-01 3.085499e-01 8.457250e-01 [75,] 2.161110e-01 4.322221e-01 7.838890e-01 [76,] 2.943913e-01 5.887825e-01 7.056087e-01 [77,] 3.854991e-01 7.709981e-01 6.145009e-01 [78,] 4.834782e-01 9.669565e-01 5.165218e-01 [79,] 5.796493e-01 8.407013e-01 4.203507e-01 [80,] 6.668408e-01 6.663185e-01 3.331592e-01 [81,] 7.471515e-01 5.056970e-01 2.528485e-01 [82,] 8.113437e-01 3.773126e-01 1.886563e-01 [83,] 8.607347e-01 2.785306e-01 1.392653e-01 [84,] 9.018531e-01 1.962937e-01 9.814685e-02 [85,] 9.291333e-01 1.417333e-01 7.086666e-02 [86,] 9.470423e-01 1.059153e-01 5.295766e-02 [87,] 9.606711e-01 7.865779e-02 3.932890e-02 [88,] 9.713048e-01 5.739049e-02 2.869524e-02 [89,] 9.796275e-01 4.074497e-02 2.037248e-02 [90,] 9.860069e-01 2.798618e-02 1.399309e-02 [91,] 9.906934e-01 1.861325e-02 9.306623e-03 [92,] 9.939423e-01 1.211545e-02 6.057724e-03 [93,] 9.960511e-01 7.897735e-03 3.948867e-03 [94,] 9.973291e-01 5.341750e-03 2.670875e-03 [95,] 9.980443e-01 3.911433e-03 1.955716e-03 [96,] 9.983914e-01 3.217171e-03 1.608585e-03 [97,] 9.984995e-01 3.000988e-03 1.500494e-03 [98,] 9.976501e-01 4.699895e-03 2.349947e-03 [99,] 9.954712e-01 9.057589e-03 4.528794e-03 [100,] 9.908189e-01 1.836230e-02 9.181148e-03 [101,] 9.957908e-01 8.418469e-03 4.209235e-03 [102,] 9.986486e-01 2.702847e-03 1.351423e-03 [103,] 9.990129e-01 1.974271e-03 9.871357e-04 [104,] 9.989963e-01 2.007491e-03 1.003746e-03 [105,] 9.993180e-01 1.364082e-03 6.820409e-04 [106,] 9.997655e-01 4.689568e-04 2.344784e-04 [107,] 9.999211e-01 1.578381e-04 7.891907e-05 > postscript(file="/var/www/html/rcomp/tmp/1pkrs1258737674.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/2wxx71258737674.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/3gewl1258737674.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/468f31258737674.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/5eh901258737674.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 = 118 Frequency = 1 1 2 3 4 5 6 -0.407176217 -0.191985100 -0.026793982 0.118397136 0.363588254 0.728779371 7 8 9 10 11 12 0.873970489 0.879161607 1.134352724 1.339543842 1.394734960 1.399926078 13 14 15 16 17 18 1.405117195 1.410308313 1.415499431 1.420690549 1.255881666 1.181072784 19 20 21 22 23 24 1.186263902 1.181455020 0.726646137 0.451837255 0.097028373 -0.037780510 25 26 27 28 29 30 -0.032589392 -0.027398274 -0.022207156 -0.017016039 -0.011824921 -0.006633803 31 32 33 34 35 36 -0.001442685 0.003748432 0.008939550 0.014130668 0.019321786 -0.375487097 37 38 39 40 41 42 -0.470295979 -0.465104861 -0.659913744 -0.704722626 -0.699531508 -1.094340390 43 44 45 46 47 48 -1.189149273 -1.183958155 -1.178767037 -1.173575919 -1.168384802 -1.163193684 49 50 51 52 53 54 -1.158002566 -1.152811448 -1.147620331 -1.142429213 -1.137238095 -1.132046978 55 56 57 58 59 60 -1.126855860 -1.121664742 -1.116473624 -1.111282507 -1.106091389 -1.100900271 61 62 63 64 65 66 -1.095709153 -1.090518036 -1.085326918 -1.080135800 -1.074944682 -1.069753565 67 68 69 70 71 72 -1.064562447 -1.059371329 -1.054180212 -1.048989094 -1.043797976 -0.828606858 73 74 75 76 77 78 -0.783415741 -0.778224623 -0.573033505 -0.517842387 -0.512651270 -0.367460152 79 80 81 82 83 84 -0.252269034 -0.067077916 0.008113201 0.183304319 0.268495437 0.413686555 85 86 87 88 89 90 0.528877672 0.534068790 0.689259908 0.794451025 0.799642143 0.954833261 91 92 93 94 95 96 1.060024379 1.065215496 1.070406614 1.075597732 1.080788850 1.085979967 97 98 99 100 101 102 1.091171085 1.096362203 1.101553321 1.106744438 1.111935556 1.117126674 103 104 105 106 107 108 1.302317791 1.377508909 1.382700027 2.130391755 1.585582873 0.920773991 109 110 111 112 113 114 0.485965108 0.181156226 -0.153652656 -0.498461538 -0.713270421 -0.798079303 115 116 117 118 -0.792888185 -0.787697068 -0.782505950 -0.777314832 > postscript(file="/var/www/html/rcomp/tmp/6fcd61258737674.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 = 118 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.407176217 NA 1 -0.191985100 -0.407176217 2 -0.026793982 -0.191985100 3 0.118397136 -0.026793982 4 0.363588254 0.118397136 5 0.728779371 0.363588254 6 0.873970489 0.728779371 7 0.879161607 0.873970489 8 1.134352724 0.879161607 9 1.339543842 1.134352724 10 1.394734960 1.339543842 11 1.399926078 1.394734960 12 1.405117195 1.399926078 13 1.410308313 1.405117195 14 1.415499431 1.410308313 15 1.420690549 1.415499431 16 1.255881666 1.420690549 17 1.181072784 1.255881666 18 1.186263902 1.181072784 19 1.181455020 1.186263902 20 0.726646137 1.181455020 21 0.451837255 0.726646137 22 0.097028373 0.451837255 23 -0.037780510 0.097028373 24 -0.032589392 -0.037780510 25 -0.027398274 -0.032589392 26 -0.022207156 -0.027398274 27 -0.017016039 -0.022207156 28 -0.011824921 -0.017016039 29 -0.006633803 -0.011824921 30 -0.001442685 -0.006633803 31 0.003748432 -0.001442685 32 0.008939550 0.003748432 33 0.014130668 0.008939550 34 0.019321786 0.014130668 35 -0.375487097 0.019321786 36 -0.470295979 -0.375487097 37 -0.465104861 -0.470295979 38 -0.659913744 -0.465104861 39 -0.704722626 -0.659913744 40 -0.699531508 -0.704722626 41 -1.094340390 -0.699531508 42 -1.189149273 -1.094340390 43 -1.183958155 -1.189149273 44 -1.178767037 -1.183958155 45 -1.173575919 -1.178767037 46 -1.168384802 -1.173575919 47 -1.163193684 -1.168384802 48 -1.158002566 -1.163193684 49 -1.152811448 -1.158002566 50 -1.147620331 -1.152811448 51 -1.142429213 -1.147620331 52 -1.137238095 -1.142429213 53 -1.132046978 -1.137238095 54 -1.126855860 -1.132046978 55 -1.121664742 -1.126855860 56 -1.116473624 -1.121664742 57 -1.111282507 -1.116473624 58 -1.106091389 -1.111282507 59 -1.100900271 -1.106091389 60 -1.095709153 -1.100900271 61 -1.090518036 -1.095709153 62 -1.085326918 -1.090518036 63 -1.080135800 -1.085326918 64 -1.074944682 -1.080135800 65 -1.069753565 -1.074944682 66 -1.064562447 -1.069753565 67 -1.059371329 -1.064562447 68 -1.054180212 -1.059371329 69 -1.048989094 -1.054180212 70 -1.043797976 -1.048989094 71 -0.828606858 -1.043797976 72 -0.783415741 -0.828606858 73 -0.778224623 -0.783415741 74 -0.573033505 -0.778224623 75 -0.517842387 -0.573033505 76 -0.512651270 -0.517842387 77 -0.367460152 -0.512651270 78 -0.252269034 -0.367460152 79 -0.067077916 -0.252269034 80 0.008113201 -0.067077916 81 0.183304319 0.008113201 82 0.268495437 0.183304319 83 0.413686555 0.268495437 84 0.528877672 0.413686555 85 0.534068790 0.528877672 86 0.689259908 0.534068790 87 0.794451025 0.689259908 88 0.799642143 0.794451025 89 0.954833261 0.799642143 90 1.060024379 0.954833261 91 1.065215496 1.060024379 92 1.070406614 1.065215496 93 1.075597732 1.070406614 94 1.080788850 1.075597732 95 1.085979967 1.080788850 96 1.091171085 1.085979967 97 1.096362203 1.091171085 98 1.101553321 1.096362203 99 1.106744438 1.101553321 100 1.111935556 1.106744438 101 1.117126674 1.111935556 102 1.302317791 1.117126674 103 1.377508909 1.302317791 104 1.382700027 1.377508909 105 2.130391755 1.382700027 106 1.585582873 2.130391755 107 0.920773991 1.585582873 108 0.485965108 0.920773991 109 0.181156226 0.485965108 110 -0.153652656 0.181156226 111 -0.498461538 -0.153652656 112 -0.713270421 -0.498461538 113 -0.798079303 -0.713270421 114 -0.792888185 -0.798079303 115 -0.787697068 -0.792888185 116 -0.782505950 -0.787697068 117 -0.777314832 -0.782505950 118 NA -0.777314832 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.191985100 -0.407176217 [2,] -0.026793982 -0.191985100 [3,] 0.118397136 -0.026793982 [4,] 0.363588254 0.118397136 [5,] 0.728779371 0.363588254 [6,] 0.873970489 0.728779371 [7,] 0.879161607 0.873970489 [8,] 1.134352724 0.879161607 [9,] 1.339543842 1.134352724 [10,] 1.394734960 1.339543842 [11,] 1.399926078 1.394734960 [12,] 1.405117195 1.399926078 [13,] 1.410308313 1.405117195 [14,] 1.415499431 1.410308313 [15,] 1.420690549 1.415499431 [16,] 1.255881666 1.420690549 [17,] 1.181072784 1.255881666 [18,] 1.186263902 1.181072784 [19,] 1.181455020 1.186263902 [20,] 0.726646137 1.181455020 [21,] 0.451837255 0.726646137 [22,] 0.097028373 0.451837255 [23,] -0.037780510 0.097028373 [24,] -0.032589392 -0.037780510 [25,] -0.027398274 -0.032589392 [26,] -0.022207156 -0.027398274 [27,] -0.017016039 -0.022207156 [28,] -0.011824921 -0.017016039 [29,] -0.006633803 -0.011824921 [30,] -0.001442685 -0.006633803 [31,] 0.003748432 -0.001442685 [32,] 0.008939550 0.003748432 [33,] 0.014130668 0.008939550 [34,] 0.019321786 0.014130668 [35,] -0.375487097 0.019321786 [36,] -0.470295979 -0.375487097 [37,] -0.465104861 -0.470295979 [38,] -0.659913744 -0.465104861 [39,] -0.704722626 -0.659913744 [40,] -0.699531508 -0.704722626 [41,] -1.094340390 -0.699531508 [42,] -1.189149273 -1.094340390 [43,] -1.183958155 -1.189149273 [44,] -1.178767037 -1.183958155 [45,] -1.173575919 -1.178767037 [46,] -1.168384802 -1.173575919 [47,] -1.163193684 -1.168384802 [48,] -1.158002566 -1.163193684 [49,] -1.152811448 -1.158002566 [50,] -1.147620331 -1.152811448 [51,] -1.142429213 -1.147620331 [52,] -1.137238095 -1.142429213 [53,] -1.132046978 -1.137238095 [54,] -1.126855860 -1.132046978 [55,] -1.121664742 -1.126855860 [56,] -1.116473624 -1.121664742 [57,] -1.111282507 -1.116473624 [58,] -1.106091389 -1.111282507 [59,] -1.100900271 -1.106091389 [60,] -1.095709153 -1.100900271 [61,] -1.090518036 -1.095709153 [62,] -1.085326918 -1.090518036 [63,] -1.080135800 -1.085326918 [64,] -1.074944682 -1.080135800 [65,] -1.069753565 -1.074944682 [66,] -1.064562447 -1.069753565 [67,] -1.059371329 -1.064562447 [68,] -1.054180212 -1.059371329 [69,] -1.048989094 -1.054180212 [70,] -1.043797976 -1.048989094 [71,] -0.828606858 -1.043797976 [72,] -0.783415741 -0.828606858 [73,] -0.778224623 -0.783415741 [74,] -0.573033505 -0.778224623 [75,] -0.517842387 -0.573033505 [76,] -0.512651270 -0.517842387 [77,] -0.367460152 -0.512651270 [78,] -0.252269034 -0.367460152 [79,] -0.067077916 -0.252269034 [80,] 0.008113201 -0.067077916 [81,] 0.183304319 0.008113201 [82,] 0.268495437 0.183304319 [83,] 0.413686555 0.268495437 [84,] 0.528877672 0.413686555 [85,] 0.534068790 0.528877672 [86,] 0.689259908 0.534068790 [87,] 0.794451025 0.689259908 [88,] 0.799642143 0.794451025 [89,] 0.954833261 0.799642143 [90,] 1.060024379 0.954833261 [91,] 1.065215496 1.060024379 [92,] 1.070406614 1.065215496 [93,] 1.075597732 1.070406614 [94,] 1.080788850 1.075597732 [95,] 1.085979967 1.080788850 [96,] 1.091171085 1.085979967 [97,] 1.096362203 1.091171085 [98,] 1.101553321 1.096362203 [99,] 1.106744438 1.101553321 [100,] 1.111935556 1.106744438 [101,] 1.117126674 1.111935556 [102,] 1.302317791 1.117126674 [103,] 1.377508909 1.302317791 [104,] 1.382700027 1.377508909 [105,] 2.130391755 1.382700027 [106,] 1.585582873 2.130391755 [107,] 0.920773991 1.585582873 [108,] 0.485965108 0.920773991 [109,] 0.181156226 0.485965108 [110,] -0.153652656 0.181156226 [111,] -0.498461538 -0.153652656 [112,] -0.713270421 -0.498461538 [113,] -0.798079303 -0.713270421 [114,] -0.792888185 -0.798079303 [115,] -0.787697068 -0.792888185 [116,] -0.782505950 -0.787697068 [117,] -0.777314832 -0.782505950 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.191985100 -0.407176217 2 -0.026793982 -0.191985100 3 0.118397136 -0.026793982 4 0.363588254 0.118397136 5 0.728779371 0.363588254 6 0.873970489 0.728779371 7 0.879161607 0.873970489 8 1.134352724 0.879161607 9 1.339543842 1.134352724 10 1.394734960 1.339543842 11 1.399926078 1.394734960 12 1.405117195 1.399926078 13 1.410308313 1.405117195 14 1.415499431 1.410308313 15 1.420690549 1.415499431 16 1.255881666 1.420690549 17 1.181072784 1.255881666 18 1.186263902 1.181072784 19 1.181455020 1.186263902 20 0.726646137 1.181455020 21 0.451837255 0.726646137 22 0.097028373 0.451837255 23 -0.037780510 0.097028373 24 -0.032589392 -0.037780510 25 -0.027398274 -0.032589392 26 -0.022207156 -0.027398274 27 -0.017016039 -0.022207156 28 -0.011824921 -0.017016039 29 -0.006633803 -0.011824921 30 -0.001442685 -0.006633803 31 0.003748432 -0.001442685 32 0.008939550 0.003748432 33 0.014130668 0.008939550 34 0.019321786 0.014130668 35 -0.375487097 0.019321786 36 -0.470295979 -0.375487097 37 -0.465104861 -0.470295979 38 -0.659913744 -0.465104861 39 -0.704722626 -0.659913744 40 -0.699531508 -0.704722626 41 -1.094340390 -0.699531508 42 -1.189149273 -1.094340390 43 -1.183958155 -1.189149273 44 -1.178767037 -1.183958155 45 -1.173575919 -1.178767037 46 -1.168384802 -1.173575919 47 -1.163193684 -1.168384802 48 -1.158002566 -1.163193684 49 -1.152811448 -1.158002566 50 -1.147620331 -1.152811448 51 -1.142429213 -1.147620331 52 -1.137238095 -1.142429213 53 -1.132046978 -1.137238095 54 -1.126855860 -1.132046978 55 -1.121664742 -1.126855860 56 -1.116473624 -1.121664742 57 -1.111282507 -1.116473624 58 -1.106091389 -1.111282507 59 -1.100900271 -1.106091389 60 -1.095709153 -1.100900271 61 -1.090518036 -1.095709153 62 -1.085326918 -1.090518036 63 -1.080135800 -1.085326918 64 -1.074944682 -1.080135800 65 -1.069753565 -1.074944682 66 -1.064562447 -1.069753565 67 -1.059371329 -1.064562447 68 -1.054180212 -1.059371329 69 -1.048989094 -1.054180212 70 -1.043797976 -1.048989094 71 -0.828606858 -1.043797976 72 -0.783415741 -0.828606858 73 -0.778224623 -0.783415741 74 -0.573033505 -0.778224623 75 -0.517842387 -0.573033505 76 -0.512651270 -0.517842387 77 -0.367460152 -0.512651270 78 -0.252269034 -0.367460152 79 -0.067077916 -0.252269034 80 0.008113201 -0.067077916 81 0.183304319 0.008113201 82 0.268495437 0.183304319 83 0.413686555 0.268495437 84 0.528877672 0.413686555 85 0.534068790 0.528877672 86 0.689259908 0.534068790 87 0.794451025 0.689259908 88 0.799642143 0.794451025 89 0.954833261 0.799642143 90 1.060024379 0.954833261 91 1.065215496 1.060024379 92 1.070406614 1.065215496 93 1.075597732 1.070406614 94 1.080788850 1.075597732 95 1.085979967 1.080788850 96 1.091171085 1.085979967 97 1.096362203 1.091171085 98 1.101553321 1.096362203 99 1.106744438 1.101553321 100 1.111935556 1.106744438 101 1.117126674 1.111935556 102 1.302317791 1.117126674 103 1.377508909 1.302317791 104 1.382700027 1.377508909 105 2.130391755 1.382700027 106 1.585582873 2.130391755 107 0.920773991 1.585582873 108 0.485965108 0.920773991 109 0.181156226 0.485965108 110 -0.153652656 0.181156226 111 -0.498461538 -0.153652656 112 -0.713270421 -0.498461538 113 -0.798079303 -0.713270421 114 -0.792888185 -0.798079303 115 -0.787697068 -0.792888185 116 -0.782505950 -0.787697068 117 -0.777314832 -0.782505950 > 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/77wvs1258737674.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/8mfu31258737674.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/9e98j1258737674.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/10f24l1258737674.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/116ync1258737674.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/1227qu1258737674.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/13383c1258737674.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/144l161258737674.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/15uofu1258737674.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/16404r1258737674.tab") + } > > system("convert tmp/1pkrs1258737674.ps tmp/1pkrs1258737674.png") > system("convert tmp/2wxx71258737674.ps tmp/2wxx71258737674.png") > system("convert tmp/3gewl1258737674.ps tmp/3gewl1258737674.png") > system("convert tmp/468f31258737674.ps tmp/468f31258737674.png") > system("convert tmp/5eh901258737674.ps tmp/5eh901258737674.png") > system("convert tmp/6fcd61258737674.ps tmp/6fcd61258737674.png") > system("convert tmp/77wvs1258737674.ps tmp/77wvs1258737674.png") > system("convert tmp/8mfu31258737674.ps tmp/8mfu31258737674.png") > system("convert tmp/9e98j1258737674.ps tmp/9e98j1258737674.png") > system("convert tmp/10f24l1258737674.ps tmp/10f24l1258737674.png") > > > proc.time() user system elapsed 3.231 1.676 6.590