R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(5.50,235.1,5.40,280.7,5.90,264.6,5.80,240.7,5.10,201.4,4.10,240.8,4.40,241.1,3.60,223.8,3.50,206.1,3.10,174.7,2.90,203.3,2.20,220.5,1.40,299.5,1.20,347.4,1.30,338.3,1.30,327.7,1.30,351.6,1.80,396.6,1.80,438.8,1.80,395.6,1.70,363.5,2.10,378.8,2.00,357.0,1.70,369.0,1.90,464.8,2.30,479.1,2.40,431.3,2.50,366.5,2.80,326.3,2.60,355.1,2.20,331.6,2.80,261.3,2.80,249.0,2.80,205.5,2.30,235.6,2.20,240.9,3.00,264.9,2.90,253.8,2.70,232.3,2.70,193.8,2.30,177.0,2.40,213.2,2.80,207.2,2.30,180.6,2.00,188.6,1.90,175.4,2.30,199.0,2.70,179.6,1.80,225.8,2.00,234.0,2.10,200.2,2.00,183.6,2.40,178.2,1.70,203.2,1.00,208.5,1.20,191.8,1.40,172.8,1.70,148.0,1.80,159.4,1.40,154.5,1.70,213.2,1.60,196.4,1.40,182.8,1.50,176.4,0.90,153.6,1.50,173.2,1.70,171.0,1.60,151.2,1.20,161.9),dim=c(2,69),dimnames=list(c('HIPC','werkloosheid'),1:69))
> y <- array(NA,dim=c(2,69),dimnames=list(c('HIPC','werkloosheid'),1:69))
> 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 = '2'
> #'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
> 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 HIPC M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 235.1 5.5 1 0 0 0 0 0 0 0 0 0 0 1
2 280.7 5.4 0 1 0 0 0 0 0 0 0 0 0 2
3 264.6 5.9 0 0 1 0 0 0 0 0 0 0 0 3
4 240.7 5.8 0 0 0 1 0 0 0 0 0 0 0 4
5 201.4 5.1 0 0 0 0 1 0 0 0 0 0 0 5
6 240.8 4.1 0 0 0 0 0 1 0 0 0 0 0 6
7 241.1 4.4 0 0 0 0 0 0 1 0 0 0 0 7
8 223.8 3.6 0 0 0 0 0 0 0 1 0 0 0 8
9 206.1 3.5 0 0 0 0 0 0 0 0 1 0 0 9
10 174.7 3.1 0 0 0 0 0 0 0 0 0 1 0 10
11 203.3 2.9 0 0 0 0 0 0 0 0 0 0 1 11
12 220.5 2.2 0 0 0 0 0 0 0 0 0 0 0 12
13 299.5 1.4 1 0 0 0 0 0 0 0 0 0 0 13
14 347.4 1.2 0 1 0 0 0 0 0 0 0 0 0 14
15 338.3 1.3 0 0 1 0 0 0 0 0 0 0 0 15
16 327.7 1.3 0 0 0 1 0 0 0 0 0 0 0 16
17 351.6 1.3 0 0 0 0 1 0 0 0 0 0 0 17
18 396.6 1.8 0 0 0 0 0 1 0 0 0 0 0 18
19 438.8 1.8 0 0 0 0 0 0 1 0 0 0 0 19
20 395.6 1.8 0 0 0 0 0 0 0 1 0 0 0 20
21 363.5 1.7 0 0 0 0 0 0 0 0 1 0 0 21
22 378.8 2.1 0 0 0 0 0 0 0 0 0 1 0 22
23 357.0 2.0 0 0 0 0 0 0 0 0 0 0 1 23
24 369.0 1.7 0 0 0 0 0 0 0 0 0 0 0 24
25 464.8 1.9 1 0 0 0 0 0 0 0 0 0 0 25
26 479.1 2.3 0 1 0 0 0 0 0 0 0 0 0 26
27 431.3 2.4 0 0 1 0 0 0 0 0 0 0 0 27
28 366.5 2.5 0 0 0 1 0 0 0 0 0 0 0 28
29 326.3 2.8 0 0 0 0 1 0 0 0 0 0 0 29
30 355.1 2.6 0 0 0 0 0 1 0 0 0 0 0 30
31 331.6 2.2 0 0 0 0 0 0 1 0 0 0 0 31
32 261.3 2.8 0 0 0 0 0 0 0 1 0 0 0 32
33 249.0 2.8 0 0 0 0 0 0 0 0 1 0 0 33
34 205.5 2.8 0 0 0 0 0 0 0 0 0 1 0 34
35 235.6 2.3 0 0 0 0 0 0 0 0 0 0 1 35
36 240.9 2.2 0 0 0 0 0 0 0 0 0 0 0 36
37 264.9 3.0 1 0 0 0 0 0 0 0 0 0 0 37
38 253.8 2.9 0 1 0 0 0 0 0 0 0 0 0 38
39 232.3 2.7 0 0 1 0 0 0 0 0 0 0 0 39
40 193.8 2.7 0 0 0 1 0 0 0 0 0 0 0 40
41 177.0 2.3 0 0 0 0 1 0 0 0 0 0 0 41
42 213.2 2.4 0 0 0 0 0 1 0 0 0 0 0 42
43 207.2 2.8 0 0 0 0 0 0 1 0 0 0 0 43
44 180.6 2.3 0 0 0 0 0 0 0 1 0 0 0 44
45 188.6 2.0 0 0 0 0 0 0 0 0 1 0 0 45
46 175.4 1.9 0 0 0 0 0 0 0 0 0 1 0 46
47 199.0 2.3 0 0 0 0 0 0 0 0 0 0 1 47
48 179.6 2.7 0 0 0 0 0 0 0 0 0 0 0 48
49 225.8 1.8 1 0 0 0 0 0 0 0 0 0 0 49
50 234.0 2.0 0 1 0 0 0 0 0 0 0 0 0 50
51 200.2 2.1 0 0 1 0 0 0 0 0 0 0 0 51
52 183.6 2.0 0 0 0 1 0 0 0 0 0 0 0 52
53 178.2 2.4 0 0 0 0 1 0 0 0 0 0 0 53
54 203.2 1.7 0 0 0 0 0 1 0 0 0 0 0 54
55 208.5 1.0 0 0 0 0 0 0 1 0 0 0 0 55
56 191.8 1.2 0 0 0 0 0 0 0 1 0 0 0 56
57 172.8 1.4 0 0 0 0 0 0 0 0 1 0 0 57
58 148.0 1.7 0 0 0 0 0 0 0 0 0 1 0 58
59 159.4 1.8 0 0 0 0 0 0 0 0 0 0 1 59
60 154.5 1.4 0 0 0 0 0 0 0 0 0 0 0 60
61 213.2 1.7 1 0 0 0 0 0 0 0 0 0 0 61
62 196.4 1.6 0 1 0 0 0 0 0 0 0 0 0 62
63 182.8 1.4 0 0 1 0 0 0 0 0 0 0 0 63
64 176.4 1.5 0 0 0 1 0 0 0 0 0 0 0 64
65 153.6 0.9 0 0 0 0 1 0 0 0 0 0 0 65
66 173.2 1.5 0 0 0 0 0 1 0 0 0 0 0 66
67 171.0 1.7 0 0 0 0 0 0 1 0 0 0 0 67
68 151.2 1.6 0 0 0 0 0 0 0 1 0 0 0 68
69 161.9 1.2 0 0 0 0 0 0 0 0 1 0 0 69
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) HIPC M1 M2 M3 M4
467.371 -46.688 55.457 74.786 58.116 35.184
M5 M6 M7 M8 M9 M10
14.503 45.257 50.251 17.133 5.154 -11.082
M11 t
4.364 -3.867
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-107.688 -28.000 -8.608 25.231 144.879
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 467.3713 40.7124 11.480 3.17e-16 ***
HIPC -46.6885 8.3543 -5.589 7.36e-07 ***
M1 55.4574 36.7517 1.509 0.1370
M2 74.7863 36.7704 2.034 0.0468 *
M3 58.1163 36.8418 1.577 0.1204
M4 35.1837 36.8657 0.954 0.3441
M5 14.5030 36.7454 0.395 0.6946
M6 45.2568 36.6887 1.234 0.2226
M7 50.2512 36.6912 1.370 0.1764
M8 17.1331 36.6620 0.467 0.6421
M9 5.1535 36.6392 0.141 0.8887
M10 -11.0821 38.2722 -0.290 0.7732
M11 4.3641 38.2577 0.114 0.9096
t -3.8674 0.4672 -8.277 3.09e-11 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 60.44 on 55 degrees of freedom
Multiple R-squared: 0.5955, Adjusted R-squared: 0.4998
F-statistic: 6.227 on 13 and 55 DF, p-value: 5.41e-07
> 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.23284403 4.656881e-01 7.671560e-01
[2,] 0.14481132 2.896226e-01 8.551887e-01
[3,] 0.12452974 2.490595e-01 8.754703e-01
[4,] 0.08415509 1.683102e-01 9.158449e-01
[5,] 0.06234972 1.246994e-01 9.376503e-01
[6,] 0.03286159 6.572318e-02 9.671384e-01
[7,] 0.04352201 8.704403e-02 9.564780e-01
[8,] 0.05235018 1.047004e-01 9.476498e-01
[9,] 0.09272955 1.854591e-01 9.072705e-01
[10,] 0.32427702 6.485540e-01 6.757230e-01
[11,] 0.74394632 5.121074e-01 2.560537e-01
[12,] 0.96905877 6.188246e-02 3.094123e-02
[13,] 0.99888621 2.227570e-03 1.113785e-03
[14,] 0.99999377 1.246837e-05 6.234187e-06
[15,] 0.99999999 1.358285e-08 6.791424e-09
[16,] 1.00000000 5.318911e-10 2.659456e-10
[17,] 1.00000000 1.310351e-10 6.551757e-11
[18,] 1.00000000 1.344042e-10 6.720208e-11
[19,] 1.00000000 2.146821e-10 1.073411e-10
[20,] 1.00000000 2.523313e-11 1.261657e-11
[21,] 1.00000000 2.555556e-11 1.277778e-11
[22,] 1.00000000 3.444904e-11 1.722452e-11
[23,] 1.00000000 4.504099e-11 2.252049e-11
[24,] 1.00000000 1.293972e-10 6.469860e-11
[25,] 1.00000000 2.062197e-10 1.031099e-10
[26,] 1.00000000 1.217993e-09 6.089966e-10
[27,] 1.00000000 7.259694e-09 3.629847e-09
[28,] 1.00000000 8.634136e-09 4.317068e-09
[29,] 0.99999999 2.713109e-08 1.356554e-08
[30,] 0.99999988 2.374030e-07 1.187015e-07
[31,] 0.99999950 1.004052e-06 5.020260e-07
[32,] 0.99999627 7.464880e-06 3.732440e-06
[33,] 0.99998331 3.337117e-05 1.668559e-05
[34,] 0.99992270 1.546047e-04 7.730234e-05
[35,] 0.99935946 1.281082e-03 6.405408e-04
[36,] 0.99772340 4.553201e-03 2.276601e-03
> postscript(file="/var/wessaorg/rcomp/tmp/1bdmw1324298098.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/wessaorg/rcomp/tmp/2hrgg1324298098.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/wessaorg/rcomp/tmp/3fmpl1324298098.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/wessaorg/rcomp/tmp/4692e1324298098.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/wessaorg/rcomp/tmp/5s79x1324298098.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 = 69
Frequency = 1
1 2 3 4 5 6
-27.0746958 -1.6050166 26.1766510 24.4078046 -23.0260427 -57.2008523
7 8 9 10 11 12
-44.0213644 -61.6866223 -68.2084813 -98.1808627 -90.4972476 -97.7477102
13 14 15 16 17 18
-107.6884649 -84.5876320 -68.4813499 -52.2813499 -3.8332726 37.6246134
19 20 21 22 23 24
78.6975621 72.4830752 51.5612162 105.6396058 67.5920673 73.8169902
25 26 27 28 29 30
127.3646992 144.8786103 122.2848924 88.9537387 87.3083551 79.8843165
31 32 33 34 35 36
36.5818798 31.2804711 34.8274585 11.4304626 6.6075385 15.4701542
37 38 39 40 41 42
25.2309414 -5.9993793 -16.2996363 -27.9996363 -38.9269445 -24.9444441
43 44 45 46 47 48
-13.3961098 -26.3548286 -16.5143803 -14.2802226 16.4164707 23.9233182
49 50 51 52 53 54
-23.4862828 -21.4100645 -30.0037824 -24.4726287 13.3508340 -21.2174365
55 56 57 58 59 60
-49.7264123 -20.1032065 -13.9185263 -4.6089831 -0.1188289 -15.4627524
61 62 63 64 65 66
5.6538030 -31.2765178 -33.6767748 -8.6079284 -34.8729294 -14.1461970
67 68 69
-8.1355555 4.3811112 12.2527131
> postscript(file="/var/wessaorg/rcomp/tmp/6htlg1324298098.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 = 69
Frequency = 1
lag(myerror, k = 1) myerror
0 -27.0746958 NA
1 -1.6050166 -27.0746958
2 26.1766510 -1.6050166
3 24.4078046 26.1766510
4 -23.0260427 24.4078046
5 -57.2008523 -23.0260427
6 -44.0213644 -57.2008523
7 -61.6866223 -44.0213644
8 -68.2084813 -61.6866223
9 -98.1808627 -68.2084813
10 -90.4972476 -98.1808627
11 -97.7477102 -90.4972476
12 -107.6884649 -97.7477102
13 -84.5876320 -107.6884649
14 -68.4813499 -84.5876320
15 -52.2813499 -68.4813499
16 -3.8332726 -52.2813499
17 37.6246134 -3.8332726
18 78.6975621 37.6246134
19 72.4830752 78.6975621
20 51.5612162 72.4830752
21 105.6396058 51.5612162
22 67.5920673 105.6396058
23 73.8169902 67.5920673
24 127.3646992 73.8169902
25 144.8786103 127.3646992
26 122.2848924 144.8786103
27 88.9537387 122.2848924
28 87.3083551 88.9537387
29 79.8843165 87.3083551
30 36.5818798 79.8843165
31 31.2804711 36.5818798
32 34.8274585 31.2804711
33 11.4304626 34.8274585
34 6.6075385 11.4304626
35 15.4701542 6.6075385
36 25.2309414 15.4701542
37 -5.9993793 25.2309414
38 -16.2996363 -5.9993793
39 -27.9996363 -16.2996363
40 -38.9269445 -27.9996363
41 -24.9444441 -38.9269445
42 -13.3961098 -24.9444441
43 -26.3548286 -13.3961098
44 -16.5143803 -26.3548286
45 -14.2802226 -16.5143803
46 16.4164707 -14.2802226
47 23.9233182 16.4164707
48 -23.4862828 23.9233182
49 -21.4100645 -23.4862828
50 -30.0037824 -21.4100645
51 -24.4726287 -30.0037824
52 13.3508340 -24.4726287
53 -21.2174365 13.3508340
54 -49.7264123 -21.2174365
55 -20.1032065 -49.7264123
56 -13.9185263 -20.1032065
57 -4.6089831 -13.9185263
58 -0.1188289 -4.6089831
59 -15.4627524 -0.1188289
60 5.6538030 -15.4627524
61 -31.2765178 5.6538030
62 -33.6767748 -31.2765178
63 -8.6079284 -33.6767748
64 -34.8729294 -8.6079284
65 -14.1461970 -34.8729294
66 -8.1355555 -14.1461970
67 4.3811112 -8.1355555
68 12.2527131 4.3811112
69 NA 12.2527131
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.6050166 -27.0746958
[2,] 26.1766510 -1.6050166
[3,] 24.4078046 26.1766510
[4,] -23.0260427 24.4078046
[5,] -57.2008523 -23.0260427
[6,] -44.0213644 -57.2008523
[7,] -61.6866223 -44.0213644
[8,] -68.2084813 -61.6866223
[9,] -98.1808627 -68.2084813
[10,] -90.4972476 -98.1808627
[11,] -97.7477102 -90.4972476
[12,] -107.6884649 -97.7477102
[13,] -84.5876320 -107.6884649
[14,] -68.4813499 -84.5876320
[15,] -52.2813499 -68.4813499
[16,] -3.8332726 -52.2813499
[17,] 37.6246134 -3.8332726
[18,] 78.6975621 37.6246134
[19,] 72.4830752 78.6975621
[20,] 51.5612162 72.4830752
[21,] 105.6396058 51.5612162
[22,] 67.5920673 105.6396058
[23,] 73.8169902 67.5920673
[24,] 127.3646992 73.8169902
[25,] 144.8786103 127.3646992
[26,] 122.2848924 144.8786103
[27,] 88.9537387 122.2848924
[28,] 87.3083551 88.9537387
[29,] 79.8843165 87.3083551
[30,] 36.5818798 79.8843165
[31,] 31.2804711 36.5818798
[32,] 34.8274585 31.2804711
[33,] 11.4304626 34.8274585
[34,] 6.6075385 11.4304626
[35,] 15.4701542 6.6075385
[36,] 25.2309414 15.4701542
[37,] -5.9993793 25.2309414
[38,] -16.2996363 -5.9993793
[39,] -27.9996363 -16.2996363
[40,] -38.9269445 -27.9996363
[41,] -24.9444441 -38.9269445
[42,] -13.3961098 -24.9444441
[43,] -26.3548286 -13.3961098
[44,] -16.5143803 -26.3548286
[45,] -14.2802226 -16.5143803
[46,] 16.4164707 -14.2802226
[47,] 23.9233182 16.4164707
[48,] -23.4862828 23.9233182
[49,] -21.4100645 -23.4862828
[50,] -30.0037824 -21.4100645
[51,] -24.4726287 -30.0037824
[52,] 13.3508340 -24.4726287
[53,] -21.2174365 13.3508340
[54,] -49.7264123 -21.2174365
[55,] -20.1032065 -49.7264123
[56,] -13.9185263 -20.1032065
[57,] -4.6089831 -13.9185263
[58,] -0.1188289 -4.6089831
[59,] -15.4627524 -0.1188289
[60,] 5.6538030 -15.4627524
[61,] -31.2765178 5.6538030
[62,] -33.6767748 -31.2765178
[63,] -8.6079284 -33.6767748
[64,] -34.8729294 -8.6079284
[65,] -14.1461970 -34.8729294
[66,] -8.1355555 -14.1461970
[67,] 4.3811112 -8.1355555
[68,] 12.2527131 4.3811112
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.6050166 -27.0746958
2 26.1766510 -1.6050166
3 24.4078046 26.1766510
4 -23.0260427 24.4078046
5 -57.2008523 -23.0260427
6 -44.0213644 -57.2008523
7 -61.6866223 -44.0213644
8 -68.2084813 -61.6866223
9 -98.1808627 -68.2084813
10 -90.4972476 -98.1808627
11 -97.7477102 -90.4972476
12 -107.6884649 -97.7477102
13 -84.5876320 -107.6884649
14 -68.4813499 -84.5876320
15 -52.2813499 -68.4813499
16 -3.8332726 -52.2813499
17 37.6246134 -3.8332726
18 78.6975621 37.6246134
19 72.4830752 78.6975621
20 51.5612162 72.4830752
21 105.6396058 51.5612162
22 67.5920673 105.6396058
23 73.8169902 67.5920673
24 127.3646992 73.8169902
25 144.8786103 127.3646992
26 122.2848924 144.8786103
27 88.9537387 122.2848924
28 87.3083551 88.9537387
29 79.8843165 87.3083551
30 36.5818798 79.8843165
31 31.2804711 36.5818798
32 34.8274585 31.2804711
33 11.4304626 34.8274585
34 6.6075385 11.4304626
35 15.4701542 6.6075385
36 25.2309414 15.4701542
37 -5.9993793 25.2309414
38 -16.2996363 -5.9993793
39 -27.9996363 -16.2996363
40 -38.9269445 -27.9996363
41 -24.9444441 -38.9269445
42 -13.3961098 -24.9444441
43 -26.3548286 -13.3961098
44 -16.5143803 -26.3548286
45 -14.2802226 -16.5143803
46 16.4164707 -14.2802226
47 23.9233182 16.4164707
48 -23.4862828 23.9233182
49 -21.4100645 -23.4862828
50 -30.0037824 -21.4100645
51 -24.4726287 -30.0037824
52 13.3508340 -24.4726287
53 -21.2174365 13.3508340
54 -49.7264123 -21.2174365
55 -20.1032065 -49.7264123
56 -13.9185263 -20.1032065
57 -4.6089831 -13.9185263
58 -0.1188289 -4.6089831
59 -15.4627524 -0.1188289
60 5.6538030 -15.4627524
61 -31.2765178 5.6538030
62 -33.6767748 -31.2765178
63 -8.6079284 -33.6767748
64 -34.8729294 -8.6079284
65 -14.1461970 -34.8729294
66 -8.1355555 -14.1461970
67 4.3811112 -8.1355555
68 12.2527131 4.3811112
> 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/wessaorg/rcomp/tmp/70swl1324298098.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/wessaorg/rcomp/tmp/8kqtv1324298098.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/wessaorg/rcomp/tmp/93frl1324298098.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/wessaorg/rcomp/tmp/10782m1324298098.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11ur711324298098.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/wessaorg/rcomp/tmp/120aft1324298098.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/wessaorg/rcomp/tmp/13ipr01324298098.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/wessaorg/rcomp/tmp/14ichj1324298099.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/wessaorg/rcomp/tmp/155e4p1324298099.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/wessaorg/rcomp/tmp/164xl81324298099.tab")
+ }
>
> try(system("convert tmp/1bdmw1324298098.ps tmp/1bdmw1324298098.png",intern=TRUE))
character(0)
> try(system("convert tmp/2hrgg1324298098.ps tmp/2hrgg1324298098.png",intern=TRUE))
character(0)
> try(system("convert tmp/3fmpl1324298098.ps tmp/3fmpl1324298098.png",intern=TRUE))
character(0)
> try(system("convert tmp/4692e1324298098.ps tmp/4692e1324298098.png",intern=TRUE))
character(0)
> try(system("convert tmp/5s79x1324298098.ps tmp/5s79x1324298098.png",intern=TRUE))
character(0)
> try(system("convert tmp/6htlg1324298098.ps tmp/6htlg1324298098.png",intern=TRUE))
character(0)
> try(system("convert tmp/70swl1324298098.ps tmp/70swl1324298098.png",intern=TRUE))
character(0)
> try(system("convert tmp/8kqtv1324298098.ps tmp/8kqtv1324298098.png",intern=TRUE))
character(0)
> try(system("convert tmp/93frl1324298098.ps tmp/93frl1324298098.png",intern=TRUE))
character(0)
> try(system("convert tmp/10782m1324298098.ps tmp/10782m1324298098.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.695 0.851 4.558