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(127
+ ,2.75
+ ,123
+ ,127
+ ,2.75
+ ,118
+ ,123
+ ,127
+ ,2.55
+ ,114
+ ,118
+ ,123
+ ,2.5
+ ,108
+ ,114
+ ,118
+ ,2.5
+ ,111
+ ,108
+ ,114
+ ,2.1
+ ,151
+ ,111
+ ,108
+ ,2
+ ,159
+ ,151
+ ,111
+ ,2
+ ,158
+ ,159
+ ,151
+ ,2
+ ,148
+ ,158
+ ,159
+ ,2
+ ,138
+ ,148
+ ,158
+ ,2
+ ,137
+ ,138
+ ,148
+ ,2
+ ,136
+ ,137
+ ,138
+ ,2
+ ,133
+ ,136
+ ,137
+ ,2
+ ,126
+ ,133
+ ,136
+ ,2
+ ,120
+ ,126
+ ,133
+ ,2
+ ,114
+ ,120
+ ,126
+ ,2
+ ,116
+ ,114
+ ,120
+ ,2
+ ,153
+ ,116
+ ,114
+ ,2
+ ,162
+ ,153
+ ,116
+ ,2
+ ,161
+ ,162
+ ,153
+ ,2
+ ,149
+ ,161
+ ,162
+ ,2
+ ,139
+ ,149
+ ,161
+ ,2
+ ,135
+ ,139
+ ,149
+ ,2
+ ,130
+ ,135
+ ,139
+ ,2
+ ,127
+ ,130
+ ,135
+ ,2
+ ,122
+ ,127
+ ,130
+ ,2
+ ,117
+ ,122
+ ,127
+ ,2
+ ,112
+ ,117
+ ,122
+ ,2
+ ,113
+ ,112
+ ,117
+ ,2
+ ,149
+ ,113
+ ,112
+ ,2
+ ,157
+ ,149
+ ,113
+ ,2
+ ,157
+ ,157
+ ,149
+ ,2
+ ,147
+ ,157
+ ,157
+ ,2
+ ,137
+ ,147
+ ,157
+ ,2
+ ,132
+ ,137
+ ,147
+ ,2.21
+ ,125
+ ,132
+ ,137
+ ,2.25
+ ,123
+ ,125
+ ,132
+ ,2.25
+ ,117
+ ,123
+ ,125
+ ,2.45
+ ,114
+ ,117
+ ,123
+ ,2.5
+ ,111
+ ,114
+ ,117
+ ,2.5
+ ,112
+ ,111
+ ,114
+ ,2.64
+ ,144
+ ,112
+ ,111
+ ,2.75
+ ,150
+ ,144
+ ,112
+ ,2.93
+ ,149
+ ,150
+ ,144
+ ,3
+ ,134
+ ,149
+ ,150
+ ,3.17
+ ,123
+ ,134
+ ,149
+ ,3.25
+ ,116
+ ,123
+ ,134
+ ,3.39
+ ,117
+ ,116
+ ,123
+ ,3.5
+ ,111
+ ,117
+ ,116
+ ,3.5
+ ,105
+ ,111
+ ,117
+ ,3.65
+ ,102
+ ,105
+ ,111
+ ,3.75
+ ,95
+ ,102
+ ,105
+ ,3.75
+ ,93
+ ,95
+ ,102
+ ,3.9
+ ,124
+ ,93
+ ,95
+ ,4
+ ,130
+ ,124
+ ,93
+ ,4
+ ,124
+ ,130
+ ,124
+ ,4
+ ,115
+ ,124
+ ,130
+ ,4
+ ,106
+ ,115
+ ,124
+ ,4
+ ,105
+ ,106
+ ,115
+ ,4
+ ,105
+ ,105
+ ,106
+ ,4
+ ,101
+ ,105
+ ,105
+ ,4
+ ,95
+ ,101
+ ,105
+ ,4
+ ,93
+ ,95
+ ,101
+ ,4
+ ,84
+ ,93
+ ,95
+ ,4
+ ,87
+ ,84
+ ,93
+ ,4
+ ,116
+ ,87
+ ,84
+ ,4.18
+ ,120
+ ,116
+ ,87
+ ,4.25
+ ,117
+ ,120
+ ,116
+ ,4.25
+ ,109
+ ,117
+ ,120
+ ,3.97
+ ,105
+ ,109
+ ,117
+ ,3.42
+ ,107
+ ,105
+ ,109
+ ,2.75)
+ ,dim=c(2
+ ,72)
+ ,dimnames=list(c('Werkloosheid'
+ ,'Rente')
+ ,1:72))
> y <- array(NA,dim=c(2,72),dimnames=list(c('Werkloosheid','Rente'),1:72))
> 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
Werkloosheid Rente M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 127.00 2.75 1 0 0 0 0 0 0 0 0 0 0 1
2 123.00 127.00 0 1 0 0 0 0 0 0 0 0 0 2
3 2.75 118.00 0 0 1 0 0 0 0 0 0 0 0 3
4 123.00 127.00 0 0 0 1 0 0 0 0 0 0 0 4
5 2.55 114.00 0 0 0 0 1 0 0 0 0 0 0 5
6 118.00 123.00 0 0 0 0 0 1 0 0 0 0 0 6
7 2.50 108.00 0 0 0 0 0 0 1 0 0 0 0 7
8 114.00 118.00 0 0 0 0 0 0 0 1 0 0 0 8
9 2.50 111.00 0 0 0 0 0 0 0 0 1 0 0 9
10 108.00 114.00 0 0 0 0 0 0 0 0 0 1 0 10
11 2.10 151.00 0 0 0 0 0 0 0 0 0 0 1 11
12 111.00 108.00 0 0 0 0 0 0 0 0 0 0 0 12
13 2.00 159.00 1 0 0 0 0 0 0 0 0 0 0 13
14 151.00 111.00 0 1 0 0 0 0 0 0 0 0 0 14
15 2.00 158.00 0 0 1 0 0 0 0 0 0 0 0 15
16 159.00 151.00 0 0 0 1 0 0 0 0 0 0 0 16
17 2.00 148.00 0 0 0 0 1 0 0 0 0 0 0 17
18 158.00 159.00 0 0 0 0 0 1 0 0 0 0 0 18
19 2.00 138.00 0 0 0 0 0 0 1 0 0 0 0 19
20 148.00 158.00 0 0 0 0 0 0 0 1 0 0 0 20
21 2.00 137.00 0 0 0 0 0 0 0 0 1 0 0 21
22 138.00 148.00 0 0 0 0 0 0 0 0 0 1 0 22
23 2.00 136.00 0 0 0 0 0 0 0 0 0 0 1 23
24 137.00 138.00 0 0 0 0 0 0 0 0 0 0 0 24
25 2.00 133.00 1 0 0 0 0 0 0 0 0 0 0 25
26 136.00 137.00 0 1 0 0 0 0 0 0 0 0 0 26
27 2.00 126.00 0 0 1 0 0 0 0 0 0 0 0 27
28 133.00 136.00 0 0 0 1 0 0 0 0 0 0 0 28
29 2.00 120.00 0 0 0 0 1 0 0 0 0 0 0 29
30 126.00 133.00 0 0 0 0 0 1 0 0 0 0 0 30
31 2.00 114.00 0 0 0 0 0 0 1 0 0 0 0 31
32 120.00 126.00 0 0 0 0 0 0 0 1 0 0 0 32
33 2.00 116.00 0 0 0 0 0 0 0 0 1 0 0 33
34 114.00 120.00 0 0 0 0 0 0 0 0 0 1 0 34
35 2.00 153.00 0 0 0 0 0 0 0 0 0 0 1 35
36 116.00 114.00 0 0 0 0 0 0 0 0 0 0 0 36
37 2.00 162.00 1 0 0 0 0 0 0 0 0 0 0 37
38 153.00 116.00 0 1 0 0 0 0 0 0 0 0 0 38
39 2.00 161.00 0 0 1 0 0 0 0 0 0 0 0 39
40 162.00 153.00 0 0 0 1 0 0 0 0 0 0 0 40
41 2.00 149.00 0 0 0 0 1 0 0 0 0 0 0 41
42 161.00 162.00 0 0 0 0 0 1 0 0 0 0 0 42
43 2.00 139.00 0 0 0 0 0 0 1 0 0 0 0 43
44 149.00 161.00 0 0 0 0 0 0 0 1 0 0 0 44
45 2.00 135.00 0 0 0 0 0 0 0 0 1 0 0 45
46 139.00 149.00 0 0 0 0 0 0 0 0 0 1 0 46
47 2.00 130.00 0 0 0 0 0 0 0 0 0 0 1 47
48 135.00 139.00 0 0 0 0 0 0 0 0 0 0 0 48
49 2.00 127.00 1 0 0 0 0 0 0 0 0 0 0 49
50 130.00 135.00 0 1 0 0 0 0 0 0 0 0 0 50
51 2.00 122.00 0 0 1 0 0 0 0 0 0 0 0 51
52 127.00 130.00 0 0 0 1 0 0 0 0 0 0 0 52
53 2.00 117.00 0 0 0 0 1 0 0 0 0 0 0 53
54 122.00 127.00 0 0 0 0 0 1 0 0 0 0 0 54
55 2.00 112.00 0 0 0 0 0 0 1 0 0 0 0 55
56 117.00 122.00 0 0 0 0 0 0 0 1 0 0 0 56
57 2.00 113.00 0 0 0 0 0 0 0 0 1 0 0 57
58 112.00 117.00 0 0 0 0 0 0 0 0 0 1 0 58
59 2.00 149.00 0 0 0 0 0 0 0 0 0 0 1 59
60 113.00 112.00 0 0 0 0 0 0 0 0 0 0 0 60
61 2.00 157.00 1 0 0 0 0 0 0 0 0 0 0 61
62 149.00 113.00 0 1 0 0 0 0 0 0 0 0 0 62
63 2.00 157.00 0 0 1 0 0 0 0 0 0 0 0 63
64 157.00 149.00 0 0 0 1 0 0 0 0 0 0 0 64
65 2.00 147.00 0 0 0 0 1 0 0 0 0 0 0 65
66 157.00 157.00 0 0 0 0 0 1 0 0 0 0 0 66
67 2.00 137.00 0 0 0 0 0 0 1 0 0 0 0 67
68 147.00 157.00 0 0 0 0 0 0 0 1 0 0 0 68
69 2.00 132.00 0 0 0 0 0 0 0 0 1 0 0 69
70 137.00 147.00 0 0 0 0 0 0 0 0 0 1 0 70
71 2.21 125.00 0 0 0 0 0 0 0 0 0 0 1 71
72 132.00 137.00 0 0 0 0 0 0 0 0 0 0 0 72
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Rente M1 M2 M3 M4
158.51930 -0.29988 -100.77832 16.56597 -116.56259 24.94409
M5 M6 M7 M8 M9 M10
-119.08151 22.39064 -121.57544 13.47118 -121.91185 3.15226
M11 t
-117.08193 0.06825
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-26.4336 -10.9895 -0.8286 6.8627 70.0155
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 158.51930 14.25391 11.121 5.23e-16 ***
Rente -0.29988 0.10234 -2.930 0.00484 **
M1 -100.77832 10.23514 -9.846 5.49e-14 ***
M2 16.56597 10.22366 1.620 0.11058
M3 -116.56259 10.38171 -11.228 3.57e-16 ***
M4 24.94409 10.38045 2.403 0.01948 *
M5 -119.08151 10.24638 -11.622 < 2e-16 ***
M6 22.39064 10.40478 2.152 0.03558 *
M7 -121.57544 10.18606 -11.935 < 2e-16 ***
M8 13.47118 10.32455 1.305 0.19712
M9 -121.91185 10.17699 -11.979 < 2e-16 ***
M10 3.15226 10.21067 0.309 0.75864
M11 -117.08193 10.30849 -11.358 2.25e-16 ***
t 0.06825 0.10534 0.648 0.51964
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 17.62 on 58 degrees of freedom
Multiple R-squared: 0.9443, Adjusted R-squared: 0.9318
F-statistic: 75.58 on 13 and 58 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.9223422 1.553155e-01 7.765777e-02
[2,] 0.9923620 1.527593e-02 7.637967e-03
[3,] 0.9865429 2.691429e-02 1.345714e-02
[4,] 0.9952074 9.585300e-03 4.792650e-03
[5,] 0.9936976 1.260478e-02 6.302388e-03
[6,] 0.9934975 1.300493e-02 6.502466e-03
[7,] 0.9995000 1.000015e-03 5.000075e-04
[8,] 0.9993234 1.353140e-03 6.765698e-04
[9,] 0.9999891 2.170225e-05 1.085112e-05
[10,] 0.9999872 2.563268e-05 1.281634e-05
[11,] 0.9999921 1.588567e-05 7.942837e-06
[12,] 0.9999921 1.579527e-05 7.897637e-06
[13,] 0.9999881 2.386457e-05 1.193229e-05
[14,] 0.9999881 2.386576e-05 1.193288e-05
[15,] 0.9999764 4.716911e-05 2.358456e-05
[16,] 0.9999636 7.289218e-05 3.644609e-05
[17,] 0.9999203 1.594920e-04 7.974602e-05
[18,] 0.9998569 2.861150e-04 1.430575e-04
[19,] 0.9997046 5.907126e-04 2.953563e-04
[20,] 0.9994260 1.147996e-03 5.739982e-04
[21,] 0.9990092 1.981598e-03 9.907989e-04
[22,] 0.9988932 2.213553e-03 1.106777e-03
[23,] 0.9981586 3.682818e-03 1.841409e-03
[24,] 0.9982203 3.559329e-03 1.779664e-03
[25,] 0.9966519 6.696143e-03 3.348071e-03
[26,] 0.9969175 6.164901e-03 3.082451e-03
[27,] 0.9938666 1.226680e-02 6.133398e-03
[28,] 0.9920155 1.596891e-02 7.984453e-03
[29,] 0.9843637 3.127268e-02 1.563634e-02
[30,] 0.9795031 4.099383e-02 2.049691e-02
[31,] 0.9681663 6.366740e-02 3.183370e-02
[32,] 0.9746798 5.064046e-02 2.532023e-02
[33,] 0.9728208 5.435834e-02 2.717917e-02
[34,] 0.9596212 8.075756e-02 4.037878e-02
[35,] 0.9568137 8.637269e-02 4.318634e-02
[36,] 0.9489842 1.020317e-01 5.101584e-02
[37,] 0.9454378 1.091243e-01 5.456216e-02
[38,] 0.9367270 1.265460e-01 6.327302e-02
[39,] 0.9298628 1.402744e-01 7.013720e-02
> postscript(file="/var/www/html/rcomp/tmp/10l5v1258711900.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/2p7ap1258711900.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/36qx21258711900.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/4vh171258711900.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/58d441258711900.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 = 72
Frequency = 1
1 2 3 4 5 6
70.0154549 -14.1363850 -4.0250388 -22.6509983 -3.0421468 -26.4335832
7 8 9 10 11 12
-2.5340246 -23.1500388 -1.4344468 -20.1671468 5.1945332 -15.9506913
13 14 15 16 17 18
-8.9464918 8.2465014 6.4013996 19.7272824 5.7849825 23.5433158
19 20 21 22 23 24
5.1435653 22.0263996 5.0436036 19.2099825 -0.2226955 18.2268986
25 26 27 28 29 30
-17.5624540 0.2245518 -4.0138717 -11.5899464 -3.4307495 -17.0726464
31 32 33 34 35 36
-2.8726272 -16.3888717 -2.0729343 -14.0057495 4.0563912 -10.7892939
37 38 39 40 41 42
-9.6847490 10.1080139 5.6631425 21.6891404 4.4469556 25.8050586
43 44 45 46 47 48
3.8055384 22.2881425 2.8059222 18.8719556 -3.6599164 14.8888717
49 50 51 52 53 54
-20.9996749 -8.0131297 -6.8513229 -21.0271673 -5.9683158 -24.5098673
55 56 57 58 59 60
-5.1103087 -22.2263229 -4.6105006 -18.5433158 1.2189400 -16.0269754
61 62 63 64 65 66
-12.8220851 3.5704476 2.8256913 13.8516892 2.2092741 18.6677226
67 68 69 70 71 72
1.5678569 17.4506913 0.2683558 14.6342741 -6.5872525 9.6511902
> postscript(file="/var/www/html/rcomp/tmp/68bvi1258711900.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 = 72
Frequency = 1
lag(myerror, k = 1) myerror
0 70.0154549 NA
1 -14.1363850 70.0154549
2 -4.0250388 -14.1363850
3 -22.6509983 -4.0250388
4 -3.0421468 -22.6509983
5 -26.4335832 -3.0421468
6 -2.5340246 -26.4335832
7 -23.1500388 -2.5340246
8 -1.4344468 -23.1500388
9 -20.1671468 -1.4344468
10 5.1945332 -20.1671468
11 -15.9506913 5.1945332
12 -8.9464918 -15.9506913
13 8.2465014 -8.9464918
14 6.4013996 8.2465014
15 19.7272824 6.4013996
16 5.7849825 19.7272824
17 23.5433158 5.7849825
18 5.1435653 23.5433158
19 22.0263996 5.1435653
20 5.0436036 22.0263996
21 19.2099825 5.0436036
22 -0.2226955 19.2099825
23 18.2268986 -0.2226955
24 -17.5624540 18.2268986
25 0.2245518 -17.5624540
26 -4.0138717 0.2245518
27 -11.5899464 -4.0138717
28 -3.4307495 -11.5899464
29 -17.0726464 -3.4307495
30 -2.8726272 -17.0726464
31 -16.3888717 -2.8726272
32 -2.0729343 -16.3888717
33 -14.0057495 -2.0729343
34 4.0563912 -14.0057495
35 -10.7892939 4.0563912
36 -9.6847490 -10.7892939
37 10.1080139 -9.6847490
38 5.6631425 10.1080139
39 21.6891404 5.6631425
40 4.4469556 21.6891404
41 25.8050586 4.4469556
42 3.8055384 25.8050586
43 22.2881425 3.8055384
44 2.8059222 22.2881425
45 18.8719556 2.8059222
46 -3.6599164 18.8719556
47 14.8888717 -3.6599164
48 -20.9996749 14.8888717
49 -8.0131297 -20.9996749
50 -6.8513229 -8.0131297
51 -21.0271673 -6.8513229
52 -5.9683158 -21.0271673
53 -24.5098673 -5.9683158
54 -5.1103087 -24.5098673
55 -22.2263229 -5.1103087
56 -4.6105006 -22.2263229
57 -18.5433158 -4.6105006
58 1.2189400 -18.5433158
59 -16.0269754 1.2189400
60 -12.8220851 -16.0269754
61 3.5704476 -12.8220851
62 2.8256913 3.5704476
63 13.8516892 2.8256913
64 2.2092741 13.8516892
65 18.6677226 2.2092741
66 1.5678569 18.6677226
67 17.4506913 1.5678569
68 0.2683558 17.4506913
69 14.6342741 0.2683558
70 -6.5872525 14.6342741
71 9.6511902 -6.5872525
72 NA 9.6511902
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -14.1363850 70.0154549
[2,] -4.0250388 -14.1363850
[3,] -22.6509983 -4.0250388
[4,] -3.0421468 -22.6509983
[5,] -26.4335832 -3.0421468
[6,] -2.5340246 -26.4335832
[7,] -23.1500388 -2.5340246
[8,] -1.4344468 -23.1500388
[9,] -20.1671468 -1.4344468
[10,] 5.1945332 -20.1671468
[11,] -15.9506913 5.1945332
[12,] -8.9464918 -15.9506913
[13,] 8.2465014 -8.9464918
[14,] 6.4013996 8.2465014
[15,] 19.7272824 6.4013996
[16,] 5.7849825 19.7272824
[17,] 23.5433158 5.7849825
[18,] 5.1435653 23.5433158
[19,] 22.0263996 5.1435653
[20,] 5.0436036 22.0263996
[21,] 19.2099825 5.0436036
[22,] -0.2226955 19.2099825
[23,] 18.2268986 -0.2226955
[24,] -17.5624540 18.2268986
[25,] 0.2245518 -17.5624540
[26,] -4.0138717 0.2245518
[27,] -11.5899464 -4.0138717
[28,] -3.4307495 -11.5899464
[29,] -17.0726464 -3.4307495
[30,] -2.8726272 -17.0726464
[31,] -16.3888717 -2.8726272
[32,] -2.0729343 -16.3888717
[33,] -14.0057495 -2.0729343
[34,] 4.0563912 -14.0057495
[35,] -10.7892939 4.0563912
[36,] -9.6847490 -10.7892939
[37,] 10.1080139 -9.6847490
[38,] 5.6631425 10.1080139
[39,] 21.6891404 5.6631425
[40,] 4.4469556 21.6891404
[41,] 25.8050586 4.4469556
[42,] 3.8055384 25.8050586
[43,] 22.2881425 3.8055384
[44,] 2.8059222 22.2881425
[45,] 18.8719556 2.8059222
[46,] -3.6599164 18.8719556
[47,] 14.8888717 -3.6599164
[48,] -20.9996749 14.8888717
[49,] -8.0131297 -20.9996749
[50,] -6.8513229 -8.0131297
[51,] -21.0271673 -6.8513229
[52,] -5.9683158 -21.0271673
[53,] -24.5098673 -5.9683158
[54,] -5.1103087 -24.5098673
[55,] -22.2263229 -5.1103087
[56,] -4.6105006 -22.2263229
[57,] -18.5433158 -4.6105006
[58,] 1.2189400 -18.5433158
[59,] -16.0269754 1.2189400
[60,] -12.8220851 -16.0269754
[61,] 3.5704476 -12.8220851
[62,] 2.8256913 3.5704476
[63,] 13.8516892 2.8256913
[64,] 2.2092741 13.8516892
[65,] 18.6677226 2.2092741
[66,] 1.5678569 18.6677226
[67,] 17.4506913 1.5678569
[68,] 0.2683558 17.4506913
[69,] 14.6342741 0.2683558
[70,] -6.5872525 14.6342741
[71,] 9.6511902 -6.5872525
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -14.1363850 70.0154549
2 -4.0250388 -14.1363850
3 -22.6509983 -4.0250388
4 -3.0421468 -22.6509983
5 -26.4335832 -3.0421468
6 -2.5340246 -26.4335832
7 -23.1500388 -2.5340246
8 -1.4344468 -23.1500388
9 -20.1671468 -1.4344468
10 5.1945332 -20.1671468
11 -15.9506913 5.1945332
12 -8.9464918 -15.9506913
13 8.2465014 -8.9464918
14 6.4013996 8.2465014
15 19.7272824 6.4013996
16 5.7849825 19.7272824
17 23.5433158 5.7849825
18 5.1435653 23.5433158
19 22.0263996 5.1435653
20 5.0436036 22.0263996
21 19.2099825 5.0436036
22 -0.2226955 19.2099825
23 18.2268986 -0.2226955
24 -17.5624540 18.2268986
25 0.2245518 -17.5624540
26 -4.0138717 0.2245518
27 -11.5899464 -4.0138717
28 -3.4307495 -11.5899464
29 -17.0726464 -3.4307495
30 -2.8726272 -17.0726464
31 -16.3888717 -2.8726272
32 -2.0729343 -16.3888717
33 -14.0057495 -2.0729343
34 4.0563912 -14.0057495
35 -10.7892939 4.0563912
36 -9.6847490 -10.7892939
37 10.1080139 -9.6847490
38 5.6631425 10.1080139
39 21.6891404 5.6631425
40 4.4469556 21.6891404
41 25.8050586 4.4469556
42 3.8055384 25.8050586
43 22.2881425 3.8055384
44 2.8059222 22.2881425
45 18.8719556 2.8059222
46 -3.6599164 18.8719556
47 14.8888717 -3.6599164
48 -20.9996749 14.8888717
49 -8.0131297 -20.9996749
50 -6.8513229 -8.0131297
51 -21.0271673 -6.8513229
52 -5.9683158 -21.0271673
53 -24.5098673 -5.9683158
54 -5.1103087 -24.5098673
55 -22.2263229 -5.1103087
56 -4.6105006 -22.2263229
57 -18.5433158 -4.6105006
58 1.2189400 -18.5433158
59 -16.0269754 1.2189400
60 -12.8220851 -16.0269754
61 3.5704476 -12.8220851
62 2.8256913 3.5704476
63 13.8516892 2.8256913
64 2.2092741 13.8516892
65 18.6677226 2.2092741
66 1.5678569 18.6677226
67 17.4506913 1.5678569
68 0.2683558 17.4506913
69 14.6342741 0.2683558
70 -6.5872525 14.6342741
71 9.6511902 -6.5872525
> 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/7mubj1258711900.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/8gbec1258711900.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/9zhp01258711900.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/10x8jv1258711900.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/11h63j1258711900.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/12dt551258711900.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/13ux3w1258711901.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/14tcfj1258711901.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/156heo1258711901.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/16p0s91258711901.tab")
+ }
>
> system("convert tmp/10l5v1258711900.ps tmp/10l5v1258711900.png")
> system("convert tmp/2p7ap1258711900.ps tmp/2p7ap1258711900.png")
> system("convert tmp/36qx21258711900.ps tmp/36qx21258711900.png")
> system("convert tmp/4vh171258711900.ps tmp/4vh171258711900.png")
> system("convert tmp/58d441258711900.ps tmp/58d441258711900.png")
> system("convert tmp/68bvi1258711900.ps tmp/68bvi1258711900.png")
> system("convert tmp/7mubj1258711900.ps tmp/7mubj1258711900.png")
> system("convert tmp/8gbec1258711900.ps tmp/8gbec1258711900.png")
> system("convert tmp/9zhp01258711900.ps tmp/9zhp01258711900.png")
> system("convert tmp/10x8jv1258711900.ps tmp/10x8jv1258711900.png")
>
>
> proc.time()
user system elapsed
2.505 1.541 3.053