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.634
+ ,1.5358
+ ,0.6348
+ ,0.62915
+ ,1.5355
+ ,0.634
+ ,0.62168
+ ,1.5287
+ ,0.62915
+ ,0.61328
+ ,1.5334
+ ,0.62168
+ ,0.6089
+ ,1.5225
+ ,0.61328
+ ,0.60857
+ ,1.5135
+ ,0.6089
+ ,0.62672
+ ,1.5144
+ ,0.60857
+ ,0.62291
+ ,1.4913
+ ,0.62672
+ ,0.62393
+ ,1.4793
+ ,0.62291
+ ,0.61838
+ ,1.4663
+ ,0.62393
+ ,0.62012
+ ,1.4749
+ ,0.61838
+ ,0.61659
+ ,1.4745
+ ,0.62012
+ ,0.6116
+ ,1.4775
+ ,0.61659
+ ,0.61573
+ ,1.4678
+ ,0.6116
+ ,0.61407
+ ,1.4658
+ ,0.61573
+ ,0.62823
+ ,1.4572
+ ,0.61407
+ ,0.64405
+ ,1.4721
+ ,0.62823
+ ,0.6387
+ ,1.4624
+ ,0.64405
+ ,0.63633
+ ,1.4636
+ ,0.6387
+ ,0.63059
+ ,1.4649
+ ,0.63633
+ ,0.62994
+ ,1.465
+ ,0.63059
+ ,0.63709
+ ,1.4673
+ ,0.62994
+ ,0.64217
+ ,1.4679
+ ,0.63709
+ ,0.65711
+ ,1.4621
+ ,0.64217
+ ,0.66977
+ ,1.4674
+ ,0.65711
+ ,0.68255
+ ,1.4695
+ ,0.66977
+ ,0.68902
+ ,1.4964
+ ,0.68255
+ ,0.71322
+ ,1.5155
+ ,0.68902
+ ,0.70224
+ ,1.5411
+ ,0.71322
+ ,0.70045
+ ,1.5476
+ ,0.70224
+ ,0.69919
+ ,1.54
+ ,0.70045
+ ,0.69693
+ ,1.5474
+ ,0.69919
+ ,0.69763
+ ,1.5485
+ ,0.69693
+ ,0.69278
+ ,1.559
+ ,0.69763
+ ,0.70196
+ ,1.5544
+ ,0.69278
+ ,0.69215
+ ,1.5657
+ ,0.70196
+ ,0.6769
+ ,1.5734
+ ,0.69215
+ ,0.67124
+ ,1.567
+ ,0.6769
+ ,0.66532
+ ,1.5547
+ ,0.67124
+ ,0.67157
+ ,1.54
+ ,0.66532
+ ,0.66428
+ ,1.5192
+ ,0.67157
+ ,0.66576
+ ,1.527
+ ,0.66428
+ ,0.66942
+ ,1.5387
+ ,0.66576
+ ,0.6813
+ ,1.5431
+ ,0.66942
+ ,0.69144
+ ,1.5426
+ ,0.6813
+ ,0.69862
+ ,1.5216
+ ,0.69144
+ ,0.695
+ ,1.5364
+ ,0.69862
+ ,0.69867
+ ,1.5469
+ ,0.695
+ ,0.68968
+ ,1.5501
+ ,0.69867
+ ,0.69233
+ ,1.5494
+ ,0.68968
+ ,0.68293
+ ,1.5475
+ ,0.69233
+ ,0.68399
+ ,1.5448
+ ,0.68293
+ ,0.66895
+ ,1.5391
+ ,0.68399
+ ,0.68756
+ ,1.5578
+ ,0.66895
+ ,0.68527
+ ,1.5528
+ ,0.68756
+ ,0.6776
+ ,1.5496
+ ,0.68527
+ ,0.68137
+ ,1.549
+ ,0.6776
+ ,0.67933
+ ,1.5449
+ ,0.68137
+ ,0.67922
+ ,1.5479
+ ,0.67933)
+ ,dim=c(3
+ ,59)
+ ,dimnames=list(c('britse_pond'
+ ,'Zwitserse_frank'
+ ,'Britse_pond_-1')
+ ,1:59))
> y <- array(NA,dim=c(3,59),dimnames=list(c('britse_pond','Zwitserse_frank','Britse_pond_-1'),1:59))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Include Monthly Dummies'
> par1 = '1'
> #'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 Britse_pond_-1 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10
1 0.63400 1.5358 0.63480 1 0 0 0 0 0 0 0 0 0
2 0.62915 1.5355 0.63400 0 1 0 0 0 0 0 0 0 0
3 0.62168 1.5287 0.62915 0 0 1 0 0 0 0 0 0 0
4 0.61328 1.5334 0.62168 0 0 0 1 0 0 0 0 0 0
5 0.60890 1.5225 0.61328 0 0 0 0 1 0 0 0 0 0
6 0.60857 1.5135 0.60890 0 0 0 0 0 1 0 0 0 0
7 0.62672 1.5144 0.60857 0 0 0 0 0 0 1 0 0 0
8 0.62291 1.4913 0.62672 0 0 0 0 0 0 0 1 0 0
9 0.62393 1.4793 0.62291 0 0 0 0 0 0 0 0 1 0
10 0.61838 1.4663 0.62393 0 0 0 0 0 0 0 0 0 1
11 0.62012 1.4749 0.61838 0 0 0 0 0 0 0 0 0 0
12 0.61659 1.4745 0.62012 0 0 0 0 0 0 0 0 0 0
13 0.61160 1.4775 0.61659 1 0 0 0 0 0 0 0 0 0
14 0.61573 1.4678 0.61160 0 1 0 0 0 0 0 0 0 0
15 0.61407 1.4658 0.61573 0 0 1 0 0 0 0 0 0 0
16 0.62823 1.4572 0.61407 0 0 0 1 0 0 0 0 0 0
17 0.64405 1.4721 0.62823 0 0 0 0 1 0 0 0 0 0
18 0.63870 1.4624 0.64405 0 0 0 0 0 1 0 0 0 0
19 0.63633 1.4636 0.63870 0 0 0 0 0 0 1 0 0 0
20 0.63059 1.4649 0.63633 0 0 0 0 0 0 0 1 0 0
21 0.62994 1.4650 0.63059 0 0 0 0 0 0 0 0 1 0
22 0.63709 1.4673 0.62994 0 0 0 0 0 0 0 0 0 1
23 0.64217 1.4679 0.63709 0 0 0 0 0 0 0 0 0 0
24 0.65711 1.4621 0.64217 0 0 0 0 0 0 0 0 0 0
25 0.66977 1.4674 0.65711 1 0 0 0 0 0 0 0 0 0
26 0.68255 1.4695 0.66977 0 1 0 0 0 0 0 0 0 0
27 0.68902 1.4964 0.68255 0 0 1 0 0 0 0 0 0 0
28 0.71322 1.5155 0.68902 0 0 0 1 0 0 0 0 0 0
29 0.70224 1.5411 0.71322 0 0 0 0 1 0 0 0 0 0
30 0.70045 1.5476 0.70224 0 0 0 0 0 1 0 0 0 0
31 0.69919 1.5400 0.70045 0 0 0 0 0 0 1 0 0 0
32 0.69693 1.5474 0.69919 0 0 0 0 0 0 0 1 0 0
33 0.69763 1.5485 0.69693 0 0 0 0 0 0 0 0 1 0
34 0.69278 1.5590 0.69763 0 0 0 0 0 0 0 0 0 1
35 0.70196 1.5544 0.69278 0 0 0 0 0 0 0 0 0 0
36 0.69215 1.5657 0.70196 0 0 0 0 0 0 0 0 0 0
37 0.67690 1.5734 0.69215 1 0 0 0 0 0 0 0 0 0
38 0.67124 1.5670 0.67690 0 1 0 0 0 0 0 0 0 0
39 0.66532 1.5547 0.67124 0 0 1 0 0 0 0 0 0 0
40 0.67157 1.5400 0.66532 0 0 0 1 0 0 0 0 0 0
41 0.66428 1.5192 0.67157 0 0 0 0 1 0 0 0 0 0
42 0.66576 1.5270 0.66428 0 0 0 0 0 1 0 0 0 0
43 0.66942 1.5387 0.66576 0 0 0 0 0 0 1 0 0 0
44 0.68130 1.5431 0.66942 0 0 0 0 0 0 0 1 0 0
45 0.69144 1.5426 0.68130 0 0 0 0 0 0 0 0 1 0
46 0.69862 1.5216 0.69144 0 0 0 0 0 0 0 0 0 1
47 0.69500 1.5364 0.69862 0 0 0 0 0 0 0 0 0 0
48 0.69867 1.5469 0.69500 0 0 0 0 0 0 0 0 0 0
49 0.68968 1.5501 0.69867 1 0 0 0 0 0 0 0 0 0
50 0.69233 1.5494 0.68968 0 1 0 0 0 0 0 0 0 0
51 0.68293 1.5475 0.69233 0 0 1 0 0 0 0 0 0 0
52 0.68399 1.5448 0.68293 0 0 0 1 0 0 0 0 0 0
53 0.66895 1.5391 0.68399 0 0 0 0 1 0 0 0 0 0
54 0.68756 1.5578 0.66895 0 0 0 0 0 1 0 0 0 0
55 0.68527 1.5528 0.68756 0 0 0 0 0 0 1 0 0 0
56 0.67760 1.5496 0.68527 0 0 0 0 0 0 0 1 0 0
57 0.68137 1.5490 0.67760 0 0 0 0 0 0 0 0 1 0
58 0.67933 1.5449 0.68137 0 0 0 0 0 0 0 0 0 1
59 0.67922 1.5479 0.67933 0 0 0 0 0 0 0 0 0 0
M11 t
1 0 1
2 0 2
3 0 3
4 0 4
5 0 5
6 0 6
7 0 7
8 0 8
9 0 9
10 0 10
11 1 11
12 0 12
13 0 13
14 0 14
15 0 15
16 0 16
17 0 17
18 0 18
19 0 19
20 0 20
21 0 21
22 0 22
23 1 23
24 0 24
25 0 25
26 0 26
27 0 27
28 0 28
29 0 29
30 0 30
31 0 31
32 0 32
33 0 33
34 0 34
35 1 35
36 0 36
37 0 37
38 0 38
39 0 39
40 0 40
41 0 41
42 0 42
43 0 43
44 0 44
45 0 45
46 0 46
47 1 47
48 0 48
49 0 49
50 0 50
51 0 51
52 0 52
53 0 53
54 0 54
55 0 55
56 0 56
57 0 57
58 0 58
59 1 59
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Zwitserse_frank `Britse_pond_-1` M1
0.1454122 -0.0985427 1.0026888 -0.0034127
M2 M3 M4 M5
0.0014803 -0.0039585 0.0069530 -0.0049388
M6 M7 M8 M9
0.0021480 0.0027141 -0.0023574 0.0018234
M10 M11 t
-0.0014061 0.0010055 0.0001048
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.012419 -0.005132 -0.001718 0.003371 0.017102
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.1454122 0.0583404 2.492 0.0165 *
Zwitserse_frank -0.0985427 0.0450611 -2.187 0.0341 *
`Britse_pond_-1` 1.0026888 0.0656729 15.268 <2e-16 ***
M1 -0.0034127 0.0057004 -0.599 0.5525
M2 0.0014803 0.0056933 0.260 0.7961
M3 -0.0039585 0.0056867 -0.696 0.4900
M4 0.0069530 0.0057071 1.218 0.2296
M5 -0.0049388 0.0056712 -0.871 0.3886
M6 0.0021480 0.0057087 0.376 0.7085
M7 0.0027141 0.0056962 0.476 0.6361
M8 -0.0023574 0.0056736 -0.416 0.6798
M9 0.0018234 0.0056820 0.321 0.7498
M10 -0.0014061 0.0056732 -0.248 0.8054
M11 0.0010055 0.0056812 0.177 0.8603
t 0.0001048 0.0001081 0.969 0.3377
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.008432 on 44 degrees of freedom
Multiple R-squared: 0.947, Adjusted R-squared: 0.9301
F-statistic: 56.11 on 14 and 44 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.7214280 0.5571440 0.27857202
[2,] 0.8537113 0.2925774 0.14628868
[3,] 0.8495166 0.3009668 0.15048341
[4,] 0.8513190 0.2973620 0.14868099
[5,] 0.8538908 0.2922185 0.14610923
[6,] 0.8510227 0.2979547 0.14897734
[7,] 0.8813125 0.2373751 0.11868755
[8,] 0.8531925 0.2936151 0.14680754
[9,] 0.8181546 0.3636908 0.18184540
[10,] 0.7386852 0.5226295 0.26131477
[11,] 0.8189073 0.3621853 0.18109265
[12,] 0.9264691 0.1470618 0.07353091
[13,] 0.8886815 0.2226370 0.11131851
[14,] 0.8561925 0.2876151 0.14380753
[15,] 0.7839211 0.4321578 0.21607890
[16,] 0.6991875 0.6016251 0.30081254
[17,] 0.6148979 0.7702042 0.38510209
[18,] 0.6530642 0.6938716 0.34693579
[19,] 0.6333158 0.7333685 0.36668424
[20,] 0.6131041 0.7737918 0.38689590
[21,] 0.6838058 0.6323884 0.31619422
[22,] 0.6777163 0.6445674 0.32228372
[23,] 0.6088797 0.7822406 0.39112031
[24,] 0.4756841 0.9513682 0.52431589
> postscript(file="/var/www/html/rcomp/tmp/1jk6h1258733582.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/2xpzk1258733582.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/3qs771258733582.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/4tt2a1258733582.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/5kb8z1258733582.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 = 59
Frequency = 1
1 2 3 4 5
6.730728e-03 -2.344397e-03 -2.874433e-04 -1.175052e-02 3.004899e-03
6 7 8 9 10
-1.011802e-03 1.688691e-02 -2.431530e-03 -3.059354e-03 -7.788470e-03
11 12 13 14 15
-2.152534e-03 -6.565893e-03 -4.412918e-03 -1.233078e-03 -1.897264e-03
16 17 18 19 20
2.063422e-03 1.694058e-02 -1.241941e-02 -9.977641e-03 -8.246465e-03
21 22 23 24 25
-7.416733e-03 3.736345e-03 -8.102091e-04 9.365321e-03 1.087528e-02
26 27 28 29 30
6.170470e-03 7.810909e-03 1.638937e-02 -4.546062e-03 -1.877604e-03
31 32 33 34 35
-2.762579e-03 1.936722e-03 7.256406e-04 -6.668614e-04 1.040643e-02
36 37 38 39 40
-6.593986e-03 -7.940974e-03 -3.938356e-03 -6.120945e-05 -3.401797e-04
41 42 43 44 45
-4.159727e-03 -1.793086e-03 8.650209e-04 1.447547e-02 8.368696e-03
46 47 48 49 50
6.436717e-03 -5.440612e-03 3.794557e-03 -5.252118e-03 1.345361e-03
51 52 53 54 55
-5.564992e-03 -6.362093e-03 -1.123969e-02 1.710190e-02 -5.011711e-03
56 57 58 59
-5.734193e-03 1.381749e-03 -1.717731e-03 -2.003072e-03
> postscript(file="/var/www/html/rcomp/tmp/60rri1258733582.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 = 59
Frequency = 1
lag(myerror, k = 1) myerror
0 6.730728e-03 NA
1 -2.344397e-03 6.730728e-03
2 -2.874433e-04 -2.344397e-03
3 -1.175052e-02 -2.874433e-04
4 3.004899e-03 -1.175052e-02
5 -1.011802e-03 3.004899e-03
6 1.688691e-02 -1.011802e-03
7 -2.431530e-03 1.688691e-02
8 -3.059354e-03 -2.431530e-03
9 -7.788470e-03 -3.059354e-03
10 -2.152534e-03 -7.788470e-03
11 -6.565893e-03 -2.152534e-03
12 -4.412918e-03 -6.565893e-03
13 -1.233078e-03 -4.412918e-03
14 -1.897264e-03 -1.233078e-03
15 2.063422e-03 -1.897264e-03
16 1.694058e-02 2.063422e-03
17 -1.241941e-02 1.694058e-02
18 -9.977641e-03 -1.241941e-02
19 -8.246465e-03 -9.977641e-03
20 -7.416733e-03 -8.246465e-03
21 3.736345e-03 -7.416733e-03
22 -8.102091e-04 3.736345e-03
23 9.365321e-03 -8.102091e-04
24 1.087528e-02 9.365321e-03
25 6.170470e-03 1.087528e-02
26 7.810909e-03 6.170470e-03
27 1.638937e-02 7.810909e-03
28 -4.546062e-03 1.638937e-02
29 -1.877604e-03 -4.546062e-03
30 -2.762579e-03 -1.877604e-03
31 1.936722e-03 -2.762579e-03
32 7.256406e-04 1.936722e-03
33 -6.668614e-04 7.256406e-04
34 1.040643e-02 -6.668614e-04
35 -6.593986e-03 1.040643e-02
36 -7.940974e-03 -6.593986e-03
37 -3.938356e-03 -7.940974e-03
38 -6.120945e-05 -3.938356e-03
39 -3.401797e-04 -6.120945e-05
40 -4.159727e-03 -3.401797e-04
41 -1.793086e-03 -4.159727e-03
42 8.650209e-04 -1.793086e-03
43 1.447547e-02 8.650209e-04
44 8.368696e-03 1.447547e-02
45 6.436717e-03 8.368696e-03
46 -5.440612e-03 6.436717e-03
47 3.794557e-03 -5.440612e-03
48 -5.252118e-03 3.794557e-03
49 1.345361e-03 -5.252118e-03
50 -5.564992e-03 1.345361e-03
51 -6.362093e-03 -5.564992e-03
52 -1.123969e-02 -6.362093e-03
53 1.710190e-02 -1.123969e-02
54 -5.011711e-03 1.710190e-02
55 -5.734193e-03 -5.011711e-03
56 1.381749e-03 -5.734193e-03
57 -1.717731e-03 1.381749e-03
58 -2.003072e-03 -1.717731e-03
59 NA -2.003072e-03
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -2.344397e-03 6.730728e-03
[2,] -2.874433e-04 -2.344397e-03
[3,] -1.175052e-02 -2.874433e-04
[4,] 3.004899e-03 -1.175052e-02
[5,] -1.011802e-03 3.004899e-03
[6,] 1.688691e-02 -1.011802e-03
[7,] -2.431530e-03 1.688691e-02
[8,] -3.059354e-03 -2.431530e-03
[9,] -7.788470e-03 -3.059354e-03
[10,] -2.152534e-03 -7.788470e-03
[11,] -6.565893e-03 -2.152534e-03
[12,] -4.412918e-03 -6.565893e-03
[13,] -1.233078e-03 -4.412918e-03
[14,] -1.897264e-03 -1.233078e-03
[15,] 2.063422e-03 -1.897264e-03
[16,] 1.694058e-02 2.063422e-03
[17,] -1.241941e-02 1.694058e-02
[18,] -9.977641e-03 -1.241941e-02
[19,] -8.246465e-03 -9.977641e-03
[20,] -7.416733e-03 -8.246465e-03
[21,] 3.736345e-03 -7.416733e-03
[22,] -8.102091e-04 3.736345e-03
[23,] 9.365321e-03 -8.102091e-04
[24,] 1.087528e-02 9.365321e-03
[25,] 6.170470e-03 1.087528e-02
[26,] 7.810909e-03 6.170470e-03
[27,] 1.638937e-02 7.810909e-03
[28,] -4.546062e-03 1.638937e-02
[29,] -1.877604e-03 -4.546062e-03
[30,] -2.762579e-03 -1.877604e-03
[31,] 1.936722e-03 -2.762579e-03
[32,] 7.256406e-04 1.936722e-03
[33,] -6.668614e-04 7.256406e-04
[34,] 1.040643e-02 -6.668614e-04
[35,] -6.593986e-03 1.040643e-02
[36,] -7.940974e-03 -6.593986e-03
[37,] -3.938356e-03 -7.940974e-03
[38,] -6.120945e-05 -3.938356e-03
[39,] -3.401797e-04 -6.120945e-05
[40,] -4.159727e-03 -3.401797e-04
[41,] -1.793086e-03 -4.159727e-03
[42,] 8.650209e-04 -1.793086e-03
[43,] 1.447547e-02 8.650209e-04
[44,] 8.368696e-03 1.447547e-02
[45,] 6.436717e-03 8.368696e-03
[46,] -5.440612e-03 6.436717e-03
[47,] 3.794557e-03 -5.440612e-03
[48,] -5.252118e-03 3.794557e-03
[49,] 1.345361e-03 -5.252118e-03
[50,] -5.564992e-03 1.345361e-03
[51,] -6.362093e-03 -5.564992e-03
[52,] -1.123969e-02 -6.362093e-03
[53,] 1.710190e-02 -1.123969e-02
[54,] -5.011711e-03 1.710190e-02
[55,] -5.734193e-03 -5.011711e-03
[56,] 1.381749e-03 -5.734193e-03
[57,] -1.717731e-03 1.381749e-03
[58,] -2.003072e-03 -1.717731e-03
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -2.344397e-03 6.730728e-03
2 -2.874433e-04 -2.344397e-03
3 -1.175052e-02 -2.874433e-04
4 3.004899e-03 -1.175052e-02
5 -1.011802e-03 3.004899e-03
6 1.688691e-02 -1.011802e-03
7 -2.431530e-03 1.688691e-02
8 -3.059354e-03 -2.431530e-03
9 -7.788470e-03 -3.059354e-03
10 -2.152534e-03 -7.788470e-03
11 -6.565893e-03 -2.152534e-03
12 -4.412918e-03 -6.565893e-03
13 -1.233078e-03 -4.412918e-03
14 -1.897264e-03 -1.233078e-03
15 2.063422e-03 -1.897264e-03
16 1.694058e-02 2.063422e-03
17 -1.241941e-02 1.694058e-02
18 -9.977641e-03 -1.241941e-02
19 -8.246465e-03 -9.977641e-03
20 -7.416733e-03 -8.246465e-03
21 3.736345e-03 -7.416733e-03
22 -8.102091e-04 3.736345e-03
23 9.365321e-03 -8.102091e-04
24 1.087528e-02 9.365321e-03
25 6.170470e-03 1.087528e-02
26 7.810909e-03 6.170470e-03
27 1.638937e-02 7.810909e-03
28 -4.546062e-03 1.638937e-02
29 -1.877604e-03 -4.546062e-03
30 -2.762579e-03 -1.877604e-03
31 1.936722e-03 -2.762579e-03
32 7.256406e-04 1.936722e-03
33 -6.668614e-04 7.256406e-04
34 1.040643e-02 -6.668614e-04
35 -6.593986e-03 1.040643e-02
36 -7.940974e-03 -6.593986e-03
37 -3.938356e-03 -7.940974e-03
38 -6.120945e-05 -3.938356e-03
39 -3.401797e-04 -6.120945e-05
40 -4.159727e-03 -3.401797e-04
41 -1.793086e-03 -4.159727e-03
42 8.650209e-04 -1.793086e-03
43 1.447547e-02 8.650209e-04
44 8.368696e-03 1.447547e-02
45 6.436717e-03 8.368696e-03
46 -5.440612e-03 6.436717e-03
47 3.794557e-03 -5.440612e-03
48 -5.252118e-03 3.794557e-03
49 1.345361e-03 -5.252118e-03
50 -5.564992e-03 1.345361e-03
51 -6.362093e-03 -5.564992e-03
52 -1.123969e-02 -6.362093e-03
53 1.710190e-02 -1.123969e-02
54 -5.011711e-03 1.710190e-02
55 -5.734193e-03 -5.011711e-03
56 1.381749e-03 -5.734193e-03
57 -1.717731e-03 1.381749e-03
58 -2.003072e-03 -1.717731e-03
> 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/7pjbd1258733582.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/8kg9t1258733582.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/9jbrx1258733582.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/100l491258733582.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/11hses1258733582.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/1249l21258733582.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/13j95t1258733582.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/143xzz1258733582.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/15jmq71258733582.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/16xiau1258733582.tab")
+ }
>
> system("convert tmp/1jk6h1258733582.ps tmp/1jk6h1258733582.png")
> system("convert tmp/2xpzk1258733582.ps tmp/2xpzk1258733582.png")
> system("convert tmp/3qs771258733582.ps tmp/3qs771258733582.png")
> system("convert tmp/4tt2a1258733582.ps tmp/4tt2a1258733582.png")
> system("convert tmp/5kb8z1258733582.ps tmp/5kb8z1258733582.png")
> system("convert tmp/60rri1258733582.ps tmp/60rri1258733582.png")
> system("convert tmp/7pjbd1258733582.ps tmp/7pjbd1258733582.png")
> system("convert tmp/8kg9t1258733582.ps tmp/8kg9t1258733582.png")
> system("convert tmp/9jbrx1258733582.ps tmp/9jbrx1258733582.png")
> system("convert tmp/100l491258733582.ps tmp/100l491258733582.png")
>
>
> proc.time()
user system elapsed
2.468 1.590 9.544