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.3954
+ ,1.0685
+ ,1.4790
+ ,1.1010
+ ,1.4619
+ ,1.0996
+ ,1.4670
+ ,1.0978
+ ,1.4799
+ ,1.0893
+ ,1.4508
+ ,1.1018
+ ,1.4678
+ ,1.0931
+ ,1.4824
+ ,1.0842
+ ,1.5189
+ ,1.0409
+ ,1.5348
+ ,1.0245
+ ,1.5666
+ ,0.9994
+ ,1.5446
+ ,1.0090
+ ,1.5803
+ ,0.9947
+ ,1.5718
+ ,1.0080
+ ,1.5832
+ ,0.9986
+ ,1.5801
+ ,1.0184
+ ,1.5605
+ ,1.0357
+ ,1.5416
+ ,1.0556
+ ,1.5479
+ ,1.0409
+ ,1.5580
+ ,1.0474
+ ,1.5790
+ ,1.0219
+ ,1.5554
+ ,1.0427
+ ,1.5761
+ ,1.0205
+ ,1.5360
+ ,1.0490
+ ,1.5621
+ ,1.0344
+ ,1.5773
+ ,1.0193
+ ,1.5710
+ ,1.0238
+ ,1.5925
+ ,1.0165
+ ,1.5844
+ ,1.0218
+ ,1.5696
+ ,1.0370
+ ,1.5540
+ ,1.0508
+ ,1.5012
+ ,1.0813
+ ,1.4676
+ ,1.0970
+ ,1.4770
+ ,1.0989
+ ,1.4660
+ ,1.1018
+ ,1.4241
+ ,1.1166
+ ,1.4214
+ ,1.1319
+ ,1.4469
+ ,1.1020
+ ,1.4618
+ ,1.0884
+ ,1.3834
+ ,1.1263
+ ,1.3412
+ ,1.1345
+ ,1.3437
+ ,1.1337
+ ,1.2630
+ ,1.1660
+ ,1.2759
+ ,1.1550
+ ,1.2743
+ ,1.1782
+ ,1.2797
+ ,1.1856
+ ,1.2573
+ ,1.2219
+ ,1.2705
+ ,1.2130
+ ,1.2680
+ ,1.2230
+ ,1.3371
+ ,1.1767
+ ,1.3885
+ ,1.1077
+ ,1.4060
+ ,1.0672
+ ,1.3855
+ ,1.0840
+ ,1.3431
+ ,1.1154
+ ,1.3257
+ ,1.1184
+ ,1.2978
+ ,1.1570
+ ,1.2793
+ ,1.1625
+ ,1.2945
+ ,1.1627
+ ,1.2890
+ ,1.1578
+ ,1.2848
+ ,1.1533
+ ,1.2694
+ ,1.1684
+ ,1.2636
+ ,1.1597
+ ,1.2900
+ ,1.1888
+ ,1.3559
+ ,1.1296
+ ,1.3305
+ ,1.1424
+ ,1.3482
+ ,1.1317
+ ,1.3146
+ ,1.1581
+ ,1.3027
+ ,1.1672
+ ,1.3247
+ ,1.1391
+ ,1.3267
+ ,1.1357
+ ,1.3621
+ ,1.1065
+ ,1.3479
+ ,1.1232
+ ,1.4011
+ ,1.0845
+ ,1.4135
+ ,1.0676
+ ,1.3964
+ ,1.0863
+ ,1.4010
+ ,1.0792
+ ,1.3955
+ ,1.0799
+ ,1.4077
+ ,1.0817
+ ,1.3975
+ ,1.0869
+ ,1.3949
+ ,1.0843
+ ,1.4138
+ ,1.0747
+ ,1.4210
+ ,1.0711
+ ,1.4253
+ ,1.0688
+ ,1.4169
+ ,1.0828
+ ,1.4174
+ ,1.0746
+ ,1.4346
+ ,1.0568
+ ,1.4296
+ ,1.0600
+ ,1.4311
+ ,1.0593
+ ,1.4594
+ ,1.0370
+ ,1.4722
+ ,1.0288
+ ,1.4669
+ ,1.0295
+ ,1.4571
+ ,1.0352
+ ,1.4709
+ ,1.0324
+ ,1.4893
+ ,1.0186
+ ,1.4997
+ ,1.0094
+ ,1.4713
+ ,1.0258
+ ,1.4846
+ ,1.0170
+ ,1.4914
+ ,1.0117
+ ,1.4859
+ ,1.0175
+ ,1.4957
+ ,1.0064
+ ,1.4843
+ ,1.0168
+ ,1.4619
+ ,1.0340
+ ,1.4340
+ ,1.0423
+ ,1.4426
+ ,1.0356
+ ,1.4318
+ ,1.0348)
+ ,dim=c(2
+ ,105)
+ ,dimnames=list(c('eu/us'
+ ,'us/ch')
+ ,1:105))
> y <- array(NA,dim=c(2,105),dimnames=list(c('eu/us','us/ch'),1:105))
> 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
eu/us us/ch
1 1.3954 1.0685
2 1.4790 1.1010
3 1.4619 1.0996
4 1.4670 1.0978
5 1.4799 1.0893
6 1.4508 1.1018
7 1.4678 1.0931
8 1.4824 1.0842
9 1.5189 1.0409
10 1.5348 1.0245
11 1.5666 0.9994
12 1.5446 1.0090
13 1.5803 0.9947
14 1.5718 1.0080
15 1.5832 0.9986
16 1.5801 1.0184
17 1.5605 1.0357
18 1.5416 1.0556
19 1.5479 1.0409
20 1.5580 1.0474
21 1.5790 1.0219
22 1.5554 1.0427
23 1.5761 1.0205
24 1.5360 1.0490
25 1.5621 1.0344
26 1.5773 1.0193
27 1.5710 1.0238
28 1.5925 1.0165
29 1.5844 1.0218
30 1.5696 1.0370
31 1.5540 1.0508
32 1.5012 1.0813
33 1.4676 1.0970
34 1.4770 1.0989
35 1.4660 1.1018
36 1.4241 1.1166
37 1.4214 1.1319
38 1.4469 1.1020
39 1.4618 1.0884
40 1.3834 1.1263
41 1.3412 1.1345
42 1.3437 1.1337
43 1.2630 1.1660
44 1.2759 1.1550
45 1.2743 1.1782
46 1.2797 1.1856
47 1.2573 1.2219
48 1.2705 1.2130
49 1.2680 1.2230
50 1.3371 1.1767
51 1.3885 1.1077
52 1.4060 1.0672
53 1.3855 1.0840
54 1.3431 1.1154
55 1.3257 1.1184
56 1.2978 1.1570
57 1.2793 1.1625
58 1.2945 1.1627
59 1.2890 1.1578
60 1.2848 1.1533
61 1.2694 1.1684
62 1.2636 1.1597
63 1.2900 1.1888
64 1.3559 1.1296
65 1.3305 1.1424
66 1.3482 1.1317
67 1.3146 1.1581
68 1.3027 1.1672
69 1.3247 1.1391
70 1.3267 1.1357
71 1.3621 1.1065
72 1.3479 1.1232
73 1.4011 1.0845
74 1.4135 1.0676
75 1.3964 1.0863
76 1.4010 1.0792
77 1.3955 1.0799
78 1.4077 1.0817
79 1.3975 1.0869
80 1.3949 1.0843
81 1.4138 1.0747
82 1.4210 1.0711
83 1.4253 1.0688
84 1.4169 1.0828
85 1.4174 1.0746
86 1.4346 1.0568
87 1.4296 1.0600
88 1.4311 1.0593
89 1.4594 1.0370
90 1.4722 1.0288
91 1.4669 1.0295
92 1.4571 1.0352
93 1.4709 1.0324
94 1.4893 1.0186
95 1.4997 1.0094
96 1.4713 1.0258
97 1.4846 1.0170
98 1.4914 1.0117
99 1.4859 1.0175
100 1.4957 1.0064
101 1.4843 1.0168
102 1.4619 1.0340
103 1.4340 1.0423
104 1.4426 1.0356
105 1.4318 1.0348
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `us/ch`
3.069 -1.511
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.07308 -0.03996 -0.01299 0.04900 0.07418
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.06886 0.08259 37.16 <2e-16 ***
`us/ch` -1.51139 0.07614 -19.85 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.0441 on 103 degrees of freedom
Multiple R-squared: 0.7928, Adjusted R-squared: 0.7908
F-statistic: 394 on 1 and 103 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.09833101 1.966620e-01 9.016690e-01
[2,] 0.08224164 1.644833e-01 9.177584e-01
[3,] 0.03941350 7.882699e-02 9.605865e-01
[4,] 0.06630251 1.326050e-01 9.336975e-01
[5,] 0.27737298 5.547460e-01 7.226270e-01
[6,] 0.23428754 4.685751e-01 7.657125e-01
[7,] 0.18025905 3.605181e-01 8.197410e-01
[8,] 0.11834784 2.366957e-01 8.816522e-01
[9,] 0.08606338 1.721268e-01 9.139366e-01
[10,] 0.06265449 1.253090e-01 9.373455e-01
[11,] 0.04367997 8.735994e-02 9.563200e-01
[12,] 0.04315875 8.631749e-02 9.568413e-01
[13,] 0.04151078 8.302156e-02 9.584892e-01
[14,] 0.04449155 8.898310e-02 9.555085e-01
[15,] 0.03665103 7.330206e-02 9.633490e-01
[16,] 0.04588775 9.177551e-02 9.541122e-01
[17,] 0.04379557 8.759114e-02 9.562044e-01
[18,] 0.04424132 8.848263e-02 9.557587e-01
[19,] 0.03939460 7.878919e-02 9.606054e-01
[20,] 0.03384034 6.768067e-02 9.661597e-01
[21,] 0.03380033 6.760066e-02 9.661997e-01
[22,] 0.03230903 6.461807e-02 9.676910e-01
[23,] 0.03186976 6.373952e-02 9.681302e-01
[24,] 0.04345891 8.691782e-02 9.565411e-01
[25,] 0.06116871 1.223374e-01 9.388313e-01
[26,] 0.10416595 2.083319e-01 8.958340e-01
[27,] 0.19572646 3.914529e-01 8.042735e-01
[28,] 0.27854608 5.570922e-01 7.214539e-01
[29,] 0.34238325 6.847665e-01 6.576167e-01
[30,] 0.49711070 9.942214e-01 5.028893e-01
[31,] 0.65711032 6.857794e-01 3.428897e-01
[32,] 0.74668466 5.066307e-01 2.533153e-01
[33,] 0.88114845 2.377031e-01 1.188515e-01
[34,] 0.95473121 9.053758e-02 4.526879e-02
[35,] 0.99051535 1.896930e-02 9.484648e-03
[36,] 0.99681043 6.379137e-03 3.189569e-03
[37,] 0.99930286 1.394279e-03 6.971395e-04
[38,] 0.99973481 5.303721e-04 2.651861e-04
[39,] 0.99998813 2.373219e-05 1.186610e-05
[40,] 0.99999935 1.298995e-06 6.494974e-07
[41,] 0.99999920 1.601347e-06 8.006733e-07
[42,] 0.99999844 3.123980e-06 1.561990e-06
[43,] 0.99999877 2.459736e-06 1.229868e-06
[44,] 0.99999924 1.529773e-06 7.648866e-07
[45,] 0.99999991 1.763921e-07 8.819606e-08
[46,] 1.00000000 5.254334e-10 2.627167e-10
[47,] 1.00000000 1.932672e-10 9.663360e-11
[48,] 1.00000000 2.160677e-11 1.080338e-11
[49,] 1.00000000 5.910471e-12 2.955236e-12
[50,] 1.00000000 2.886583e-12 1.443291e-12
[51,] 1.00000000 2.252369e-13 1.126184e-13
[52,] 1.00000000 4.432122e-13 2.216061e-13
[53,] 1.00000000 3.564331e-13 1.782165e-13
[54,] 1.00000000 9.152709e-13 4.576355e-13
[55,] 1.00000000 1.066313e-12 5.331567e-13
[56,] 1.00000000 2.406896e-13 1.203448e-13
[57,] 1.00000000 7.655418e-14 3.827709e-14
[58,] 1.00000000 1.279393e-17 6.396964e-18
[59,] 1.00000000 9.850343e-18 4.925171e-18
[60,] 1.00000000 1.617640e-17 8.088202e-18
[61,] 1.00000000 6.551581e-17 3.275791e-17
[62,] 1.00000000 1.811011e-16 9.055053e-17
[63,] 1.00000000 5.298404e-16 2.649202e-16
[64,] 1.00000000 1.318127e-15 6.590633e-16
[65,] 1.00000000 4.672180e-15 2.336090e-15
[66,] 1.00000000 1.279971e-14 6.399854e-15
[67,] 1.00000000 2.198617e-14 1.099308e-14
[68,] 1.00000000 7.566611e-14 3.783305e-14
[69,] 1.00000000 2.283852e-13 1.141926e-13
[70,] 1.00000000 4.186361e-13 2.093181e-13
[71,] 1.00000000 1.347146e-12 6.735728e-13
[72,] 1.00000000 3.380149e-12 1.690075e-12
[73,] 1.00000000 4.956131e-12 2.478065e-12
[74,] 1.00000000 1.706883e-11 8.534415e-12
[75,] 1.00000000 6.152193e-11 3.076096e-11
[76,] 1.00000000 1.583520e-10 7.917600e-11
[77,] 1.00000000 5.569916e-10 2.784958e-10
[78,] 1.00000000 1.890043e-09 9.450214e-10
[79,] 1.00000000 5.900822e-09 2.950411e-09
[80,] 1.00000000 5.690449e-09 2.845224e-09
[81,] 0.99999999 1.026555e-08 5.132777e-09
[82,] 0.99999999 2.763446e-08 1.381723e-08
[83,] 0.99999997 6.391168e-08 3.195584e-08
[84,] 0.99999997 6.881025e-08 3.440513e-08
[85,] 0.99999992 1.557095e-07 7.785476e-08
[86,] 0.99999980 4.031690e-07 2.015845e-07
[87,] 0.99999929 1.421634e-06 7.108168e-07
[88,] 0.99999766 4.671637e-06 2.335819e-06
[89,] 0.99999819 3.616158e-06 1.808079e-06
[90,] 0.99999529 9.423918e-06 4.711959e-06
[91,] 0.99997707 4.586357e-05 2.293178e-05
[92,] 0.99991291 1.741862e-04 8.709312e-05
[93,] 0.99959800 8.040090e-04 4.020045e-04
[94,] 0.99811029 3.779412e-03 1.889706e-03
[95,] 0.99301594 1.396812e-02 6.984060e-03
[96,] 0.97315637 5.368726e-02 2.684363e-02
> postscript(file="/var/www/html/rcomp/tmp/16n3e1290505477.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/2zw2h1290505477.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/3zw2h1290505477.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/4ankk1290505477.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/5ankk1290505477.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 = 105
Frequency = 1
1 2 3 4 5
-0.0585441959 0.0741759950 0.0549600484 0.0573395455 0.0573927263
6 7 8 9 10
0.0471851074 0.0510360102 0.0521846348 0.0232414265 0.0143546225
11 12 13 14 15
0.0082187211 0.0007280698 0.0148151858 0.0264166793 0.0236096087
16 17 18 19 20
0.0504351405 0.0569821960 0.0681588667 0.0522414265 0.0721654647
21 22 23 24 25
0.0546250072 0.0624619294 0.0496090605 0.0525836895 0.0566173883
26 27 28 29 30
0.0489953919 0.0494966491 0.0599634985 0.0598738681 0.0680470036
31 32 33 34 35
0.0733041924 0.0666016024 0.0567304331 0.0690020750 0.0623851074
36 37 38 39 40
0.0428536867 0.0632779612 0.0435873855 0.0379324749 0.0168141745
41 42 43 44 45
-0.0129924235 -0.0117015359 -0.0435836230 -0.0473089184 -0.0138446590
46 47 48 49 50
0.0027396306 0.0352031055 0.0349517301 0.0475656350 0.0466882552
51 52 53 54 55
-0.0061976887 -0.0499090036 -0.0450176433 -0.0399599819 -0.0528258104
56 57 58 59 60
-0.0223861374 -0.0325734897 -0.0170712116 -0.0299770250 -0.0409782823
61 62 63 64 65
-0.0335562858 -0.0525053831 0.0178760802 -0.0056982369 -0.0117524386
66 67 68 69 70
-0.0102243169 -0.0039236079 -0.0020699544 -0.0225400272 -0.0256787549
71 72 73 74 75
-0.0344113573 -0.0233711360 -0.0286619481 -0.0418044474 -0.0306414452
76 77 78 79 80
-0.0367723177 -0.0412143443 -0.0262938414 -0.0286346109 -0.0351642262
81 82 83 84 85
-0.0307735749 -0.0290145806 -0.0281907788 -0.0154313119 -0.0273247139
86 87 88 89 90
-0.0370274647 -0.0371910151 -0.0367489884 -0.0421529964 -0.0417463984
91 92 93 94 95
-0.0459884251 -0.0471734993 -0.0376053927 -0.0400625814 -0.0435673740
96 97 98 99 100
-0.0471805699 -0.0471808062 -0.0483911758 -0.0451251110 -0.0521015454
101 102 103 104 105
-0.0477830843 -0.0441871679 -0.0595426268 -0.0610689431 -0.0730780555
> postscript(file="/var/www/html/rcomp/tmp/6ankk1290505477.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 = 105
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.0585441959 NA
1 0.0741759950 -0.0585441959
2 0.0549600484 0.0741759950
3 0.0573395455 0.0549600484
4 0.0573927263 0.0573395455
5 0.0471851074 0.0573927263
6 0.0510360102 0.0471851074
7 0.0521846348 0.0510360102
8 0.0232414265 0.0521846348
9 0.0143546225 0.0232414265
10 0.0082187211 0.0143546225
11 0.0007280698 0.0082187211
12 0.0148151858 0.0007280698
13 0.0264166793 0.0148151858
14 0.0236096087 0.0264166793
15 0.0504351405 0.0236096087
16 0.0569821960 0.0504351405
17 0.0681588667 0.0569821960
18 0.0522414265 0.0681588667
19 0.0721654647 0.0522414265
20 0.0546250072 0.0721654647
21 0.0624619294 0.0546250072
22 0.0496090605 0.0624619294
23 0.0525836895 0.0496090605
24 0.0566173883 0.0525836895
25 0.0489953919 0.0566173883
26 0.0494966491 0.0489953919
27 0.0599634985 0.0494966491
28 0.0598738681 0.0599634985
29 0.0680470036 0.0598738681
30 0.0733041924 0.0680470036
31 0.0666016024 0.0733041924
32 0.0567304331 0.0666016024
33 0.0690020750 0.0567304331
34 0.0623851074 0.0690020750
35 0.0428536867 0.0623851074
36 0.0632779612 0.0428536867
37 0.0435873855 0.0632779612
38 0.0379324749 0.0435873855
39 0.0168141745 0.0379324749
40 -0.0129924235 0.0168141745
41 -0.0117015359 -0.0129924235
42 -0.0435836230 -0.0117015359
43 -0.0473089184 -0.0435836230
44 -0.0138446590 -0.0473089184
45 0.0027396306 -0.0138446590
46 0.0352031055 0.0027396306
47 0.0349517301 0.0352031055
48 0.0475656350 0.0349517301
49 0.0466882552 0.0475656350
50 -0.0061976887 0.0466882552
51 -0.0499090036 -0.0061976887
52 -0.0450176433 -0.0499090036
53 -0.0399599819 -0.0450176433
54 -0.0528258104 -0.0399599819
55 -0.0223861374 -0.0528258104
56 -0.0325734897 -0.0223861374
57 -0.0170712116 -0.0325734897
58 -0.0299770250 -0.0170712116
59 -0.0409782823 -0.0299770250
60 -0.0335562858 -0.0409782823
61 -0.0525053831 -0.0335562858
62 0.0178760802 -0.0525053831
63 -0.0056982369 0.0178760802
64 -0.0117524386 -0.0056982369
65 -0.0102243169 -0.0117524386
66 -0.0039236079 -0.0102243169
67 -0.0020699544 -0.0039236079
68 -0.0225400272 -0.0020699544
69 -0.0256787549 -0.0225400272
70 -0.0344113573 -0.0256787549
71 -0.0233711360 -0.0344113573
72 -0.0286619481 -0.0233711360
73 -0.0418044474 -0.0286619481
74 -0.0306414452 -0.0418044474
75 -0.0367723177 -0.0306414452
76 -0.0412143443 -0.0367723177
77 -0.0262938414 -0.0412143443
78 -0.0286346109 -0.0262938414
79 -0.0351642262 -0.0286346109
80 -0.0307735749 -0.0351642262
81 -0.0290145806 -0.0307735749
82 -0.0281907788 -0.0290145806
83 -0.0154313119 -0.0281907788
84 -0.0273247139 -0.0154313119
85 -0.0370274647 -0.0273247139
86 -0.0371910151 -0.0370274647
87 -0.0367489884 -0.0371910151
88 -0.0421529964 -0.0367489884
89 -0.0417463984 -0.0421529964
90 -0.0459884251 -0.0417463984
91 -0.0471734993 -0.0459884251
92 -0.0376053927 -0.0471734993
93 -0.0400625814 -0.0376053927
94 -0.0435673740 -0.0400625814
95 -0.0471805699 -0.0435673740
96 -0.0471808062 -0.0471805699
97 -0.0483911758 -0.0471808062
98 -0.0451251110 -0.0483911758
99 -0.0521015454 -0.0451251110
100 -0.0477830843 -0.0521015454
101 -0.0441871679 -0.0477830843
102 -0.0595426268 -0.0441871679
103 -0.0610689431 -0.0595426268
104 -0.0730780555 -0.0610689431
105 NA -0.0730780555
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.0741759950 -0.0585441959
[2,] 0.0549600484 0.0741759950
[3,] 0.0573395455 0.0549600484
[4,] 0.0573927263 0.0573395455
[5,] 0.0471851074 0.0573927263
[6,] 0.0510360102 0.0471851074
[7,] 0.0521846348 0.0510360102
[8,] 0.0232414265 0.0521846348
[9,] 0.0143546225 0.0232414265
[10,] 0.0082187211 0.0143546225
[11,] 0.0007280698 0.0082187211
[12,] 0.0148151858 0.0007280698
[13,] 0.0264166793 0.0148151858
[14,] 0.0236096087 0.0264166793
[15,] 0.0504351405 0.0236096087
[16,] 0.0569821960 0.0504351405
[17,] 0.0681588667 0.0569821960
[18,] 0.0522414265 0.0681588667
[19,] 0.0721654647 0.0522414265
[20,] 0.0546250072 0.0721654647
[21,] 0.0624619294 0.0546250072
[22,] 0.0496090605 0.0624619294
[23,] 0.0525836895 0.0496090605
[24,] 0.0566173883 0.0525836895
[25,] 0.0489953919 0.0566173883
[26,] 0.0494966491 0.0489953919
[27,] 0.0599634985 0.0494966491
[28,] 0.0598738681 0.0599634985
[29,] 0.0680470036 0.0598738681
[30,] 0.0733041924 0.0680470036
[31,] 0.0666016024 0.0733041924
[32,] 0.0567304331 0.0666016024
[33,] 0.0690020750 0.0567304331
[34,] 0.0623851074 0.0690020750
[35,] 0.0428536867 0.0623851074
[36,] 0.0632779612 0.0428536867
[37,] 0.0435873855 0.0632779612
[38,] 0.0379324749 0.0435873855
[39,] 0.0168141745 0.0379324749
[40,] -0.0129924235 0.0168141745
[41,] -0.0117015359 -0.0129924235
[42,] -0.0435836230 -0.0117015359
[43,] -0.0473089184 -0.0435836230
[44,] -0.0138446590 -0.0473089184
[45,] 0.0027396306 -0.0138446590
[46,] 0.0352031055 0.0027396306
[47,] 0.0349517301 0.0352031055
[48,] 0.0475656350 0.0349517301
[49,] 0.0466882552 0.0475656350
[50,] -0.0061976887 0.0466882552
[51,] -0.0499090036 -0.0061976887
[52,] -0.0450176433 -0.0499090036
[53,] -0.0399599819 -0.0450176433
[54,] -0.0528258104 -0.0399599819
[55,] -0.0223861374 -0.0528258104
[56,] -0.0325734897 -0.0223861374
[57,] -0.0170712116 -0.0325734897
[58,] -0.0299770250 -0.0170712116
[59,] -0.0409782823 -0.0299770250
[60,] -0.0335562858 -0.0409782823
[61,] -0.0525053831 -0.0335562858
[62,] 0.0178760802 -0.0525053831
[63,] -0.0056982369 0.0178760802
[64,] -0.0117524386 -0.0056982369
[65,] -0.0102243169 -0.0117524386
[66,] -0.0039236079 -0.0102243169
[67,] -0.0020699544 -0.0039236079
[68,] -0.0225400272 -0.0020699544
[69,] -0.0256787549 -0.0225400272
[70,] -0.0344113573 -0.0256787549
[71,] -0.0233711360 -0.0344113573
[72,] -0.0286619481 -0.0233711360
[73,] -0.0418044474 -0.0286619481
[74,] -0.0306414452 -0.0418044474
[75,] -0.0367723177 -0.0306414452
[76,] -0.0412143443 -0.0367723177
[77,] -0.0262938414 -0.0412143443
[78,] -0.0286346109 -0.0262938414
[79,] -0.0351642262 -0.0286346109
[80,] -0.0307735749 -0.0351642262
[81,] -0.0290145806 -0.0307735749
[82,] -0.0281907788 -0.0290145806
[83,] -0.0154313119 -0.0281907788
[84,] -0.0273247139 -0.0154313119
[85,] -0.0370274647 -0.0273247139
[86,] -0.0371910151 -0.0370274647
[87,] -0.0367489884 -0.0371910151
[88,] -0.0421529964 -0.0367489884
[89,] -0.0417463984 -0.0421529964
[90,] -0.0459884251 -0.0417463984
[91,] -0.0471734993 -0.0459884251
[92,] -0.0376053927 -0.0471734993
[93,] -0.0400625814 -0.0376053927
[94,] -0.0435673740 -0.0400625814
[95,] -0.0471805699 -0.0435673740
[96,] -0.0471808062 -0.0471805699
[97,] -0.0483911758 -0.0471808062
[98,] -0.0451251110 -0.0483911758
[99,] -0.0521015454 -0.0451251110
[100,] -0.0477830843 -0.0521015454
[101,] -0.0441871679 -0.0477830843
[102,] -0.0595426268 -0.0441871679
[103,] -0.0610689431 -0.0595426268
[104,] -0.0730780555 -0.0610689431
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.0741759950 -0.0585441959
2 0.0549600484 0.0741759950
3 0.0573395455 0.0549600484
4 0.0573927263 0.0573395455
5 0.0471851074 0.0573927263
6 0.0510360102 0.0471851074
7 0.0521846348 0.0510360102
8 0.0232414265 0.0521846348
9 0.0143546225 0.0232414265
10 0.0082187211 0.0143546225
11 0.0007280698 0.0082187211
12 0.0148151858 0.0007280698
13 0.0264166793 0.0148151858
14 0.0236096087 0.0264166793
15 0.0504351405 0.0236096087
16 0.0569821960 0.0504351405
17 0.0681588667 0.0569821960
18 0.0522414265 0.0681588667
19 0.0721654647 0.0522414265
20 0.0546250072 0.0721654647
21 0.0624619294 0.0546250072
22 0.0496090605 0.0624619294
23 0.0525836895 0.0496090605
24 0.0566173883 0.0525836895
25 0.0489953919 0.0566173883
26 0.0494966491 0.0489953919
27 0.0599634985 0.0494966491
28 0.0598738681 0.0599634985
29 0.0680470036 0.0598738681
30 0.0733041924 0.0680470036
31 0.0666016024 0.0733041924
32 0.0567304331 0.0666016024
33 0.0690020750 0.0567304331
34 0.0623851074 0.0690020750
35 0.0428536867 0.0623851074
36 0.0632779612 0.0428536867
37 0.0435873855 0.0632779612
38 0.0379324749 0.0435873855
39 0.0168141745 0.0379324749
40 -0.0129924235 0.0168141745
41 -0.0117015359 -0.0129924235
42 -0.0435836230 -0.0117015359
43 -0.0473089184 -0.0435836230
44 -0.0138446590 -0.0473089184
45 0.0027396306 -0.0138446590
46 0.0352031055 0.0027396306
47 0.0349517301 0.0352031055
48 0.0475656350 0.0349517301
49 0.0466882552 0.0475656350
50 -0.0061976887 0.0466882552
51 -0.0499090036 -0.0061976887
52 -0.0450176433 -0.0499090036
53 -0.0399599819 -0.0450176433
54 -0.0528258104 -0.0399599819
55 -0.0223861374 -0.0528258104
56 -0.0325734897 -0.0223861374
57 -0.0170712116 -0.0325734897
58 -0.0299770250 -0.0170712116
59 -0.0409782823 -0.0299770250
60 -0.0335562858 -0.0409782823
61 -0.0525053831 -0.0335562858
62 0.0178760802 -0.0525053831
63 -0.0056982369 0.0178760802
64 -0.0117524386 -0.0056982369
65 -0.0102243169 -0.0117524386
66 -0.0039236079 -0.0102243169
67 -0.0020699544 -0.0039236079
68 -0.0225400272 -0.0020699544
69 -0.0256787549 -0.0225400272
70 -0.0344113573 -0.0256787549
71 -0.0233711360 -0.0344113573
72 -0.0286619481 -0.0233711360
73 -0.0418044474 -0.0286619481
74 -0.0306414452 -0.0418044474
75 -0.0367723177 -0.0306414452
76 -0.0412143443 -0.0367723177
77 -0.0262938414 -0.0412143443
78 -0.0286346109 -0.0262938414
79 -0.0351642262 -0.0286346109
80 -0.0307735749 -0.0351642262
81 -0.0290145806 -0.0307735749
82 -0.0281907788 -0.0290145806
83 -0.0154313119 -0.0281907788
84 -0.0273247139 -0.0154313119
85 -0.0370274647 -0.0273247139
86 -0.0371910151 -0.0370274647
87 -0.0367489884 -0.0371910151
88 -0.0421529964 -0.0367489884
89 -0.0417463984 -0.0421529964
90 -0.0459884251 -0.0417463984
91 -0.0471734993 -0.0459884251
92 -0.0376053927 -0.0471734993
93 -0.0400625814 -0.0376053927
94 -0.0435673740 -0.0400625814
95 -0.0471805699 -0.0435673740
96 -0.0471808062 -0.0471805699
97 -0.0483911758 -0.0471808062
98 -0.0451251110 -0.0483911758
99 -0.0521015454 -0.0451251110
100 -0.0477830843 -0.0521015454
101 -0.0441871679 -0.0477830843
102 -0.0595426268 -0.0441871679
103 -0.0610689431 -0.0595426268
104 -0.0730780555 -0.0610689431
> 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/7ke1m1290505477.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/8ke1m1290505477.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/9vo071290505477.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/10vo071290505477.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/11gohd1290505477.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/122pf11290505477.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/1388uv1290505477.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/14cqtj1290505477.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/15xrr71290505477.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/1619qc1290505477.tab")
+ }
>
> try(system("convert tmp/16n3e1290505477.ps tmp/16n3e1290505477.png",intern=TRUE))
character(0)
> try(system("convert tmp/2zw2h1290505477.ps tmp/2zw2h1290505477.png",intern=TRUE))
character(0)
> try(system("convert tmp/3zw2h1290505477.ps tmp/3zw2h1290505477.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ankk1290505477.ps tmp/4ankk1290505477.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ankk1290505477.ps tmp/5ankk1290505477.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ankk1290505477.ps tmp/6ankk1290505477.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ke1m1290505477.ps tmp/7ke1m1290505477.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ke1m1290505477.ps tmp/8ke1m1290505477.png",intern=TRUE))
character(0)
> try(system("convert tmp/9vo071290505477.ps tmp/9vo071290505477.png",intern=TRUE))
character(0)
> try(system("convert tmp/10vo071290505477.ps tmp/10vo071290505477.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.003 1.643 6.959