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,139,595,135,591,130,589,127,584,122,573,117,567,112,569,113,621,149,629,157,628,157,612,147,595,137,597,132,593,125,590,123,580,117,574,114,573,111,573,112,620,144,626,150,620,149,588,134,566,123,557,116,561,117,549,111,532,105,526,102,511,95,499,93,555,124,565,130,542,124,527,115,510,106,514,105,517,105,508,101,493,95,490,93,469,84,478,87,528,116,534,120,518,117,506,109,502,105,516,107,528,109,533,109,536,108,537,107,524,99,536,103,587,131,597,137,581,135,564,124),dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> 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 594 139 1 0 0 0 0 0 0 0 0 0 0
2 595 135 0 1 0 0 0 0 0 0 0 0 0
3 591 130 0 0 1 0 0 0 0 0 0 0 0
4 589 127 0 0 0 1 0 0 0 0 0 0 0
5 584 122 0 0 0 0 1 0 0 0 0 0 0
6 573 117 0 0 0 0 0 1 0 0 0 0 0
7 567 112 0 0 0 0 0 0 1 0 0 0 0
8 569 113 0 0 0 0 0 0 0 1 0 0 0
9 621 149 0 0 0 0 0 0 0 0 1 0 0
10 629 157 0 0 0 0 0 0 0 0 0 1 0
11 628 157 0 0 0 0 0 0 0 0 0 0 1
12 612 147 0 0 0 0 0 0 0 0 0 0 0
13 595 137 1 0 0 0 0 0 0 0 0 0 0
14 597 132 0 1 0 0 0 0 0 0 0 0 0
15 593 125 0 0 1 0 0 0 0 0 0 0 0
16 590 123 0 0 0 1 0 0 0 0 0 0 0
17 580 117 0 0 0 0 1 0 0 0 0 0 0
18 574 114 0 0 0 0 0 1 0 0 0 0 0
19 573 111 0 0 0 0 0 0 1 0 0 0 0
20 573 112 0 0 0 0 0 0 0 1 0 0 0
21 620 144 0 0 0 0 0 0 0 0 1 0 0
22 626 150 0 0 0 0 0 0 0 0 0 1 0
23 620 149 0 0 0 0 0 0 0 0 0 0 1
24 588 134 0 0 0 0 0 0 0 0 0 0 0
25 566 123 1 0 0 0 0 0 0 0 0 0 0
26 557 116 0 1 0 0 0 0 0 0 0 0 0
27 561 117 0 0 1 0 0 0 0 0 0 0 0
28 549 111 0 0 0 1 0 0 0 0 0 0 0
29 532 105 0 0 0 0 1 0 0 0 0 0 0
30 526 102 0 0 0 0 0 1 0 0 0 0 0
31 511 95 0 0 0 0 0 0 1 0 0 0 0
32 499 93 0 0 0 0 0 0 0 1 0 0 0
33 555 124 0 0 0 0 0 0 0 0 1 0 0
34 565 130 0 0 0 0 0 0 0 0 0 1 0
35 542 124 0 0 0 0 0 0 0 0 0 0 1
36 527 115 0 0 0 0 0 0 0 0 0 0 0
37 510 106 1 0 0 0 0 0 0 0 0 0 0
38 514 105 0 1 0 0 0 0 0 0 0 0 0
39 517 105 0 0 1 0 0 0 0 0 0 0 0
40 508 101 0 0 0 1 0 0 0 0 0 0 0
41 493 95 0 0 0 0 1 0 0 0 0 0 0
42 490 93 0 0 0 0 0 1 0 0 0 0 0
43 469 84 0 0 0 0 0 0 1 0 0 0 0
44 478 87 0 0 0 0 0 0 0 1 0 0 0
45 528 116 0 0 0 0 0 0 0 0 1 0 0
46 534 120 0 0 0 0 0 0 0 0 0 1 0
47 518 117 0 0 0 0 0 0 0 0 0 0 1
48 506 109 0 0 0 0 0 0 0 0 0 0 0
49 502 105 1 0 0 0 0 0 0 0 0 0 0
50 516 107 0 1 0 0 0 0 0 0 0 0 0
51 528 109 0 0 1 0 0 0 0 0 0 0 0
52 533 109 0 0 0 1 0 0 0 0 0 0 0
53 536 108 0 0 0 0 1 0 0 0 0 0 0
54 537 107 0 0 0 0 0 1 0 0 0 0 0
55 524 99 0 0 0 0 0 0 1 0 0 0 0
56 536 103 0 0 0 0 0 0 0 1 0 0 0
57 587 131 0 0 0 0 0 0 0 0 1 0 0
58 597 137 0 0 0 0 0 0 0 0 0 1 0
59 581 135 0 0 0 0 0 0 0 0 0 0 1
60 564 124 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
176.905 3.040 5.554 17.075 24.748 29.670
M5 M6 M7 M8 M9 M10
35.464 38.978 47.237 45.180 1.517 -8.726
M11
-13.829
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-16.5371 -4.8048 0.4078 3.7822 12.2729
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 176.90525 11.53630 15.335 < 2e-16 ***
X 3.04050 0.08725 34.850 < 2e-16 ***
M1 5.55390 5.03546 1.103 0.27566
M2 17.07539 5.05944 3.375 0.00149 **
M3 24.74829 5.08025 4.871 1.30e-05 ***
M4 29.66979 5.12545 5.789 5.61e-07 ***
M5 35.46418 5.22430 6.788 1.71e-08 ***
M6 38.97758 5.29642 7.359 2.34e-09 ***
M7 47.23677 5.49859 8.591 3.39e-11 ***
M8 45.18007 5.45012 8.290 9.44e-11 ***
M9 1.51651 5.06152 0.300 0.76579
M10 -8.72648 5.15096 -1.694 0.09685 .
M11 -13.82929 5.10894 -2.707 0.00944 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 7.944 on 47 degrees of freedom
Multiple R-squared: 0.9704, Adjusted R-squared: 0.9628
F-statistic: 128.3 on 12 and 47 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.0008606974 1.721395e-03 9.991393e-01
[2,] 0.0360528531 7.210571e-02 9.639471e-01
[3,] 0.0158405863 3.168117e-02 9.841594e-01
[4,] 0.0534852783 1.069706e-01 9.465147e-01
[5,] 0.0577461667 1.154923e-01 9.422538e-01
[6,] 0.0347221019 6.944420e-02 9.652779e-01
[7,] 0.0492381727 9.847635e-02 9.507618e-01
[8,] 0.1657108133 3.314216e-01 8.342892e-01
[9,] 0.8694870357 2.610259e-01 1.305130e-01
[10,] 0.9538015748 9.239685e-02 4.619843e-02
[11,] 0.9883610556 2.327789e-02 1.163894e-02
[12,] 0.9948722686 1.025546e-02 5.127731e-03
[13,] 0.9990834476 1.833105e-03 9.165524e-04
[14,] 0.9998897939 2.204122e-04 1.102061e-04
[15,] 0.9999693582 6.128355e-05 3.064177e-05
[16,] 0.9999778400 4.431993e-05 2.215997e-05
[17,] 0.9999802759 3.944811e-05 1.972406e-05
[18,] 0.9999678898 6.422031e-05 3.211015e-05
[19,] 0.9999762342 4.753167e-05 2.376584e-05
[20,] 0.9999162322 1.675357e-04 8.376784e-05
[21,] 0.9997905419 4.189162e-04 2.094581e-04
[22,] 0.9996341981 7.316037e-04 3.658019e-04
[23,] 0.9995683873 8.632254e-04 4.316127e-04
[24,] 0.9992304127 1.539175e-03 7.695873e-04
[25,] 0.9988531106 2.293779e-03 1.146889e-03
[26,] 0.9986205517 2.758897e-03 1.379448e-03
[27,] 0.9985015229 2.996954e-03 1.498477e-03
[28,] 0.9938473177 1.230536e-02 6.152682e-03
[29,] 0.9758786847 4.824263e-02 2.412132e-02
> postscript(file="/var/www/html/rcomp/tmp/1vi1n1258741048.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/22ib81258741048.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/39q6g1258741048.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/4etmq1258741048.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/5zmmr1258741048.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 = 60
Frequency = 1
1 2 3 4 5 6
-11.08847991 -9.44798109 -5.91838487 -3.71838487 0.68971489 1.37881229
7 8 9 10 11 12
2.32211395 3.33831347 -10.45608085 -16.53707849 -12.43427565 -11.85857494
13 14 15 16 17 18
-4.00748227 1.67351536 11.28410922 9.44361040 11.89220898 11.50030875
19 20 21 22 23 24
11.36261276 10.37881229 3.74641324 1.74641324 3.88971489 3.66790969
25 26 27 28 29 30
9.55950118 10.32149645 3.60809976 4.92959622 0.37819480 -0.01370544
31 32 33 34 35 36
-1.98940615 -5.85171016 -0.44361040 1.55638960 1.90218534 0.43738724
37 38 39 40 41 42
5.24798109 0.76698345 -3.90591442 -5.66541560 -8.21681702 -8.64921607
43 44 45 46 47 48
-10.54391915 -8.60871726 -3.11961986 0.96137778 -0.81432293 -2.31961986
49 50 51 52 53 54
0.28847991 -3.31401418 -5.06790969 -4.98940615 -4.74330165 -4.21619953
55 56 57 58 59 60
-1.15140142 0.74330165 10.27289787 12.27289787 7.45669835 10.07289787
> postscript(file="/var/www/html/rcomp/tmp/6pwjk1258741048.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -11.08847991 NA
1 -9.44798109 -11.08847991
2 -5.91838487 -9.44798109
3 -3.71838487 -5.91838487
4 0.68971489 -3.71838487
5 1.37881229 0.68971489
6 2.32211395 1.37881229
7 3.33831347 2.32211395
8 -10.45608085 3.33831347
9 -16.53707849 -10.45608085
10 -12.43427565 -16.53707849
11 -11.85857494 -12.43427565
12 -4.00748227 -11.85857494
13 1.67351536 -4.00748227
14 11.28410922 1.67351536
15 9.44361040 11.28410922
16 11.89220898 9.44361040
17 11.50030875 11.89220898
18 11.36261276 11.50030875
19 10.37881229 11.36261276
20 3.74641324 10.37881229
21 1.74641324 3.74641324
22 3.88971489 1.74641324
23 3.66790969 3.88971489
24 9.55950118 3.66790969
25 10.32149645 9.55950118
26 3.60809976 10.32149645
27 4.92959622 3.60809976
28 0.37819480 4.92959622
29 -0.01370544 0.37819480
30 -1.98940615 -0.01370544
31 -5.85171016 -1.98940615
32 -0.44361040 -5.85171016
33 1.55638960 -0.44361040
34 1.90218534 1.55638960
35 0.43738724 1.90218534
36 5.24798109 0.43738724
37 0.76698345 5.24798109
38 -3.90591442 0.76698345
39 -5.66541560 -3.90591442
40 -8.21681702 -5.66541560
41 -8.64921607 -8.21681702
42 -10.54391915 -8.64921607
43 -8.60871726 -10.54391915
44 -3.11961986 -8.60871726
45 0.96137778 -3.11961986
46 -0.81432293 0.96137778
47 -2.31961986 -0.81432293
48 0.28847991 -2.31961986
49 -3.31401418 0.28847991
50 -5.06790969 -3.31401418
51 -4.98940615 -5.06790969
52 -4.74330165 -4.98940615
53 -4.21619953 -4.74330165
54 -1.15140142 -4.21619953
55 0.74330165 -1.15140142
56 10.27289787 0.74330165
57 12.27289787 10.27289787
58 7.45669835 12.27289787
59 10.07289787 7.45669835
60 NA 10.07289787
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -9.44798109 -11.08847991
[2,] -5.91838487 -9.44798109
[3,] -3.71838487 -5.91838487
[4,] 0.68971489 -3.71838487
[5,] 1.37881229 0.68971489
[6,] 2.32211395 1.37881229
[7,] 3.33831347 2.32211395
[8,] -10.45608085 3.33831347
[9,] -16.53707849 -10.45608085
[10,] -12.43427565 -16.53707849
[11,] -11.85857494 -12.43427565
[12,] -4.00748227 -11.85857494
[13,] 1.67351536 -4.00748227
[14,] 11.28410922 1.67351536
[15,] 9.44361040 11.28410922
[16,] 11.89220898 9.44361040
[17,] 11.50030875 11.89220898
[18,] 11.36261276 11.50030875
[19,] 10.37881229 11.36261276
[20,] 3.74641324 10.37881229
[21,] 1.74641324 3.74641324
[22,] 3.88971489 1.74641324
[23,] 3.66790969 3.88971489
[24,] 9.55950118 3.66790969
[25,] 10.32149645 9.55950118
[26,] 3.60809976 10.32149645
[27,] 4.92959622 3.60809976
[28,] 0.37819480 4.92959622
[29,] -0.01370544 0.37819480
[30,] -1.98940615 -0.01370544
[31,] -5.85171016 -1.98940615
[32,] -0.44361040 -5.85171016
[33,] 1.55638960 -0.44361040
[34,] 1.90218534 1.55638960
[35,] 0.43738724 1.90218534
[36,] 5.24798109 0.43738724
[37,] 0.76698345 5.24798109
[38,] -3.90591442 0.76698345
[39,] -5.66541560 -3.90591442
[40,] -8.21681702 -5.66541560
[41,] -8.64921607 -8.21681702
[42,] -10.54391915 -8.64921607
[43,] -8.60871726 -10.54391915
[44,] -3.11961986 -8.60871726
[45,] 0.96137778 -3.11961986
[46,] -0.81432293 0.96137778
[47,] -2.31961986 -0.81432293
[48,] 0.28847991 -2.31961986
[49,] -3.31401418 0.28847991
[50,] -5.06790969 -3.31401418
[51,] -4.98940615 -5.06790969
[52,] -4.74330165 -4.98940615
[53,] -4.21619953 -4.74330165
[54,] -1.15140142 -4.21619953
[55,] 0.74330165 -1.15140142
[56,] 10.27289787 0.74330165
[57,] 12.27289787 10.27289787
[58,] 7.45669835 12.27289787
[59,] 10.07289787 7.45669835
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -9.44798109 -11.08847991
2 -5.91838487 -9.44798109
3 -3.71838487 -5.91838487
4 0.68971489 -3.71838487
5 1.37881229 0.68971489
6 2.32211395 1.37881229
7 3.33831347 2.32211395
8 -10.45608085 3.33831347
9 -16.53707849 -10.45608085
10 -12.43427565 -16.53707849
11 -11.85857494 -12.43427565
12 -4.00748227 -11.85857494
13 1.67351536 -4.00748227
14 11.28410922 1.67351536
15 9.44361040 11.28410922
16 11.89220898 9.44361040
17 11.50030875 11.89220898
18 11.36261276 11.50030875
19 10.37881229 11.36261276
20 3.74641324 10.37881229
21 1.74641324 3.74641324
22 3.88971489 1.74641324
23 3.66790969 3.88971489
24 9.55950118 3.66790969
25 10.32149645 9.55950118
26 3.60809976 10.32149645
27 4.92959622 3.60809976
28 0.37819480 4.92959622
29 -0.01370544 0.37819480
30 -1.98940615 -0.01370544
31 -5.85171016 -1.98940615
32 -0.44361040 -5.85171016
33 1.55638960 -0.44361040
34 1.90218534 1.55638960
35 0.43738724 1.90218534
36 5.24798109 0.43738724
37 0.76698345 5.24798109
38 -3.90591442 0.76698345
39 -5.66541560 -3.90591442
40 -8.21681702 -5.66541560
41 -8.64921607 -8.21681702
42 -10.54391915 -8.64921607
43 -8.60871726 -10.54391915
44 -3.11961986 -8.60871726
45 0.96137778 -3.11961986
46 -0.81432293 0.96137778
47 -2.31961986 -0.81432293
48 0.28847991 -2.31961986
49 -3.31401418 0.28847991
50 -5.06790969 -3.31401418
51 -4.98940615 -5.06790969
52 -4.74330165 -4.98940615
53 -4.21619953 -4.74330165
54 -1.15140142 -4.21619953
55 0.74330165 -1.15140142
56 10.27289787 0.74330165
57 12.27289787 10.27289787
58 7.45669835 12.27289787
59 10.07289787 7.45669835
> 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/7l2p61258741048.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/8ieu91258741048.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/9j1ib1258741048.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/10eqyc1258741048.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/11nsmt1258741048.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/120xri1258741049.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/13uoae1258741049.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/14yuxx1258741049.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/15qnmu1258741049.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/16lsp91258741049.tab")
+ }
>
> system("convert tmp/1vi1n1258741048.ps tmp/1vi1n1258741048.png")
> system("convert tmp/22ib81258741048.ps tmp/22ib81258741048.png")
> system("convert tmp/39q6g1258741048.ps tmp/39q6g1258741048.png")
> system("convert tmp/4etmq1258741048.ps tmp/4etmq1258741048.png")
> system("convert tmp/5zmmr1258741048.ps tmp/5zmmr1258741048.png")
> system("convert tmp/6pwjk1258741048.ps tmp/6pwjk1258741048.png")
> system("convert tmp/7l2p61258741048.ps tmp/7l2p61258741048.png")
> system("convert tmp/8ieu91258741048.ps tmp/8ieu91258741048.png")
> system("convert tmp/9j1ib1258741048.ps tmp/9j1ib1258741048.png")
> system("convert tmp/10eqyc1258741048.ps tmp/10eqyc1258741048.png")
>
>
> proc.time()
user system elapsed
2.381 1.537 2.766