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(95.2,0,95.00,0,94.00,0,92.2,0,91.00,0,91.2,0,103.4,1,105.00,0,104.6,0,103.8,0,101.8,0,102.4,0,103.8,0,103.4,0,102.00,0,101.8,0,100.2,0,101.4,0,113.8,0,116.00,0,115.6,0,113.00,0,109.4,0,111.00,0,112.4,0,112.2,0,111.00,0,108.8,0,107.4,0,108.6,0,118.8,0,122.2,1,122.6,0,122.2,0,118.8,0,119.00,0,118.2,0,117.8,0,116.8,0,114.6,0,113.4,0,113.8,0,124.2,0,125.8,0,125.6,0,122.4,0,119.00,0,119.4,0,118.6,0,118.00,0,116.00,0,114.8,0,114.6,0,114.6,0,124.00,0,125.2,0,124.00,0,117.6,1,113.2,0,111.4,0,112.2,0,109.8,0,106.4,0,105.2,0,102.2,0,99.8,0,111.00,0,113.00,0,108.4,0,105.4,0,102.00,0,102.8,0),dim=c(2,72),dimnames=list(c('Werkloosheid','Dumivariabele'),1:72)) > y <- array(NA,dim=c(2,72),dimnames=list(c('Werkloosheid','Dumivariabele'),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 = 'No 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 Werkloosheid Dumivariabele M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 95.2 0 1 0 0 0 0 0 0 0 0 0 0 2 95.0 0 0 1 0 0 0 0 0 0 0 0 0 3 94.0 0 0 0 1 0 0 0 0 0 0 0 0 4 92.2 0 0 0 0 1 0 0 0 0 0 0 0 5 91.0 0 0 0 0 0 1 0 0 0 0 0 0 6 91.2 0 0 0 0 0 0 1 0 0 0 0 0 7 103.4 1 0 0 0 0 0 0 1 0 0 0 0 8 105.0 0 0 0 0 0 0 0 0 1 0 0 0 9 104.6 0 0 0 0 0 0 0 0 0 1 0 0 10 103.8 0 0 0 0 0 0 0 0 0 0 1 0 11 101.8 0 0 0 0 0 0 0 0 0 0 0 1 12 102.4 0 0 0 0 0 0 0 0 0 0 0 0 13 103.8 0 1 0 0 0 0 0 0 0 0 0 0 14 103.4 0 0 1 0 0 0 0 0 0 0 0 0 15 102.0 0 0 0 1 0 0 0 0 0 0 0 0 16 101.8 0 0 0 0 1 0 0 0 0 0 0 0 17 100.2 0 0 0 0 0 1 0 0 0 0 0 0 18 101.4 0 0 0 0 0 0 1 0 0 0 0 0 19 113.8 0 0 0 0 0 0 0 1 0 0 0 0 20 116.0 0 0 0 0 0 0 0 0 1 0 0 0 21 115.6 0 0 0 0 0 0 0 0 0 1 0 0 22 113.0 0 0 0 0 0 0 0 0 0 0 1 0 23 109.4 0 0 0 0 0 0 0 0 0 0 0 1 24 111.0 0 0 0 0 0 0 0 0 0 0 0 0 25 112.4 0 1 0 0 0 0 0 0 0 0 0 0 26 112.2 0 0 1 0 0 0 0 0 0 0 0 0 27 111.0 0 0 0 1 0 0 0 0 0 0 0 0 28 108.8 0 0 0 0 1 0 0 0 0 0 0 0 29 107.4 0 0 0 0 0 1 0 0 0 0 0 0 30 108.6 0 0 0 0 0 0 1 0 0 0 0 0 31 118.8 0 0 0 0 0 0 0 1 0 0 0 0 32 122.2 1 0 0 0 0 0 0 0 1 0 0 0 33 122.6 0 0 0 0 0 0 0 0 0 1 0 0 34 122.2 0 0 0 0 0 0 0 0 0 0 1 0 35 118.8 0 0 0 0 0 0 0 0 0 0 0 1 36 119.0 0 0 0 0 0 0 0 0 0 0 0 0 37 118.2 0 1 0 0 0 0 0 0 0 0 0 0 38 117.8 0 0 1 0 0 0 0 0 0 0 0 0 39 116.8 0 0 0 1 0 0 0 0 0 0 0 0 40 114.6 0 0 0 0 1 0 0 0 0 0 0 0 41 113.4 0 0 0 0 0 1 0 0 0 0 0 0 42 113.8 0 0 0 0 0 0 1 0 0 0 0 0 43 124.2 0 0 0 0 0 0 0 1 0 0 0 0 44 125.8 0 0 0 0 0 0 0 0 1 0 0 0 45 125.6 0 0 0 0 0 0 0 0 0 1 0 0 46 122.4 0 0 0 0 0 0 0 0 0 0 1 0 47 119.0 0 0 0 0 0 0 0 0 0 0 0 1 48 119.4 0 0 0 0 0 0 0 0 0 0 0 0 49 118.6 0 1 0 0 0 0 0 0 0 0 0 0 50 118.0 0 0 1 0 0 0 0 0 0 0 0 0 51 116.0 0 0 0 1 0 0 0 0 0 0 0 0 52 114.8 0 0 0 0 1 0 0 0 0 0 0 0 53 114.6 0 0 0 0 0 1 0 0 0 0 0 0 54 114.6 0 0 0 0 0 0 1 0 0 0 0 0 55 124.0 0 0 0 0 0 0 0 1 0 0 0 0 56 125.2 0 0 0 0 0 0 0 0 1 0 0 0 57 124.0 0 0 0 0 0 0 0 0 0 1 0 0 58 117.6 1 0 0 0 0 0 0 0 0 0 1 0 59 113.2 0 0 0 0 0 0 0 0 0 0 0 1 60 111.4 0 0 0 0 0 0 0 0 0 0 0 0 61 112.2 0 1 0 0 0 0 0 0 0 0 0 0 62 109.8 0 0 1 0 0 0 0 0 0 0 0 0 63 106.4 0 0 0 1 0 0 0 0 0 0 0 0 64 105.2 0 0 0 0 1 0 0 0 0 0 0 0 65 102.2 0 0 0 0 0 1 0 0 0 0 0 0 66 99.8 0 0 0 0 0 0 1 0 0 0 0 0 67 111.0 0 0 0 0 0 0 0 1 0 0 0 0 68 113.0 0 0 0 0 0 0 0 0 1 0 0 0 69 108.4 0 0 0 0 0 0 0 0 0 1 0 0 70 105.4 0 0 0 0 0 0 0 0 0 0 1 0 71 102.0 0 0 0 0 0 0 0 0 0 0 0 1 72 102.8 0 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Dumivariabele M1 M2 M3 111.0000 -1.8400 -0.9333 -1.6333 -3.3000 M4 M5 M6 M7 M8 -4.7667 -6.2000 -6.1000 5.1733 7.1733 M9 M10 M11 5.8000 3.3733 -0.3000 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -14.867 -5.767 1.283 8.007 9.800 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 111.0000 3.4850 31.851 <2e-16 *** Dumivariabele -1.8400 5.3989 -0.341 0.734 M1 -0.9333 4.9285 -0.189 0.850 M2 -1.6333 4.9285 -0.331 0.742 M3 -3.3000 4.9285 -0.670 0.506 M4 -4.7667 4.9285 -0.967 0.337 M5 -6.2000 4.9285 -1.258 0.213 M6 -6.1000 4.9285 -1.238 0.221 M7 5.1733 5.0100 1.033 0.306 M8 7.1733 5.0100 1.432 0.157 M9 5.8000 4.9285 1.177 0.244 M10 3.3733 5.0100 0.673 0.503 M11 -0.3000 4.9285 -0.061 0.952 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 8.536 on 59 degrees of freedom Multiple R-squared: 0.2411, Adjusted R-squared: 0.0867 F-statistic: 1.562 on 12 and 59 DF, p-value: 0.1285 > 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.7178033 0.5643935 0.2821967 [2,] 0.7093843 0.5812315 0.2906157 [3,] 0.7240073 0.5519855 0.2759927 [4,] 0.6145472 0.7709056 0.3854528 [5,] 0.6476626 0.7046748 0.3523374 [6,] 0.6691782 0.6616437 0.3308218 [7,] 0.6500136 0.6999727 0.3499864 [8,] 0.6074501 0.7850999 0.3925499 [9,] 0.5742790 0.8514420 0.4257210 [10,] 0.6544690 0.6910619 0.3455310 [11,] 0.7095736 0.5808529 0.2904264 [12,] 0.7453054 0.5093893 0.2546946 [13,] 0.7546280 0.4907441 0.2453720 [14,] 0.7583053 0.4833894 0.2416947 [15,] 0.7601628 0.4796744 0.2398372 [16,] 0.6975393 0.6049214 0.3024607 [17,] 0.7566126 0.4867749 0.2433874 [18,] 0.7505259 0.4989483 0.2494741 [19,] 0.7722726 0.4554548 0.2277274 [20,] 0.7820603 0.4358795 0.2179397 [21,] 0.7852231 0.4295539 0.2147769 [22,] 0.7839512 0.4320975 0.2160488 [23,] 0.7791996 0.4416008 0.2208004 [24,] 0.7771440 0.4457119 0.2228560 [25,] 0.7617278 0.4765445 0.2382722 [26,] 0.7447890 0.5104220 0.2552110 [27,] 0.7285593 0.5428815 0.2714407 [28,] 0.6999793 0.6000415 0.3000207 [29,] 0.6610294 0.6779413 0.3389706 [30,] 0.6451024 0.7097952 0.3548976 [31,] 0.6882082 0.6235837 0.3117918 [32,] 0.6878638 0.6242724 0.3121362 [33,] 0.7015079 0.5969842 0.2984921 [34,] 0.6484538 0.7030925 0.3515462 [35,] 0.6002765 0.7994469 0.3997235 [36,] 0.5563827 0.8872347 0.4436173 [37,] 0.5081063 0.9837874 0.4918937 [38,] 0.4949412 0.9898824 0.5050588 [39,] 0.5223270 0.9553461 0.4776730 [40,] 0.5099827 0.9800345 0.4900173 [41,] 0.4760300 0.9520600 0.5239700 > postscript(file="/var/www/html/freestat/rcomp/tmp/1ml951228490610.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/freestat/rcomp/tmp/2paga1228490610.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/freestat/rcomp/tmp/3vwip1228490610.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/freestat/rcomp/tmp/4m0ql1228490610.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/freestat/rcomp/tmp/5uhi61228490610.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 -1.486667e+01 -1.436667e+01 -1.370000e+01 -1.403333e+01 -1.380000e+01 6 7 8 9 10 -1.370000e+01 -1.093333e+01 -1.317333e+01 -1.220000e+01 -1.057333e+01 11 12 13 14 15 -8.900000e+00 -8.600000e+00 -6.266667e+00 -5.966667e+00 -5.700000e+00 16 17 18 19 20 -4.433333e+00 -4.600000e+00 -3.500000e+00 -2.373333e+00 -2.173333e+00 21 22 23 24 25 -1.200000e+00 -1.373333e+00 -1.300000e+00 -8.401374e-15 2.333333e+00 26 27 28 29 30 2.833333e+00 3.300000e+00 2.566667e+00 2.600000e+00 3.700000e+00 31 32 33 34 35 2.626667e+00 5.866667e+00 5.800000e+00 7.826667e+00 8.100000e+00 36 37 38 39 40 8.000000e+00 8.133333e+00 8.433333e+00 9.100000e+00 8.366667e+00 41 42 43 44 45 8.600000e+00 8.900000e+00 8.026667e+00 7.626667e+00 8.800000e+00 46 47 48 49 50 8.026667e+00 8.300000e+00 8.400000e+00 8.533333e+00 8.633333e+00 51 52 53 54 55 8.300000e+00 8.566667e+00 9.800000e+00 9.700000e+00 7.826667e+00 56 57 58 59 60 7.026667e+00 7.200000e+00 5.066667e+00 2.500000e+00 4.000000e-01 61 62 63 64 65 2.133333e+00 4.333333e-01 -1.300000e+00 -1.033333e+00 -2.600000e+00 66 67 68 69 70 -5.100000e+00 -5.173333e+00 -5.173333e+00 -8.400000e+00 -8.973333e+00 71 72 -8.700000e+00 -8.200000e+00 > postscript(file="/var/www/html/freestat/rcomp/tmp/6y8nw1228490610.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 -1.486667e+01 NA 1 -1.436667e+01 -1.486667e+01 2 -1.370000e+01 -1.436667e+01 3 -1.403333e+01 -1.370000e+01 4 -1.380000e+01 -1.403333e+01 5 -1.370000e+01 -1.380000e+01 6 -1.093333e+01 -1.370000e+01 7 -1.317333e+01 -1.093333e+01 8 -1.220000e+01 -1.317333e+01 9 -1.057333e+01 -1.220000e+01 10 -8.900000e+00 -1.057333e+01 11 -8.600000e+00 -8.900000e+00 12 -6.266667e+00 -8.600000e+00 13 -5.966667e+00 -6.266667e+00 14 -5.700000e+00 -5.966667e+00 15 -4.433333e+00 -5.700000e+00 16 -4.600000e+00 -4.433333e+00 17 -3.500000e+00 -4.600000e+00 18 -2.373333e+00 -3.500000e+00 19 -2.173333e+00 -2.373333e+00 20 -1.200000e+00 -2.173333e+00 21 -1.373333e+00 -1.200000e+00 22 -1.300000e+00 -1.373333e+00 23 -8.401374e-15 -1.300000e+00 24 2.333333e+00 -8.401374e-15 25 2.833333e+00 2.333333e+00 26 3.300000e+00 2.833333e+00 27 2.566667e+00 3.300000e+00 28 2.600000e+00 2.566667e+00 29 3.700000e+00 2.600000e+00 30 2.626667e+00 3.700000e+00 31 5.866667e+00 2.626667e+00 32 5.800000e+00 5.866667e+00 33 7.826667e+00 5.800000e+00 34 8.100000e+00 7.826667e+00 35 8.000000e+00 8.100000e+00 36 8.133333e+00 8.000000e+00 37 8.433333e+00 8.133333e+00 38 9.100000e+00 8.433333e+00 39 8.366667e+00 9.100000e+00 40 8.600000e+00 8.366667e+00 41 8.900000e+00 8.600000e+00 42 8.026667e+00 8.900000e+00 43 7.626667e+00 8.026667e+00 44 8.800000e+00 7.626667e+00 45 8.026667e+00 8.800000e+00 46 8.300000e+00 8.026667e+00 47 8.400000e+00 8.300000e+00 48 8.533333e+00 8.400000e+00 49 8.633333e+00 8.533333e+00 50 8.300000e+00 8.633333e+00 51 8.566667e+00 8.300000e+00 52 9.800000e+00 8.566667e+00 53 9.700000e+00 9.800000e+00 54 7.826667e+00 9.700000e+00 55 7.026667e+00 7.826667e+00 56 7.200000e+00 7.026667e+00 57 5.066667e+00 7.200000e+00 58 2.500000e+00 5.066667e+00 59 4.000000e-01 2.500000e+00 60 2.133333e+00 4.000000e-01 61 4.333333e-01 2.133333e+00 62 -1.300000e+00 4.333333e-01 63 -1.033333e+00 -1.300000e+00 64 -2.600000e+00 -1.033333e+00 65 -5.100000e+00 -2.600000e+00 66 -5.173333e+00 -5.100000e+00 67 -5.173333e+00 -5.173333e+00 68 -8.400000e+00 -5.173333e+00 69 -8.973333e+00 -8.400000e+00 70 -8.700000e+00 -8.973333e+00 71 -8.200000e+00 -8.700000e+00 72 NA -8.200000e+00 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.436667e+01 -1.486667e+01 [2,] -1.370000e+01 -1.436667e+01 [3,] -1.403333e+01 -1.370000e+01 [4,] -1.380000e+01 -1.403333e+01 [5,] -1.370000e+01 -1.380000e+01 [6,] -1.093333e+01 -1.370000e+01 [7,] -1.317333e+01 -1.093333e+01 [8,] -1.220000e+01 -1.317333e+01 [9,] -1.057333e+01 -1.220000e+01 [10,] -8.900000e+00 -1.057333e+01 [11,] -8.600000e+00 -8.900000e+00 [12,] -6.266667e+00 -8.600000e+00 [13,] -5.966667e+00 -6.266667e+00 [14,] -5.700000e+00 -5.966667e+00 [15,] -4.433333e+00 -5.700000e+00 [16,] -4.600000e+00 -4.433333e+00 [17,] -3.500000e+00 -4.600000e+00 [18,] -2.373333e+00 -3.500000e+00 [19,] -2.173333e+00 -2.373333e+00 [20,] -1.200000e+00 -2.173333e+00 [21,] -1.373333e+00 -1.200000e+00 [22,] -1.300000e+00 -1.373333e+00 [23,] -8.401374e-15 -1.300000e+00 [24,] 2.333333e+00 -8.401374e-15 [25,] 2.833333e+00 2.333333e+00 [26,] 3.300000e+00 2.833333e+00 [27,] 2.566667e+00 3.300000e+00 [28,] 2.600000e+00 2.566667e+00 [29,] 3.700000e+00 2.600000e+00 [30,] 2.626667e+00 3.700000e+00 [31,] 5.866667e+00 2.626667e+00 [32,] 5.800000e+00 5.866667e+00 [33,] 7.826667e+00 5.800000e+00 [34,] 8.100000e+00 7.826667e+00 [35,] 8.000000e+00 8.100000e+00 [36,] 8.133333e+00 8.000000e+00 [37,] 8.433333e+00 8.133333e+00 [38,] 9.100000e+00 8.433333e+00 [39,] 8.366667e+00 9.100000e+00 [40,] 8.600000e+00 8.366667e+00 [41,] 8.900000e+00 8.600000e+00 [42,] 8.026667e+00 8.900000e+00 [43,] 7.626667e+00 8.026667e+00 [44,] 8.800000e+00 7.626667e+00 [45,] 8.026667e+00 8.800000e+00 [46,] 8.300000e+00 8.026667e+00 [47,] 8.400000e+00 8.300000e+00 [48,] 8.533333e+00 8.400000e+00 [49,] 8.633333e+00 8.533333e+00 [50,] 8.300000e+00 8.633333e+00 [51,] 8.566667e+00 8.300000e+00 [52,] 9.800000e+00 8.566667e+00 [53,] 9.700000e+00 9.800000e+00 [54,] 7.826667e+00 9.700000e+00 [55,] 7.026667e+00 7.826667e+00 [56,] 7.200000e+00 7.026667e+00 [57,] 5.066667e+00 7.200000e+00 [58,] 2.500000e+00 5.066667e+00 [59,] 4.000000e-01 2.500000e+00 [60,] 2.133333e+00 4.000000e-01 [61,] 4.333333e-01 2.133333e+00 [62,] -1.300000e+00 4.333333e-01 [63,] -1.033333e+00 -1.300000e+00 [64,] -2.600000e+00 -1.033333e+00 [65,] -5.100000e+00 -2.600000e+00 [66,] -5.173333e+00 -5.100000e+00 [67,] -5.173333e+00 -5.173333e+00 [68,] -8.400000e+00 -5.173333e+00 [69,] -8.973333e+00 -8.400000e+00 [70,] -8.700000e+00 -8.973333e+00 [71,] -8.200000e+00 -8.700000e+00 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.436667e+01 -1.486667e+01 2 -1.370000e+01 -1.436667e+01 3 -1.403333e+01 -1.370000e+01 4 -1.380000e+01 -1.403333e+01 5 -1.370000e+01 -1.380000e+01 6 -1.093333e+01 -1.370000e+01 7 -1.317333e+01 -1.093333e+01 8 -1.220000e+01 -1.317333e+01 9 -1.057333e+01 -1.220000e+01 10 -8.900000e+00 -1.057333e+01 11 -8.600000e+00 -8.900000e+00 12 -6.266667e+00 -8.600000e+00 13 -5.966667e+00 -6.266667e+00 14 -5.700000e+00 -5.966667e+00 15 -4.433333e+00 -5.700000e+00 16 -4.600000e+00 -4.433333e+00 17 -3.500000e+00 -4.600000e+00 18 -2.373333e+00 -3.500000e+00 19 -2.173333e+00 -2.373333e+00 20 -1.200000e+00 -2.173333e+00 21 -1.373333e+00 -1.200000e+00 22 -1.300000e+00 -1.373333e+00 23 -8.401374e-15 -1.300000e+00 24 2.333333e+00 -8.401374e-15 25 2.833333e+00 2.333333e+00 26 3.300000e+00 2.833333e+00 27 2.566667e+00 3.300000e+00 28 2.600000e+00 2.566667e+00 29 3.700000e+00 2.600000e+00 30 2.626667e+00 3.700000e+00 31 5.866667e+00 2.626667e+00 32 5.800000e+00 5.866667e+00 33 7.826667e+00 5.800000e+00 34 8.100000e+00 7.826667e+00 35 8.000000e+00 8.100000e+00 36 8.133333e+00 8.000000e+00 37 8.433333e+00 8.133333e+00 38 9.100000e+00 8.433333e+00 39 8.366667e+00 9.100000e+00 40 8.600000e+00 8.366667e+00 41 8.900000e+00 8.600000e+00 42 8.026667e+00 8.900000e+00 43 7.626667e+00 8.026667e+00 44 8.800000e+00 7.626667e+00 45 8.026667e+00 8.800000e+00 46 8.300000e+00 8.026667e+00 47 8.400000e+00 8.300000e+00 48 8.533333e+00 8.400000e+00 49 8.633333e+00 8.533333e+00 50 8.300000e+00 8.633333e+00 51 8.566667e+00 8.300000e+00 52 9.800000e+00 8.566667e+00 53 9.700000e+00 9.800000e+00 54 7.826667e+00 9.700000e+00 55 7.026667e+00 7.826667e+00 56 7.200000e+00 7.026667e+00 57 5.066667e+00 7.200000e+00 58 2.500000e+00 5.066667e+00 59 4.000000e-01 2.500000e+00 60 2.133333e+00 4.000000e-01 61 4.333333e-01 2.133333e+00 62 -1.300000e+00 4.333333e-01 63 -1.033333e+00 -1.300000e+00 64 -2.600000e+00 -1.033333e+00 65 -5.100000e+00 -2.600000e+00 66 -5.173333e+00 -5.100000e+00 67 -5.173333e+00 -5.173333e+00 68 -8.400000e+00 -5.173333e+00 69 -8.973333e+00 -8.400000e+00 70 -8.700000e+00 -8.973333e+00 71 -8.200000e+00 -8.700000e+00 > 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/freestat/rcomp/tmp/7tlkh1228490611.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/freestat/rcomp/tmp/8fhks1228490611.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/freestat/rcomp/tmp/9jdvw1228490611.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/freestat/rcomp/tmp/107ii81228490611.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/1145jb1228490611.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/freestat/rcomp/tmp/12z7kq1228490611.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/freestat/rcomp/tmp/13ixeb1228490611.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/freestat/rcomp/tmp/14bdpt1228490611.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/freestat/rcomp/tmp/152hp41228490611.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/freestat/rcomp/tmp/16s9n61228490611.tab") + } > > system("convert tmp/1ml951228490610.ps tmp/1ml951228490610.png") > system("convert tmp/2paga1228490610.ps tmp/2paga1228490610.png") > system("convert tmp/3vwip1228490610.ps tmp/3vwip1228490610.png") > system("convert tmp/4m0ql1228490610.ps tmp/4m0ql1228490610.png") > system("convert tmp/5uhi61228490610.ps tmp/5uhi61228490610.png") > system("convert tmp/6y8nw1228490610.ps tmp/6y8nw1228490610.png") > system("convert tmp/7tlkh1228490611.ps tmp/7tlkh1228490611.png") > system("convert tmp/8fhks1228490611.ps tmp/8fhks1228490611.png") > system("convert tmp/9jdvw1228490611.ps tmp/9jdvw1228490611.png") > system("convert tmp/107ii81228490611.ps tmp/107ii81228490611.png") > > > proc.time() user system elapsed 3.864 2.553 4.439