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(562,573,561,572,555,566,544,555,537,548,543,554,594,605,611,622,613,624,611,622,594,605,595,606,591,602,589,600,584,595,573,584,567,578,569,580,621,632,629,640,628,639,612,623,595,606,597,608,593,604,590,601,580,591,574,585,573,584,573,584,620,631,626,637,620,631,588,599,566,577,557,568,561,572,549,560,532,543,526,537,511,522,499,510,555,566,565,576,542,553,527,538,510,521,514,525,517,528,508,519,493,504,490,501,469,480,478,489,528,539,534,545,518,529,506,517,502,513,516,527,528,539),dim=c(2,61),dimnames=list(c('Y','X'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),1:61)) > 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 Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 562 573 1 0 0 0 0 0 0 0 0 0 0 2 561 572 0 1 0 0 0 0 0 0 0 0 0 3 555 566 0 0 1 0 0 0 0 0 0 0 0 4 544 555 0 0 0 1 0 0 0 0 0 0 0 5 537 548 0 0 0 0 1 0 0 0 0 0 0 6 543 554 0 0 0 0 0 1 0 0 0 0 0 7 594 605 0 0 0 0 0 0 1 0 0 0 0 8 611 622 0 0 0 0 0 0 0 1 0 0 0 9 613 624 0 0 0 0 0 0 0 0 1 0 0 10 611 622 0 0 0 0 0 0 0 0 0 1 0 11 594 605 0 0 0 0 0 0 0 0 0 0 1 12 595 606 0 0 0 0 0 0 0 0 0 0 0 13 591 602 1 0 0 0 0 0 0 0 0 0 0 14 589 600 0 1 0 0 0 0 0 0 0 0 0 15 584 595 0 0 1 0 0 0 0 0 0 0 0 16 573 584 0 0 0 1 0 0 0 0 0 0 0 17 567 578 0 0 0 0 1 0 0 0 0 0 0 18 569 580 0 0 0 0 0 1 0 0 0 0 0 19 621 632 0 0 0 0 0 0 1 0 0 0 0 20 629 640 0 0 0 0 0 0 0 1 0 0 0 21 628 639 0 0 0 0 0 0 0 0 1 0 0 22 612 623 0 0 0 0 0 0 0 0 0 1 0 23 595 606 0 0 0 0 0 0 0 0 0 0 1 24 597 608 0 0 0 0 0 0 0 0 0 0 0 25 593 604 1 0 0 0 0 0 0 0 0 0 0 26 590 601 0 1 0 0 0 0 0 0 0 0 0 27 580 591 0 0 1 0 0 0 0 0 0 0 0 28 574 585 0 0 0 1 0 0 0 0 0 0 0 29 573 584 0 0 0 0 1 0 0 0 0 0 0 30 573 584 0 0 0 0 0 1 0 0 0 0 0 31 620 631 0 0 0 0 0 0 1 0 0 0 0 32 626 637 0 0 0 0 0 0 0 1 0 0 0 33 620 631 0 0 0 0 0 0 0 0 1 0 0 34 588 599 0 0 0 0 0 0 0 0 0 1 0 35 566 577 0 0 0 0 0 0 0 0 0 0 1 36 557 568 0 0 0 0 0 0 0 0 0 0 0 37 561 572 1 0 0 0 0 0 0 0 0 0 0 38 549 560 0 1 0 0 0 0 0 0 0 0 0 39 532 543 0 0 1 0 0 0 0 0 0 0 0 40 526 537 0 0 0 1 0 0 0 0 0 0 0 41 511 522 0 0 0 0 1 0 0 0 0 0 0 42 499 510 0 0 0 0 0 1 0 0 0 0 0 43 555 566 0 0 0 0 0 0 1 0 0 0 0 44 565 576 0 0 0 0 0 0 0 1 0 0 0 45 542 553 0 0 0 0 0 0 0 0 1 0 0 46 527 538 0 0 0 0 0 0 0 0 0 1 0 47 510 521 0 0 0 0 0 0 0 0 0 0 1 48 514 525 0 0 0 0 0 0 0 0 0 0 0 49 517 528 1 0 0 0 0 0 0 0 0 0 0 50 508 519 0 1 0 0 0 0 0 0 0 0 0 51 493 504 0 0 1 0 0 0 0 0 0 0 0 52 490 501 0 0 0 1 0 0 0 0 0 0 0 53 469 480 0 0 0 0 1 0 0 0 0 0 0 54 478 489 0 0 0 0 0 1 0 0 0 0 0 55 528 539 0 0 0 0 0 0 1 0 0 0 0 56 534 545 0 0 0 0 0 0 0 1 0 0 0 57 518 529 0 0 0 0 0 0 0 0 1 0 0 58 506 517 0 0 0 0 0 0 0 0 0 1 0 59 502 513 0 0 0 0 0 0 0 0 0 0 1 60 516 527 0 0 0 0 0 0 0 0 0 0 0 61 528 539 1 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) X M1 M2 M3 M4 -1.100e+01 1.000e+00 1.498e-13 3.152e-15 7.174e-17 1.262e-15 M5 M6 M7 M8 M9 M10 2.125e-15 2.661e-15 2.715e-15 -2.734e-15 4.279e-15 4.758e-16 M11 1.291e-15 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.529e-13 -2.684e-15 -7.011e-16 2.373e-15 7.412e-13 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.100e+01 2.368e-13 -4.646e+13 <2e-16 *** X 1.000e+00 4.073e-16 2.455e+15 <2e-16 *** M1 1.498e-13 7.100e-14 2.109e+00 0.0401 * M2 3.152e-15 7.416e-14 4.300e-02 0.9663 M3 7.174e-17 7.420e-14 1.000e-03 0.9992 M4 1.262e-15 7.438e-14 1.700e-02 0.9865 M5 2.125e-15 7.481e-14 2.800e-02 0.9775 M6 2.661e-15 7.476e-14 3.600e-02 0.9718 M7 2.715e-15 7.501e-14 3.600e-02 0.9713 M8 -2.734e-15 7.568e-14 -3.600e-02 0.9713 M9 4.279e-15 7.504e-14 5.700e-02 0.9548 M10 4.758e-16 7.434e-14 6.000e-03 0.9949 M11 1.291e-15 7.415e-14 1.700e-02 0.9862 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.172e-13 on 48 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 6.361e+29 on 12 and 48 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,] 8.226928e-06 1.645386e-05 9.999918e-01 [2,] 7.148369e-07 1.429674e-06 9.999993e-01 [3,] 8.815844e-14 1.763169e-13 1.000000e+00 [4,] 7.029471e-01 5.941057e-01 2.970529e-01 [5,] 1.000000e+00 2.089740e-59 1.044870e-59 [6,] 9.037656e-01 1.924688e-01 9.623440e-02 [7,] 9.978164e-01 4.367147e-03 2.183574e-03 [8,] 9.956651e-01 8.669805e-03 4.334903e-03 [9,] 9.941335e-01 1.173299e-02 5.866494e-03 [10,] 6.229330e-18 1.245866e-17 1.000000e+00 [11,] 4.402590e-14 8.805180e-14 1.000000e+00 [12,] 1.000000e+00 4.025165e-23 2.012582e-23 [13,] 1.000000e+00 2.848458e-35 1.424229e-35 [14,] 1.000000e+00 2.110572e-10 1.055286e-10 [15,] 3.399092e-05 6.798183e-05 9.999660e-01 [16,] 5.453296e-29 1.090659e-28 1.000000e+00 [17,] 5.614791e-03 1.122958e-02 9.943852e-01 [18,] 1.000000e+00 3.236823e-10 1.618412e-10 [19,] 6.690668e-03 1.338134e-02 9.933093e-01 [20,] 9.866810e-01 2.663810e-02 1.331905e-02 [21,] 6.662558e-34 1.332512e-33 1.000000e+00 [22,] 8.802336e-03 1.760467e-02 9.911977e-01 [23,] 5.989428e-01 8.021143e-01 4.010572e-01 [24,] 1.000000e+00 3.977524e-14 1.988762e-14 [25,] 5.588865e-12 1.117773e-11 1.000000e+00 [26,] 1.000000e+00 3.364306e-10 1.682153e-10 [27,] 1.000000e+00 4.980118e-13 2.490059e-13 [28,] 1.000000e+00 5.341512e-08 2.670756e-08 [29,] 7.050857e-03 1.410171e-02 9.929491e-01 [30,] 9.999763e-01 4.744762e-05 2.372381e-05 > postscript(file="/var/www/html/rcomp/tmp/1p4ew1258733021.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/21alv1258733021.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/360dw1258733021.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/4nu7r1258733021.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/50jp21258733021.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 = 61 Frequency = 1 1 2 3 4 5 7.411765e-13 7.172843e-17 1.365155e-15 5.037221e-16 -3.219309e-15 6 7 8 9 10 -2.318934e-15 9.490744e-16 3.991790e-16 -2.139649e-16 -2.810286e-15 11 12 13 14 15 2.372773e-15 -3.794600e-15 -1.485989e-13 -1.277020e-15 1.480947e-17 16 17 18 19 20 -8.466233e-16 -4.815947e-16 -8.344268e-16 -1.471964e-15 -5.951798e-15 21 22 23 24 25 1.598982e-15 3.942309e-15 -5.085487e-15 -4.500265e-15 -1.528573e-13 26 27 28 29 30 -1.629852e-15 -2.126576e-15 -1.199455e-15 -1.710409e-15 -2.245755e-15 31 32 33 34 35 -1.119132e-15 -4.893302e-15 -2.683789e-15 1.752137e-15 -1.824275e-16 36 37 38 39 40 2.063501e-15 -1.482280e-13 4.017640e-16 4.151222e-15 5.078342e-15 41 42 43 44 45 2.401610e-15 6.100249e-15 -1.277687e-15 4.194956e-15 -3.584598e-15 46 47 48 49 50 -1.594103e-15 3.588956e-15 3.468514e-15 -1.473583e-13 2.433380e-15 51 52 53 54 55 -3.404610e-15 -3.535986e-15 3.009702e-15 -7.011327e-16 2.919708e-15 56 57 58 59 60 6.250965e-15 4.883371e-15 -1.290057e-15 -6.938148e-16 2.762850e-15 61 -1.441340e-13 > postscript(file="/var/www/html/rcomp/tmp/6jdp21258733021.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 7.411765e-13 NA 1 7.172843e-17 7.411765e-13 2 1.365155e-15 7.172843e-17 3 5.037221e-16 1.365155e-15 4 -3.219309e-15 5.037221e-16 5 -2.318934e-15 -3.219309e-15 6 9.490744e-16 -2.318934e-15 7 3.991790e-16 9.490744e-16 8 -2.139649e-16 3.991790e-16 9 -2.810286e-15 -2.139649e-16 10 2.372773e-15 -2.810286e-15 11 -3.794600e-15 2.372773e-15 12 -1.485989e-13 -3.794600e-15 13 -1.277020e-15 -1.485989e-13 14 1.480947e-17 -1.277020e-15 15 -8.466233e-16 1.480947e-17 16 -4.815947e-16 -8.466233e-16 17 -8.344268e-16 -4.815947e-16 18 -1.471964e-15 -8.344268e-16 19 -5.951798e-15 -1.471964e-15 20 1.598982e-15 -5.951798e-15 21 3.942309e-15 1.598982e-15 22 -5.085487e-15 3.942309e-15 23 -4.500265e-15 -5.085487e-15 24 -1.528573e-13 -4.500265e-15 25 -1.629852e-15 -1.528573e-13 26 -2.126576e-15 -1.629852e-15 27 -1.199455e-15 -2.126576e-15 28 -1.710409e-15 -1.199455e-15 29 -2.245755e-15 -1.710409e-15 30 -1.119132e-15 -2.245755e-15 31 -4.893302e-15 -1.119132e-15 32 -2.683789e-15 -4.893302e-15 33 1.752137e-15 -2.683789e-15 34 -1.824275e-16 1.752137e-15 35 2.063501e-15 -1.824275e-16 36 -1.482280e-13 2.063501e-15 37 4.017640e-16 -1.482280e-13 38 4.151222e-15 4.017640e-16 39 5.078342e-15 4.151222e-15 40 2.401610e-15 5.078342e-15 41 6.100249e-15 2.401610e-15 42 -1.277687e-15 6.100249e-15 43 4.194956e-15 -1.277687e-15 44 -3.584598e-15 4.194956e-15 45 -1.594103e-15 -3.584598e-15 46 3.588956e-15 -1.594103e-15 47 3.468514e-15 3.588956e-15 48 -1.473583e-13 3.468514e-15 49 2.433380e-15 -1.473583e-13 50 -3.404610e-15 2.433380e-15 51 -3.535986e-15 -3.404610e-15 52 3.009702e-15 -3.535986e-15 53 -7.011327e-16 3.009702e-15 54 2.919708e-15 -7.011327e-16 55 6.250965e-15 2.919708e-15 56 4.883371e-15 6.250965e-15 57 -1.290057e-15 4.883371e-15 58 -6.938148e-16 -1.290057e-15 59 2.762850e-15 -6.938148e-16 60 -1.441340e-13 2.762850e-15 61 NA -1.441340e-13 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 7.172843e-17 7.411765e-13 [2,] 1.365155e-15 7.172843e-17 [3,] 5.037221e-16 1.365155e-15 [4,] -3.219309e-15 5.037221e-16 [5,] -2.318934e-15 -3.219309e-15 [6,] 9.490744e-16 -2.318934e-15 [7,] 3.991790e-16 9.490744e-16 [8,] -2.139649e-16 3.991790e-16 [9,] -2.810286e-15 -2.139649e-16 [10,] 2.372773e-15 -2.810286e-15 [11,] -3.794600e-15 2.372773e-15 [12,] -1.485989e-13 -3.794600e-15 [13,] -1.277020e-15 -1.485989e-13 [14,] 1.480947e-17 -1.277020e-15 [15,] -8.466233e-16 1.480947e-17 [16,] -4.815947e-16 -8.466233e-16 [17,] -8.344268e-16 -4.815947e-16 [18,] -1.471964e-15 -8.344268e-16 [19,] -5.951798e-15 -1.471964e-15 [20,] 1.598982e-15 -5.951798e-15 [21,] 3.942309e-15 1.598982e-15 [22,] -5.085487e-15 3.942309e-15 [23,] -4.500265e-15 -5.085487e-15 [24,] -1.528573e-13 -4.500265e-15 [25,] -1.629852e-15 -1.528573e-13 [26,] -2.126576e-15 -1.629852e-15 [27,] -1.199455e-15 -2.126576e-15 [28,] -1.710409e-15 -1.199455e-15 [29,] -2.245755e-15 -1.710409e-15 [30,] -1.119132e-15 -2.245755e-15 [31,] -4.893302e-15 -1.119132e-15 [32,] -2.683789e-15 -4.893302e-15 [33,] 1.752137e-15 -2.683789e-15 [34,] -1.824275e-16 1.752137e-15 [35,] 2.063501e-15 -1.824275e-16 [36,] -1.482280e-13 2.063501e-15 [37,] 4.017640e-16 -1.482280e-13 [38,] 4.151222e-15 4.017640e-16 [39,] 5.078342e-15 4.151222e-15 [40,] 2.401610e-15 5.078342e-15 [41,] 6.100249e-15 2.401610e-15 [42,] -1.277687e-15 6.100249e-15 [43,] 4.194956e-15 -1.277687e-15 [44,] -3.584598e-15 4.194956e-15 [45,] -1.594103e-15 -3.584598e-15 [46,] 3.588956e-15 -1.594103e-15 [47,] 3.468514e-15 3.588956e-15 [48,] -1.473583e-13 3.468514e-15 [49,] 2.433380e-15 -1.473583e-13 [50,] -3.404610e-15 2.433380e-15 [51,] -3.535986e-15 -3.404610e-15 [52,] 3.009702e-15 -3.535986e-15 [53,] -7.011327e-16 3.009702e-15 [54,] 2.919708e-15 -7.011327e-16 [55,] 6.250965e-15 2.919708e-15 [56,] 4.883371e-15 6.250965e-15 [57,] -1.290057e-15 4.883371e-15 [58,] -6.938148e-16 -1.290057e-15 [59,] 2.762850e-15 -6.938148e-16 [60,] -1.441340e-13 2.762850e-15 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 7.172843e-17 7.411765e-13 2 1.365155e-15 7.172843e-17 3 5.037221e-16 1.365155e-15 4 -3.219309e-15 5.037221e-16 5 -2.318934e-15 -3.219309e-15 6 9.490744e-16 -2.318934e-15 7 3.991790e-16 9.490744e-16 8 -2.139649e-16 3.991790e-16 9 -2.810286e-15 -2.139649e-16 10 2.372773e-15 -2.810286e-15 11 -3.794600e-15 2.372773e-15 12 -1.485989e-13 -3.794600e-15 13 -1.277020e-15 -1.485989e-13 14 1.480947e-17 -1.277020e-15 15 -8.466233e-16 1.480947e-17 16 -4.815947e-16 -8.466233e-16 17 -8.344268e-16 -4.815947e-16 18 -1.471964e-15 -8.344268e-16 19 -5.951798e-15 -1.471964e-15 20 1.598982e-15 -5.951798e-15 21 3.942309e-15 1.598982e-15 22 -5.085487e-15 3.942309e-15 23 -4.500265e-15 -5.085487e-15 24 -1.528573e-13 -4.500265e-15 25 -1.629852e-15 -1.528573e-13 26 -2.126576e-15 -1.629852e-15 27 -1.199455e-15 -2.126576e-15 28 -1.710409e-15 -1.199455e-15 29 -2.245755e-15 -1.710409e-15 30 -1.119132e-15 -2.245755e-15 31 -4.893302e-15 -1.119132e-15 32 -2.683789e-15 -4.893302e-15 33 1.752137e-15 -2.683789e-15 34 -1.824275e-16 1.752137e-15 35 2.063501e-15 -1.824275e-16 36 -1.482280e-13 2.063501e-15 37 4.017640e-16 -1.482280e-13 38 4.151222e-15 4.017640e-16 39 5.078342e-15 4.151222e-15 40 2.401610e-15 5.078342e-15 41 6.100249e-15 2.401610e-15 42 -1.277687e-15 6.100249e-15 43 4.194956e-15 -1.277687e-15 44 -3.584598e-15 4.194956e-15 45 -1.594103e-15 -3.584598e-15 46 3.588956e-15 -1.594103e-15 47 3.468514e-15 3.588956e-15 48 -1.473583e-13 3.468514e-15 49 2.433380e-15 -1.473583e-13 50 -3.404610e-15 2.433380e-15 51 -3.535986e-15 -3.404610e-15 52 3.009702e-15 -3.535986e-15 53 -7.011327e-16 3.009702e-15 54 2.919708e-15 -7.011327e-16 55 6.250965e-15 2.919708e-15 56 4.883371e-15 6.250965e-15 57 -1.290057e-15 4.883371e-15 58 -6.938148e-16 -1.290057e-15 59 2.762850e-15 -6.938148e-16 60 -1.441340e-13 2.762850e-15 > 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/7hf9h1258733021.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/8m97g1258733021.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/979sf1258733021.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/10b3m61258733021.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/11cpsf1258733021.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/1231cd1258733021.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/13mmdp1258733021.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/14dg0e1258733021.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/15vlut1258733021.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/16ajdj1258733021.tab") + } > > system("convert tmp/1p4ew1258733021.ps tmp/1p4ew1258733021.png") > system("convert tmp/21alv1258733021.ps tmp/21alv1258733021.png") > system("convert tmp/360dw1258733021.ps tmp/360dw1258733021.png") > system("convert tmp/4nu7r1258733021.ps tmp/4nu7r1258733021.png") > system("convert tmp/50jp21258733021.ps tmp/50jp21258733021.png") > system("convert tmp/6jdp21258733021.ps tmp/6jdp21258733021.png") > system("convert tmp/7hf9h1258733021.ps tmp/7hf9h1258733021.png") > system("convert tmp/8m97g1258733021.ps tmp/8m97g1258733021.png") > system("convert tmp/979sf1258733021.ps tmp/979sf1258733021.png") > system("convert tmp/10b3m61258733021.ps tmp/10b3m61258733021.png") > > > proc.time() user system elapsed 2.432 1.570 3.476