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(0.6348,1.5291,0.634,1.5358,0.62915,1.5355,0.62168,1.5287,0.61328,1.5334,0.6089,1.5225,0.60857,1.5135,0.62672,1.5144,0.62291,1.4913,0.62393,1.4793,0.61838,1.4663,0.62012,1.4749,0.61659,1.4745,0.6116,1.4775,0.61573,1.4678,0.61407,1.4658,0.62823,1.4572,0.64405,1.4721,0.6387,1.4624,0.63633,1.4636,0.63059,1.4649,0.62994,1.465,0.63709,1.4673,0.64217,1.4679,0.65711,1.4621,0.66977,1.4674,0.68255,1.4695,0.68902,1.4964,0.71322,1.5155,0.70224,1.5411,0.70045,1.5476,0.69919,1.54,0.69693,1.5474,0.69763,1.5485,0.69278,1.559,0.70196,1.5544,0.69215,1.5657,0.6769,1.5734,0.67124,1.567,0.66532,1.5547,0.67157,1.54,0.66428,1.5192,0.66576,1.527,0.66942,1.5387,0.6813,1.5431,0.69144,1.5426,0.69862,1.5216,0.695,1.5364,0.69867,1.5469,0.68968,1.5501,0.69233,1.5494,0.68293,1.5475,0.68399,1.5448,0.66895,1.5391,0.68756,1.5578,0.68527,1.5528,0.6776,1.5496,0.68137,1.549,0.67933,1.5449,0.67922,1.5479),dim=c(2,60),dimnames=list(c('Britse_pond','Zwitserse_frank'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Britse_pond','Zwitserse_frank'),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 = 'Do not include Seasonal 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
Britse_pond Zwitserse_frank
1 0.63480 1.5291
2 0.63400 1.5358
3 0.62915 1.5355
4 0.62168 1.5287
5 0.61328 1.5334
6 0.60890 1.5225
7 0.60857 1.5135
8 0.62672 1.5144
9 0.62291 1.4913
10 0.62393 1.4793
11 0.61838 1.4663
12 0.62012 1.4749
13 0.61659 1.4745
14 0.61160 1.4775
15 0.61573 1.4678
16 0.61407 1.4658
17 0.62823 1.4572
18 0.64405 1.4721
19 0.63870 1.4624
20 0.63633 1.4636
21 0.63059 1.4649
22 0.62994 1.4650
23 0.63709 1.4673
24 0.64217 1.4679
25 0.65711 1.4621
26 0.66977 1.4674
27 0.68255 1.4695
28 0.68902 1.4964
29 0.71322 1.5155
30 0.70224 1.5411
31 0.70045 1.5476
32 0.69919 1.5400
33 0.69693 1.5474
34 0.69763 1.5485
35 0.69278 1.5590
36 0.70196 1.5544
37 0.69215 1.5657
38 0.67690 1.5734
39 0.67124 1.5670
40 0.66532 1.5547
41 0.67157 1.5400
42 0.66428 1.5192
43 0.66576 1.5270
44 0.66942 1.5387
45 0.68130 1.5431
46 0.69144 1.5426
47 0.69862 1.5216
48 0.69500 1.5364
49 0.69867 1.5469
50 0.68968 1.5501
51 0.69233 1.5494
52 0.68293 1.5475
53 0.68399 1.5448
54 0.66895 1.5391
55 0.68756 1.5578
56 0.68527 1.5528
57 0.67760 1.5496
58 0.68137 1.5490
59 0.67933 1.5449
60 0.67922 1.5479
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Zwitserse_frank
-0.1910 0.5612
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.05629 -0.01630 0.00318 0.01452 0.05370
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.1910 0.1347 -1.418 0.161
Zwitserse_frank 0.5612 0.0887 6.327 3.91e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.02467 on 58 degrees of freedom
Multiple R-squared: 0.4084, Adjusted R-squared: 0.3982
F-statistic: 40.03 on 1 and 58 DF, p-value: 3.914e-08
> 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.126043355 2.520867e-01 8.739566e-01
[2,] 0.086142977 1.722860e-01 9.138570e-01
[3,] 0.050412926 1.008259e-01 9.495871e-01
[4,] 0.070337246 1.406745e-01 9.296628e-01
[5,] 0.062975177 1.259504e-01 9.370248e-01
[6,] 0.039655229 7.931046e-02 9.603448e-01
[7,] 0.021127102 4.225420e-02 9.788729e-01
[8,] 0.011561143 2.312229e-02 9.884389e-01
[9,] 0.007019170 1.403834e-02 9.929808e-01
[10,] 0.006743951 1.348790e-02 9.932560e-01
[11,] 0.004634296 9.268592e-03 9.953657e-01
[12,] 0.003834437 7.668873e-03 9.961656e-01
[13,] 0.004852822 9.705643e-03 9.951472e-01
[14,] 0.027691665 5.538333e-02 9.723083e-01
[15,] 0.038542584 7.708517e-02 9.614574e-01
[16,] 0.040756192 8.151238e-02 9.592438e-01
[17,] 0.040431752 8.086350e-02 9.595682e-01
[18,] 0.048870687 9.774137e-02 9.511293e-01
[19,] 0.076535125 1.530703e-01 9.234649e-01
[20,] 0.155166967 3.103339e-01 8.448330e-01
[21,] 0.385275980 7.705520e-01 6.147240e-01
[22,] 0.737827715 5.243446e-01 2.621723e-01
[23,] 0.941197299 1.176054e-01 5.880270e-02
[24,] 0.991542344 1.691531e-02 8.457656e-03
[25,] 0.999927263 1.454733e-04 7.273664e-05
[26,] 0.999990297 1.940542e-05 9.702708e-06
[27,] 0.999996329 7.342294e-06 3.671147e-06
[28,] 0.999998052 3.896940e-06 1.948470e-06
[29,] 0.999998131 3.737364e-06 1.868682e-06
[30,] 0.999998155 3.690899e-06 1.845450e-06
[31,] 0.999996475 7.049892e-06 3.524946e-06
[32,] 0.999997803 4.394832e-06 2.197416e-06
[33,] 0.999995712 8.576729e-06 4.288365e-06
[34,] 0.999989151 2.169857e-05 1.084929e-05
[35,] 0.999983648 3.270483e-05 1.635242e-05
[36,] 0.999989250 2.149906e-05 1.074953e-05
[37,] 0.999979290 4.141920e-05 2.070960e-05
[38,] 0.999972398 5.520317e-05 2.760159e-05
[39,] 0.999984826 3.034800e-05 1.517400e-05
[40,] 0.999991699 1.660195e-05 8.300977e-06
[41,] 0.999976597 4.680501e-05 2.340251e-05
[42,] 0.999936366 1.272684e-04 6.363422e-05
[43,] 0.999917841 1.643190e-04 8.215949e-05
[44,] 0.999960930 7.813973e-05 3.906987e-05
[45,] 0.999995530 8.939138e-06 4.469569e-06
[46,] 0.999987133 2.573400e-05 1.286700e-05
[47,] 0.999994834 1.033293e-05 5.166467e-06
[48,] 0.999970057 5.988613e-05 2.994307e-05
[49,] 0.999982844 3.431119e-05 1.715560e-05
[50,] 0.999894569 2.108615e-04 1.054308e-04
[51,] 0.998685943 2.628114e-03 1.314057e-03
> postscript(file="/var/www/html/rcomp/tmp/1vovz1258644760.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/2oifp1258644760.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/3xd641258644760.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/490af1258644760.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/5erem1258644760.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
-0.0323520338 -0.0369122919 -0.0415939221 -0.0452475408 -0.0562853338
6 7 8 9 10
-0.0545478990 -0.0498268061 -0.0321819154 -0.0230274436 -0.0152726530
11 12 13 14 15
-0.0135266299 -0.0166132298 -0.0199187368 -0.0265924345 -0.0170184788
16 17 18 19 20
-0.0175560137 0.0014305862 0.0088882213 0.0089821770 0.0059386979
21 22 23 24 25
-0.0005309044 -0.0012370276 0.0046221375 0.0093653980 0.0275605467
26 27 28 29 30
0.0372460143 0.0488474259 0.0402202704 0.0537007288 0.0283531756
31 32 33 34 35
0.0229151641 0.0259205314 0.0195074106 0.0195900548 0.0088471131
36 37 38 39 40
0.0206087828 0.0044568550 -0.0151146356 -0.0171827473 -0.0161995870
41 42 43 44 45
-0.0016994686 0.0026841684 -0.0002134455 -0.0031198663 0.0062907105
46 47 48 49 50
0.0167113268 0.0356772103 0.0237509686 0.0215280269 0.0107420827
51 52 53 54 55
0.0137849455 0.0054512873 0.0080266152 -0.0038143593 0.0043005921
56 57 58 59 60
0.0048167549 -0.0010573010 0.0030494385 0.0033104920 0.0015167943
> postscript(file="/var/www/html/rcomp/tmp/63pd01258644760.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 -0.0323520338 NA
1 -0.0369122919 -0.0323520338
2 -0.0415939221 -0.0369122919
3 -0.0452475408 -0.0415939221
4 -0.0562853338 -0.0452475408
5 -0.0545478990 -0.0562853338
6 -0.0498268061 -0.0545478990
7 -0.0321819154 -0.0498268061
8 -0.0230274436 -0.0321819154
9 -0.0152726530 -0.0230274436
10 -0.0135266299 -0.0152726530
11 -0.0166132298 -0.0135266299
12 -0.0199187368 -0.0166132298
13 -0.0265924345 -0.0199187368
14 -0.0170184788 -0.0265924345
15 -0.0175560137 -0.0170184788
16 0.0014305862 -0.0175560137
17 0.0088882213 0.0014305862
18 0.0089821770 0.0088882213
19 0.0059386979 0.0089821770
20 -0.0005309044 0.0059386979
21 -0.0012370276 -0.0005309044
22 0.0046221375 -0.0012370276
23 0.0093653980 0.0046221375
24 0.0275605467 0.0093653980
25 0.0372460143 0.0275605467
26 0.0488474259 0.0372460143
27 0.0402202704 0.0488474259
28 0.0537007288 0.0402202704
29 0.0283531756 0.0537007288
30 0.0229151641 0.0283531756
31 0.0259205314 0.0229151641
32 0.0195074106 0.0259205314
33 0.0195900548 0.0195074106
34 0.0088471131 0.0195900548
35 0.0206087828 0.0088471131
36 0.0044568550 0.0206087828
37 -0.0151146356 0.0044568550
38 -0.0171827473 -0.0151146356
39 -0.0161995870 -0.0171827473
40 -0.0016994686 -0.0161995870
41 0.0026841684 -0.0016994686
42 -0.0002134455 0.0026841684
43 -0.0031198663 -0.0002134455
44 0.0062907105 -0.0031198663
45 0.0167113268 0.0062907105
46 0.0356772103 0.0167113268
47 0.0237509686 0.0356772103
48 0.0215280269 0.0237509686
49 0.0107420827 0.0215280269
50 0.0137849455 0.0107420827
51 0.0054512873 0.0137849455
52 0.0080266152 0.0054512873
53 -0.0038143593 0.0080266152
54 0.0043005921 -0.0038143593
55 0.0048167549 0.0043005921
56 -0.0010573010 0.0048167549
57 0.0030494385 -0.0010573010
58 0.0033104920 0.0030494385
59 0.0015167943 0.0033104920
60 NA 0.0015167943
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.0369122919 -0.0323520338
[2,] -0.0415939221 -0.0369122919
[3,] -0.0452475408 -0.0415939221
[4,] -0.0562853338 -0.0452475408
[5,] -0.0545478990 -0.0562853338
[6,] -0.0498268061 -0.0545478990
[7,] -0.0321819154 -0.0498268061
[8,] -0.0230274436 -0.0321819154
[9,] -0.0152726530 -0.0230274436
[10,] -0.0135266299 -0.0152726530
[11,] -0.0166132298 -0.0135266299
[12,] -0.0199187368 -0.0166132298
[13,] -0.0265924345 -0.0199187368
[14,] -0.0170184788 -0.0265924345
[15,] -0.0175560137 -0.0170184788
[16,] 0.0014305862 -0.0175560137
[17,] 0.0088882213 0.0014305862
[18,] 0.0089821770 0.0088882213
[19,] 0.0059386979 0.0089821770
[20,] -0.0005309044 0.0059386979
[21,] -0.0012370276 -0.0005309044
[22,] 0.0046221375 -0.0012370276
[23,] 0.0093653980 0.0046221375
[24,] 0.0275605467 0.0093653980
[25,] 0.0372460143 0.0275605467
[26,] 0.0488474259 0.0372460143
[27,] 0.0402202704 0.0488474259
[28,] 0.0537007288 0.0402202704
[29,] 0.0283531756 0.0537007288
[30,] 0.0229151641 0.0283531756
[31,] 0.0259205314 0.0229151641
[32,] 0.0195074106 0.0259205314
[33,] 0.0195900548 0.0195074106
[34,] 0.0088471131 0.0195900548
[35,] 0.0206087828 0.0088471131
[36,] 0.0044568550 0.0206087828
[37,] -0.0151146356 0.0044568550
[38,] -0.0171827473 -0.0151146356
[39,] -0.0161995870 -0.0171827473
[40,] -0.0016994686 -0.0161995870
[41,] 0.0026841684 -0.0016994686
[42,] -0.0002134455 0.0026841684
[43,] -0.0031198663 -0.0002134455
[44,] 0.0062907105 -0.0031198663
[45,] 0.0167113268 0.0062907105
[46,] 0.0356772103 0.0167113268
[47,] 0.0237509686 0.0356772103
[48,] 0.0215280269 0.0237509686
[49,] 0.0107420827 0.0215280269
[50,] 0.0137849455 0.0107420827
[51,] 0.0054512873 0.0137849455
[52,] 0.0080266152 0.0054512873
[53,] -0.0038143593 0.0080266152
[54,] 0.0043005921 -0.0038143593
[55,] 0.0048167549 0.0043005921
[56,] -0.0010573010 0.0048167549
[57,] 0.0030494385 -0.0010573010
[58,] 0.0033104920 0.0030494385
[59,] 0.0015167943 0.0033104920
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.0369122919 -0.0323520338
2 -0.0415939221 -0.0369122919
3 -0.0452475408 -0.0415939221
4 -0.0562853338 -0.0452475408
5 -0.0545478990 -0.0562853338
6 -0.0498268061 -0.0545478990
7 -0.0321819154 -0.0498268061
8 -0.0230274436 -0.0321819154
9 -0.0152726530 -0.0230274436
10 -0.0135266299 -0.0152726530
11 -0.0166132298 -0.0135266299
12 -0.0199187368 -0.0166132298
13 -0.0265924345 -0.0199187368
14 -0.0170184788 -0.0265924345
15 -0.0175560137 -0.0170184788
16 0.0014305862 -0.0175560137
17 0.0088882213 0.0014305862
18 0.0089821770 0.0088882213
19 0.0059386979 0.0089821770
20 -0.0005309044 0.0059386979
21 -0.0012370276 -0.0005309044
22 0.0046221375 -0.0012370276
23 0.0093653980 0.0046221375
24 0.0275605467 0.0093653980
25 0.0372460143 0.0275605467
26 0.0488474259 0.0372460143
27 0.0402202704 0.0488474259
28 0.0537007288 0.0402202704
29 0.0283531756 0.0537007288
30 0.0229151641 0.0283531756
31 0.0259205314 0.0229151641
32 0.0195074106 0.0259205314
33 0.0195900548 0.0195074106
34 0.0088471131 0.0195900548
35 0.0206087828 0.0088471131
36 0.0044568550 0.0206087828
37 -0.0151146356 0.0044568550
38 -0.0171827473 -0.0151146356
39 -0.0161995870 -0.0171827473
40 -0.0016994686 -0.0161995870
41 0.0026841684 -0.0016994686
42 -0.0002134455 0.0026841684
43 -0.0031198663 -0.0002134455
44 0.0062907105 -0.0031198663
45 0.0167113268 0.0062907105
46 0.0356772103 0.0167113268
47 0.0237509686 0.0356772103
48 0.0215280269 0.0237509686
49 0.0107420827 0.0215280269
50 0.0137849455 0.0107420827
51 0.0054512873 0.0137849455
52 0.0080266152 0.0054512873
53 -0.0038143593 0.0080266152
54 0.0043005921 -0.0038143593
55 0.0048167549 0.0043005921
56 -0.0010573010 0.0048167549
57 0.0030494385 -0.0010573010
58 0.0033104920 0.0030494385
59 0.0015167943 0.0033104920
> 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/724e01258644760.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/8ftnx1258644760.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/9lblo1258644760.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/1088rz1258644760.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/11uk7f1258644760.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/12ha5i1258644760.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/13jj2j1258644760.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/14htsn1258644760.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/15lwk11258644760.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/16diqg1258644760.tab")
+ }
>
> system("convert tmp/1vovz1258644760.ps tmp/1vovz1258644760.png")
> system("convert tmp/2oifp1258644760.ps tmp/2oifp1258644760.png")
> system("convert tmp/3xd641258644760.ps tmp/3xd641258644760.png")
> system("convert tmp/490af1258644760.ps tmp/490af1258644760.png")
> system("convert tmp/5erem1258644760.ps tmp/5erem1258644760.png")
> system("convert tmp/63pd01258644760.ps tmp/63pd01258644760.png")
> system("convert tmp/724e01258644760.ps tmp/724e01258644760.png")
> system("convert tmp/8ftnx1258644760.ps tmp/8ftnx1258644760.png")
> system("convert tmp/9lblo1258644760.ps tmp/9lblo1258644760.png")
> system("convert tmp/1088rz1258644760.ps tmp/1088rz1258644760.png")
>
>
> proc.time()
user system elapsed
2.565 1.614 9.851