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(594,0,611,595,0,594,591,0,595,589,0,591,584,0,589,573,0,584,567,0,573,569,0,567,621,0,569,629,0,621,628,0,629,612,0,628,595,0,612,597,0,595,593,0,597,590,0,593,580,0,590,574,0,580,573,0,574,573,0,573,620,0,573,626,0,620,620,0,626,588,0,620,566,0,588,557,0,566,561,0,557,549,0,561,532,0,549,526,0,532,511,0,526,499,0,511,555,0,499,565,0,555,542,0,565,527,0,542,510,0,527,514,0,510,517,0,514,508,0,517,493,0,508,490,0,493,469,0,490,478,0,469,528,0,478,534,0,528,518,1,534,506,1,518,502,1,506,516,1,502,528,1,516,533,1,528,536,1,533,537,1,536,524,1,537,536,1,524,587,1,536,597,1,587,581,1,597,564,1,581,558,1,564),dim=c(3,61),dimnames=list(c('WklBe','X','Y1'),1:61))
> y <- array(NA,dim=c(3,61),dimnames=list(c('WklBe','X','Y1'),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 = '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
WklBe X Y1 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 594 0 611 1 0 0 0 0 0 0 0 0 0 0 1
2 595 0 594 0 1 0 0 0 0 0 0 0 0 0 2
3 591 0 595 0 0 1 0 0 0 0 0 0 0 0 3
4 589 0 591 0 0 0 1 0 0 0 0 0 0 0 4
5 584 0 589 0 0 0 0 1 0 0 0 0 0 0 5
6 573 0 584 0 0 0 0 0 1 0 0 0 0 0 6
7 567 0 573 0 0 0 0 0 0 1 0 0 0 0 7
8 569 0 567 0 0 0 0 0 0 0 1 0 0 0 8
9 621 0 569 0 0 0 0 0 0 0 0 1 0 0 9
10 629 0 621 0 0 0 0 0 0 0 0 0 1 0 10
11 628 0 629 0 0 0 0 0 0 0 0 0 0 1 11
12 612 0 628 0 0 0 0 0 0 0 0 0 0 0 12
13 595 0 612 1 0 0 0 0 0 0 0 0 0 0 13
14 597 0 595 0 1 0 0 0 0 0 0 0 0 0 14
15 593 0 597 0 0 1 0 0 0 0 0 0 0 0 15
16 590 0 593 0 0 0 1 0 0 0 0 0 0 0 16
17 580 0 590 0 0 0 0 1 0 0 0 0 0 0 17
18 574 0 580 0 0 0 0 0 1 0 0 0 0 0 18
19 573 0 574 0 0 0 0 0 0 1 0 0 0 0 19
20 573 0 573 0 0 0 0 0 0 0 1 0 0 0 20
21 620 0 573 0 0 0 0 0 0 0 0 1 0 0 21
22 626 0 620 0 0 0 0 0 0 0 0 0 1 0 22
23 620 0 626 0 0 0 0 0 0 0 0 0 0 1 23
24 588 0 620 0 0 0 0 0 0 0 0 0 0 0 24
25 566 0 588 1 0 0 0 0 0 0 0 0 0 0 25
26 557 0 566 0 1 0 0 0 0 0 0 0 0 0 26
27 561 0 557 0 0 1 0 0 0 0 0 0 0 0 27
28 549 0 561 0 0 0 1 0 0 0 0 0 0 0 28
29 532 0 549 0 0 0 0 1 0 0 0 0 0 0 29
30 526 0 532 0 0 0 0 0 1 0 0 0 0 0 30
31 511 0 526 0 0 0 0 0 0 1 0 0 0 0 31
32 499 0 511 0 0 0 0 0 0 0 1 0 0 0 32
33 555 0 499 0 0 0 0 0 0 0 0 1 0 0 33
34 565 0 555 0 0 0 0 0 0 0 0 0 1 0 34
35 542 0 565 0 0 0 0 0 0 0 0 0 0 1 35
36 527 0 542 0 0 0 0 0 0 0 0 0 0 0 36
37 510 0 527 1 0 0 0 0 0 0 0 0 0 0 37
38 514 0 510 0 1 0 0 0 0 0 0 0 0 0 38
39 517 0 514 0 0 1 0 0 0 0 0 0 0 0 39
40 508 0 517 0 0 0 1 0 0 0 0 0 0 0 40
41 493 0 508 0 0 0 0 1 0 0 0 0 0 0 41
42 490 0 493 0 0 0 0 0 1 0 0 0 0 0 42
43 469 0 490 0 0 0 0 0 0 1 0 0 0 0 43
44 478 0 469 0 0 0 0 0 0 0 1 0 0 0 44
45 528 0 478 0 0 0 0 0 0 0 0 1 0 0 45
46 534 0 528 0 0 0 0 0 0 0 0 0 1 0 46
47 518 1 534 0 0 0 0 0 0 0 0 0 0 1 47
48 506 1 518 0 0 0 0 0 0 0 0 0 0 0 48
49 502 1 506 1 0 0 0 0 0 0 0 0 0 0 49
50 516 1 502 0 1 0 0 0 0 0 0 0 0 0 50
51 528 1 516 0 0 1 0 0 0 0 0 0 0 0 51
52 533 1 528 0 0 0 1 0 0 0 0 0 0 0 52
53 536 1 533 0 0 0 0 1 0 0 0 0 0 0 53
54 537 1 536 0 0 0 0 0 1 0 0 0 0 0 54
55 524 1 537 0 0 0 0 0 0 1 0 0 0 0 55
56 536 1 524 0 0 0 0 0 0 0 1 0 0 0 56
57 587 1 536 0 0 0 0 0 0 0 0 1 0 0 57
58 597 1 587 0 0 0 0 0 0 0 0 0 1 0 58
59 581 1 597 0 0 0 0 0 0 0 0 0 0 1 59
60 564 1 581 0 0 0 0 0 0 0 0 0 0 0 60
61 558 1 564 1 0 0 0 0 0 0 0 0 0 0 61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X Y1 M1 M2 M3
20.2334 12.2075 0.9389 3.6415 19.4702 19.6449
M4 M5 M6 M7 M8 M9
13.6074 8.9788 12.4690 6.1915 19.1352 68.4976
M10 M11 t
28.6543 6.5297 -0.2280
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-12.84619 -3.82084 0.09088 3.42359 13.18127
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 20.23337 24.36510 0.830 0.410588
X 12.20752 3.24662 3.760 0.000478 ***
Y1 0.93889 0.03738 25.119 < 2e-16 ***
M1 3.64152 3.78768 0.961 0.341373
M2 19.47022 4.17524 4.663 2.70e-05 ***
M3 19.64491 4.11174 4.778 1.85e-05 ***
M4 13.60737 4.05835 3.353 0.001607 **
M5 8.97875 4.07617 2.203 0.032662 *
M6 12.46904 4.15233 3.003 0.004314 **
M7 6.19154 4.18785 1.478 0.146103
M8 19.13517 4.32104 4.428 5.81e-05 ***
M9 68.49763 4.25309 16.105 < 2e-16 ***
M10 28.65432 3.92029 7.309 3.14e-09 ***
M11 6.52969 3.89834 1.675 0.100722
t -0.22803 0.11222 -2.032 0.047948 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.134 on 46 degrees of freedom
Multiple R-squared: 0.9827, Adjusted R-squared: 0.9774
F-statistic: 186.8 on 14 and 46 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.038013726 0.076027452 0.961986274
[2,] 0.051203825 0.102407651 0.948796175
[3,] 0.019514863 0.039029726 0.980485137
[4,] 0.009406131 0.018812262 0.990593869
[5,] 0.005365553 0.010731106 0.994634447
[6,] 0.044883500 0.089766999 0.955116500
[7,] 0.237795248 0.475590497 0.762204752
[8,] 0.211425905 0.422851809 0.788574095
[9,] 0.178418454 0.356836909 0.821581546
[10,] 0.467685656 0.935371311 0.532314344
[11,] 0.436746902 0.873493804 0.563253098
[12,] 0.390688412 0.781376823 0.609311588
[13,] 0.361564391 0.723128782 0.638435609
[14,] 0.388793030 0.777586060 0.611206970
[15,] 0.860815724 0.278368553 0.139184276
[16,] 0.929773952 0.140452096 0.070226048
[17,] 0.926751927 0.146496146 0.073248073
[18,] 0.947846407 0.104307187 0.052153593
[19,] 0.994089280 0.011821440 0.005910720
[20,] 0.988316410 0.023367181 0.011683590
[21,] 0.986990141 0.026019718 0.013009859
[22,] 0.995156932 0.009686135 0.004843068
[23,] 0.995351057 0.009297886 0.004648943
[24,] 0.994127063 0.011745874 0.005872937
[25,] 0.989206706 0.021586588 0.010793294
[26,] 0.972566608 0.054866784 0.027433392
> postscript(file="/var/www/html/rcomp/tmp/14mxs1260893850.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/2ap1v1260893850.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/3srbr1260893850.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/4jn911260893850.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/5banu1260893850.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 6
-3.31075232 -1.95024249 -6.83579167 1.18534768 2.91978211 -6.64801298
7 8 9 10 11 12
4.18534768 -0.89689822 0.09088047 -0.66023429 13.18126957 4.87788433
13 14 15 16 17 18
-0.51330947 1.84720036 -3.97724227 3.04389708 0.71722495 0.84389708
19 20 21 22 23 24
11.98279052 0.20607741 -1.92835702 0.01499544 10.73428619 -8.87463185
25 26 27 28 29 30
-4.24353056 -8.18855352 4.31483173 -5.17517647 -6.05180761 0.64711862
31 32 33 34 35 36
-2.21398794 -12.84619286 5.28609403 2.77940551 -7.25687752 6.09539297
37 38 39 40 41 42
-0.23469427 4.12581556 3.42358606 -2.12752870 -3.82084017 4.00029917
43 44 45 46 47 48
-7.67748771 8.32366802 0.73919261 -0.13413525 -11.62236382 -1.84234742
49 50 51 52 53 54
2.01088501 4.16578008 3.07461615 3.07346041 6.23564073 1.15669811
55 56 57 58 59 60
-6.27666255 5.21334565 -4.18781009 -2.00003140 -5.03631443 -0.25629803
61
6.29140161
> postscript(file="/var/www/html/rcomp/tmp/6tl0y1260893850.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 -3.31075232 NA
1 -1.95024249 -3.31075232
2 -6.83579167 -1.95024249
3 1.18534768 -6.83579167
4 2.91978211 1.18534768
5 -6.64801298 2.91978211
6 4.18534768 -6.64801298
7 -0.89689822 4.18534768
8 0.09088047 -0.89689822
9 -0.66023429 0.09088047
10 13.18126957 -0.66023429
11 4.87788433 13.18126957
12 -0.51330947 4.87788433
13 1.84720036 -0.51330947
14 -3.97724227 1.84720036
15 3.04389708 -3.97724227
16 0.71722495 3.04389708
17 0.84389708 0.71722495
18 11.98279052 0.84389708
19 0.20607741 11.98279052
20 -1.92835702 0.20607741
21 0.01499544 -1.92835702
22 10.73428619 0.01499544
23 -8.87463185 10.73428619
24 -4.24353056 -8.87463185
25 -8.18855352 -4.24353056
26 4.31483173 -8.18855352
27 -5.17517647 4.31483173
28 -6.05180761 -5.17517647
29 0.64711862 -6.05180761
30 -2.21398794 0.64711862
31 -12.84619286 -2.21398794
32 5.28609403 -12.84619286
33 2.77940551 5.28609403
34 -7.25687752 2.77940551
35 6.09539297 -7.25687752
36 -0.23469427 6.09539297
37 4.12581556 -0.23469427
38 3.42358606 4.12581556
39 -2.12752870 3.42358606
40 -3.82084017 -2.12752870
41 4.00029917 -3.82084017
42 -7.67748771 4.00029917
43 8.32366802 -7.67748771
44 0.73919261 8.32366802
45 -0.13413525 0.73919261
46 -11.62236382 -0.13413525
47 -1.84234742 -11.62236382
48 2.01088501 -1.84234742
49 4.16578008 2.01088501
50 3.07461615 4.16578008
51 3.07346041 3.07461615
52 6.23564073 3.07346041
53 1.15669811 6.23564073
54 -6.27666255 1.15669811
55 5.21334565 -6.27666255
56 -4.18781009 5.21334565
57 -2.00003140 -4.18781009
58 -5.03631443 -2.00003140
59 -0.25629803 -5.03631443
60 6.29140161 -0.25629803
61 NA 6.29140161
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.95024249 -3.31075232
[2,] -6.83579167 -1.95024249
[3,] 1.18534768 -6.83579167
[4,] 2.91978211 1.18534768
[5,] -6.64801298 2.91978211
[6,] 4.18534768 -6.64801298
[7,] -0.89689822 4.18534768
[8,] 0.09088047 -0.89689822
[9,] -0.66023429 0.09088047
[10,] 13.18126957 -0.66023429
[11,] 4.87788433 13.18126957
[12,] -0.51330947 4.87788433
[13,] 1.84720036 -0.51330947
[14,] -3.97724227 1.84720036
[15,] 3.04389708 -3.97724227
[16,] 0.71722495 3.04389708
[17,] 0.84389708 0.71722495
[18,] 11.98279052 0.84389708
[19,] 0.20607741 11.98279052
[20,] -1.92835702 0.20607741
[21,] 0.01499544 -1.92835702
[22,] 10.73428619 0.01499544
[23,] -8.87463185 10.73428619
[24,] -4.24353056 -8.87463185
[25,] -8.18855352 -4.24353056
[26,] 4.31483173 -8.18855352
[27,] -5.17517647 4.31483173
[28,] -6.05180761 -5.17517647
[29,] 0.64711862 -6.05180761
[30,] -2.21398794 0.64711862
[31,] -12.84619286 -2.21398794
[32,] 5.28609403 -12.84619286
[33,] 2.77940551 5.28609403
[34,] -7.25687752 2.77940551
[35,] 6.09539297 -7.25687752
[36,] -0.23469427 6.09539297
[37,] 4.12581556 -0.23469427
[38,] 3.42358606 4.12581556
[39,] -2.12752870 3.42358606
[40,] -3.82084017 -2.12752870
[41,] 4.00029917 -3.82084017
[42,] -7.67748771 4.00029917
[43,] 8.32366802 -7.67748771
[44,] 0.73919261 8.32366802
[45,] -0.13413525 0.73919261
[46,] -11.62236382 -0.13413525
[47,] -1.84234742 -11.62236382
[48,] 2.01088501 -1.84234742
[49,] 4.16578008 2.01088501
[50,] 3.07461615 4.16578008
[51,] 3.07346041 3.07461615
[52,] 6.23564073 3.07346041
[53,] 1.15669811 6.23564073
[54,] -6.27666255 1.15669811
[55,] 5.21334565 -6.27666255
[56,] -4.18781009 5.21334565
[57,] -2.00003140 -4.18781009
[58,] -5.03631443 -2.00003140
[59,] -0.25629803 -5.03631443
[60,] 6.29140161 -0.25629803
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.95024249 -3.31075232
2 -6.83579167 -1.95024249
3 1.18534768 -6.83579167
4 2.91978211 1.18534768
5 -6.64801298 2.91978211
6 4.18534768 -6.64801298
7 -0.89689822 4.18534768
8 0.09088047 -0.89689822
9 -0.66023429 0.09088047
10 13.18126957 -0.66023429
11 4.87788433 13.18126957
12 -0.51330947 4.87788433
13 1.84720036 -0.51330947
14 -3.97724227 1.84720036
15 3.04389708 -3.97724227
16 0.71722495 3.04389708
17 0.84389708 0.71722495
18 11.98279052 0.84389708
19 0.20607741 11.98279052
20 -1.92835702 0.20607741
21 0.01499544 -1.92835702
22 10.73428619 0.01499544
23 -8.87463185 10.73428619
24 -4.24353056 -8.87463185
25 -8.18855352 -4.24353056
26 4.31483173 -8.18855352
27 -5.17517647 4.31483173
28 -6.05180761 -5.17517647
29 0.64711862 -6.05180761
30 -2.21398794 0.64711862
31 -12.84619286 -2.21398794
32 5.28609403 -12.84619286
33 2.77940551 5.28609403
34 -7.25687752 2.77940551
35 6.09539297 -7.25687752
36 -0.23469427 6.09539297
37 4.12581556 -0.23469427
38 3.42358606 4.12581556
39 -2.12752870 3.42358606
40 -3.82084017 -2.12752870
41 4.00029917 -3.82084017
42 -7.67748771 4.00029917
43 8.32366802 -7.67748771
44 0.73919261 8.32366802
45 -0.13413525 0.73919261
46 -11.62236382 -0.13413525
47 -1.84234742 -11.62236382
48 2.01088501 -1.84234742
49 4.16578008 2.01088501
50 3.07461615 4.16578008
51 3.07346041 3.07461615
52 6.23564073 3.07346041
53 1.15669811 6.23564073
54 -6.27666255 1.15669811
55 5.21334565 -6.27666255
56 -4.18781009 5.21334565
57 -2.00003140 -4.18781009
58 -5.03631443 -2.00003140
59 -0.25629803 -5.03631443
60 6.29140161 -0.25629803
> 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/7mgan1260893850.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/88kpg1260893850.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/98oyw1260893850.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/10pbzs1260893850.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/11tswa1260893850.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/123z771260893850.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/13h7jr1260893850.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/14m8by1260893850.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/1539ju1260893850.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/16nhqj1260893850.tab")
+ }
>
> try(system("convert tmp/14mxs1260893850.ps tmp/14mxs1260893850.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ap1v1260893850.ps tmp/2ap1v1260893850.png",intern=TRUE))
character(0)
> try(system("convert tmp/3srbr1260893850.ps tmp/3srbr1260893850.png",intern=TRUE))
character(0)
> try(system("convert tmp/4jn911260893850.ps tmp/4jn911260893850.png",intern=TRUE))
character(0)
> try(system("convert tmp/5banu1260893850.ps tmp/5banu1260893850.png",intern=TRUE))
character(0)
> try(system("convert tmp/6tl0y1260893850.ps tmp/6tl0y1260893850.png",intern=TRUE))
character(0)
> try(system("convert tmp/7mgan1260893850.ps tmp/7mgan1260893850.png",intern=TRUE))
character(0)
> try(system("convert tmp/88kpg1260893850.ps tmp/88kpg1260893850.png",intern=TRUE))
character(0)
> try(system("convert tmp/98oyw1260893850.ps tmp/98oyw1260893850.png",intern=TRUE))
character(0)
> try(system("convert tmp/10pbzs1260893850.ps tmp/10pbzs1260893850.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.381 1.541 3.382