R version 2.8.0 (2008-10-20) 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(7.5,0,7.2,0,6.9,0,6.7,0,6.4,0,6.3,0,6.8,0,7.3,0,7.1,0,7.1,0,6.8,0,6.5,0,6.3,0,6.1,0,6.1,0,6.3,0,6.3,0,6,0,6.2,0,6.4,0,6.8,0,7.5,0,7.5,0,7.6,0,7.6,0,7.4,0,7.3,0,7.1,0,6.9,0,6.8,0,7.5,0,7.6,0,7.8,0,8.0,0,8.1,0,8.2,0,8.3,0,8.2,0,8.0,0,7.9,0,7.6,0,7.6,0,8.2,0,8.3,0,8.4,0,8.4,0,8.4,0,8.6,0,8.9,0,8.8,0,8.3,0,7.5,0,7.2,0,7.5,0,8.8,0,9.3,0,9.3,0,8.7,1,8.2,1,8.3,1,8.5,1,8.6,1,8.6,1,8.2,1,8.1,1,8.0,1,8.6,1,8.7,1,8.8,1,8.5,1,8.4,1,8.5,1,8.7,1,8.7,1,8.6,1,8.5,1,8.3,1,8.1,1,8.2,1,8.1,1,8.1,1,7.9,1,7.9,1,7.9,1,8.0,1,8.0,1,7.9,1,8.0,1,7.7,1,7.2,1,7.5,1,7.3,1,7.0,1,7.0,1,7.0,1,7.2,1,7.3,1,7.1,1,6.8,1,6.6,1,6.2,1,6.2,1,6.8,1,6.9,1,6.8,1),dim=c(2,105),dimnames=list(c('w','d'),1:105)) > y <- array(NA,dim=c(2,105),dimnames=list(c('w','d'),1:105)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x w d 1 7.5 0 2 7.2 0 3 6.9 0 4 6.7 0 5 6.4 0 6 6.3 0 7 6.8 0 8 7.3 0 9 7.1 0 10 7.1 0 11 6.8 0 12 6.5 0 13 6.3 0 14 6.1 0 15 6.1 0 16 6.3 0 17 6.3 0 18 6.0 0 19 6.2 0 20 6.4 0 21 6.8 0 22 7.5 0 23 7.5 0 24 7.6 0 25 7.6 0 26 7.4 0 27 7.3 0 28 7.1 0 29 6.9 0 30 6.8 0 31 7.5 0 32 7.6 0 33 7.8 0 34 8.0 0 35 8.1 0 36 8.2 0 37 8.3 0 38 8.2 0 39 8.0 0 40 7.9 0 41 7.6 0 42 7.6 0 43 8.2 0 44 8.3 0 45 8.4 0 46 8.4 0 47 8.4 0 48 8.6 0 49 8.9 0 50 8.8 0 51 8.3 0 52 7.5 0 53 7.2 0 54 7.5 0 55 8.8 0 56 9.3 0 57 9.3 0 58 8.7 1 59 8.2 1 60 8.3 1 61 8.5 1 62 8.6 1 63 8.6 1 64 8.2 1 65 8.1 1 66 8.0 1 67 8.6 1 68 8.7 1 69 8.8 1 70 8.5 1 71 8.4 1 72 8.5 1 73 8.7 1 74 8.7 1 75 8.6 1 76 8.5 1 77 8.3 1 78 8.1 1 79 8.2 1 80 8.1 1 81 8.1 1 82 7.9 1 83 7.9 1 84 7.9 1 85 8.0 1 86 8.0 1 87 7.9 1 88 8.0 1 89 7.7 1 90 7.2 1 91 7.5 1 92 7.3 1 93 7.0 1 94 7.0 1 95 7.0 1 96 7.2 1 97 7.3 1 98 7.1 1 99 6.8 1 100 6.6 1 101 6.2 1 102 6.2 1 103 6.8 1 104 6.9 1 105 6.8 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) d 7.4649 0.3726 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.6375 -0.6649 0.0625 0.6625 1.8351 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.4649 0.1058 70.544 <2e-16 *** d 0.3726 0.1565 2.381 0.0191 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.7989 on 103 degrees of freedom Multiple R-squared: 0.05215, Adjusted R-squared: 0.04295 F-statistic: 5.667 on 1 and 103 DF, p-value: 0.01912 > 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,] 0.229906374 0.45981275 0.770093626 [2,] 0.206031378 0.41206276 0.793968622 [3,] 0.109838201 0.21967640 0.890161799 [4,] 0.078884156 0.15776831 0.921115844 [5,] 0.042580971 0.08516194 0.957419029 [6,] 0.021845844 0.04369169 0.978154156 [7,] 0.010630992 0.02126198 0.989369008 [8,] 0.007831245 0.01566249 0.992168755 [9,] 0.008883286 0.01776657 0.991116714 [10,] 0.015153165 0.03030633 0.984846835 [11,] 0.021320111 0.04264022 0.978679889 [12,] 0.019123022 0.03824604 0.980876978 [13,] 0.017251644 0.03450329 0.982748356 [14,] 0.027639804 0.05527961 0.972360196 [15,] 0.030019931 0.06003986 0.969980069 [16,] 0.026424816 0.05284963 0.973575184 [17,] 0.020496812 0.04099362 0.979503188 [18,] 0.034625124 0.06925025 0.965374876 [19,] 0.048753572 0.09750714 0.951246428 [20,] 0.069557503 0.13911501 0.930442497 [21,] 0.088259576 0.17651915 0.911740424 [22,] 0.088185033 0.17637007 0.911814967 [23,] 0.081990408 0.16398082 0.918009592 [24,] 0.071971809 0.14394362 0.928028191 [25,] 0.065403911 0.13080782 0.934596089 [26,] 0.064186817 0.12837363 0.935813183 [27,] 0.070174815 0.14034963 0.929825185 [28,] 0.080541716 0.16108343 0.919458284 [29,] 0.104577043 0.20915409 0.895422957 [30,] 0.150023059 0.30004612 0.849976941 [31,] 0.209105408 0.41821082 0.790894592 [32,] 0.281678556 0.56335711 0.718321444 [33,] 0.365878203 0.73175641 0.634121797 [34,] 0.417814517 0.83562903 0.582185483 [35,] 0.430439774 0.86087955 0.569560226 [36,] 0.428194752 0.85638950 0.571805248 [37,] 0.410961520 0.82192304 0.589038480 [38,] 0.396725794 0.79345159 0.603274206 [39,] 0.421695667 0.84339133 0.578304333 [40,] 0.452833392 0.90566678 0.547166608 [41,] 0.489939735 0.97987947 0.510060265 [42,] 0.517971256 0.96405749 0.482028744 [43,] 0.538162573 0.92367485 0.461837427 [44,] 0.578949392 0.84210122 0.421050608 [45,] 0.660620625 0.67875875 0.339379375 [46,] 0.709905941 0.58018812 0.290094059 [47,] 0.694963927 0.61007215 0.305036073 [48,] 0.675667067 0.64866587 0.324332933 [49,] 0.710000973 0.57999805 0.289999027 [50,] 0.753616016 0.49276797 0.246383984 [51,] 0.782286303 0.43542739 0.217713697 [52,] 0.837483831 0.32503234 0.162516169 [53,] 0.873704524 0.25259095 0.126295476 [54,] 0.866174095 0.26765181 0.133825905 [55,] 0.840457141 0.31908572 0.159542859 [56,] 0.812926124 0.37414775 0.187073876 [57,] 0.793416421 0.41316716 0.206583579 [58,] 0.781586784 0.43682643 0.218413216 [59,] 0.771341891 0.45731622 0.228658109 [60,] 0.737479344 0.52504131 0.262520656 [61,] 0.697920994 0.60415801 0.302079006 [62,] 0.653350003 0.69329999 0.346649997 [63,] 0.647559027 0.70488195 0.352440973 [64,] 0.659165323 0.68166935 0.340834677 [65,] 0.692330214 0.61533957 0.307669786 [66,] 0.688689371 0.62262126 0.311310629 [67,] 0.677527802 0.64494440 0.322472198 [68,] 0.682737322 0.63452536 0.317262678 [69,] 0.726832728 0.54633454 0.273167272 [70,] 0.779457974 0.44108405 0.220542026 [71,] 0.822276652 0.35544670 0.177723348 [72,] 0.856181631 0.28763674 0.143818369 [73,] 0.870887792 0.25822442 0.129112208 [74,] 0.870814920 0.25837016 0.129185080 [75,] 0.884017443 0.23196511 0.115982557 [76,] 0.891864223 0.21627155 0.108135777 [77,] 0.903986946 0.19202611 0.096013054 [78,] 0.902776176 0.19444765 0.097223824 [79,] 0.904441995 0.19111601 0.095558005 [80,] 0.909741041 0.18051792 0.090258959 [81,] 0.929440153 0.14111969 0.070559847 [82,] 0.952616687 0.09476663 0.047383313 [83,] 0.968888307 0.06222339 0.031111693 [84,] 0.989428618 0.02114276 0.010571382 [85,] 0.994447789 0.01110442 0.005552211 [86,] 0.991986709 0.01602658 0.008013291 [87,] 0.994238868 0.01152226 0.005761132 [88,] 0.993743120 0.01251376 0.006256880 [89,] 0.989021159 0.02195768 0.010978841 [90,] 0.980892433 0.03821513 0.019107567 [91,] 0.967242091 0.06551582 0.032757909 [92,] 0.959328632 0.08134274 0.040671368 [93,] 0.968225666 0.06354867 0.031774334 [94,] 0.965079474 0.06984105 0.034920526 [95,] 0.928169197 0.14366161 0.071830803 [96,] 0.837917284 0.32416543 0.162082716 > postscript(file="/var/www/html/rcomp/tmp/1r0yi1227789725.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/2ce0r1227789725.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/3xrly1227789725.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/4yjqc1227789725.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/58fzo1227789725.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 = 105 Frequency = 1 1 2 3 4 5 6 0.03508772 -0.26491228 -0.56491228 -0.76491228 -1.06491228 -1.16491228 7 8 9 10 11 12 -0.66491228 -0.16491228 -0.36491228 -0.36491228 -0.66491228 -0.96491228 13 14 15 16 17 18 -1.16491228 -1.36491228 -1.36491228 -1.16491228 -1.16491228 -1.46491228 19 20 21 22 23 24 -1.26491228 -1.06491228 -0.66491228 0.03508772 0.03508772 0.13508772 25 26 27 28 29 30 0.13508772 -0.06491228 -0.16491228 -0.36491228 -0.56491228 -0.66491228 31 32 33 34 35 36 0.03508772 0.13508772 0.33508772 0.53508772 0.63508772 0.73508772 37 38 39 40 41 42 0.83508772 0.73508772 0.53508772 0.43508772 0.13508772 0.13508772 43 44 45 46 47 48 0.73508772 0.83508772 0.93508772 0.93508772 0.93508772 1.13508772 49 50 51 52 53 54 1.43508772 1.33508772 0.83508772 0.03508772 -0.26491228 0.03508772 55 56 57 58 59 60 1.33508772 1.83508772 1.83508772 0.86250000 0.36250000 0.46250000 61 62 63 64 65 66 0.66250000 0.76250000 0.76250000 0.36250000 0.26250000 0.16250000 67 68 69 70 71 72 0.76250000 0.86250000 0.96250000 0.66250000 0.56250000 0.66250000 73 74 75 76 77 78 0.86250000 0.86250000 0.76250000 0.66250000 0.46250000 0.26250000 79 80 81 82 83 84 0.36250000 0.26250000 0.26250000 0.06250000 0.06250000 0.06250000 85 86 87 88 89 90 0.16250000 0.16250000 0.06250000 0.16250000 -0.13750000 -0.63750000 91 92 93 94 95 96 -0.33750000 -0.53750000 -0.83750000 -0.83750000 -0.83750000 -0.63750000 97 98 99 100 101 102 -0.53750000 -0.73750000 -1.03750000 -1.23750000 -1.63750000 -1.63750000 103 104 105 -1.03750000 -0.93750000 -1.03750000 > postscript(file="/var/www/html/rcomp/tmp/6ox7w1227789725.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 = 105 Frequency = 1 lag(myerror, k = 1) myerror 0 0.03508772 NA 1 -0.26491228 0.03508772 2 -0.56491228 -0.26491228 3 -0.76491228 -0.56491228 4 -1.06491228 -0.76491228 5 -1.16491228 -1.06491228 6 -0.66491228 -1.16491228 7 -0.16491228 -0.66491228 8 -0.36491228 -0.16491228 9 -0.36491228 -0.36491228 10 -0.66491228 -0.36491228 11 -0.96491228 -0.66491228 12 -1.16491228 -0.96491228 13 -1.36491228 -1.16491228 14 -1.36491228 -1.36491228 15 -1.16491228 -1.36491228 16 -1.16491228 -1.16491228 17 -1.46491228 -1.16491228 18 -1.26491228 -1.46491228 19 -1.06491228 -1.26491228 20 -0.66491228 -1.06491228 21 0.03508772 -0.66491228 22 0.03508772 0.03508772 23 0.13508772 0.03508772 24 0.13508772 0.13508772 25 -0.06491228 0.13508772 26 -0.16491228 -0.06491228 27 -0.36491228 -0.16491228 28 -0.56491228 -0.36491228 29 -0.66491228 -0.56491228 30 0.03508772 -0.66491228 31 0.13508772 0.03508772 32 0.33508772 0.13508772 33 0.53508772 0.33508772 34 0.63508772 0.53508772 35 0.73508772 0.63508772 36 0.83508772 0.73508772 37 0.73508772 0.83508772 38 0.53508772 0.73508772 39 0.43508772 0.53508772 40 0.13508772 0.43508772 41 0.13508772 0.13508772 42 0.73508772 0.13508772 43 0.83508772 0.73508772 44 0.93508772 0.83508772 45 0.93508772 0.93508772 46 0.93508772 0.93508772 47 1.13508772 0.93508772 48 1.43508772 1.13508772 49 1.33508772 1.43508772 50 0.83508772 1.33508772 51 0.03508772 0.83508772 52 -0.26491228 0.03508772 53 0.03508772 -0.26491228 54 1.33508772 0.03508772 55 1.83508772 1.33508772 56 1.83508772 1.83508772 57 0.86250000 1.83508772 58 0.36250000 0.86250000 59 0.46250000 0.36250000 60 0.66250000 0.46250000 61 0.76250000 0.66250000 62 0.76250000 0.76250000 63 0.36250000 0.76250000 64 0.26250000 0.36250000 65 0.16250000 0.26250000 66 0.76250000 0.16250000 67 0.86250000 0.76250000 68 0.96250000 0.86250000 69 0.66250000 0.96250000 70 0.56250000 0.66250000 71 0.66250000 0.56250000 72 0.86250000 0.66250000 73 0.86250000 0.86250000 74 0.76250000 0.86250000 75 0.66250000 0.76250000 76 0.46250000 0.66250000 77 0.26250000 0.46250000 78 0.36250000 0.26250000 79 0.26250000 0.36250000 80 0.26250000 0.26250000 81 0.06250000 0.26250000 82 0.06250000 0.06250000 83 0.06250000 0.06250000 84 0.16250000 0.06250000 85 0.16250000 0.16250000 86 0.06250000 0.16250000 87 0.16250000 0.06250000 88 -0.13750000 0.16250000 89 -0.63750000 -0.13750000 90 -0.33750000 -0.63750000 91 -0.53750000 -0.33750000 92 -0.83750000 -0.53750000 93 -0.83750000 -0.83750000 94 -0.83750000 -0.83750000 95 -0.63750000 -0.83750000 96 -0.53750000 -0.63750000 97 -0.73750000 -0.53750000 98 -1.03750000 -0.73750000 99 -1.23750000 -1.03750000 100 -1.63750000 -1.23750000 101 -1.63750000 -1.63750000 102 -1.03750000 -1.63750000 103 -0.93750000 -1.03750000 104 -1.03750000 -0.93750000 105 NA -1.03750000 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.26491228 0.03508772 [2,] -0.56491228 -0.26491228 [3,] -0.76491228 -0.56491228 [4,] -1.06491228 -0.76491228 [5,] -1.16491228 -1.06491228 [6,] -0.66491228 -1.16491228 [7,] -0.16491228 -0.66491228 [8,] -0.36491228 -0.16491228 [9,] -0.36491228 -0.36491228 [10,] -0.66491228 -0.36491228 [11,] -0.96491228 -0.66491228 [12,] -1.16491228 -0.96491228 [13,] -1.36491228 -1.16491228 [14,] -1.36491228 -1.36491228 [15,] -1.16491228 -1.36491228 [16,] -1.16491228 -1.16491228 [17,] -1.46491228 -1.16491228 [18,] -1.26491228 -1.46491228 [19,] -1.06491228 -1.26491228 [20,] -0.66491228 -1.06491228 [21,] 0.03508772 -0.66491228 [22,] 0.03508772 0.03508772 [23,] 0.13508772 0.03508772 [24,] 0.13508772 0.13508772 [25,] -0.06491228 0.13508772 [26,] -0.16491228 -0.06491228 [27,] -0.36491228 -0.16491228 [28,] -0.56491228 -0.36491228 [29,] -0.66491228 -0.56491228 [30,] 0.03508772 -0.66491228 [31,] 0.13508772 0.03508772 [32,] 0.33508772 0.13508772 [33,] 0.53508772 0.33508772 [34,] 0.63508772 0.53508772 [35,] 0.73508772 0.63508772 [36,] 0.83508772 0.73508772 [37,] 0.73508772 0.83508772 [38,] 0.53508772 0.73508772 [39,] 0.43508772 0.53508772 [40,] 0.13508772 0.43508772 [41,] 0.13508772 0.13508772 [42,] 0.73508772 0.13508772 [43,] 0.83508772 0.73508772 [44,] 0.93508772 0.83508772 [45,] 0.93508772 0.93508772 [46,] 0.93508772 0.93508772 [47,] 1.13508772 0.93508772 [48,] 1.43508772 1.13508772 [49,] 1.33508772 1.43508772 [50,] 0.83508772 1.33508772 [51,] 0.03508772 0.83508772 [52,] -0.26491228 0.03508772 [53,] 0.03508772 -0.26491228 [54,] 1.33508772 0.03508772 [55,] 1.83508772 1.33508772 [56,] 1.83508772 1.83508772 [57,] 0.86250000 1.83508772 [58,] 0.36250000 0.86250000 [59,] 0.46250000 0.36250000 [60,] 0.66250000 0.46250000 [61,] 0.76250000 0.66250000 [62,] 0.76250000 0.76250000 [63,] 0.36250000 0.76250000 [64,] 0.26250000 0.36250000 [65,] 0.16250000 0.26250000 [66,] 0.76250000 0.16250000 [67,] 0.86250000 0.76250000 [68,] 0.96250000 0.86250000 [69,] 0.66250000 0.96250000 [70,] 0.56250000 0.66250000 [71,] 0.66250000 0.56250000 [72,] 0.86250000 0.66250000 [73,] 0.86250000 0.86250000 [74,] 0.76250000 0.86250000 [75,] 0.66250000 0.76250000 [76,] 0.46250000 0.66250000 [77,] 0.26250000 0.46250000 [78,] 0.36250000 0.26250000 [79,] 0.26250000 0.36250000 [80,] 0.26250000 0.26250000 [81,] 0.06250000 0.26250000 [82,] 0.06250000 0.06250000 [83,] 0.06250000 0.06250000 [84,] 0.16250000 0.06250000 [85,] 0.16250000 0.16250000 [86,] 0.06250000 0.16250000 [87,] 0.16250000 0.06250000 [88,] -0.13750000 0.16250000 [89,] -0.63750000 -0.13750000 [90,] -0.33750000 -0.63750000 [91,] -0.53750000 -0.33750000 [92,] -0.83750000 -0.53750000 [93,] -0.83750000 -0.83750000 [94,] -0.83750000 -0.83750000 [95,] -0.63750000 -0.83750000 [96,] -0.53750000 -0.63750000 [97,] -0.73750000 -0.53750000 [98,] -1.03750000 -0.73750000 [99,] -1.23750000 -1.03750000 [100,] -1.63750000 -1.23750000 [101,] -1.63750000 -1.63750000 [102,] -1.03750000 -1.63750000 [103,] -0.93750000 -1.03750000 [104,] -1.03750000 -0.93750000 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.26491228 0.03508772 2 -0.56491228 -0.26491228 3 -0.76491228 -0.56491228 4 -1.06491228 -0.76491228 5 -1.16491228 -1.06491228 6 -0.66491228 -1.16491228 7 -0.16491228 -0.66491228 8 -0.36491228 -0.16491228 9 -0.36491228 -0.36491228 10 -0.66491228 -0.36491228 11 -0.96491228 -0.66491228 12 -1.16491228 -0.96491228 13 -1.36491228 -1.16491228 14 -1.36491228 -1.36491228 15 -1.16491228 -1.36491228 16 -1.16491228 -1.16491228 17 -1.46491228 -1.16491228 18 -1.26491228 -1.46491228 19 -1.06491228 -1.26491228 20 -0.66491228 -1.06491228 21 0.03508772 -0.66491228 22 0.03508772 0.03508772 23 0.13508772 0.03508772 24 0.13508772 0.13508772 25 -0.06491228 0.13508772 26 -0.16491228 -0.06491228 27 -0.36491228 -0.16491228 28 -0.56491228 -0.36491228 29 -0.66491228 -0.56491228 30 0.03508772 -0.66491228 31 0.13508772 0.03508772 32 0.33508772 0.13508772 33 0.53508772 0.33508772 34 0.63508772 0.53508772 35 0.73508772 0.63508772 36 0.83508772 0.73508772 37 0.73508772 0.83508772 38 0.53508772 0.73508772 39 0.43508772 0.53508772 40 0.13508772 0.43508772 41 0.13508772 0.13508772 42 0.73508772 0.13508772 43 0.83508772 0.73508772 44 0.93508772 0.83508772 45 0.93508772 0.93508772 46 0.93508772 0.93508772 47 1.13508772 0.93508772 48 1.43508772 1.13508772 49 1.33508772 1.43508772 50 0.83508772 1.33508772 51 0.03508772 0.83508772 52 -0.26491228 0.03508772 53 0.03508772 -0.26491228 54 1.33508772 0.03508772 55 1.83508772 1.33508772 56 1.83508772 1.83508772 57 0.86250000 1.83508772 58 0.36250000 0.86250000 59 0.46250000 0.36250000 60 0.66250000 0.46250000 61 0.76250000 0.66250000 62 0.76250000 0.76250000 63 0.36250000 0.76250000 64 0.26250000 0.36250000 65 0.16250000 0.26250000 66 0.76250000 0.16250000 67 0.86250000 0.76250000 68 0.96250000 0.86250000 69 0.66250000 0.96250000 70 0.56250000 0.66250000 71 0.66250000 0.56250000 72 0.86250000 0.66250000 73 0.86250000 0.86250000 74 0.76250000 0.86250000 75 0.66250000 0.76250000 76 0.46250000 0.66250000 77 0.26250000 0.46250000 78 0.36250000 0.26250000 79 0.26250000 0.36250000 80 0.26250000 0.26250000 81 0.06250000 0.26250000 82 0.06250000 0.06250000 83 0.06250000 0.06250000 84 0.16250000 0.06250000 85 0.16250000 0.16250000 86 0.06250000 0.16250000 87 0.16250000 0.06250000 88 -0.13750000 0.16250000 89 -0.63750000 -0.13750000 90 -0.33750000 -0.63750000 91 -0.53750000 -0.33750000 92 -0.83750000 -0.53750000 93 -0.83750000 -0.83750000 94 -0.83750000 -0.83750000 95 -0.63750000 -0.83750000 96 -0.53750000 -0.63750000 97 -0.73750000 -0.53750000 98 -1.03750000 -0.73750000 99 -1.23750000 -1.03750000 100 -1.63750000 -1.23750000 101 -1.63750000 -1.63750000 102 -1.03750000 -1.63750000 103 -0.93750000 -1.03750000 104 -1.03750000 -0.93750000 > 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/7jopc1227789725.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/86fs61227789725.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/95w3r1227789725.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/10bdyn1227789725.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/11673r1227789725.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/12gsk71227789725.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/133mu71227789726.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/1433j01227789726.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/15p8d61227789726.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/166d5t1227789726.tab") + } > > system("convert tmp/1r0yi1227789725.ps tmp/1r0yi1227789725.png") > system("convert tmp/2ce0r1227789725.ps tmp/2ce0r1227789725.png") > system("convert tmp/3xrly1227789725.ps tmp/3xrly1227789725.png") > system("convert tmp/4yjqc1227789725.ps tmp/4yjqc1227789725.png") > system("convert tmp/58fzo1227789725.ps tmp/58fzo1227789725.png") > system("convert tmp/6ox7w1227789725.ps tmp/6ox7w1227789725.png") > system("convert tmp/7jopc1227789725.ps tmp/7jopc1227789725.png") > system("convert tmp/86fs61227789725.ps tmp/86fs61227789725.png") > system("convert tmp/95w3r1227789725.ps tmp/95w3r1227789725.png") > system("convert tmp/10bdyn1227789725.ps tmp/10bdyn1227789725.png") > > > proc.time() user system elapsed 2.933 1.587 3.322