R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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(6.4,12.5,6.8,14.8,7.5,15.9,7.5,14.8,7.6,12.9,7.6,14.3,7.4,14.2,7.3,15.9,7.1,15.3,6.9,15.5,6.8,15.1,7.5,15,7.6,12.1,7.8,15.8,8,16.9,8.1,15.1,8.2,13.7,8.3,14.8,8.2,14.7,8,16,7.9,15.4,7.6,15,7.6,15.5,8.2,15.1,8.3,11.7,8.4,16.3,8.4,16.7,8.4,15,8.6,14.9,8.9,14.6,8.8,15.3,8.3,17.9,7.5,16.4,7.2,15.4,7.5,17.9,8.8,15.9,9.3,13.9,9.3,17.8,8.7,17.9,8.2,17.4,8.3,16.7,8.5,16,8.6,16.6,8.6,19.1,8.2,17.8,8.1,17.2,8,18.6,8.6,16.3,8.7,15.1,8.8,19.2,8.5,17.7,8.4,19.1,8.5,18,8.7,17.5,8.7,17.8,8.6,21.1,8.5,17.2,8.3,19.4,8.1,19.8,8.2,17.6,8.1,16.2,8.1,19.5,7.9,19.9,7.9,20,7.9,17.3,8,18.9,8,18.6,7.9,21.4,8,18.6,7.7,19.8,7.2,20.8,7.5,19.6,7.3,17.7,7,19.8,7,22.2,7,20.7,7.2,17.9,7.3,21.2,7.1,21.4,6.8,21.7,6.6,23.2,6.2,21.5,6.2,22.9,6.8,23.2,6.9,18.6),dim=c(2,85),dimnames=list(c('Werkloosheid','Export'),1:85))
> y <- array(NA,dim=c(2,85),dimnames=list(c('Werkloosheid','Export'),1:85))
> 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 = '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
Werkloosheid Export t
1 6.4 12.5 1
2 6.8 14.8 2
3 7.5 15.9 3
4 7.5 14.8 4
5 7.6 12.9 5
6 7.6 14.3 6
7 7.4 14.2 7
8 7.3 15.9 8
9 7.1 15.3 9
10 6.9 15.5 10
11 6.8 15.1 11
12 7.5 15.0 12
13 7.6 12.1 13
14 7.8 15.8 14
15 8.0 16.9 15
16 8.1 15.1 16
17 8.2 13.7 17
18 8.3 14.8 18
19 8.2 14.7 19
20 8.0 16.0 20
21 7.9 15.4 21
22 7.6 15.0 22
23 7.6 15.5 23
24 8.2 15.1 24
25 8.3 11.7 25
26 8.4 16.3 26
27 8.4 16.7 27
28 8.4 15.0 28
29 8.6 14.9 29
30 8.9 14.6 30
31 8.8 15.3 31
32 8.3 17.9 32
33 7.5 16.4 33
34 7.2 15.4 34
35 7.5 17.9 35
36 8.8 15.9 36
37 9.3 13.9 37
38 9.3 17.8 38
39 8.7 17.9 39
40 8.2 17.4 40
41 8.3 16.7 41
42 8.5 16.0 42
43 8.6 16.6 43
44 8.6 19.1 44
45 8.2 17.8 45
46 8.1 17.2 46
47 8.0 18.6 47
48 8.6 16.3 48
49 8.7 15.1 49
50 8.8 19.2 50
51 8.5 17.7 51
52 8.4 19.1 52
53 8.5 18.0 53
54 8.7 17.5 54
55 8.7 17.8 55
56 8.6 21.1 56
57 8.5 17.2 57
58 8.3 19.4 58
59 8.1 19.8 59
60 8.2 17.6 60
61 8.1 16.2 61
62 8.1 19.5 62
63 7.9 19.9 63
64 7.9 20.0 64
65 7.9 17.3 65
66 8.0 18.9 66
67 8.0 18.6 67
68 7.9 21.4 68
69 8.0 18.6 69
70 7.7 19.8 70
71 7.2 20.8 71
72 7.5 19.6 72
73 7.3 17.7 73
74 7.0 19.8 74
75 7.0 22.2 75
76 7.0 20.7 76
77 7.2 17.9 77
78 7.3 21.2 78
79 7.1 21.4 79
80 6.8 21.7 80
81 6.6 23.2 81
82 6.2 21.5 82
83 6.2 22.9 83
84 6.8 23.2 84
85 6.9 18.6 85
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Export t
9.97087 -0.14254 0.00855
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.7977 -0.4478 0.1388 0.4934 1.5414
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.970870 0.726316 13.728 <2e-16 ***
Export -0.142540 0.052939 -2.693 0.0086 **
t 0.008550 0.005613 1.523 0.1315
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6687 on 82 degrees of freedom
Multiple R-squared: 0.1025, Adjusted R-squared: 0.08059
F-statistic: 4.681 on 2 and 82 DF, p-value: 0.01188
> 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.05266760 1.053352e-01 9.473324e-01
[2,] 0.08057593 1.611519e-01 9.194241e-01
[3,] 0.13156373 2.631275e-01 8.684363e-01
[4,] 0.15524587 3.104917e-01 8.447541e-01
[5,] 0.19435800 3.887160e-01 8.056420e-01
[6,] 0.22115512 4.423102e-01 7.788449e-01
[7,] 0.18544194 3.708839e-01 8.145581e-01
[8,] 0.17197590 3.439518e-01 8.280241e-01
[9,] 0.14855383 2.971077e-01 8.514462e-01
[10,] 0.12623605 2.524721e-01 8.737640e-01
[11,] 0.10945406 2.189081e-01 8.905459e-01
[12,] 0.09353122 1.870624e-01 9.064688e-01
[13,] 0.07271645 1.454329e-01 9.272835e-01
[14,] 0.05047398 1.009480e-01 9.495260e-01
[15,] 0.03809381 7.618762e-02 9.619062e-01
[16,] 0.03505089 7.010178e-02 9.649491e-01
[17,] 0.06521664 1.304333e-01 9.347834e-01
[18,] 0.10929777 2.185955e-01 8.907022e-01
[19,] 0.09056059 1.811212e-01 9.094394e-01
[20,] 0.08336369 1.667274e-01 9.166363e-01
[21,] 0.06457007 1.291401e-01 9.354299e-01
[22,] 0.04803494 9.606988e-02 9.519651e-01
[23,] 0.03736661 7.473321e-02 9.626334e-01
[24,] 0.02768998 5.537996e-02 9.723100e-01
[25,] 0.02330461 4.660922e-02 9.766954e-01
[26,] 0.01611460 3.222919e-02 9.838854e-01
[27,] 0.01435632 2.871265e-02 9.856437e-01
[28,] 0.15799684 3.159937e-01 8.420032e-01
[29,] 0.84274529 3.145094e-01 1.572547e-01
[30,] 0.98717804 2.564393e-02 1.282196e-02
[31,] 0.98542743 2.914513e-02 1.457257e-02
[32,] 0.98508362 2.983276e-02 1.491638e-02
[33,] 0.99039412 1.921176e-02 9.605882e-03
[34,] 0.98594455 2.811091e-02 1.405545e-02
[35,] 0.99240526 1.518947e-02 7.594736e-03
[36,] 0.99568206 8.635875e-03 4.317937e-03
[37,] 0.99626263 7.474737e-03 3.737368e-03
[38,] 0.99556063 8.878749e-03 4.439374e-03
[39,] 0.99336836 1.326328e-02 6.631642e-03
[40,] 0.99715239 5.695216e-03 2.847608e-03
[41,] 0.99962648 7.470443e-04 3.735221e-04
[42,] 0.99998992 2.015984e-05 1.007992e-05
[43,] 0.99999187 1.626380e-05 8.131899e-06
[44,] 0.99999158 1.684310e-05 8.421552e-06
[45,] 0.99998212 3.576043e-05 1.788021e-05
[46,] 0.99998161 3.677337e-05 1.838669e-05
[47,] 0.99998193 3.613078e-05 1.806539e-05
[48,] 0.99997586 4.827382e-05 2.413691e-05
[49,] 0.99994875 1.025052e-04 5.125258e-05
[50,] 0.99989860 2.028007e-04 1.014003e-04
[51,] 0.99985435 2.913066e-04 1.456533e-04
[52,] 0.99974633 5.073366e-04 2.536683e-04
[53,] 0.99956940 8.612043e-04 4.306022e-04
[54,] 0.99942402 1.151958e-03 5.759791e-04
[55,] 0.99923433 1.531339e-03 7.656694e-04
[56,] 0.99935738 1.285237e-03 6.426187e-04
[57,] 0.99895133 2.097338e-03 1.048669e-03
[58,] 0.99861915 2.761710e-03 1.380855e-03
[59,] 0.99795449 4.091024e-03 2.045512e-03
[60,] 0.99777733 4.445349e-03 2.222675e-03
[61,] 0.99628529 7.429429e-03 3.714715e-03
[62,] 0.99409858 1.180285e-02 5.901424e-03
[63,] 0.99340774 1.318452e-02 6.592259e-03
[64,] 0.99384904 1.230193e-02 6.150963e-03
[65,] 0.99299721 1.400557e-02 7.002785e-03
[66,] 0.99012465 1.975071e-02 9.875354e-03
[67,] 0.98597813 2.804373e-02 1.402187e-02
[68,] 0.97897481 4.205037e-02 2.102519e-02
[69,] 0.97433903 5.132194e-02 2.566097e-02
[70,] 0.95420692 9.158615e-02 4.579308e-02
[71,] 0.92531061 1.493788e-01 7.468939e-02
[72,] 0.88782107 2.243579e-01 1.121789e-01
[73,] 0.82806066 3.438787e-01 1.719393e-01
[74,] 0.76838559 4.632288e-01 2.316144e-01
> postscript(file="/var/www/html/rcomp/tmp/1s4kp1228903023.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/29yma1228903023.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/3dz9x1228903023.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/4wcj01228903023.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/55tu91228903023.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 = 85
Frequency = 1
1 2 3 4 5 6
-1.79767609 -1.07838550 -0.23014236 -0.39548618 -0.57486163 -0.38385662
7 8 9 10 11 12
-0.60666092 -0.47289405 -0.76696811 -0.94701054 -1.11257669 -0.43538098
13 14 15 16 17 18
-0.75729596 -0.03845004 0.30979311 0.14467162 0.03656593 0.28480908
19 20 21 22 23 24
0.16200479 0.13875584 -0.05531822 -0.42088437 -0.35816494 0.17626891
25 26 27 28 29 30
-0.21691584 0.53021567 0.57868114 0.32781360 0.50500931 0.75369711
31 32 33 34 35 36
0.74492444 0.60697689 -0.41538275 -0.86647262 -0.21867413 0.78769647
37 38 39 40 41 42
0.99406707 1.54142090 0.94712452 0.36730441 0.35897640 0.45064839
43 44 45 46 47 48
0.62762177 0.97542026 0.38156853 0.18749447 0.27849948 0.54210822
49 50 51 52 53 54
0.46251044 1.13837218 0.61601255 0.70701755 0.64167373 0.76185362
55 56 57 58 59 60
0.79606514 1.15789526 0.49344075 0.59847738 0.44694285 0.22480554
61 62 63 64 65 66
-0.08330014 0.37852998 0.22699545 0.23269907 -0.16070801 0.15880490
67 68 69 70 71 72
0.10749271 0.39805306 0.09039203 -0.04711087 -0.41312168 -0.29271946
73 74 75 76 77 78
-0.77209490 -0.78131223 -0.44776769 -0.67012733 -0.87778835 -0.31595824
79 80 81 82 83 84
-0.49600067 -0.76178915 -0.75653019 -1.40739773 -1.21639273 -0.58218121
85
-1.14641339
> postscript(file="/var/www/html/rcomp/tmp/6gb8a1228903023.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 = 85
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.79767609 NA
1 -1.07838550 -1.79767609
2 -0.23014236 -1.07838550
3 -0.39548618 -0.23014236
4 -0.57486163 -0.39548618
5 -0.38385662 -0.57486163
6 -0.60666092 -0.38385662
7 -0.47289405 -0.60666092
8 -0.76696811 -0.47289405
9 -0.94701054 -0.76696811
10 -1.11257669 -0.94701054
11 -0.43538098 -1.11257669
12 -0.75729596 -0.43538098
13 -0.03845004 -0.75729596
14 0.30979311 -0.03845004
15 0.14467162 0.30979311
16 0.03656593 0.14467162
17 0.28480908 0.03656593
18 0.16200479 0.28480908
19 0.13875584 0.16200479
20 -0.05531822 0.13875584
21 -0.42088437 -0.05531822
22 -0.35816494 -0.42088437
23 0.17626891 -0.35816494
24 -0.21691584 0.17626891
25 0.53021567 -0.21691584
26 0.57868114 0.53021567
27 0.32781360 0.57868114
28 0.50500931 0.32781360
29 0.75369711 0.50500931
30 0.74492444 0.75369711
31 0.60697689 0.74492444
32 -0.41538275 0.60697689
33 -0.86647262 -0.41538275
34 -0.21867413 -0.86647262
35 0.78769647 -0.21867413
36 0.99406707 0.78769647
37 1.54142090 0.99406707
38 0.94712452 1.54142090
39 0.36730441 0.94712452
40 0.35897640 0.36730441
41 0.45064839 0.35897640
42 0.62762177 0.45064839
43 0.97542026 0.62762177
44 0.38156853 0.97542026
45 0.18749447 0.38156853
46 0.27849948 0.18749447
47 0.54210822 0.27849948
48 0.46251044 0.54210822
49 1.13837218 0.46251044
50 0.61601255 1.13837218
51 0.70701755 0.61601255
52 0.64167373 0.70701755
53 0.76185362 0.64167373
54 0.79606514 0.76185362
55 1.15789526 0.79606514
56 0.49344075 1.15789526
57 0.59847738 0.49344075
58 0.44694285 0.59847738
59 0.22480554 0.44694285
60 -0.08330014 0.22480554
61 0.37852998 -0.08330014
62 0.22699545 0.37852998
63 0.23269907 0.22699545
64 -0.16070801 0.23269907
65 0.15880490 -0.16070801
66 0.10749271 0.15880490
67 0.39805306 0.10749271
68 0.09039203 0.39805306
69 -0.04711087 0.09039203
70 -0.41312168 -0.04711087
71 -0.29271946 -0.41312168
72 -0.77209490 -0.29271946
73 -0.78131223 -0.77209490
74 -0.44776769 -0.78131223
75 -0.67012733 -0.44776769
76 -0.87778835 -0.67012733
77 -0.31595824 -0.87778835
78 -0.49600067 -0.31595824
79 -0.76178915 -0.49600067
80 -0.75653019 -0.76178915
81 -1.40739773 -0.75653019
82 -1.21639273 -1.40739773
83 -0.58218121 -1.21639273
84 -1.14641339 -0.58218121
85 NA -1.14641339
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.07838550 -1.79767609
[2,] -0.23014236 -1.07838550
[3,] -0.39548618 -0.23014236
[4,] -0.57486163 -0.39548618
[5,] -0.38385662 -0.57486163
[6,] -0.60666092 -0.38385662
[7,] -0.47289405 -0.60666092
[8,] -0.76696811 -0.47289405
[9,] -0.94701054 -0.76696811
[10,] -1.11257669 -0.94701054
[11,] -0.43538098 -1.11257669
[12,] -0.75729596 -0.43538098
[13,] -0.03845004 -0.75729596
[14,] 0.30979311 -0.03845004
[15,] 0.14467162 0.30979311
[16,] 0.03656593 0.14467162
[17,] 0.28480908 0.03656593
[18,] 0.16200479 0.28480908
[19,] 0.13875584 0.16200479
[20,] -0.05531822 0.13875584
[21,] -0.42088437 -0.05531822
[22,] -0.35816494 -0.42088437
[23,] 0.17626891 -0.35816494
[24,] -0.21691584 0.17626891
[25,] 0.53021567 -0.21691584
[26,] 0.57868114 0.53021567
[27,] 0.32781360 0.57868114
[28,] 0.50500931 0.32781360
[29,] 0.75369711 0.50500931
[30,] 0.74492444 0.75369711
[31,] 0.60697689 0.74492444
[32,] -0.41538275 0.60697689
[33,] -0.86647262 -0.41538275
[34,] -0.21867413 -0.86647262
[35,] 0.78769647 -0.21867413
[36,] 0.99406707 0.78769647
[37,] 1.54142090 0.99406707
[38,] 0.94712452 1.54142090
[39,] 0.36730441 0.94712452
[40,] 0.35897640 0.36730441
[41,] 0.45064839 0.35897640
[42,] 0.62762177 0.45064839
[43,] 0.97542026 0.62762177
[44,] 0.38156853 0.97542026
[45,] 0.18749447 0.38156853
[46,] 0.27849948 0.18749447
[47,] 0.54210822 0.27849948
[48,] 0.46251044 0.54210822
[49,] 1.13837218 0.46251044
[50,] 0.61601255 1.13837218
[51,] 0.70701755 0.61601255
[52,] 0.64167373 0.70701755
[53,] 0.76185362 0.64167373
[54,] 0.79606514 0.76185362
[55,] 1.15789526 0.79606514
[56,] 0.49344075 1.15789526
[57,] 0.59847738 0.49344075
[58,] 0.44694285 0.59847738
[59,] 0.22480554 0.44694285
[60,] -0.08330014 0.22480554
[61,] 0.37852998 -0.08330014
[62,] 0.22699545 0.37852998
[63,] 0.23269907 0.22699545
[64,] -0.16070801 0.23269907
[65,] 0.15880490 -0.16070801
[66,] 0.10749271 0.15880490
[67,] 0.39805306 0.10749271
[68,] 0.09039203 0.39805306
[69,] -0.04711087 0.09039203
[70,] -0.41312168 -0.04711087
[71,] -0.29271946 -0.41312168
[72,] -0.77209490 -0.29271946
[73,] -0.78131223 -0.77209490
[74,] -0.44776769 -0.78131223
[75,] -0.67012733 -0.44776769
[76,] -0.87778835 -0.67012733
[77,] -0.31595824 -0.87778835
[78,] -0.49600067 -0.31595824
[79,] -0.76178915 -0.49600067
[80,] -0.75653019 -0.76178915
[81,] -1.40739773 -0.75653019
[82,] -1.21639273 -1.40739773
[83,] -0.58218121 -1.21639273
[84,] -1.14641339 -0.58218121
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.07838550 -1.79767609
2 -0.23014236 -1.07838550
3 -0.39548618 -0.23014236
4 -0.57486163 -0.39548618
5 -0.38385662 -0.57486163
6 -0.60666092 -0.38385662
7 -0.47289405 -0.60666092
8 -0.76696811 -0.47289405
9 -0.94701054 -0.76696811
10 -1.11257669 -0.94701054
11 -0.43538098 -1.11257669
12 -0.75729596 -0.43538098
13 -0.03845004 -0.75729596
14 0.30979311 -0.03845004
15 0.14467162 0.30979311
16 0.03656593 0.14467162
17 0.28480908 0.03656593
18 0.16200479 0.28480908
19 0.13875584 0.16200479
20 -0.05531822 0.13875584
21 -0.42088437 -0.05531822
22 -0.35816494 -0.42088437
23 0.17626891 -0.35816494
24 -0.21691584 0.17626891
25 0.53021567 -0.21691584
26 0.57868114 0.53021567
27 0.32781360 0.57868114
28 0.50500931 0.32781360
29 0.75369711 0.50500931
30 0.74492444 0.75369711
31 0.60697689 0.74492444
32 -0.41538275 0.60697689
33 -0.86647262 -0.41538275
34 -0.21867413 -0.86647262
35 0.78769647 -0.21867413
36 0.99406707 0.78769647
37 1.54142090 0.99406707
38 0.94712452 1.54142090
39 0.36730441 0.94712452
40 0.35897640 0.36730441
41 0.45064839 0.35897640
42 0.62762177 0.45064839
43 0.97542026 0.62762177
44 0.38156853 0.97542026
45 0.18749447 0.38156853
46 0.27849948 0.18749447
47 0.54210822 0.27849948
48 0.46251044 0.54210822
49 1.13837218 0.46251044
50 0.61601255 1.13837218
51 0.70701755 0.61601255
52 0.64167373 0.70701755
53 0.76185362 0.64167373
54 0.79606514 0.76185362
55 1.15789526 0.79606514
56 0.49344075 1.15789526
57 0.59847738 0.49344075
58 0.44694285 0.59847738
59 0.22480554 0.44694285
60 -0.08330014 0.22480554
61 0.37852998 -0.08330014
62 0.22699545 0.37852998
63 0.23269907 0.22699545
64 -0.16070801 0.23269907
65 0.15880490 -0.16070801
66 0.10749271 0.15880490
67 0.39805306 0.10749271
68 0.09039203 0.39805306
69 -0.04711087 0.09039203
70 -0.41312168 -0.04711087
71 -0.29271946 -0.41312168
72 -0.77209490 -0.29271946
73 -0.78131223 -0.77209490
74 -0.44776769 -0.78131223
75 -0.67012733 -0.44776769
76 -0.87778835 -0.67012733
77 -0.31595824 -0.87778835
78 -0.49600067 -0.31595824
79 -0.76178915 -0.49600067
80 -0.75653019 -0.76178915
81 -1.40739773 -0.75653019
82 -1.21639273 -1.40739773
83 -0.58218121 -1.21639273
84 -1.14641339 -0.58218121
> 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/7zt441228903023.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/8fnww1228903023.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/9mtz71228903023.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/10mul51228903023.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/111xza1228903023.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/12zotj1228903023.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/13m5ne1228903023.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/14lyxb1228903023.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/15ejs91228903024.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/16sfi91228903024.tab")
+ }
>
> system("convert tmp/1s4kp1228903023.ps tmp/1s4kp1228903023.png")
> system("convert tmp/29yma1228903023.ps tmp/29yma1228903023.png")
> system("convert tmp/3dz9x1228903023.ps tmp/3dz9x1228903023.png")
> system("convert tmp/4wcj01228903023.ps tmp/4wcj01228903023.png")
> system("convert tmp/55tu91228903023.ps tmp/55tu91228903023.png")
> system("convert tmp/6gb8a1228903023.ps tmp/6gb8a1228903023.png")
> system("convert tmp/7zt441228903023.ps tmp/7zt441228903023.png")
> system("convert tmp/8fnww1228903023.ps tmp/8fnww1228903023.png")
> system("convert tmp/9mtz71228903023.ps tmp/9mtz71228903023.png")
> system("convert tmp/10mul51228903023.ps tmp/10mul51228903023.png")
>
>
> proc.time()
user system elapsed
2.835 1.653 3.647