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(4138,613,5560,4634,611,3922,3996,594,3759,4308,595,4138,4143,591,4634,4429,589,3996,5219,584,4308,4929,573,4143,5755,567,4429,5592,569,5219,4163,621,4929,4962,629,5755,5208,628,5592,4755,612,4163,4491,595,4962,5732,597,5208,5731,593,4755,5040,590,4491,6102,580,5732,4904,574,5731,5369,573,5040,5578,573,6102,4619,620,4904,4731,626,5369,5011,620,5578,5299,588,4619,4146,566,4731,4625,557,5011,4736,561,5299,4219,549,4146,5116,532,4625,4205,526,4736,4121,511,4219,5103,499,5116,4300,555,4205,4578,565,4121,3809,542,5103,5526,527,4300,4247,510,4578,3830,514,3809,4394,517,5526,4826,508,4247,4409,493,3830,4569,490,4394,4106,469,4826,4794,478,4409,3914,528,4569,3793,534,4106,4405,518,4794,4022,506,3914,4100,502,3793,4788,516,4405,3163,528,4022,3585,533,4100,3903,536,4788,4178,537,3163,3863,524,3585,4187,536,3903),dim=c(3,58),dimnames=list(c('Y','X','yt-3'),1:58))
> y <- array(NA,dim=c(3,58),dimnames=list(c('Y','X','yt-3'),1:58))
> 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'
> 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 yt-3 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 4138 613 5560 1 0 0 0 0 0 0 0 0 0 0 1
2 4634 611 3922 0 1 0 0 0 0 0 0 0 0 0 2
3 3996 594 3759 0 0 1 0 0 0 0 0 0 0 0 3
4 4308 595 4138 0 0 0 1 0 0 0 0 0 0 0 4
5 4143 591 4634 0 0 0 0 1 0 0 0 0 0 0 5
6 4429 589 3996 0 0 0 0 0 1 0 0 0 0 0 6
7 5219 584 4308 0 0 0 0 0 0 1 0 0 0 0 7
8 4929 573 4143 0 0 0 0 0 0 0 1 0 0 0 8
9 5755 567 4429 0 0 0 0 0 0 0 0 1 0 0 9
10 5592 569 5219 0 0 0 0 0 0 0 0 0 1 0 10
11 4163 621 4929 0 0 0 0 0 0 0 0 0 0 1 11
12 4962 629 5755 0 0 0 0 0 0 0 0 0 0 0 12
13 5208 628 5592 1 0 0 0 0 0 0 0 0 0 0 13
14 4755 612 4163 0 1 0 0 0 0 0 0 0 0 0 14
15 4491 595 4962 0 0 1 0 0 0 0 0 0 0 0 15
16 5732 597 5208 0 0 0 1 0 0 0 0 0 0 0 16
17 5731 593 4755 0 0 0 0 1 0 0 0 0 0 0 17
18 5040 590 4491 0 0 0 0 0 1 0 0 0 0 0 18
19 6102 580 5732 0 0 0 0 0 0 1 0 0 0 0 19
20 4904 574 5731 0 0 0 0 0 0 0 1 0 0 0 20
21 5369 573 5040 0 0 0 0 0 0 0 0 1 0 0 21
22 5578 573 6102 0 0 0 0 0 0 0 0 0 1 0 22
23 4619 620 4904 0 0 0 0 0 0 0 0 0 0 1 23
24 4731 626 5369 0 0 0 0 0 0 0 0 0 0 0 24
25 5011 620 5578 1 0 0 0 0 0 0 0 0 0 0 25
26 5299 588 4619 0 1 0 0 0 0 0 0 0 0 0 26
27 4146 566 4731 0 0 1 0 0 0 0 0 0 0 0 27
28 4625 557 5011 0 0 0 1 0 0 0 0 0 0 0 28
29 4736 561 5299 0 0 0 0 1 0 0 0 0 0 0 29
30 4219 549 4146 0 0 0 0 0 1 0 0 0 0 0 30
31 5116 532 4625 0 0 0 0 0 0 1 0 0 0 0 31
32 4205 526 4736 0 0 0 0 0 0 0 1 0 0 0 32
33 4121 511 4219 0 0 0 0 0 0 0 0 1 0 0 33
34 5103 499 5116 0 0 0 0 0 0 0 0 0 1 0 34
35 4300 555 4205 0 0 0 0 0 0 0 0 0 0 1 35
36 4578 565 4121 0 0 0 0 0 0 0 0 0 0 0 36
37 3809 542 5103 1 0 0 0 0 0 0 0 0 0 0 37
38 5526 527 4300 0 1 0 0 0 0 0 0 0 0 0 38
39 4247 510 4578 0 0 1 0 0 0 0 0 0 0 0 39
40 3830 514 3809 0 0 0 1 0 0 0 0 0 0 0 40
41 4394 517 5526 0 0 0 0 1 0 0 0 0 0 0 41
42 4826 508 4247 0 0 0 0 0 1 0 0 0 0 0 42
43 4409 493 3830 0 0 0 0 0 0 1 0 0 0 0 43
44 4569 490 4394 0 0 0 0 0 0 0 1 0 0 0 44
45 4106 469 4826 0 0 0 0 0 0 0 0 1 0 0 45
46 4794 478 4409 0 0 0 0 0 0 0 0 0 1 0 46
47 3914 528 4569 0 0 0 0 0 0 0 0 0 0 1 47
48 3793 534 4106 0 0 0 0 0 0 0 0 0 0 0 48
49 4405 518 4794 1 0 0 0 0 0 0 0 0 0 0 49
50 4022 506 3914 0 1 0 0 0 0 0 0 0 0 0 50
51 4100 502 3793 0 0 1 0 0 0 0 0 0 0 0 51
52 4788 516 4405 0 0 0 1 0 0 0 0 0 0 0 52
53 3163 528 4022 0 0 0 0 1 0 0 0 0 0 0 53
54 3585 533 4100 0 0 0 0 0 1 0 0 0 0 0 54
55 3903 536 4788 0 0 0 0 0 0 1 0 0 0 0 55
56 4178 537 3163 0 0 0 0 0 0 0 1 0 0 0 56
57 3863 524 3585 0 0 0 0 0 0 0 0 1 0 0 57
58 4187 536 3903 0 0 0 0 0 0 0 0 0 1 0 58
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X `yt-3` M1 M2 M3
1793.725 1.606 0.428 -252.500 603.669 -90.472
M4 M5 M6 M7 M8 M9
312.032 -47.431 234.187 590.986 311.522 430.916
M10 M11 t
618.344 -185.133 -9.782
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-853.80 -322.74 -84.83 306.91 1163.45
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1793.7249 2025.6732 0.885 0.38081
X 1.6064 3.0603 0.525 0.60233
`yt-3` 0.4280 0.1297 3.300 0.00195 **
M1 -252.4998 333.2200 -0.758 0.45273
M2 603.6690 345.1162 1.749 0.08740 .
M3 -90.4715 351.3533 -0.257 0.79803
M4 312.0321 344.5180 0.906 0.37014
M5 -47.4314 339.3863 -0.140 0.88951
M6 234.1871 348.3528 0.672 0.50501
M7 590.9860 348.3548 1.697 0.09702 .
M8 311.5215 353.3272 0.882 0.38285
M9 430.9157 364.9102 1.181 0.24414
M10 618.3436 360.8073 1.714 0.09377 .
M11 -185.1332 344.0659 -0.538 0.59330
t -9.7822 7.0187 -1.394 0.17056
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 483.8 on 43 degrees of freedom
Multiple R-squared: 0.5423, Adjusted R-squared: 0.3933
F-statistic: 3.639 on 14 and 43 DF, p-value: 0.0005453
> 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.72111198 0.5577760 0.27888802
[2,] 0.61550493 0.7689901 0.38449507
[3,] 0.63111404 0.7377719 0.36888596
[4,] 0.79561078 0.4087784 0.20438922
[5,] 0.74252748 0.5149450 0.25747252
[6,] 0.66169719 0.6766056 0.33830281
[7,] 0.64907096 0.7018581 0.35092904
[8,] 0.57822827 0.8435435 0.42177173
[9,] 0.48804795 0.9760959 0.51195205
[10,] 0.42215294 0.8443059 0.57784706
[11,] 0.33666198 0.6733240 0.66333802
[12,] 0.27611737 0.5522347 0.72388263
[13,] 0.20550063 0.4110013 0.79449937
[14,] 0.16403934 0.3280787 0.83596066
[15,] 0.15696022 0.3139204 0.84303978
[16,] 0.12906819 0.2581364 0.87093181
[17,] 0.12316774 0.2463355 0.87683226
[18,] 0.11462543 0.2292509 0.88537457
[19,] 0.09120007 0.1824001 0.90879993
[20,] 0.11263069 0.2252614 0.88736931
[21,] 0.29512984 0.5902597 0.70487016
[22,] 0.19862954 0.3972591 0.80137046
[23,] 0.92393202 0.1521360 0.07606798
> postscript(file="/var/www/html/rcomp/tmp/1q2o01261334438.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/214l11261334438.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/3prnv1261334438.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/4uz3z1261334438.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/5e49t1261334438.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 = 58
Frequency = 1
1 2 3 4 5 6 7
-757.63806 -403.80863 -240.81918 -485.34490 -486.94317 -196.52636 120.96461
8 9 10 11 12 13 14
208.49556 812.12462 130.17557 -444.98890 -187.68831 391.95803 -270.16721
15 16 17 18 19 20 21
-144.87800 594.90894 1163.44739 318.41251 518.35799 -380.32895 272.38781
22 23 24 25 26 27 28
-150.75434 140.70343 -131.28860 331.18755 234.62215 -227.04619 -246.13961
29 30 31 32 33 34 35
104.42720 -171.69115 200.60680 -459.01198 -407.27118 32.47731 342.65217
36 37 38 39 40 41 42
465.18614 -424.84422 813.51941 146.77726 -340.26633 -146.65200 575.33377
43 44 45 46 47 48 49
13.87362 226.56849 -497.18905 177.16824 -38.36670 -146.20923 459.33670
50 51 52 53 54 55 56
-374.16572 465.96612 476.84189 -634.27942 -525.52877 -853.80301 404.27689
57 58
-180.05220 -189.06678
> postscript(file="/var/www/html/rcomp/tmp/6jjb31261334438.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 = 58
Frequency = 1
lag(myerror, k = 1) myerror
0 -757.63806 NA
1 -403.80863 -757.63806
2 -240.81918 -403.80863
3 -485.34490 -240.81918
4 -486.94317 -485.34490
5 -196.52636 -486.94317
6 120.96461 -196.52636
7 208.49556 120.96461
8 812.12462 208.49556
9 130.17557 812.12462
10 -444.98890 130.17557
11 -187.68831 -444.98890
12 391.95803 -187.68831
13 -270.16721 391.95803
14 -144.87800 -270.16721
15 594.90894 -144.87800
16 1163.44739 594.90894
17 318.41251 1163.44739
18 518.35799 318.41251
19 -380.32895 518.35799
20 272.38781 -380.32895
21 -150.75434 272.38781
22 140.70343 -150.75434
23 -131.28860 140.70343
24 331.18755 -131.28860
25 234.62215 331.18755
26 -227.04619 234.62215
27 -246.13961 -227.04619
28 104.42720 -246.13961
29 -171.69115 104.42720
30 200.60680 -171.69115
31 -459.01198 200.60680
32 -407.27118 -459.01198
33 32.47731 -407.27118
34 342.65217 32.47731
35 465.18614 342.65217
36 -424.84422 465.18614
37 813.51941 -424.84422
38 146.77726 813.51941
39 -340.26633 146.77726
40 -146.65200 -340.26633
41 575.33377 -146.65200
42 13.87362 575.33377
43 226.56849 13.87362
44 -497.18905 226.56849
45 177.16824 -497.18905
46 -38.36670 177.16824
47 -146.20923 -38.36670
48 459.33670 -146.20923
49 -374.16572 459.33670
50 465.96612 -374.16572
51 476.84189 465.96612
52 -634.27942 476.84189
53 -525.52877 -634.27942
54 -853.80301 -525.52877
55 404.27689 -853.80301
56 -180.05220 404.27689
57 -189.06678 -180.05220
58 NA -189.06678
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -403.80863 -757.63806
[2,] -240.81918 -403.80863
[3,] -485.34490 -240.81918
[4,] -486.94317 -485.34490
[5,] -196.52636 -486.94317
[6,] 120.96461 -196.52636
[7,] 208.49556 120.96461
[8,] 812.12462 208.49556
[9,] 130.17557 812.12462
[10,] -444.98890 130.17557
[11,] -187.68831 -444.98890
[12,] 391.95803 -187.68831
[13,] -270.16721 391.95803
[14,] -144.87800 -270.16721
[15,] 594.90894 -144.87800
[16,] 1163.44739 594.90894
[17,] 318.41251 1163.44739
[18,] 518.35799 318.41251
[19,] -380.32895 518.35799
[20,] 272.38781 -380.32895
[21,] -150.75434 272.38781
[22,] 140.70343 -150.75434
[23,] -131.28860 140.70343
[24,] 331.18755 -131.28860
[25,] 234.62215 331.18755
[26,] -227.04619 234.62215
[27,] -246.13961 -227.04619
[28,] 104.42720 -246.13961
[29,] -171.69115 104.42720
[30,] 200.60680 -171.69115
[31,] -459.01198 200.60680
[32,] -407.27118 -459.01198
[33,] 32.47731 -407.27118
[34,] 342.65217 32.47731
[35,] 465.18614 342.65217
[36,] -424.84422 465.18614
[37,] 813.51941 -424.84422
[38,] 146.77726 813.51941
[39,] -340.26633 146.77726
[40,] -146.65200 -340.26633
[41,] 575.33377 -146.65200
[42,] 13.87362 575.33377
[43,] 226.56849 13.87362
[44,] -497.18905 226.56849
[45,] 177.16824 -497.18905
[46,] -38.36670 177.16824
[47,] -146.20923 -38.36670
[48,] 459.33670 -146.20923
[49,] -374.16572 459.33670
[50,] 465.96612 -374.16572
[51,] 476.84189 465.96612
[52,] -634.27942 476.84189
[53,] -525.52877 -634.27942
[54,] -853.80301 -525.52877
[55,] 404.27689 -853.80301
[56,] -180.05220 404.27689
[57,] -189.06678 -180.05220
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -403.80863 -757.63806
2 -240.81918 -403.80863
3 -485.34490 -240.81918
4 -486.94317 -485.34490
5 -196.52636 -486.94317
6 120.96461 -196.52636
7 208.49556 120.96461
8 812.12462 208.49556
9 130.17557 812.12462
10 -444.98890 130.17557
11 -187.68831 -444.98890
12 391.95803 -187.68831
13 -270.16721 391.95803
14 -144.87800 -270.16721
15 594.90894 -144.87800
16 1163.44739 594.90894
17 318.41251 1163.44739
18 518.35799 318.41251
19 -380.32895 518.35799
20 272.38781 -380.32895
21 -150.75434 272.38781
22 140.70343 -150.75434
23 -131.28860 140.70343
24 331.18755 -131.28860
25 234.62215 331.18755
26 -227.04619 234.62215
27 -246.13961 -227.04619
28 104.42720 -246.13961
29 -171.69115 104.42720
30 200.60680 -171.69115
31 -459.01198 200.60680
32 -407.27118 -459.01198
33 32.47731 -407.27118
34 342.65217 32.47731
35 465.18614 342.65217
36 -424.84422 465.18614
37 813.51941 -424.84422
38 146.77726 813.51941
39 -340.26633 146.77726
40 -146.65200 -340.26633
41 575.33377 -146.65200
42 13.87362 575.33377
43 226.56849 13.87362
44 -497.18905 226.56849
45 177.16824 -497.18905
46 -38.36670 177.16824
47 -146.20923 -38.36670
48 459.33670 -146.20923
49 -374.16572 459.33670
50 465.96612 -374.16572
51 476.84189 465.96612
52 -634.27942 476.84189
53 -525.52877 -634.27942
54 -853.80301 -525.52877
55 404.27689 -853.80301
56 -180.05220 404.27689
57 -189.06678 -180.05220
> 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/7o8z01261334438.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/8ci651261334438.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/9qoh61261334438.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/1007co1261334438.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/11m8391261334438.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/12g76y1261334438.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/13tars1261334438.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/14vf0v1261334438.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/15pqfp1261334438.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/16u8c71261334438.tab")
+ }
>
> try(system("convert tmp/1q2o01261334438.ps tmp/1q2o01261334438.png",intern=TRUE))
character(0)
> try(system("convert tmp/214l11261334438.ps tmp/214l11261334438.png",intern=TRUE))
character(0)
> try(system("convert tmp/3prnv1261334438.ps tmp/3prnv1261334438.png",intern=TRUE))
character(0)
> try(system("convert tmp/4uz3z1261334438.ps tmp/4uz3z1261334438.png",intern=TRUE))
character(0)
> try(system("convert tmp/5e49t1261334438.ps tmp/5e49t1261334438.png",intern=TRUE))
character(0)
> try(system("convert tmp/6jjb31261334438.ps tmp/6jjb31261334438.png",intern=TRUE))
character(0)
> try(system("convert tmp/7o8z01261334438.ps tmp/7o8z01261334438.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ci651261334438.ps tmp/8ci651261334438.png",intern=TRUE))
character(0)
> try(system("convert tmp/9qoh61261334438.ps tmp/9qoh61261334438.png",intern=TRUE))
character(0)
> try(system("convert tmp/1007co1261334438.ps tmp/1007co1261334438.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.375 1.610 5.338