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(1.4816
+ ,133.91
+ ,0.91557
+ ,43.6188
+ ,1.4562
+ ,133.14
+ ,0.89135
+ ,44.7624
+ ,1.4268
+ ,135.31
+ ,0.86265
+ ,45.1972
+ ,1.4088
+ ,133.09
+ ,0.86092
+ ,44.3881
+ ,1.4016
+ ,135.39
+ ,0.85670
+ ,43.5552
+ ,1.3650
+ ,131.85
+ ,0.88444
+ ,43.5678
+ ,1.3190
+ ,130.25
+ ,0.89756
+ ,44.2135
+ ,1.3050
+ ,127.65
+ ,0.91966
+ ,45.1450
+ ,1.2785
+ ,118.30
+ ,0.88691
+ ,45.8079
+ ,1.3239
+ ,119.73
+ ,0.91819
+ ,42.3282
+ ,1.3449
+ ,122.51
+ ,0.90448
+ ,37.8999
+ ,1.2732
+ ,123.28
+ ,0.83063
+ ,34.7964
+ ,1.3322
+ ,133.52
+ ,0.78668
+ ,35.2144
+ ,1.4369
+ ,153.20
+ ,0.79924
+ ,36.3727
+ ,1.4975
+ ,163.63
+ ,0.79279
+ ,36.2502
+ ,1.5770
+ ,168.45
+ ,0.79308
+ ,36.8261
+ ,1.5553
+ ,166.26
+ ,0.79152
+ ,36.7723
+ ,1.5557
+ ,162.31
+ ,0.79209
+ ,36.9042
+ ,1.5750
+ ,161.56
+ ,0.79487
+ ,37.0494
+ ,1.5527
+ ,156.59
+ ,0.77494
+ ,36.8259
+ ,1.4748
+ ,157.97
+ ,0.75094
+ ,36.1357
+ ,1.4718
+ ,158.68
+ ,0.74725
+ ,36.0300
+ ,1.4570
+ ,163.55
+ ,0.72064
+ ,35.7927
+ ,1.4684
+ ,162.89
+ ,0.70896
+ ,35.9174
+ ,1.4227
+ ,164.95
+ ,0.69614
+ ,35.4008
+ ,1.3896
+ ,159.82
+ ,0.68887
+ ,35.1723
+ ,1.3622
+ ,159.05
+ ,0.67766
+ ,34.9211
+ ,1.3716
+ ,166.76
+ ,0.67440
+ ,35.0292
+ ,1.3419
+ ,164.55
+ ,0.67562
+ ,34.7739
+ ,1.3511
+ ,163.22
+ ,0.68136
+ ,34.8999
+ ,1.3516
+ ,160.68
+ ,0.67934
+ ,34.9054
+ ,1.3242
+ ,155.24
+ ,0.68021
+ ,34.5680
+ ,1.3074
+ ,157.60
+ ,0.66800
+ ,34.4060
+ ,1.2999
+ ,156.56
+ ,0.66341
+ ,34.4578
+ ,1.3213
+ ,154.82
+ ,0.67286
+ ,34.7316
+ ,1.2881
+ ,151.11
+ ,0.67397
+ ,34.2602
+ ,1.2611
+ ,149.65
+ ,0.67254
+ ,33.8849
+ ,1.2727
+ ,148.99
+ ,0.67511
+ ,34.0549
+ ,1.2811
+ ,148.53
+ ,0.67669
+ ,34.2755
+ ,1.2684
+ ,146.70
+ ,0.68782
+ ,34.1393
+ ,1.2650
+ ,145.11
+ ,0.68666
+ ,34.1587
+ ,1.2770
+ ,142.70
+ ,0.68330
+ ,34.5386
+ ,1.2271
+ ,143.59
+ ,0.69463
+ ,33.7987
+ ,1.2020
+ ,140.96
+ ,0.68935
+ ,33.4973
+ ,1.1938
+ ,140.77
+ ,0.68297
+ ,33.6802
+ ,1.2103
+ ,139.81
+ ,0.68598
+ ,34.3284
+ ,1.1856
+ ,140.58
+ ,0.67922
+ ,34.1538
+ ,1.1786
+ ,139.59
+ ,0.67933
+ ,33.9184
+ ,1.2015
+ ,138.05
+ ,0.68137
+ ,34.3262
+ ,1.2256
+ ,136.06
+ ,0.67760
+ ,34.7750
+ ,1.2292
+ ,135.98
+ ,0.68527
+ ,35.0119
+ ,1.2037
+ ,134.75
+ ,0.68756
+ ,34.5513
+ ,1.2165
+ ,132.22
+ ,0.66895
+ ,34.6951
+ ,1.2694
+ ,135.37
+ ,0.68399
+ ,35.4730
+ ,1.2938
+ ,138.84
+ ,0.68293
+ ,35.9794
+ ,1.3201
+ ,138.83
+ ,0.69233
+ ,36.4789
+ ,1.3014
+ ,136.55
+ ,0.68968
+ ,36.3910
+ ,1.3119
+ ,135.63
+ ,0.69867
+ ,36.6704
+ ,1.3408
+ ,139.14
+ ,0.69500
+ ,37.4162
+ ,1.2991
+ ,136.09
+ ,0.69862
+ ,37.1185)
+ ,dim=c(4
+ ,60)
+ ,dimnames=list(c('dollar/euro'
+ ,'Japanseyen/euro'
+ ,'pond/euro'
+ ,'roebel/euro')
+ ,1:60))
> y <- array(NA,dim=c(4,60),dimnames=list(c('dollar/euro','Japanseyen/euro','pond/euro','roebel/euro'),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 = '0'
> #'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
dollar/euro Japanseyen/euro pond/euro roebel/euro
1 1.4816 133.91 0.91557 43.6188
2 1.4562 133.14 0.89135 44.7624
3 1.4268 135.31 0.86265 45.1972
4 1.4088 133.09 0.86092 44.3881
5 1.4016 135.39 0.85670 43.5552
6 1.3650 131.85 0.88444 43.5678
7 1.3190 130.25 0.89756 44.2135
8 1.3050 127.65 0.91966 45.1450
9 1.2785 118.30 0.88691 45.8079
10 1.3239 119.73 0.91819 42.3282
11 1.3449 122.51 0.90448 37.8999
12 1.2732 123.28 0.83063 34.7964
13 1.3322 133.52 0.78668 35.2144
14 1.4369 153.20 0.79924 36.3727
15 1.4975 163.63 0.79279 36.2502
16 1.5770 168.45 0.79308 36.8261
17 1.5553 166.26 0.79152 36.7723
18 1.5557 162.31 0.79209 36.9042
19 1.5750 161.56 0.79487 37.0494
20 1.5527 156.59 0.77494 36.8259
21 1.4748 157.97 0.75094 36.1357
22 1.4718 158.68 0.74725 36.0300
23 1.4570 163.55 0.72064 35.7927
24 1.4684 162.89 0.70896 35.9174
25 1.4227 164.95 0.69614 35.4008
26 1.3896 159.82 0.68887 35.1723
27 1.3622 159.05 0.67766 34.9211
28 1.3716 166.76 0.67440 35.0292
29 1.3419 164.55 0.67562 34.7739
30 1.3511 163.22 0.68136 34.8999
31 1.3516 160.68 0.67934 34.9054
32 1.3242 155.24 0.68021 34.5680
33 1.3074 157.60 0.66800 34.4060
34 1.2999 156.56 0.66341 34.4578
35 1.3213 154.82 0.67286 34.7316
36 1.2881 151.11 0.67397 34.2602
37 1.2611 149.65 0.67254 33.8849
38 1.2727 148.99 0.67511 34.0549
39 1.2811 148.53 0.67669 34.2755
40 1.2684 146.70 0.68782 34.1393
41 1.2650 145.11 0.68666 34.1587
42 1.2770 142.70 0.68330 34.5386
43 1.2271 143.59 0.69463 33.7987
44 1.2020 140.96 0.68935 33.4973
45 1.1938 140.77 0.68297 33.6802
46 1.2103 139.81 0.68598 34.3284
47 1.1856 140.58 0.67922 34.1538
48 1.1786 139.59 0.67933 33.9184
49 1.2015 138.05 0.68137 34.3262
50 1.2256 136.06 0.67760 34.7750
51 1.2292 135.98 0.68527 35.0119
52 1.2037 134.75 0.68756 34.5513
53 1.2165 132.22 0.66895 34.6951
54 1.2694 135.37 0.68399 35.4730
55 1.2938 138.84 0.68293 35.9794
56 1.3201 138.83 0.69233 36.4789
57 1.3014 136.55 0.68968 36.3910
58 1.3119 135.63 0.69867 36.6704
59 1.3408 139.14 0.69500 37.4162
60 1.2991 136.09 0.69862 37.1185
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `Japanseyen/euro` `pond/euro` `roebel/euro`
-0.490341 0.006985 0.928188 0.003480
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.107005 -0.033322 -0.007034 0.034844 0.101827
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.4903414 0.1236283 -3.966 0.000210 ***
`Japanseyen/euro` 0.0069850 0.0005053 13.824 < 2e-16 ***
`pond/euro` 0.9281875 0.1475492 6.291 5.1e-08 ***
`roebel/euro` 0.0034799 0.0035283 0.986 0.328233
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.04613 on 56 degrees of freedom
Multiple R-squared: 0.8209, Adjusted R-squared: 0.8113
F-statistic: 85.57 on 3 and 56 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.3725378 7.450756e-01 6.274622e-01
[2,] 0.2944963 5.889927e-01 7.055037e-01
[3,] 0.9061013 1.877974e-01 9.389868e-02
[4,] 0.9983369 3.326216e-03 1.663108e-03
[5,] 0.9998672 2.655425e-04 1.327713e-04
[6,] 0.9998369 3.261409e-04 1.630704e-04
[7,] 0.9997038 5.924137e-04 2.962069e-04
[8,] 0.9999766 4.689283e-05 2.344642e-05
[9,] 0.9999910 1.801141e-05 9.005704e-06
[10,] 0.9999864 2.729949e-05 1.364975e-05
[11,] 0.9999858 2.835987e-05 1.417994e-05
[12,] 0.9999857 2.857227e-05 1.428613e-05
[13,] 0.9999890 2.199790e-05 1.099895e-05
[14,] 0.9999972 5.544305e-06 2.772152e-06
[15,] 0.9999935 1.290808e-05 6.454041e-06
[16,] 0.9999863 2.732579e-05 1.366289e-05
[17,] 0.9999834 3.322997e-05 1.661499e-05
[18,] 0.9999906 1.882312e-05 9.411560e-06
[19,] 0.9999937 1.252518e-05 6.262590e-06
[20,] 0.9999958 8.342066e-06 4.171033e-06
[21,] 0.9999955 9.035733e-06 4.517867e-06
[22,] 0.9999972 5.693922e-06 2.846961e-06
[23,] 0.9999989 2.171436e-06 1.085718e-06
[24,] 0.9999989 2.179529e-06 1.089765e-06
[25,] 0.9999974 5.104479e-06 2.552240e-06
[26,] 0.9999935 1.296263e-05 6.481317e-06
[27,] 0.9999880 2.403417e-05 1.201709e-05
[28,] 0.9999865 2.701854e-05 1.350927e-05
[29,] 0.9999712 5.752878e-05 2.876439e-05
[30,] 0.9999286 1.427911e-04 7.139554e-05
[31,] 0.9998397 3.206131e-04 1.603065e-04
[32,] 0.9996191 7.618838e-04 3.809419e-04
[33,] 0.9991520 1.695946e-03 8.479729e-04
[34,] 0.9983882 3.223549e-03 1.611775e-03
[35,] 0.9979916 4.016890e-03 2.008445e-03
[36,] 0.9994835 1.033000e-03 5.165001e-04
[37,] 0.9994682 1.063637e-03 5.318186e-04
[38,] 0.9997183 5.634708e-04 2.817354e-04
[39,] 0.9996295 7.410050e-04 3.705025e-04
[40,] 0.9991641 1.671867e-03 8.359337e-04
[41,] 0.9984879 3.024294e-03 1.512147e-03
[42,] 0.9973467 5.306665e-03 2.653332e-03
[43,] 0.9949827 1.003455e-02 5.017277e-03
[44,] 0.9894771 2.104583e-02 1.052291e-02
[45,] 0.9786155 4.276902e-02 2.138451e-02
[46,] 0.9916005 1.679898e-02 8.399488e-03
[47,] 0.9710933 5.781335e-02 2.890667e-02
> postscript(file="/var/www/html/rcomp/tmp/1f80x1258721189.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/25e2w1258721189.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/356j01258721189.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/4fv8s1258721189.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/5nhg11258721189.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.0349760396 0.0334555419 0.0140241050 0.0159520629 -0.0004979767
6 7 8 9 10
-0.0381629968 -0.0874118583 -0.1070054425 -0.0401047801 -0.0216179586
11 12 13 14 15
0.0080993619 0.0103674683 0.0371807495 -0.0112720115 -0.0171120165
16 17 18 19 20
0.0264472403 0.0216794876 0.0486820021 0.0701350769 0.1018268487
21 22 23 24 25
0.0389659364 0.0347994544 0.0115075637 0.0379249217 -0.0084670087
26 27 28 29 30
0.0018089019 -0.0089335478 -0.0507378531 -0.0652450677 -0.0525213387
31 32 33 34 35
-0.0324237484 -0.0214589860 -0.0428465712 -0.0390020941 -0.0151724379
36 37 38 39 40
-0.0218481094 -0.0360167566 -0.0227837102 -0.0134048326 -0.0231791254
41 42 43 44 45
-0.0144638562 0.0161665856 -0.0478916111 -0.0486715015 -0.0502589974
46 47 48 49 50
-0.0321029556 -0.0552992341 -0.0546670582 -0.0243228309 0.0156147205
51 52 53 54 55
0.0118299301 -0.0056012792 0.0416438218 0.0558742511 0.0552581063
56 57 58 59 60
0.0711647823 0.0711560647 0.0787655349 0.0839594727 0.0612395199
> postscript(file="/var/www/html/rcomp/tmp/6lr4u1258721189.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.0349760396 NA
1 0.0334555419 0.0349760396
2 0.0140241050 0.0334555419
3 0.0159520629 0.0140241050
4 -0.0004979767 0.0159520629
5 -0.0381629968 -0.0004979767
6 -0.0874118583 -0.0381629968
7 -0.1070054425 -0.0874118583
8 -0.0401047801 -0.1070054425
9 -0.0216179586 -0.0401047801
10 0.0080993619 -0.0216179586
11 0.0103674683 0.0080993619
12 0.0371807495 0.0103674683
13 -0.0112720115 0.0371807495
14 -0.0171120165 -0.0112720115
15 0.0264472403 -0.0171120165
16 0.0216794876 0.0264472403
17 0.0486820021 0.0216794876
18 0.0701350769 0.0486820021
19 0.1018268487 0.0701350769
20 0.0389659364 0.1018268487
21 0.0347994544 0.0389659364
22 0.0115075637 0.0347994544
23 0.0379249217 0.0115075637
24 -0.0084670087 0.0379249217
25 0.0018089019 -0.0084670087
26 -0.0089335478 0.0018089019
27 -0.0507378531 -0.0089335478
28 -0.0652450677 -0.0507378531
29 -0.0525213387 -0.0652450677
30 -0.0324237484 -0.0525213387
31 -0.0214589860 -0.0324237484
32 -0.0428465712 -0.0214589860
33 -0.0390020941 -0.0428465712
34 -0.0151724379 -0.0390020941
35 -0.0218481094 -0.0151724379
36 -0.0360167566 -0.0218481094
37 -0.0227837102 -0.0360167566
38 -0.0134048326 -0.0227837102
39 -0.0231791254 -0.0134048326
40 -0.0144638562 -0.0231791254
41 0.0161665856 -0.0144638562
42 -0.0478916111 0.0161665856
43 -0.0486715015 -0.0478916111
44 -0.0502589974 -0.0486715015
45 -0.0321029556 -0.0502589974
46 -0.0552992341 -0.0321029556
47 -0.0546670582 -0.0552992341
48 -0.0243228309 -0.0546670582
49 0.0156147205 -0.0243228309
50 0.0118299301 0.0156147205
51 -0.0056012792 0.0118299301
52 0.0416438218 -0.0056012792
53 0.0558742511 0.0416438218
54 0.0552581063 0.0558742511
55 0.0711647823 0.0552581063
56 0.0711560647 0.0711647823
57 0.0787655349 0.0711560647
58 0.0839594727 0.0787655349
59 0.0612395199 0.0839594727
60 NA 0.0612395199
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.0334555419 0.0349760396
[2,] 0.0140241050 0.0334555419
[3,] 0.0159520629 0.0140241050
[4,] -0.0004979767 0.0159520629
[5,] -0.0381629968 -0.0004979767
[6,] -0.0874118583 -0.0381629968
[7,] -0.1070054425 -0.0874118583
[8,] -0.0401047801 -0.1070054425
[9,] -0.0216179586 -0.0401047801
[10,] 0.0080993619 -0.0216179586
[11,] 0.0103674683 0.0080993619
[12,] 0.0371807495 0.0103674683
[13,] -0.0112720115 0.0371807495
[14,] -0.0171120165 -0.0112720115
[15,] 0.0264472403 -0.0171120165
[16,] 0.0216794876 0.0264472403
[17,] 0.0486820021 0.0216794876
[18,] 0.0701350769 0.0486820021
[19,] 0.1018268487 0.0701350769
[20,] 0.0389659364 0.1018268487
[21,] 0.0347994544 0.0389659364
[22,] 0.0115075637 0.0347994544
[23,] 0.0379249217 0.0115075637
[24,] -0.0084670087 0.0379249217
[25,] 0.0018089019 -0.0084670087
[26,] -0.0089335478 0.0018089019
[27,] -0.0507378531 -0.0089335478
[28,] -0.0652450677 -0.0507378531
[29,] -0.0525213387 -0.0652450677
[30,] -0.0324237484 -0.0525213387
[31,] -0.0214589860 -0.0324237484
[32,] -0.0428465712 -0.0214589860
[33,] -0.0390020941 -0.0428465712
[34,] -0.0151724379 -0.0390020941
[35,] -0.0218481094 -0.0151724379
[36,] -0.0360167566 -0.0218481094
[37,] -0.0227837102 -0.0360167566
[38,] -0.0134048326 -0.0227837102
[39,] -0.0231791254 -0.0134048326
[40,] -0.0144638562 -0.0231791254
[41,] 0.0161665856 -0.0144638562
[42,] -0.0478916111 0.0161665856
[43,] -0.0486715015 -0.0478916111
[44,] -0.0502589974 -0.0486715015
[45,] -0.0321029556 -0.0502589974
[46,] -0.0552992341 -0.0321029556
[47,] -0.0546670582 -0.0552992341
[48,] -0.0243228309 -0.0546670582
[49,] 0.0156147205 -0.0243228309
[50,] 0.0118299301 0.0156147205
[51,] -0.0056012792 0.0118299301
[52,] 0.0416438218 -0.0056012792
[53,] 0.0558742511 0.0416438218
[54,] 0.0552581063 0.0558742511
[55,] 0.0711647823 0.0552581063
[56,] 0.0711560647 0.0711647823
[57,] 0.0787655349 0.0711560647
[58,] 0.0839594727 0.0787655349
[59,] 0.0612395199 0.0839594727
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.0334555419 0.0349760396
2 0.0140241050 0.0334555419
3 0.0159520629 0.0140241050
4 -0.0004979767 0.0159520629
5 -0.0381629968 -0.0004979767
6 -0.0874118583 -0.0381629968
7 -0.1070054425 -0.0874118583
8 -0.0401047801 -0.1070054425
9 -0.0216179586 -0.0401047801
10 0.0080993619 -0.0216179586
11 0.0103674683 0.0080993619
12 0.0371807495 0.0103674683
13 -0.0112720115 0.0371807495
14 -0.0171120165 -0.0112720115
15 0.0264472403 -0.0171120165
16 0.0216794876 0.0264472403
17 0.0486820021 0.0216794876
18 0.0701350769 0.0486820021
19 0.1018268487 0.0701350769
20 0.0389659364 0.1018268487
21 0.0347994544 0.0389659364
22 0.0115075637 0.0347994544
23 0.0379249217 0.0115075637
24 -0.0084670087 0.0379249217
25 0.0018089019 -0.0084670087
26 -0.0089335478 0.0018089019
27 -0.0507378531 -0.0089335478
28 -0.0652450677 -0.0507378531
29 -0.0525213387 -0.0652450677
30 -0.0324237484 -0.0525213387
31 -0.0214589860 -0.0324237484
32 -0.0428465712 -0.0214589860
33 -0.0390020941 -0.0428465712
34 -0.0151724379 -0.0390020941
35 -0.0218481094 -0.0151724379
36 -0.0360167566 -0.0218481094
37 -0.0227837102 -0.0360167566
38 -0.0134048326 -0.0227837102
39 -0.0231791254 -0.0134048326
40 -0.0144638562 -0.0231791254
41 0.0161665856 -0.0144638562
42 -0.0478916111 0.0161665856
43 -0.0486715015 -0.0478916111
44 -0.0502589974 -0.0486715015
45 -0.0321029556 -0.0502589974
46 -0.0552992341 -0.0321029556
47 -0.0546670582 -0.0552992341
48 -0.0243228309 -0.0546670582
49 0.0156147205 -0.0243228309
50 0.0118299301 0.0156147205
51 -0.0056012792 0.0118299301
52 0.0416438218 -0.0056012792
53 0.0558742511 0.0416438218
54 0.0552581063 0.0558742511
55 0.0711647823 0.0552581063
56 0.0711560647 0.0711647823
57 0.0787655349 0.0711560647
58 0.0839594727 0.0787655349
59 0.0612395199 0.0839594727
> 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/7xuny1258721189.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/8jj0t1258721189.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/9nd4v1258721189.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/108l9n1258721189.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/11367i1258721189.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/12c0n11258721189.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/13ytk51258721189.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/14yu3l1258721189.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/152zlh1258721189.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/16tbdq1258721189.tab")
+ }
>
> system("convert tmp/1f80x1258721189.ps tmp/1f80x1258721189.png")
> system("convert tmp/25e2w1258721189.ps tmp/25e2w1258721189.png")
> system("convert tmp/356j01258721189.ps tmp/356j01258721189.png")
> system("convert tmp/4fv8s1258721189.ps tmp/4fv8s1258721189.png")
> system("convert tmp/5nhg11258721189.ps tmp/5nhg11258721189.png")
> system("convert tmp/6lr4u1258721189.ps tmp/6lr4u1258721189.png")
> system("convert tmp/7xuny1258721189.ps tmp/7xuny1258721189.png")
> system("convert tmp/8jj0t1258721189.ps tmp/8jj0t1258721189.png")
> system("convert tmp/9nd4v1258721189.ps tmp/9nd4v1258721189.png")
> system("convert tmp/108l9n1258721189.ps tmp/108l9n1258721189.png")
>
>
> proc.time()
user system elapsed
2.481 1.539 7.591