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(13132.1,0,17665.9,0,16913,0,17318.8,0,16224.2,0,15469.6,0,16557.5,0,19414.8,0,17335,0,16525.2,0,18160.4,0,15553.8,0,15262.2,0,18581,0,17564.1,0,18948.6,0,17187.8,0,17564.8,0,17668.4,0,20811.7,0,17257.8,0,18984.2,0,20532.6,0,17082.3,0,16894.9,0,20274.9,0,20078.6,0,19900.9,0,17012.2,0,19642.9,0,19024,0,21691,0,18835.9,0,19873.4,0,21468.2,0,19406.8,0,18385.3,0,20739.3,0,22268.3,0,21569,0,17514.8,0,21124.7,0,21251,0,21393,0,22145.2,0,20310.5,0,23466.9,0,21264.6,0,18388.1,0,22635.4,0,22014.3,1,18422.7,1,16120.2,1,16037.7,1,16410.7,1,17749.8,1,16349.8,1,15662.3,1,17782.3,1,16398.9,1),dim=c(2,60),dimnames=list(c('Uitvoer','Crisis'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Uitvoer','Crisis'),1:60))
> 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
Uitvoer Crisis M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 13132.1 0 1 0 0 0 0 0 0 0 0 0 0 1
2 17665.9 0 0 1 0 0 0 0 0 0 0 0 0 2
3 16913.0 0 0 0 1 0 0 0 0 0 0 0 0 3
4 17318.8 0 0 0 0 1 0 0 0 0 0 0 0 4
5 16224.2 0 0 0 0 0 1 0 0 0 0 0 0 5
6 15469.6 0 0 0 0 0 0 1 0 0 0 0 0 6
7 16557.5 0 0 0 0 0 0 0 1 0 0 0 0 7
8 19414.8 0 0 0 0 0 0 0 0 1 0 0 0 8
9 17335.0 0 0 0 0 0 0 0 0 0 1 0 0 9
10 16525.2 0 0 0 0 0 0 0 0 0 0 1 0 10
11 18160.4 0 0 0 0 0 0 0 0 0 0 0 1 11
12 15553.8 0 0 0 0 0 0 0 0 0 0 0 0 12
13 15262.2 0 1 0 0 0 0 0 0 0 0 0 0 13
14 18581.0 0 0 1 0 0 0 0 0 0 0 0 0 14
15 17564.1 0 0 0 1 0 0 0 0 0 0 0 0 15
16 18948.6 0 0 0 0 1 0 0 0 0 0 0 0 16
17 17187.8 0 0 0 0 0 1 0 0 0 0 0 0 17
18 17564.8 0 0 0 0 0 0 1 0 0 0 0 0 18
19 17668.4 0 0 0 0 0 0 0 1 0 0 0 0 19
20 20811.7 0 0 0 0 0 0 0 0 1 0 0 0 20
21 17257.8 0 0 0 0 0 0 0 0 0 1 0 0 21
22 18984.2 0 0 0 0 0 0 0 0 0 0 1 0 22
23 20532.6 0 0 0 0 0 0 0 0 0 0 0 1 23
24 17082.3 0 0 0 0 0 0 0 0 0 0 0 0 24
25 16894.9 0 1 0 0 0 0 0 0 0 0 0 0 25
26 20274.9 0 0 1 0 0 0 0 0 0 0 0 0 26
27 20078.6 0 0 0 1 0 0 0 0 0 0 0 0 27
28 19900.9 0 0 0 0 1 0 0 0 0 0 0 0 28
29 17012.2 0 0 0 0 0 1 0 0 0 0 0 0 29
30 19642.9 0 0 0 0 0 0 1 0 0 0 0 0 30
31 19024.0 0 0 0 0 0 0 0 1 0 0 0 0 31
32 21691.0 0 0 0 0 0 0 0 0 1 0 0 0 32
33 18835.9 0 0 0 0 0 0 0 0 0 1 0 0 33
34 19873.4 0 0 0 0 0 0 0 0 0 0 1 0 34
35 21468.2 0 0 0 0 0 0 0 0 0 0 0 1 35
36 19406.8 0 0 0 0 0 0 0 0 0 0 0 0 36
37 18385.3 0 1 0 0 0 0 0 0 0 0 0 0 37
38 20739.3 0 0 1 0 0 0 0 0 0 0 0 0 38
39 22268.3 0 0 0 1 0 0 0 0 0 0 0 0 39
40 21569.0 0 0 0 0 1 0 0 0 0 0 0 0 40
41 17514.8 0 0 0 0 0 1 0 0 0 0 0 0 41
42 21124.7 0 0 0 0 0 0 1 0 0 0 0 0 42
43 21251.0 0 0 0 0 0 0 0 1 0 0 0 0 43
44 21393.0 0 0 0 0 0 0 0 0 1 0 0 0 44
45 22145.2 0 0 0 0 0 0 0 0 0 1 0 0 45
46 20310.5 0 0 0 0 0 0 0 0 0 0 1 0 46
47 23466.9 0 0 0 0 0 0 0 0 0 0 0 1 47
48 21264.6 0 0 0 0 0 0 0 0 0 0 0 0 48
49 18388.1 0 1 0 0 0 0 0 0 0 0 0 0 49
50 22635.4 0 0 1 0 0 0 0 0 0 0 0 0 50
51 22014.3 1 0 0 1 0 0 0 0 0 0 0 0 51
52 18422.7 1 0 0 0 1 0 0 0 0 0 0 0 52
53 16120.2 1 0 0 0 0 1 0 0 0 0 0 0 53
54 16037.7 1 0 0 0 0 0 1 0 0 0 0 0 54
55 16410.7 1 0 0 0 0 0 0 1 0 0 0 0 55
56 17749.8 1 0 0 0 0 0 0 0 1 0 0 0 56
57 16349.8 1 0 0 0 0 0 0 0 0 1 0 0 57
58 15662.3 1 0 0 0 0 0 0 0 0 0 1 0 58
59 17782.3 1 0 0 0 0 0 0 0 0 0 0 1 59
60 16398.9 1 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Crisis M1 M2 M3 M4
14842.0 -5214.9 -1306.1 2145.7 2861.9 2211.2
M5 M6 M7 M8 M9 M10
-324.0 717.0 816.3 2731.0 788.6 560.0
M11 t
2455.9 115.1
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1865.8 -599.0 -46.4 594.3 3657.1
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 14842.040 536.877 27.645 < 2e-16 ***
Crisis -5214.891 458.128 -11.383 5.65e-15 ***
M1 -1306.060 631.748 -2.067 0.044351 *
M2 2145.658 631.055 3.400 0.001402 **
M3 2861.934 632.178 4.527 4.21e-05 ***
M4 2211.213 630.871 3.505 0.001030 **
M5 -324.009 629.714 -0.515 0.609343
M6 717.030 628.711 1.140 0.259991
M7 816.348 627.860 1.300 0.200007
M8 2731.026 627.163 4.355 7.38e-05 ***
M9 788.645 626.621 1.259 0.214537
M10 559.963 626.233 0.894 0.375882
M11 2455.862 626.000 3.923 0.000290 ***
t 115.062 9.857 11.673 2.38e-15 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 989.7 on 46 degrees of freedom
Multiple R-squared: 0.847, Adjusted R-squared: 0.8038
F-statistic: 19.59 on 13 and 46 DF, p-value: 1.618e-14
> 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.1287222098 0.257444420 0.8712778
[2,] 0.0863798373 0.172759675 0.9136202
[3,] 0.0369792863 0.073958573 0.9630207
[4,] 0.0153069292 0.030613858 0.9846931
[5,] 0.0344899884 0.068979977 0.9655100
[6,] 0.0427963474 0.085592695 0.9572037
[7,] 0.0363303254 0.072660651 0.9636697
[8,] 0.0194607171 0.038921434 0.9805393
[9,] 0.0111303371 0.022260674 0.9888697
[10,] 0.0052276448 0.010455290 0.9947724
[11,] 0.0078443754 0.015688751 0.9921556
[12,] 0.0050977915 0.010195583 0.9949022
[13,] 0.0231092734 0.046218547 0.9768907
[14,] 0.0200901998 0.040180400 0.9799098
[15,] 0.0116793342 0.023358668 0.9883207
[16,] 0.0086771264 0.017354253 0.9913229
[17,] 0.0069440374 0.013888075 0.9930560
[18,] 0.0039810596 0.007962119 0.9960189
[19,] 0.0017867502 0.003573500 0.9982132
[20,] 0.0013800688 0.002760138 0.9986199
[21,] 0.0009237008 0.001847402 0.9990763
[22,] 0.0006097685 0.001219537 0.9993902
[23,] 0.0239771071 0.047954214 0.9760229
[24,] 0.0191831765 0.038366353 0.9808168
[25,] 0.6715188050 0.656962390 0.3284812
[26,] 0.5403698848 0.919260230 0.4596301
[27,] 0.3800228208 0.760045642 0.6199772
> postscript(file="/var/www/html/rcomp/tmp/1dbi91259931169.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/2cpt31259931169.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/3lury1259931169.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/470fx1259931169.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/5d5841259931169.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 = 60
Frequency = 1
1 2 3 4 5 6
-518.94143 448.07857 -1136.15957 -194.69957 1130.86043 -779.83957
7 8 9 10 11 12
93.68043 921.24043 668.76043 -27.41957 -403.17957 -668.97957
13 14 15 16 17 18
230.41929 -17.56071 -1865.79886 54.36114 713.72114 -65.37886
19 20 21 22 23 24
-176.15886 937.40114 -789.17886 1050.84114 588.28114 -521.21886
25 26 27 28 29 30
482.38000 295.60000 -732.03814 -374.07814 -842.61814 631.98186
31 32 33 34 35 36
-201.29814 435.96186 -591.81814 559.30186 143.14186 422.54186
37 38 39 40 41 42
592.04071 -620.73929 76.92257 -86.71743 -1720.75743 733.04257
43 44 45 46 47 48
644.96257 -1242.77743 1336.74257 -384.33743 761.10257 899.60257
49 50 51 52 53 54
-785.89857 -105.37857 3657.07400 601.13400 718.79400 -519.80600
55 56 57 58 59 60
-361.18600 -1051.82600 -624.50600 -1198.38600 -1089.34600 -131.94600
> postscript(file="/var/www/html/rcomp/tmp/6womq1259931169.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -518.94143 NA
1 448.07857 -518.94143
2 -1136.15957 448.07857
3 -194.69957 -1136.15957
4 1130.86043 -194.69957
5 -779.83957 1130.86043
6 93.68043 -779.83957
7 921.24043 93.68043
8 668.76043 921.24043
9 -27.41957 668.76043
10 -403.17957 -27.41957
11 -668.97957 -403.17957
12 230.41929 -668.97957
13 -17.56071 230.41929
14 -1865.79886 -17.56071
15 54.36114 -1865.79886
16 713.72114 54.36114
17 -65.37886 713.72114
18 -176.15886 -65.37886
19 937.40114 -176.15886
20 -789.17886 937.40114
21 1050.84114 -789.17886
22 588.28114 1050.84114
23 -521.21886 588.28114
24 482.38000 -521.21886
25 295.60000 482.38000
26 -732.03814 295.60000
27 -374.07814 -732.03814
28 -842.61814 -374.07814
29 631.98186 -842.61814
30 -201.29814 631.98186
31 435.96186 -201.29814
32 -591.81814 435.96186
33 559.30186 -591.81814
34 143.14186 559.30186
35 422.54186 143.14186
36 592.04071 422.54186
37 -620.73929 592.04071
38 76.92257 -620.73929
39 -86.71743 76.92257
40 -1720.75743 -86.71743
41 733.04257 -1720.75743
42 644.96257 733.04257
43 -1242.77743 644.96257
44 1336.74257 -1242.77743
45 -384.33743 1336.74257
46 761.10257 -384.33743
47 899.60257 761.10257
48 -785.89857 899.60257
49 -105.37857 -785.89857
50 3657.07400 -105.37857
51 601.13400 3657.07400
52 718.79400 601.13400
53 -519.80600 718.79400
54 -361.18600 -519.80600
55 -1051.82600 -361.18600
56 -624.50600 -1051.82600
57 -1198.38600 -624.50600
58 -1089.34600 -1198.38600
59 -131.94600 -1089.34600
60 NA -131.94600
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 448.07857 -518.94143
[2,] -1136.15957 448.07857
[3,] -194.69957 -1136.15957
[4,] 1130.86043 -194.69957
[5,] -779.83957 1130.86043
[6,] 93.68043 -779.83957
[7,] 921.24043 93.68043
[8,] 668.76043 921.24043
[9,] -27.41957 668.76043
[10,] -403.17957 -27.41957
[11,] -668.97957 -403.17957
[12,] 230.41929 -668.97957
[13,] -17.56071 230.41929
[14,] -1865.79886 -17.56071
[15,] 54.36114 -1865.79886
[16,] 713.72114 54.36114
[17,] -65.37886 713.72114
[18,] -176.15886 -65.37886
[19,] 937.40114 -176.15886
[20,] -789.17886 937.40114
[21,] 1050.84114 -789.17886
[22,] 588.28114 1050.84114
[23,] -521.21886 588.28114
[24,] 482.38000 -521.21886
[25,] 295.60000 482.38000
[26,] -732.03814 295.60000
[27,] -374.07814 -732.03814
[28,] -842.61814 -374.07814
[29,] 631.98186 -842.61814
[30,] -201.29814 631.98186
[31,] 435.96186 -201.29814
[32,] -591.81814 435.96186
[33,] 559.30186 -591.81814
[34,] 143.14186 559.30186
[35,] 422.54186 143.14186
[36,] 592.04071 422.54186
[37,] -620.73929 592.04071
[38,] 76.92257 -620.73929
[39,] -86.71743 76.92257
[40,] -1720.75743 -86.71743
[41,] 733.04257 -1720.75743
[42,] 644.96257 733.04257
[43,] -1242.77743 644.96257
[44,] 1336.74257 -1242.77743
[45,] -384.33743 1336.74257
[46,] 761.10257 -384.33743
[47,] 899.60257 761.10257
[48,] -785.89857 899.60257
[49,] -105.37857 -785.89857
[50,] 3657.07400 -105.37857
[51,] 601.13400 3657.07400
[52,] 718.79400 601.13400
[53,] -519.80600 718.79400
[54,] -361.18600 -519.80600
[55,] -1051.82600 -361.18600
[56,] -624.50600 -1051.82600
[57,] -1198.38600 -624.50600
[58,] -1089.34600 -1198.38600
[59,] -131.94600 -1089.34600
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 448.07857 -518.94143
2 -1136.15957 448.07857
3 -194.69957 -1136.15957
4 1130.86043 -194.69957
5 -779.83957 1130.86043
6 93.68043 -779.83957
7 921.24043 93.68043
8 668.76043 921.24043
9 -27.41957 668.76043
10 -403.17957 -27.41957
11 -668.97957 -403.17957
12 230.41929 -668.97957
13 -17.56071 230.41929
14 -1865.79886 -17.56071
15 54.36114 -1865.79886
16 713.72114 54.36114
17 -65.37886 713.72114
18 -176.15886 -65.37886
19 937.40114 -176.15886
20 -789.17886 937.40114
21 1050.84114 -789.17886
22 588.28114 1050.84114
23 -521.21886 588.28114
24 482.38000 -521.21886
25 295.60000 482.38000
26 -732.03814 295.60000
27 -374.07814 -732.03814
28 -842.61814 -374.07814
29 631.98186 -842.61814
30 -201.29814 631.98186
31 435.96186 -201.29814
32 -591.81814 435.96186
33 559.30186 -591.81814
34 143.14186 559.30186
35 422.54186 143.14186
36 592.04071 422.54186
37 -620.73929 592.04071
38 76.92257 -620.73929
39 -86.71743 76.92257
40 -1720.75743 -86.71743
41 733.04257 -1720.75743
42 644.96257 733.04257
43 -1242.77743 644.96257
44 1336.74257 -1242.77743
45 -384.33743 1336.74257
46 761.10257 -384.33743
47 899.60257 761.10257
48 -785.89857 899.60257
49 -105.37857 -785.89857
50 3657.07400 -105.37857
51 601.13400 3657.07400
52 718.79400 601.13400
53 -519.80600 718.79400
54 -361.18600 -519.80600
55 -1051.82600 -361.18600
56 -624.50600 -1051.82600
57 -1198.38600 -624.50600
58 -1089.34600 -1198.38600
59 -131.94600 -1089.34600
> 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/7fkw11259931169.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/8x8zk1259931169.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/94i901259931169.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/10mqlt1259931169.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/11ijt81259931169.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/12xp681259931169.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/13n0x31259931170.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/14qwwa1259931170.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/15ayf81259931170.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/16h6ka1259931170.tab")
+ }
>
> system("convert tmp/1dbi91259931169.ps tmp/1dbi91259931169.png")
> system("convert tmp/2cpt31259931169.ps tmp/2cpt31259931169.png")
> system("convert tmp/3lury1259931169.ps tmp/3lury1259931169.png")
> system("convert tmp/470fx1259931169.ps tmp/470fx1259931169.png")
> system("convert tmp/5d5841259931169.ps tmp/5d5841259931169.png")
> system("convert tmp/6womq1259931169.ps tmp/6womq1259931169.png")
> system("convert tmp/7fkw11259931169.ps tmp/7fkw11259931169.png")
> system("convert tmp/8x8zk1259931169.ps tmp/8x8zk1259931169.png")
> system("convert tmp/94i901259931169.ps tmp/94i901259931169.png")
> system("convert tmp/10mqlt1259931169.ps tmp/10mqlt1259931169.png")
>
>
> proc.time()
user system elapsed
2.409 1.557 3.647