R version 2.7.0 (2008-04-22) 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(96.5,0,97.3,0,122,0,91,0,107.9,0,114.6,0,98,0,95.5,0,98.7,0,115.9,0,110.4,0,109.5,0,92.3,0,102.1,0,112.8,0,110.2,0,98.9,0,119,0,104.3,0,98.8,0,109.4,1,170.3,1,118,1,116.9,1,111.7,1,116.8,1,116.1,1,114.8,1,110.8,1,122.8,1,104.7,1,86,1,127.2,1,126.1,1,114.6,1,127.8,1,105.2,1,113.1,1,161,1,126.9,1,117.7,1,144.9,1,119.4,1,107.1,1,142.8,1,126.2,1,126.9,1,179.2,1,105.3,1,114.8,1,125.4,1,113.2,1,134.4,1,150,1,100.9,1,101.8,1,137.7,1,138.7,1,135.4,1,153.8,1,119.5,1,123.3,1,166.4,1,137.5,1,142.2,1,167,1,112.3,1,120.6,1,154.9,1,153.4,1,156.2,1,175.8,1,131.7,1,130.1,1,161.1,1,128.2,1,140.3,1,174.9,1,111.8,1,136.6,1,166.1,1,159.4,1,168.2,1,154.6,1),dim=c(2,84),dimnames=list(c('Productie_Medische_apparatuur','Dummy'),1:84)) > y <- array(NA,dim=c(2,84),dimnames=list(c('Productie_Medische_apparatuur','Dummy'),1:84)) > 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 Productie_Medische_apparatuur Dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 96.5 0 1 0 0 0 0 0 0 0 0 0 0 1 2 97.3 0 0 1 0 0 0 0 0 0 0 0 0 2 3 122.0 0 0 0 1 0 0 0 0 0 0 0 0 3 4 91.0 0 0 0 0 1 0 0 0 0 0 0 0 4 5 107.9 0 0 0 0 0 1 0 0 0 0 0 0 5 6 114.6 0 0 0 0 0 0 1 0 0 0 0 0 6 7 98.0 0 0 0 0 0 0 0 1 0 0 0 0 7 8 95.5 0 0 0 0 0 0 0 0 1 0 0 0 8 9 98.7 0 0 0 0 0 0 0 0 0 1 0 0 9 10 115.9 0 0 0 0 0 0 0 0 0 0 1 0 10 11 110.4 0 0 0 0 0 0 0 0 0 0 0 1 11 12 109.5 0 0 0 0 0 0 0 0 0 0 0 0 12 13 92.3 0 1 0 0 0 0 0 0 0 0 0 0 13 14 102.1 0 0 1 0 0 0 0 0 0 0 0 0 14 15 112.8 0 0 0 1 0 0 0 0 0 0 0 0 15 16 110.2 0 0 0 0 1 0 0 0 0 0 0 0 16 17 98.9 0 0 0 0 0 1 0 0 0 0 0 0 17 18 119.0 0 0 0 0 0 0 1 0 0 0 0 0 18 19 104.3 0 0 0 0 0 0 0 1 0 0 0 0 19 20 98.8 0 0 0 0 0 0 0 0 1 0 0 0 20 21 109.4 1 0 0 0 0 0 0 0 0 1 0 0 21 22 170.3 1 0 0 0 0 0 0 0 0 0 1 0 22 23 118.0 1 0 0 0 0 0 0 0 0 0 0 1 23 24 116.9 1 0 0 0 0 0 0 0 0 0 0 0 24 25 111.7 1 1 0 0 0 0 0 0 0 0 0 0 25 26 116.8 1 0 1 0 0 0 0 0 0 0 0 0 26 27 116.1 1 0 0 1 0 0 0 0 0 0 0 0 27 28 114.8 1 0 0 0 1 0 0 0 0 0 0 0 28 29 110.8 1 0 0 0 0 1 0 0 0 0 0 0 29 30 122.8 1 0 0 0 0 0 1 0 0 0 0 0 30 31 104.7 1 0 0 0 0 0 0 1 0 0 0 0 31 32 86.0 1 0 0 0 0 0 0 0 1 0 0 0 32 33 127.2 1 0 0 0 0 0 0 0 0 1 0 0 33 34 126.1 1 0 0 0 0 0 0 0 0 0 1 0 34 35 114.6 1 0 0 0 0 0 0 0 0 0 0 1 35 36 127.8 1 0 0 0 0 0 0 0 0 0 0 0 36 37 105.2 1 1 0 0 0 0 0 0 0 0 0 0 37 38 113.1 1 0 1 0 0 0 0 0 0 0 0 0 38 39 161.0 1 0 0 1 0 0 0 0 0 0 0 0 39 40 126.9 1 0 0 0 1 0 0 0 0 0 0 0 40 41 117.7 1 0 0 0 0 1 0 0 0 0 0 0 41 42 144.9 1 0 0 0 0 0 1 0 0 0 0 0 42 43 119.4 1 0 0 0 0 0 0 1 0 0 0 0 43 44 107.1 1 0 0 0 0 0 0 0 1 0 0 0 44 45 142.8 1 0 0 0 0 0 0 0 0 1 0 0 45 46 126.2 1 0 0 0 0 0 0 0 0 0 1 0 46 47 126.9 1 0 0 0 0 0 0 0 0 0 0 1 47 48 179.2 1 0 0 0 0 0 0 0 0 0 0 0 48 49 105.3 1 1 0 0 0 0 0 0 0 0 0 0 49 50 114.8 1 0 1 0 0 0 0 0 0 0 0 0 50 51 125.4 1 0 0 1 0 0 0 0 0 0 0 0 51 52 113.2 1 0 0 0 1 0 0 0 0 0 0 0 52 53 134.4 1 0 0 0 0 1 0 0 0 0 0 0 53 54 150.0 1 0 0 0 0 0 1 0 0 0 0 0 54 55 100.9 1 0 0 0 0 0 0 1 0 0 0 0 55 56 101.8 1 0 0 0 0 0 0 0 1 0 0 0 56 57 137.7 1 0 0 0 0 0 0 0 0 1 0 0 57 58 138.7 1 0 0 0 0 0 0 0 0 0 1 0 58 59 135.4 1 0 0 0 0 0 0 0 0 0 0 1 59 60 153.8 1 0 0 0 0 0 0 0 0 0 0 0 60 61 119.5 1 1 0 0 0 0 0 0 0 0 0 0 61 62 123.3 1 0 1 0 0 0 0 0 0 0 0 0 62 63 166.4 1 0 0 1 0 0 0 0 0 0 0 0 63 64 137.5 1 0 0 0 1 0 0 0 0 0 0 0 64 65 142.2 1 0 0 0 0 1 0 0 0 0 0 0 65 66 167.0 1 0 0 0 0 0 1 0 0 0 0 0 66 67 112.3 1 0 0 0 0 0 0 1 0 0 0 0 67 68 120.6 1 0 0 0 0 0 0 0 1 0 0 0 68 69 154.9 1 0 0 0 0 0 0 0 0 1 0 0 69 70 153.4 1 0 0 0 0 0 0 0 0 0 1 0 70 71 156.2 1 0 0 0 0 0 0 0 0 0 0 1 71 72 175.8 1 0 0 0 0 0 0 0 0 0 0 0 72 73 131.7 1 1 0 0 0 0 0 0 0 0 0 0 73 74 130.1 1 0 1 0 0 0 0 0 0 0 0 0 74 75 161.1 1 0 0 1 0 0 0 0 0 0 0 0 75 76 128.2 1 0 0 0 1 0 0 0 0 0 0 0 76 77 140.3 1 0 0 0 0 1 0 0 0 0 0 0 77 78 174.9 1 0 0 0 0 0 1 0 0 0 0 0 78 79 111.8 1 0 0 0 0 0 0 1 0 0 0 0 79 80 136.6 1 0 0 0 0 0 0 0 1 0 0 0 80 81 166.1 1 0 0 0 0 0 0 0 0 1 0 0 81 82 159.4 1 0 0 0 0 0 0 0 0 0 1 0 82 83 168.2 1 0 0 0 0 0 0 0 0 0 0 1 83 84 154.6 1 0 0 0 0 0 0 0 0 0 0 0 84 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Dummy M1 M2 M3 M4 116.87547 -0.38199 -29.93493 -25.49256 -2.19304 -23.22210 M5 M6 M7 M8 M9 M10 -19.47973 0.06264 -35.08071 -36.39548 -9.74140 -2.74188 M11 t -11.95666 0.60049 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -19.5253 -8.8965 -0.9218 7.0796 43.3377 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 116.87547 5.37250 21.754 < 2e-16 *** Dummy -0.38199 4.61751 -0.083 0.934305 M1 -29.93493 6.46882 -4.628 1.65e-05 *** M2 -25.49256 6.46426 -3.944 0.000188 *** M3 -2.19304 6.46072 -0.339 0.735292 M4 -23.22210 6.45818 -3.596 0.000598 *** M5 -19.47973 6.45666 -3.017 0.003557 ** M6 0.06264 6.45616 0.010 0.992287 M7 -35.08071 6.45666 -5.433 7.58e-07 *** M8 -36.39548 6.45818 -5.636 3.40e-07 *** M9 -9.74140 6.44527 -1.511 0.135187 M10 -2.74188 6.44273 -0.426 0.671721 M11 -11.95666 6.44120 -1.856 0.067623 . t 0.60049 0.08091 7.421 2.12e-10 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 12.05 on 70 degrees of freedom Multiple R-squared: 0.7684, Adjusted R-squared: 0.7254 F-statistic: 17.87 on 13 and 70 DF, p-value: < 2.2e-16 > 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.36751861 0.73503722 0.63248139 [2,] 0.22953084 0.45906169 0.77046916 [3,] 0.13305362 0.26610724 0.86694638 [4,] 0.06763863 0.13527726 0.93236137 [5,] 0.03371576 0.06743153 0.96628424 [6,] 0.38241415 0.76482831 0.61758585 [7,] 0.43771843 0.87543686 0.56228157 [8,] 0.44340100 0.88680200 0.55659900 [9,] 0.37715778 0.75431557 0.62284222 [10,] 0.32042541 0.64085081 0.67957459 [11,] 0.41817553 0.83635105 0.58182447 [12,] 0.34122428 0.68244855 0.65877572 [13,] 0.28417382 0.56834764 0.71582618 [14,] 0.26677032 0.53354065 0.73322968 [15,] 0.24885768 0.49771536 0.75114232 [16,] 0.35889074 0.71778149 0.64110926 [17,] 0.37857472 0.75714944 0.62142528 [18,] 0.44941617 0.89883234 0.55058383 [19,] 0.40634101 0.81268203 0.59365899 [20,] 0.43654624 0.87309247 0.56345376 [21,] 0.36145532 0.72291065 0.63854468 [22,] 0.29376696 0.58753391 0.70623304 [23,] 0.65690502 0.68618995 0.34309498 [24,] 0.66059011 0.67881978 0.33940989 [25,] 0.59507645 0.80984709 0.40492355 [26,] 0.56418774 0.87162452 0.43581226 [27,] 0.67266590 0.65466821 0.32733410 [28,] 0.60675771 0.78648459 0.39324229 [29,] 0.61632440 0.76735120 0.38367560 [30,] 0.65443425 0.69113150 0.34556575 [31,] 0.60385619 0.79228762 0.39614381 [32,] 0.97918924 0.04162153 0.02081076 [33,] 0.97258008 0.05483984 0.02741992 [34,] 0.96020192 0.07959616 0.03979808 [35,] 0.98605134 0.02789731 0.01394866 [36,] 0.98020289 0.03959422 0.01979711 [37,] 0.97265116 0.05469768 0.02734884 [38,] 0.96222724 0.07554552 0.03777276 [39,] 0.95066833 0.09866335 0.04933167 [40,] 0.95186650 0.09626701 0.04813350 [41,] 0.94479766 0.11040469 0.05520234 [42,] 0.92507880 0.14984240 0.07492120 [43,] 0.95860090 0.08279820 0.04139910 [44,] 0.93806239 0.12387521 0.06193761 [45,] 0.91553907 0.16892185 0.08446093 [46,] 0.86657622 0.26684757 0.13342378 [47,] 0.82699004 0.34601993 0.17300996 [48,] 0.79356476 0.41287048 0.20643524 [49,] 0.69851932 0.60296135 0.30148068 [50,] 0.57355619 0.85288763 0.42644381 [51,] 0.42086489 0.84172978 0.57913511 > postscript(file="/var/www/html/rcomp/tmp/110ys1227445621.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/20l0u1227445622.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/319eb1227445622.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/4epfy1227445622.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/5wskl1227445622.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 = 84 Frequency = 1 1 2 3 4 5 6 8.9589660 4.7161089 5.5161089 -5.0553197 7.5018232 -5.9410340 7 8 9 10 11 12 12.0018232 10.2161089 -13.8384615 -4.2384615 -1.1241758 -14.5813187 13 14 15 16 17 18 -2.4468781 2.3102647 -10.8897353 6.9388362 -8.7040210 -8.7468781 19 20 21 22 23 24 11.0959790 6.3102647 -9.9623127 43.3376873 -0.3480270 -14.0051698 25 26 27 28 29 30 10.1292707 10.1864136 -14.4135864 4.7149850 -3.6278721 -11.7707293 31 32 33 34 35 36 4.6721279 -13.3135864 0.6318432 -8.0681568 -10.9538711 -10.3110140 37 38 39 40 41 42 -3.5765734 -0.7194306 23.2805694 9.6091409 -3.9337163 3.1234266 43 44 45 46 47 48 12.1662837 0.5805694 9.0259990 -15.1740010 -5.8597153 33.8831419 49 50 51 52 53 54 -10.6824176 -6.2252747 -19.5252747 -11.2967033 5.5604396 1.0175824 55 56 57 58 59 60 -13.5395604 -11.9252747 -3.2798452 -9.8798452 -4.5655594 1.2772977 61 62 63 64 65 66 -3.6882617 -4.9311189 14.2688811 5.7974525 6.1545954 10.8117383 67 68 69 70 71 72 -9.3454046 -0.3311189 6.7143107 -2.3856893 9.0285964 16.0714535 73 74 75 76 77 78 1.3058941 -5.3369630 1.7630370 -10.7083916 -2.9512488 11.5058941 79 80 81 82 83 84 -17.0512488 8.4630370 10.7084665 -3.5915335 13.8227522 -12.3343906 > postscript(file="/var/www/html/rcomp/tmp/6wq3p1227445622.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 = 84 Frequency = 1 lag(myerror, k = 1) myerror 0 8.9589660 NA 1 4.7161089 8.9589660 2 5.5161089 4.7161089 3 -5.0553197 5.5161089 4 7.5018232 -5.0553197 5 -5.9410340 7.5018232 6 12.0018232 -5.9410340 7 10.2161089 12.0018232 8 -13.8384615 10.2161089 9 -4.2384615 -13.8384615 10 -1.1241758 -4.2384615 11 -14.5813187 -1.1241758 12 -2.4468781 -14.5813187 13 2.3102647 -2.4468781 14 -10.8897353 2.3102647 15 6.9388362 -10.8897353 16 -8.7040210 6.9388362 17 -8.7468781 -8.7040210 18 11.0959790 -8.7468781 19 6.3102647 11.0959790 20 -9.9623127 6.3102647 21 43.3376873 -9.9623127 22 -0.3480270 43.3376873 23 -14.0051698 -0.3480270 24 10.1292707 -14.0051698 25 10.1864136 10.1292707 26 -14.4135864 10.1864136 27 4.7149850 -14.4135864 28 -3.6278721 4.7149850 29 -11.7707293 -3.6278721 30 4.6721279 -11.7707293 31 -13.3135864 4.6721279 32 0.6318432 -13.3135864 33 -8.0681568 0.6318432 34 -10.9538711 -8.0681568 35 -10.3110140 -10.9538711 36 -3.5765734 -10.3110140 37 -0.7194306 -3.5765734 38 23.2805694 -0.7194306 39 9.6091409 23.2805694 40 -3.9337163 9.6091409 41 3.1234266 -3.9337163 42 12.1662837 3.1234266 43 0.5805694 12.1662837 44 9.0259990 0.5805694 45 -15.1740010 9.0259990 46 -5.8597153 -15.1740010 47 33.8831419 -5.8597153 48 -10.6824176 33.8831419 49 -6.2252747 -10.6824176 50 -19.5252747 -6.2252747 51 -11.2967033 -19.5252747 52 5.5604396 -11.2967033 53 1.0175824 5.5604396 54 -13.5395604 1.0175824 55 -11.9252747 -13.5395604 56 -3.2798452 -11.9252747 57 -9.8798452 -3.2798452 58 -4.5655594 -9.8798452 59 1.2772977 -4.5655594 60 -3.6882617 1.2772977 61 -4.9311189 -3.6882617 62 14.2688811 -4.9311189 63 5.7974525 14.2688811 64 6.1545954 5.7974525 65 10.8117383 6.1545954 66 -9.3454046 10.8117383 67 -0.3311189 -9.3454046 68 6.7143107 -0.3311189 69 -2.3856893 6.7143107 70 9.0285964 -2.3856893 71 16.0714535 9.0285964 72 1.3058941 16.0714535 73 -5.3369630 1.3058941 74 1.7630370 -5.3369630 75 -10.7083916 1.7630370 76 -2.9512488 -10.7083916 77 11.5058941 -2.9512488 78 -17.0512488 11.5058941 79 8.4630370 -17.0512488 80 10.7084665 8.4630370 81 -3.5915335 10.7084665 82 13.8227522 -3.5915335 83 -12.3343906 13.8227522 84 NA -12.3343906 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 4.7161089 8.9589660 [2,] 5.5161089 4.7161089 [3,] -5.0553197 5.5161089 [4,] 7.5018232 -5.0553197 [5,] -5.9410340 7.5018232 [6,] 12.0018232 -5.9410340 [7,] 10.2161089 12.0018232 [8,] -13.8384615 10.2161089 [9,] -4.2384615 -13.8384615 [10,] -1.1241758 -4.2384615 [11,] -14.5813187 -1.1241758 [12,] -2.4468781 -14.5813187 [13,] 2.3102647 -2.4468781 [14,] -10.8897353 2.3102647 [15,] 6.9388362 -10.8897353 [16,] -8.7040210 6.9388362 [17,] -8.7468781 -8.7040210 [18,] 11.0959790 -8.7468781 [19,] 6.3102647 11.0959790 [20,] -9.9623127 6.3102647 [21,] 43.3376873 -9.9623127 [22,] -0.3480270 43.3376873 [23,] -14.0051698 -0.3480270 [24,] 10.1292707 -14.0051698 [25,] 10.1864136 10.1292707 [26,] -14.4135864 10.1864136 [27,] 4.7149850 -14.4135864 [28,] -3.6278721 4.7149850 [29,] -11.7707293 -3.6278721 [30,] 4.6721279 -11.7707293 [31,] -13.3135864 4.6721279 [32,] 0.6318432 -13.3135864 [33,] -8.0681568 0.6318432 [34,] -10.9538711 -8.0681568 [35,] -10.3110140 -10.9538711 [36,] -3.5765734 -10.3110140 [37,] -0.7194306 -3.5765734 [38,] 23.2805694 -0.7194306 [39,] 9.6091409 23.2805694 [40,] -3.9337163 9.6091409 [41,] 3.1234266 -3.9337163 [42,] 12.1662837 3.1234266 [43,] 0.5805694 12.1662837 [44,] 9.0259990 0.5805694 [45,] -15.1740010 9.0259990 [46,] -5.8597153 -15.1740010 [47,] 33.8831419 -5.8597153 [48,] -10.6824176 33.8831419 [49,] -6.2252747 -10.6824176 [50,] -19.5252747 -6.2252747 [51,] -11.2967033 -19.5252747 [52,] 5.5604396 -11.2967033 [53,] 1.0175824 5.5604396 [54,] -13.5395604 1.0175824 [55,] -11.9252747 -13.5395604 [56,] -3.2798452 -11.9252747 [57,] -9.8798452 -3.2798452 [58,] -4.5655594 -9.8798452 [59,] 1.2772977 -4.5655594 [60,] -3.6882617 1.2772977 [61,] -4.9311189 -3.6882617 [62,] 14.2688811 -4.9311189 [63,] 5.7974525 14.2688811 [64,] 6.1545954 5.7974525 [65,] 10.8117383 6.1545954 [66,] -9.3454046 10.8117383 [67,] -0.3311189 -9.3454046 [68,] 6.7143107 -0.3311189 [69,] -2.3856893 6.7143107 [70,] 9.0285964 -2.3856893 [71,] 16.0714535 9.0285964 [72,] 1.3058941 16.0714535 [73,] -5.3369630 1.3058941 [74,] 1.7630370 -5.3369630 [75,] -10.7083916 1.7630370 [76,] -2.9512488 -10.7083916 [77,] 11.5058941 -2.9512488 [78,] -17.0512488 11.5058941 [79,] 8.4630370 -17.0512488 [80,] 10.7084665 8.4630370 [81,] -3.5915335 10.7084665 [82,] 13.8227522 -3.5915335 [83,] -12.3343906 13.8227522 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 4.7161089 8.9589660 2 5.5161089 4.7161089 3 -5.0553197 5.5161089 4 7.5018232 -5.0553197 5 -5.9410340 7.5018232 6 12.0018232 -5.9410340 7 10.2161089 12.0018232 8 -13.8384615 10.2161089 9 -4.2384615 -13.8384615 10 -1.1241758 -4.2384615 11 -14.5813187 -1.1241758 12 -2.4468781 -14.5813187 13 2.3102647 -2.4468781 14 -10.8897353 2.3102647 15 6.9388362 -10.8897353 16 -8.7040210 6.9388362 17 -8.7468781 -8.7040210 18 11.0959790 -8.7468781 19 6.3102647 11.0959790 20 -9.9623127 6.3102647 21 43.3376873 -9.9623127 22 -0.3480270 43.3376873 23 -14.0051698 -0.3480270 24 10.1292707 -14.0051698 25 10.1864136 10.1292707 26 -14.4135864 10.1864136 27 4.7149850 -14.4135864 28 -3.6278721 4.7149850 29 -11.7707293 -3.6278721 30 4.6721279 -11.7707293 31 -13.3135864 4.6721279 32 0.6318432 -13.3135864 33 -8.0681568 0.6318432 34 -10.9538711 -8.0681568 35 -10.3110140 -10.9538711 36 -3.5765734 -10.3110140 37 -0.7194306 -3.5765734 38 23.2805694 -0.7194306 39 9.6091409 23.2805694 40 -3.9337163 9.6091409 41 3.1234266 -3.9337163 42 12.1662837 3.1234266 43 0.5805694 12.1662837 44 9.0259990 0.5805694 45 -15.1740010 9.0259990 46 -5.8597153 -15.1740010 47 33.8831419 -5.8597153 48 -10.6824176 33.8831419 49 -6.2252747 -10.6824176 50 -19.5252747 -6.2252747 51 -11.2967033 -19.5252747 52 5.5604396 -11.2967033 53 1.0175824 5.5604396 54 -13.5395604 1.0175824 55 -11.9252747 -13.5395604 56 -3.2798452 -11.9252747 57 -9.8798452 -3.2798452 58 -4.5655594 -9.8798452 59 1.2772977 -4.5655594 60 -3.6882617 1.2772977 61 -4.9311189 -3.6882617 62 14.2688811 -4.9311189 63 5.7974525 14.2688811 64 6.1545954 5.7974525 65 10.8117383 6.1545954 66 -9.3454046 10.8117383 67 -0.3311189 -9.3454046 68 6.7143107 -0.3311189 69 -2.3856893 6.7143107 70 9.0285964 -2.3856893 71 16.0714535 9.0285964 72 1.3058941 16.0714535 73 -5.3369630 1.3058941 74 1.7630370 -5.3369630 75 -10.7083916 1.7630370 76 -2.9512488 -10.7083916 77 11.5058941 -2.9512488 78 -17.0512488 11.5058941 79 8.4630370 -17.0512488 80 10.7084665 8.4630370 81 -3.5915335 10.7084665 82 13.8227522 -3.5915335 83 -12.3343906 13.8227522 > 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/7znk01227445622.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/8r6p31227445622.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/9hgi01227445622.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/10j84z1227445622.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/11la911227445622.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/12g7cc1227445622.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/13bw751227445622.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/14frxp1227445622.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/153o7c1227445623.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/16lvm41227445623.tab") + } > > system("convert tmp/110ys1227445621.ps tmp/110ys1227445621.png") > system("convert tmp/20l0u1227445622.ps tmp/20l0u1227445622.png") > system("convert tmp/319eb1227445622.ps tmp/319eb1227445622.png") > system("convert tmp/4epfy1227445622.ps tmp/4epfy1227445622.png") > system("convert tmp/5wskl1227445622.ps tmp/5wskl1227445622.png") > system("convert tmp/6wq3p1227445622.ps tmp/6wq3p1227445622.png") > system("convert tmp/7znk01227445622.ps tmp/7znk01227445622.png") > system("convert tmp/8r6p31227445622.ps tmp/8r6p31227445622.png") > system("convert tmp/9hgi01227445622.ps tmp/9hgi01227445622.png") > system("convert tmp/10j84z1227445622.ps tmp/10j84z1227445622.png") > > > proc.time() user system elapsed 5.549 2.800 5.939