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(61.2
+ ,2.08
+ ,83.9
+ ,10554.27
+ ,62
+ ,2.09
+ ,85.6
+ ,10532.54
+ ,65.1
+ ,2.07
+ ,87.5
+ ,10324.31
+ ,63.2
+ ,2.04
+ ,88.5
+ ,10695.25
+ ,66.3
+ ,2.35
+ ,91
+ ,10827.81
+ ,61.9
+ ,2.33
+ ,90.6
+ ,10872.48
+ ,62.1
+ ,2.37
+ ,91.2
+ ,10971.19
+ ,66.3
+ ,2.59
+ ,93.2
+ ,11145.65
+ ,72
+ ,2.62
+ ,90.1
+ ,11234.68
+ ,65.3
+ ,2.6
+ ,95
+ ,11333.88
+ ,67.6
+ ,2.83
+ ,95.4
+ ,10997.97
+ ,70.5
+ ,2.78
+ ,93.7
+ ,11036.89
+ ,74.2
+ ,3.01
+ ,93.9
+ ,11257.35
+ ,77.8
+ ,3.06
+ ,92.5
+ ,11533.59
+ ,78.5
+ ,3.33
+ ,89.2
+ ,11963.12
+ ,77.8
+ ,3.32
+ ,93.3
+ ,12185.15
+ ,81.4
+ ,3.6
+ ,93
+ ,12377.62
+ ,84.5
+ ,3.57
+ ,96.1
+ ,12512.89
+ ,88
+ ,3.57
+ ,96.7
+ ,12631.48
+ ,93.9
+ ,3.83
+ ,97.6
+ ,12268.53
+ ,98.9
+ ,3.84
+ ,102.6
+ ,12754.8
+ ,96.7
+ ,3.8
+ ,107.6
+ ,13407.75
+ ,98.9
+ ,4.07
+ ,103.5
+ ,13480.21
+ ,102.2
+ ,4.05
+ ,100.8
+ ,13673.28
+ ,105.4
+ ,4.272
+ ,94.5
+ ,13239.71
+ ,105.1
+ ,3.858
+ ,100.1
+ ,13557.69
+ ,116.6
+ ,4.067
+ ,97.4
+ ,13901.28
+ ,112
+ ,3.964
+ ,103
+ ,13200.58
+ ,108.8
+ ,3.782
+ ,100.2
+ ,13406.97
+ ,106.9
+ ,4.114
+ ,100.2
+ ,12538.12
+ ,109.5
+ ,4.009
+ ,99
+ ,12419.57
+ ,106.7
+ ,4.025
+ ,102.4
+ ,12193.88
+ ,118.9
+ ,4.082
+ ,99
+ ,12656.63
+ ,117.5
+ ,4.044
+ ,103.7
+ ,12812.48
+ ,113.7
+ ,3.916
+ ,103.4
+ ,12056.67
+ ,119.6
+ ,4.289
+ ,95.3
+ ,11322.38
+ ,120.6
+ ,4.296
+ ,93.6
+ ,11530.75
+ ,117.5
+ ,4.193
+ ,102.4
+ ,11114.08
+ ,120.3
+ ,3.48
+ ,110.5
+ ,9181.73
+ ,119.8
+ ,2.934
+ ,109.1
+ ,8614.55
+ ,108
+ ,2.221
+ ,100.9
+ ,8595.56
+ ,98.8
+ ,1.211
+ ,108.1
+ ,8396.2
+ ,94.6
+ ,1.28
+ ,105
+ ,7690.5
+ ,84.6
+ ,0.96
+ ,111.5
+ ,7235.47
+ ,84.4
+ ,0.5
+ ,109.5
+ ,7992.12
+ ,79.1
+ ,0.687
+ ,110.5
+ ,8398.37
+ ,73.3
+ ,0.344
+ ,114
+ ,8593
+ ,74.3
+ ,0.346
+ ,108.2
+ ,8679.75
+ ,67.8
+ ,0.334
+ ,110.3
+ ,9374.63
+ ,64.8
+ ,0.34
+ ,111.8
+ ,9634.97
+ ,66.5
+ ,0.328
+ ,107.5
+ ,9857.34
+ ,57.7
+ ,0.344
+ ,114.1
+ ,10238.83
+ ,53.8
+ ,0.341
+ ,113.8
+ ,10433.44
+ ,51.8
+ ,0.32
+ ,114.5
+ ,10471.24
+ ,50.9
+ ,0.314
+ ,114.8
+ ,10214.51
+ ,49
+ ,0.325
+ ,117.8
+ ,10677.52
+ ,48.1
+ ,0.339
+ ,116.7
+ ,11052.15
+ ,42.6
+ ,0.329
+ ,122.8
+ ,10500.19
+ ,40.9
+ ,0.48
+ ,122.3
+ ,10159.27
+ ,43.3
+ ,0.399
+ ,115
+ ,10222.24
+ ,43.7
+ ,0.37
+ ,118.5
+ ,10350.4)
+ ,dim=c(4
+ ,61)
+ ,dimnames=list(c('2JAAR'
+ ,'Eonia'
+ ,'deposits'
+ ,'DowJones')
+ ,1:61))
> y <- array(NA,dim=c(4,61),dimnames=list(c('2JAAR','Eonia','deposits','DowJones'),1:61))
> 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
2JAAR Eonia deposits DowJones
1 61.2 2.080 83.9 10554.27
2 62.0 2.090 85.6 10532.54
3 65.1 2.070 87.5 10324.31
4 63.2 2.040 88.5 10695.25
5 66.3 2.350 91.0 10827.81
6 61.9 2.330 90.6 10872.48
7 62.1 2.370 91.2 10971.19
8 66.3 2.590 93.2 11145.65
9 72.0 2.620 90.1 11234.68
10 65.3 2.600 95.0 11333.88
11 67.6 2.830 95.4 10997.97
12 70.5 2.780 93.7 11036.89
13 74.2 3.010 93.9 11257.35
14 77.8 3.060 92.5 11533.59
15 78.5 3.330 89.2 11963.12
16 77.8 3.320 93.3 12185.15
17 81.4 3.600 93.0 12377.62
18 84.5 3.570 96.1 12512.89
19 88.0 3.570 96.7 12631.48
20 93.9 3.830 97.6 12268.53
21 98.9 3.840 102.6 12754.80
22 96.7 3.800 107.6 13407.75
23 98.9 4.070 103.5 13480.21
24 102.2 4.050 100.8 13673.28
25 105.4 4.272 94.5 13239.71
26 105.1 3.858 100.1 13557.69
27 116.6 4.067 97.4 13901.28
28 112.0 3.964 103.0 13200.58
29 108.8 3.782 100.2 13406.97
30 106.9 4.114 100.2 12538.12
31 109.5 4.009 99.0 12419.57
32 106.7 4.025 102.4 12193.88
33 118.9 4.082 99.0 12656.63
34 117.5 4.044 103.7 12812.48
35 113.7 3.916 103.4 12056.67
36 119.6 4.289 95.3 11322.38
37 120.6 4.296 93.6 11530.75
38 117.5 4.193 102.4 11114.08
39 120.3 3.480 110.5 9181.73
40 119.8 2.934 109.1 8614.55
41 108.0 2.221 100.9 8595.56
42 98.8 1.211 108.1 8396.20
43 94.6 1.280 105.0 7690.50
44 84.6 0.960 111.5 7235.47
45 84.4 0.500 109.5 7992.12
46 79.1 0.687 110.5 8398.37
47 73.3 0.344 114.0 8593.00
48 74.3 0.346 108.2 8679.75
49 67.8 0.334 110.3 9374.63
50 64.8 0.340 111.8 9634.97
51 66.5 0.328 107.5 9857.34
52 57.7 0.344 114.1 10238.83
53 53.8 0.341 113.8 10433.44
54 51.8 0.320 114.5 10471.24
55 50.9 0.314 114.8 10214.51
56 49.0 0.325 117.8 10677.52
57 48.1 0.339 116.7 11052.15
58 42.6 0.329 122.8 10500.19
59 40.9 0.480 122.3 10159.27
60 43.3 0.399 115.0 10222.24
61 43.7 0.370 118.5 10350.40
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Eonia deposits DowJones
11.610911 23.937608 1.064653 -0.008671
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-24.314 -6.919 -0.834 6.488 24.479
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 11.610911 20.808690 0.558 0.579
Eonia 23.937608 1.533361 15.611 < 2e-16 ***
deposits 1.064653 0.170415 6.247 5.64e-08 ***
DowJones -0.008671 0.001197 -7.243 1.25e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 10.06 on 57 degrees of freedom
Multiple R-squared: 0.8363, Adjusted R-squared: 0.8276
F-statistic: 97.04 on 3 and 57 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,] 5.317492e-03 1.063498e-02 0.9946825080
[2,] 1.501090e-03 3.002180e-03 0.9984989098
[3,] 5.008848e-03 1.001770e-02 0.9949911523
[4,] 1.400582e-03 2.801164e-03 0.9985994181
[5,] 6.335194e-04 1.267039e-03 0.9993664806
[6,] 2.240509e-04 4.481018e-04 0.9997759491
[7,] 8.556178e-05 1.711236e-04 0.9999144382
[8,] 4.155732e-05 8.311464e-05 0.9999584427
[9,] 2.891862e-05 5.783724e-05 0.9999710814
[10,] 1.479296e-05 2.958592e-05 0.9999852070
[11,] 1.287886e-05 2.575772e-05 0.9999871211
[12,] 3.496591e-05 6.993182e-05 0.9999650341
[13,] 2.121218e-04 4.242436e-04 0.9997878782
[14,] 2.747204e-03 5.494408e-03 0.9972527961
[15,] 1.690857e-02 3.381713e-02 0.9830914328
[16,] 1.069732e-02 2.139465e-02 0.9893026770
[17,] 6.282287e-03 1.256457e-02 0.9937177134
[18,] 4.619094e-03 9.238189e-03 0.9953809056
[19,] 1.071396e-02 2.142792e-02 0.9892860376
[20,] 1.436604e-02 2.873208e-02 0.9856339616
[21,] 6.110342e-02 1.222068e-01 0.9388965823
[22,] 2.074877e-01 4.149754e-01 0.7925123094
[23,] 2.728248e-01 5.456497e-01 0.7271751673
[24,] 3.725282e-01 7.450565e-01 0.6274717588
[25,] 4.884830e-01 9.769660e-01 0.5115169971
[26,] 5.030756e-01 9.938488e-01 0.4969244152
[27,] 6.938996e-01 6.122008e-01 0.3061003994
[28,] 9.030577e-01 1.938847e-01 0.0969423479
[29,] 9.498728e-01 1.002544e-01 0.0501272079
[30,] 9.466310e-01 1.067379e-01 0.0533689568
[31,] 9.472523e-01 1.054955e-01 0.0527477328
[32,] 9.390206e-01 1.219588e-01 0.0609793850
[33,] 9.308935e-01 1.382131e-01 0.0691065473
[34,] 9.732700e-01 5.345999e-02 0.0267299926
[35,] 9.844947e-01 3.101065e-02 0.0155053231
[36,] 9.993156e-01 1.368789e-03 0.0006843945
[37,] 9.989656e-01 2.068766e-03 0.0010343829
[38,] 9.977872e-01 4.425529e-03 0.0022127643
[39,] 9.960538e-01 7.892367e-03 0.0039461835
[40,] 9.987857e-01 2.428519e-03 0.0012142594
[41,] 9.978705e-01 4.259083e-03 0.0021295415
[42,] 9.948217e-01 1.035659e-02 0.0051782959
[43,] 9.882984e-01 2.340330e-02 0.0117016498
[44,] 9.837894e-01 3.242122e-02 0.0162106113
[45,] 9.764927e-01 4.701464e-02 0.0235073206
[46,] 9.892386e-01 2.152285e-02 0.0107614262
[47,] 9.844751e-01 3.104970e-02 0.0155248519
[48,] 9.606821e-01 7.863582e-02 0.0393179100
> postscript(file="/var/www/html/rcomp/tmp/1ceru1293375605.ps",horizontal=F,onefile=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/2ceru1293375605.ps",horizontal=F,onefile=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/3ffba1293375606.ps",horizontal=F,onefile=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/4ffba1293375606.ps",horizontal=F,onefile=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/5ffba1293375606.ps",horizontal=F,onefile=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 = 61
Frequency = 1
1 2 3 4 5 6
1.99316181 0.55544889 0.30574554 1.27573377 -4.55709713 -7.66513894
7 8 9 10 11 12
-8.20549620 -9.88829037 -0.83399210 -11.41185308 -17.95612367 -11.71184765
13 14 15 16 17 18
-11.81876452 -5.52978438 -4.05502095 -6.95544581 -8.06962472 -6.37896174
19 20 21 22 23 24
-2.48943024 -6.91862630 -3.26470033 -4.16857008 -3.43832708 4.88914709
25 26 27 28 29 30
5.72272015 12.12811542 24.47907380 10.30664454 16.23397759 -1.14732341
31 32 33 34 35 36
4.21573276 -4.54410443 13.92389377 9.78106667 2.81065943 2.03841143
37 38 39 40 41 42
6.48758701 -7.12883777 -12.64090369 -3.49861433 10.33439017 15.91717044
43 44 45 46 47 48
7.24659991 -5.95929048 13.54241674 6.22412583 6.59612421 14.47546894
49 50 51 52 53 54
12.05242617 9.56929368 18.06277984 5.16106140 3.33978207 1.42498777
55 56 57 58 59 60
-1.87695245 -3.21935077 -0.03484848 -16.57604030 -24.31449485 -11.65755104
61
-13.17833956
> postscript(file="/var/www/html/rcomp/tmp/68psd1293375606.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 1.99316181 NA
1 0.55544889 1.99316181
2 0.30574554 0.55544889
3 1.27573377 0.30574554
4 -4.55709713 1.27573377
5 -7.66513894 -4.55709713
6 -8.20549620 -7.66513894
7 -9.88829037 -8.20549620
8 -0.83399210 -9.88829037
9 -11.41185308 -0.83399210
10 -17.95612367 -11.41185308
11 -11.71184765 -17.95612367
12 -11.81876452 -11.71184765
13 -5.52978438 -11.81876452
14 -4.05502095 -5.52978438
15 -6.95544581 -4.05502095
16 -8.06962472 -6.95544581
17 -6.37896174 -8.06962472
18 -2.48943024 -6.37896174
19 -6.91862630 -2.48943024
20 -3.26470033 -6.91862630
21 -4.16857008 -3.26470033
22 -3.43832708 -4.16857008
23 4.88914709 -3.43832708
24 5.72272015 4.88914709
25 12.12811542 5.72272015
26 24.47907380 12.12811542
27 10.30664454 24.47907380
28 16.23397759 10.30664454
29 -1.14732341 16.23397759
30 4.21573276 -1.14732341
31 -4.54410443 4.21573276
32 13.92389377 -4.54410443
33 9.78106667 13.92389377
34 2.81065943 9.78106667
35 2.03841143 2.81065943
36 6.48758701 2.03841143
37 -7.12883777 6.48758701
38 -12.64090369 -7.12883777
39 -3.49861433 -12.64090369
40 10.33439017 -3.49861433
41 15.91717044 10.33439017
42 7.24659991 15.91717044
43 -5.95929048 7.24659991
44 13.54241674 -5.95929048
45 6.22412583 13.54241674
46 6.59612421 6.22412583
47 14.47546894 6.59612421
48 12.05242617 14.47546894
49 9.56929368 12.05242617
50 18.06277984 9.56929368
51 5.16106140 18.06277984
52 3.33978207 5.16106140
53 1.42498777 3.33978207
54 -1.87695245 1.42498777
55 -3.21935077 -1.87695245
56 -0.03484848 -3.21935077
57 -16.57604030 -0.03484848
58 -24.31449485 -16.57604030
59 -11.65755104 -24.31449485
60 -13.17833956 -11.65755104
61 NA -13.17833956
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.55544889 1.99316181
[2,] 0.30574554 0.55544889
[3,] 1.27573377 0.30574554
[4,] -4.55709713 1.27573377
[5,] -7.66513894 -4.55709713
[6,] -8.20549620 -7.66513894
[7,] -9.88829037 -8.20549620
[8,] -0.83399210 -9.88829037
[9,] -11.41185308 -0.83399210
[10,] -17.95612367 -11.41185308
[11,] -11.71184765 -17.95612367
[12,] -11.81876452 -11.71184765
[13,] -5.52978438 -11.81876452
[14,] -4.05502095 -5.52978438
[15,] -6.95544581 -4.05502095
[16,] -8.06962472 -6.95544581
[17,] -6.37896174 -8.06962472
[18,] -2.48943024 -6.37896174
[19,] -6.91862630 -2.48943024
[20,] -3.26470033 -6.91862630
[21,] -4.16857008 -3.26470033
[22,] -3.43832708 -4.16857008
[23,] 4.88914709 -3.43832708
[24,] 5.72272015 4.88914709
[25,] 12.12811542 5.72272015
[26,] 24.47907380 12.12811542
[27,] 10.30664454 24.47907380
[28,] 16.23397759 10.30664454
[29,] -1.14732341 16.23397759
[30,] 4.21573276 -1.14732341
[31,] -4.54410443 4.21573276
[32,] 13.92389377 -4.54410443
[33,] 9.78106667 13.92389377
[34,] 2.81065943 9.78106667
[35,] 2.03841143 2.81065943
[36,] 6.48758701 2.03841143
[37,] -7.12883777 6.48758701
[38,] -12.64090369 -7.12883777
[39,] -3.49861433 -12.64090369
[40,] 10.33439017 -3.49861433
[41,] 15.91717044 10.33439017
[42,] 7.24659991 15.91717044
[43,] -5.95929048 7.24659991
[44,] 13.54241674 -5.95929048
[45,] 6.22412583 13.54241674
[46,] 6.59612421 6.22412583
[47,] 14.47546894 6.59612421
[48,] 12.05242617 14.47546894
[49,] 9.56929368 12.05242617
[50,] 18.06277984 9.56929368
[51,] 5.16106140 18.06277984
[52,] 3.33978207 5.16106140
[53,] 1.42498777 3.33978207
[54,] -1.87695245 1.42498777
[55,] -3.21935077 -1.87695245
[56,] -0.03484848 -3.21935077
[57,] -16.57604030 -0.03484848
[58,] -24.31449485 -16.57604030
[59,] -11.65755104 -24.31449485
[60,] -13.17833956 -11.65755104
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.55544889 1.99316181
2 0.30574554 0.55544889
3 1.27573377 0.30574554
4 -4.55709713 1.27573377
5 -7.66513894 -4.55709713
6 -8.20549620 -7.66513894
7 -9.88829037 -8.20549620
8 -0.83399210 -9.88829037
9 -11.41185308 -0.83399210
10 -17.95612367 -11.41185308
11 -11.71184765 -17.95612367
12 -11.81876452 -11.71184765
13 -5.52978438 -11.81876452
14 -4.05502095 -5.52978438
15 -6.95544581 -4.05502095
16 -8.06962472 -6.95544581
17 -6.37896174 -8.06962472
18 -2.48943024 -6.37896174
19 -6.91862630 -2.48943024
20 -3.26470033 -6.91862630
21 -4.16857008 -3.26470033
22 -3.43832708 -4.16857008
23 4.88914709 -3.43832708
24 5.72272015 4.88914709
25 12.12811542 5.72272015
26 24.47907380 12.12811542
27 10.30664454 24.47907380
28 16.23397759 10.30664454
29 -1.14732341 16.23397759
30 4.21573276 -1.14732341
31 -4.54410443 4.21573276
32 13.92389377 -4.54410443
33 9.78106667 13.92389377
34 2.81065943 9.78106667
35 2.03841143 2.81065943
36 6.48758701 2.03841143
37 -7.12883777 6.48758701
38 -12.64090369 -7.12883777
39 -3.49861433 -12.64090369
40 10.33439017 -3.49861433
41 15.91717044 10.33439017
42 7.24659991 15.91717044
43 -5.95929048 7.24659991
44 13.54241674 -5.95929048
45 6.22412583 13.54241674
46 6.59612421 6.22412583
47 14.47546894 6.59612421
48 12.05242617 14.47546894
49 9.56929368 12.05242617
50 18.06277984 9.56929368
51 5.16106140 18.06277984
52 3.33978207 5.16106140
53 1.42498777 3.33978207
54 -1.87695245 1.42498777
55 -3.21935077 -1.87695245
56 -0.03484848 -3.21935077
57 -16.57604030 -0.03484848
58 -24.31449485 -16.57604030
59 -11.65755104 -24.31449485
60 -13.17833956 -11.65755104
> 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/7jyag1293375606.ps",horizontal=F,onefile=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/8jyag1293375606.ps",horizontal=F,onefile=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/9jyag1293375606.ps",horizontal=F,onefile=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/10t7rj1293375606.ps",horizontal=F,onefile=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/11phpr1293375606.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/12mr4i1293375606.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/13rccn1293375606.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/14vvst1293375606.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/15gd9z1293375606.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/16y5nw1293375606.tab")
+ }
>
> try(system("convert tmp/1ceru1293375605.ps tmp/1ceru1293375605.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ceru1293375605.ps tmp/2ceru1293375605.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ffba1293375606.ps tmp/3ffba1293375606.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ffba1293375606.ps tmp/4ffba1293375606.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ffba1293375606.ps tmp/5ffba1293375606.png",intern=TRUE))
character(0)
> try(system("convert tmp/68psd1293375606.ps tmp/68psd1293375606.png",intern=TRUE))
character(0)
> try(system("convert tmp/7jyag1293375606.ps tmp/7jyag1293375606.png",intern=TRUE))
character(0)
> try(system("convert tmp/8jyag1293375606.ps tmp/8jyag1293375606.png",intern=TRUE))
character(0)
> try(system("convert tmp/9jyag1293375606.ps tmp/9jyag1293375606.png",intern=TRUE))
character(0)
> try(system("convert tmp/10t7rj1293375606.ps tmp/10t7rj1293375606.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.579 1.599 5.892