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(300,2.26,302,2.57,400,3.07,392,2.76,373,2.51,379,2.87,303,3.14,324,3.11,353,3.16,392,2.47,327,2.57,376,2.89,329,2.63,359,2.38,413,1.69,338,1.96,422,2.19,390,1.87,370,1.60,367,1.63,406,1.22,418,1.21,346,1.49,350,1.64,330,1.66,318,1.77,382,1.82,337,1.78,372,1.28,422,1.29,428,1.37,426,1.12,396,1.51,458,2.24,315,2.94,337,3.09,386,3.46,352,3.64,383,4.39,439,4.15,397,5.21,453,5.80,363,5.91,365,5.39,474,5.46,373,4.72,403,3.14,384,2.63,364,2.32,361,1.93,419,0.62,352,0.60,363,-0.37,410,-1.10,361,-1.68,383,-0.78,342,-1.19,369,-0.79,361,-0.12,317,0.26,386,0.62,318,0.70,407,1.66,393,1.80,404,2.27,498,2.46,438,2.57),dim=c(2,67),dimnames=list(c('Aantal_vergunningen','Inflatie'),1:67)) > y <- array(NA,dim=c(2,67),dimnames=list(c('Aantal_vergunningen','Inflatie'),1:67)) > 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 Aantal_vergunningen Inflatie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 300 2.26 1 0 0 0 0 0 0 0 0 0 0 2 302 2.57 0 1 0 0 0 0 0 0 0 0 0 3 400 3.07 0 0 1 0 0 0 0 0 0 0 0 4 392 2.76 0 0 0 1 0 0 0 0 0 0 0 5 373 2.51 0 0 0 0 1 0 0 0 0 0 0 6 379 2.87 0 0 0 0 0 1 0 0 0 0 0 7 303 3.14 0 0 0 0 0 0 1 0 0 0 0 8 324 3.11 0 0 0 0 0 0 0 1 0 0 0 9 353 3.16 0 0 0 0 0 0 0 0 1 0 0 10 392 2.47 0 0 0 0 0 0 0 0 0 1 0 11 327 2.57 0 0 0 0 0 0 0 0 0 0 1 12 376 2.89 0 0 0 0 0 0 0 0 0 0 0 13 329 2.63 1 0 0 0 0 0 0 0 0 0 0 14 359 2.38 0 1 0 0 0 0 0 0 0 0 0 15 413 1.69 0 0 1 0 0 0 0 0 0 0 0 16 338 1.96 0 0 0 1 0 0 0 0 0 0 0 17 422 2.19 0 0 0 0 1 0 0 0 0 0 0 18 390 1.87 0 0 0 0 0 1 0 0 0 0 0 19 370 1.60 0 0 0 0 0 0 1 0 0 0 0 20 367 1.63 0 0 0 0 0 0 0 1 0 0 0 21 406 1.22 0 0 0 0 0 0 0 0 1 0 0 22 418 1.21 0 0 0 0 0 0 0 0 0 1 0 23 346 1.49 0 0 0 0 0 0 0 0 0 0 1 24 350 1.64 0 0 0 0 0 0 0 0 0 0 0 25 330 1.66 1 0 0 0 0 0 0 0 0 0 0 26 318 1.77 0 1 0 0 0 0 0 0 0 0 0 27 382 1.82 0 0 1 0 0 0 0 0 0 0 0 28 337 1.78 0 0 0 1 0 0 0 0 0 0 0 29 372 1.28 0 0 0 0 1 0 0 0 0 0 0 30 422 1.29 0 0 0 0 0 1 0 0 0 0 0 31 428 1.37 0 0 0 0 0 0 1 0 0 0 0 32 426 1.12 0 0 0 0 0 0 0 1 0 0 0 33 396 1.51 0 0 0 0 0 0 0 0 1 0 0 34 458 2.24 0 0 0 0 0 0 0 0 0 1 0 35 315 2.94 0 0 0 0 0 0 0 0 0 0 1 36 337 3.09 0 0 0 0 0 0 0 0 0 0 0 37 386 3.46 1 0 0 0 0 0 0 0 0 0 0 38 352 3.64 0 1 0 0 0 0 0 0 0 0 0 39 383 4.39 0 0 1 0 0 0 0 0 0 0 0 40 439 4.15 0 0 0 1 0 0 0 0 0 0 0 41 397 5.21 0 0 0 0 1 0 0 0 0 0 0 42 453 5.80 0 0 0 0 0 1 0 0 0 0 0 43 363 5.91 0 0 0 0 0 0 1 0 0 0 0 44 365 5.39 0 0 0 0 0 0 0 1 0 0 0 45 474 5.46 0 0 0 0 0 0 0 0 1 0 0 46 373 4.72 0 0 0 0 0 0 0 0 0 1 0 47 403 3.14 0 0 0 0 0 0 0 0 0 0 1 48 384 2.63 0 0 0 0 0 0 0 0 0 0 0 49 364 2.32 1 0 0 0 0 0 0 0 0 0 0 50 361 1.93 0 1 0 0 0 0 0 0 0 0 0 51 419 0.62 0 0 1 0 0 0 0 0 0 0 0 52 352 0.60 0 0 0 1 0 0 0 0 0 0 0 53 363 -0.37 0 0 0 0 1 0 0 0 0 0 0 54 410 -1.10 0 0 0 0 0 1 0 0 0 0 0 55 361 -1.68 0 0 0 0 0 0 1 0 0 0 0 56 383 -0.78 0 0 0 0 0 0 0 1 0 0 0 57 342 -1.19 0 0 0 0 0 0 0 0 1 0 0 58 369 -0.79 0 0 0 0 0 0 0 0 0 1 0 59 361 -0.12 0 0 0 0 0 0 0 0 0 0 1 60 317 0.26 0 0 0 0 0 0 0 0 0 0 0 61 386 0.62 1 0 0 0 0 0 0 0 0 0 0 62 318 0.70 0 1 0 0 0 0 0 0 0 0 0 63 407 1.66 0 0 1 0 0 0 0 0 0 0 0 64 393 1.80 0 0 0 1 0 0 0 0 0 0 0 65 404 2.27 0 0 0 0 1 0 0 0 0 0 0 66 498 2.46 0 0 0 0 0 1 0 0 0 0 0 67 438 2.57 0 0 0 0 0 0 1 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Inflatie M1 M2 M3 M4 344.888 3.764 -3.845 -18.037 47.466 22.092 M5 M6 M7 M8 M9 M10 35.400 72.171 24.180 20.230 41.663 49.697 M11 -2.031 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -77.887 -22.277 -2.899 19.739 71.682 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 344.888 17.130 20.133 < 2e-16 *** Inflatie 3.764 2.747 1.370 0.17622 M1 -3.845 21.838 -0.176 0.86088 M2 -18.037 21.838 -0.826 0.41246 M3 47.466 21.839 2.173 0.03415 * M4 22.092 21.838 1.012 0.31623 M5 35.400 21.838 1.621 0.11084 M6 72.171 21.839 3.305 0.00169 ** M7 24.180 21.838 1.107 0.27309 M8 20.230 22.808 0.887 0.37903 M9 41.663 22.809 1.827 0.07329 . M10 49.697 22.811 2.179 0.03374 * M11 -2.031 22.810 -0.089 0.92937 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 36.06 on 54 degrees of freedom Multiple R-squared: 0.401, Adjusted R-squared: 0.2679 F-statistic: 3.013 on 12 and 54 DF, p-value: 0.002719 > 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.59908612 0.80182776 0.40091388 [2,] 0.59835340 0.80329319 0.40164660 [3,] 0.48769606 0.97539212 0.51230394 [4,] 0.50179435 0.99641129 0.49820565 [5,] 0.39246273 0.78492547 0.60753727 [6,] 0.28693229 0.57386458 0.71306771 [7,] 0.20002660 0.40005320 0.79997340 [8,] 0.13115474 0.26230948 0.86884526 [9,] 0.14016942 0.28033884 0.85983058 [10,] 0.10196619 0.20393238 0.89803381 [11,] 0.07853746 0.15707492 0.92146254 [12,] 0.06814857 0.13629715 0.93185143 [13,] 0.07697076 0.15394151 0.92302924 [14,] 0.07090103 0.14180205 0.92909897 [15,] 0.05481382 0.10962763 0.94518618 [16,] 0.13518330 0.27036659 0.86481670 [17,] 0.18843870 0.37687740 0.81156130 [18,] 0.13411018 0.26822036 0.86588982 [19,] 0.26185715 0.52371430 0.73814285 [20,] 0.30988541 0.61977082 0.69011459 [21,] 0.24933514 0.49867027 0.75066486 [22,] 0.37317267 0.74634535 0.62682733 [23,] 0.33336501 0.66673002 0.66663499 [24,] 0.32113725 0.64227449 0.67886275 [25,] 0.49277124 0.98554247 0.50722876 [26,] 0.40980920 0.81961840 0.59019080 [27,] 0.41181270 0.82362541 0.58818730 [28,] 0.59648401 0.80703198 0.40351599 [29,] 0.82143132 0.35713736 0.17856868 [30,] 0.85570457 0.28859086 0.14429543 [31,] 0.96861490 0.06277021 0.03138510 [32,] 0.95560274 0.08879453 0.04439726 [33,] 0.92978795 0.14042410 0.07021205 [34,] 0.97595562 0.04808876 0.02404438 [35,] 0.95283216 0.09433568 0.04716784 [36,] 0.96217508 0.07564984 0.03782492 > postscript(file="/var/www/html/rcomp/tmp/15l8r1292502832.ps",horizontal=F,onefile=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/25l8r1292502832.ps",horizontal=F,onefile=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/35l8r1292502832.ps",horizontal=F,onefile=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/4gdpc1292502832.ps",horizontal=F,onefile=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/5gdpc1292502832.ps",horizontal=F,onefile=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 = 67 Frequency = 1 1 2 3 4 5 6 -49.54934977 -34.52445892 -3.91006281 14.63133711 -16.73587822 -48.86155122 7 8 9 10 11 12 -77.88684831 -52.82432164 -45.44590040 -11.88204805 -25.53047839 20.23389227 13 14 15 16 17 18 -21.94206533 23.19071934 14.28438981 -36.35738600 33.46863253 -34.09745511 19 20 21 22 23 24 -5.09014032 -4.25345941 14.85644603 18.86071304 -2.46525460 -1.06098760 25 26 27 28 29 30 -17.29089211 -15.51318204 -17.20494268 -36.67984871 -13.10604001 0.08572063 31 32 33 34 35 36 53.77560179 56.66622960 3.76485817 54.98369405 -38.92319395 -19.51892695 37 38 39 40 41 42 31.93373491 11.44795825 -25.87866966 56.39924353 -2.89893770 14.10964721 43 44 45 46 47 48 -28.31339452 -20.40646075 66.89667856 -39.35126428 48.32398683 29.21255726 49 50 51 52 53 54 14.22480446 26.88456258 24.31197264 -17.23821531 -15.89528145 -2.91808969 55 56 57 58 59 60 -1.74390510 20.81801220 -40.07208236 -22.61109476 18.59494012 -28.86653498 61 62 63 64 65 66 42.62376784 -11.48559921 8.39731270 19.24486937 15.16750484 71.68172819 67 59.25868646 > postscript(file="/var/www/html/rcomp/tmp/6gdpc1292502832.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 67 Frequency = 1 lag(myerror, k = 1) myerror 0 -49.54934977 NA 1 -34.52445892 -49.54934977 2 -3.91006281 -34.52445892 3 14.63133711 -3.91006281 4 -16.73587822 14.63133711 5 -48.86155122 -16.73587822 6 -77.88684831 -48.86155122 7 -52.82432164 -77.88684831 8 -45.44590040 -52.82432164 9 -11.88204805 -45.44590040 10 -25.53047839 -11.88204805 11 20.23389227 -25.53047839 12 -21.94206533 20.23389227 13 23.19071934 -21.94206533 14 14.28438981 23.19071934 15 -36.35738600 14.28438981 16 33.46863253 -36.35738600 17 -34.09745511 33.46863253 18 -5.09014032 -34.09745511 19 -4.25345941 -5.09014032 20 14.85644603 -4.25345941 21 18.86071304 14.85644603 22 -2.46525460 18.86071304 23 -1.06098760 -2.46525460 24 -17.29089211 -1.06098760 25 -15.51318204 -17.29089211 26 -17.20494268 -15.51318204 27 -36.67984871 -17.20494268 28 -13.10604001 -36.67984871 29 0.08572063 -13.10604001 30 53.77560179 0.08572063 31 56.66622960 53.77560179 32 3.76485817 56.66622960 33 54.98369405 3.76485817 34 -38.92319395 54.98369405 35 -19.51892695 -38.92319395 36 31.93373491 -19.51892695 37 11.44795825 31.93373491 38 -25.87866966 11.44795825 39 56.39924353 -25.87866966 40 -2.89893770 56.39924353 41 14.10964721 -2.89893770 42 -28.31339452 14.10964721 43 -20.40646075 -28.31339452 44 66.89667856 -20.40646075 45 -39.35126428 66.89667856 46 48.32398683 -39.35126428 47 29.21255726 48.32398683 48 14.22480446 29.21255726 49 26.88456258 14.22480446 50 24.31197264 26.88456258 51 -17.23821531 24.31197264 52 -15.89528145 -17.23821531 53 -2.91808969 -15.89528145 54 -1.74390510 -2.91808969 55 20.81801220 -1.74390510 56 -40.07208236 20.81801220 57 -22.61109476 -40.07208236 58 18.59494012 -22.61109476 59 -28.86653498 18.59494012 60 42.62376784 -28.86653498 61 -11.48559921 42.62376784 62 8.39731270 -11.48559921 63 19.24486937 8.39731270 64 15.16750484 19.24486937 65 71.68172819 15.16750484 66 59.25868646 71.68172819 67 NA 59.25868646 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -34.52445892 -49.54934977 [2,] -3.91006281 -34.52445892 [3,] 14.63133711 -3.91006281 [4,] -16.73587822 14.63133711 [5,] -48.86155122 -16.73587822 [6,] -77.88684831 -48.86155122 [7,] -52.82432164 -77.88684831 [8,] -45.44590040 -52.82432164 [9,] -11.88204805 -45.44590040 [10,] -25.53047839 -11.88204805 [11,] 20.23389227 -25.53047839 [12,] -21.94206533 20.23389227 [13,] 23.19071934 -21.94206533 [14,] 14.28438981 23.19071934 [15,] -36.35738600 14.28438981 [16,] 33.46863253 -36.35738600 [17,] -34.09745511 33.46863253 [18,] -5.09014032 -34.09745511 [19,] -4.25345941 -5.09014032 [20,] 14.85644603 -4.25345941 [21,] 18.86071304 14.85644603 [22,] -2.46525460 18.86071304 [23,] -1.06098760 -2.46525460 [24,] -17.29089211 -1.06098760 [25,] -15.51318204 -17.29089211 [26,] -17.20494268 -15.51318204 [27,] -36.67984871 -17.20494268 [28,] -13.10604001 -36.67984871 [29,] 0.08572063 -13.10604001 [30,] 53.77560179 0.08572063 [31,] 56.66622960 53.77560179 [32,] 3.76485817 56.66622960 [33,] 54.98369405 3.76485817 [34,] -38.92319395 54.98369405 [35,] -19.51892695 -38.92319395 [36,] 31.93373491 -19.51892695 [37,] 11.44795825 31.93373491 [38,] -25.87866966 11.44795825 [39,] 56.39924353 -25.87866966 [40,] -2.89893770 56.39924353 [41,] 14.10964721 -2.89893770 [42,] -28.31339452 14.10964721 [43,] -20.40646075 -28.31339452 [44,] 66.89667856 -20.40646075 [45,] -39.35126428 66.89667856 [46,] 48.32398683 -39.35126428 [47,] 29.21255726 48.32398683 [48,] 14.22480446 29.21255726 [49,] 26.88456258 14.22480446 [50,] 24.31197264 26.88456258 [51,] -17.23821531 24.31197264 [52,] -15.89528145 -17.23821531 [53,] -2.91808969 -15.89528145 [54,] -1.74390510 -2.91808969 [55,] 20.81801220 -1.74390510 [56,] -40.07208236 20.81801220 [57,] -22.61109476 -40.07208236 [58,] 18.59494012 -22.61109476 [59,] -28.86653498 18.59494012 [60,] 42.62376784 -28.86653498 [61,] -11.48559921 42.62376784 [62,] 8.39731270 -11.48559921 [63,] 19.24486937 8.39731270 [64,] 15.16750484 19.24486937 [65,] 71.68172819 15.16750484 [66,] 59.25868646 71.68172819 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -34.52445892 -49.54934977 2 -3.91006281 -34.52445892 3 14.63133711 -3.91006281 4 -16.73587822 14.63133711 5 -48.86155122 -16.73587822 6 -77.88684831 -48.86155122 7 -52.82432164 -77.88684831 8 -45.44590040 -52.82432164 9 -11.88204805 -45.44590040 10 -25.53047839 -11.88204805 11 20.23389227 -25.53047839 12 -21.94206533 20.23389227 13 23.19071934 -21.94206533 14 14.28438981 23.19071934 15 -36.35738600 14.28438981 16 33.46863253 -36.35738600 17 -34.09745511 33.46863253 18 -5.09014032 -34.09745511 19 -4.25345941 -5.09014032 20 14.85644603 -4.25345941 21 18.86071304 14.85644603 22 -2.46525460 18.86071304 23 -1.06098760 -2.46525460 24 -17.29089211 -1.06098760 25 -15.51318204 -17.29089211 26 -17.20494268 -15.51318204 27 -36.67984871 -17.20494268 28 -13.10604001 -36.67984871 29 0.08572063 -13.10604001 30 53.77560179 0.08572063 31 56.66622960 53.77560179 32 3.76485817 56.66622960 33 54.98369405 3.76485817 34 -38.92319395 54.98369405 35 -19.51892695 -38.92319395 36 31.93373491 -19.51892695 37 11.44795825 31.93373491 38 -25.87866966 11.44795825 39 56.39924353 -25.87866966 40 -2.89893770 56.39924353 41 14.10964721 -2.89893770 42 -28.31339452 14.10964721 43 -20.40646075 -28.31339452 44 66.89667856 -20.40646075 45 -39.35126428 66.89667856 46 48.32398683 -39.35126428 47 29.21255726 48.32398683 48 14.22480446 29.21255726 49 26.88456258 14.22480446 50 24.31197264 26.88456258 51 -17.23821531 24.31197264 52 -15.89528145 -17.23821531 53 -2.91808969 -15.89528145 54 -1.74390510 -2.91808969 55 20.81801220 -1.74390510 56 -40.07208236 20.81801220 57 -22.61109476 -40.07208236 58 18.59494012 -22.61109476 59 -28.86653498 18.59494012 60 42.62376784 -28.86653498 61 -11.48559921 42.62376784 62 8.39731270 -11.48559921 63 19.24486937 8.39731270 64 15.16750484 19.24486937 65 71.68172819 15.16750484 66 59.25868646 71.68172819 > 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/7rm6f1292502832.ps",horizontal=F,onefile=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/8jv6i1292502832.ps",horizontal=F,onefile=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/9jv6i1292502832.ps",horizontal=F,onefile=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/10jv6i1292502832.ps",horizontal=F,onefile=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/11ne4o1292502832.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/128e3u1292502832.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/13fxi61292502832.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/14qph91292502832.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/15tpfe1292502832.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/16phvn1292502832.tab") + } > > try(system("convert tmp/15l8r1292502832.ps tmp/15l8r1292502832.png",intern=TRUE)) character(0) > try(system("convert tmp/25l8r1292502832.ps tmp/25l8r1292502832.png",intern=TRUE)) character(0) > try(system("convert tmp/35l8r1292502832.ps tmp/35l8r1292502832.png",intern=TRUE)) character(0) > try(system("convert tmp/4gdpc1292502832.ps tmp/4gdpc1292502832.png",intern=TRUE)) character(0) > try(system("convert tmp/5gdpc1292502832.ps tmp/5gdpc1292502832.png",intern=TRUE)) character(0) > try(system("convert tmp/6gdpc1292502832.ps tmp/6gdpc1292502832.png",intern=TRUE)) character(0) > try(system("convert tmp/7rm6f1292502832.ps tmp/7rm6f1292502832.png",intern=TRUE)) character(0) > try(system("convert tmp/8jv6i1292502832.ps tmp/8jv6i1292502832.png",intern=TRUE)) character(0) > try(system("convert tmp/9jv6i1292502832.ps tmp/9jv6i1292502832.png",intern=TRUE)) character(0) > try(system("convert tmp/10jv6i1292502832.ps tmp/10jv6i1292502832.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.551 1.664 6.161