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(17823.2,0,17872,0,17420.4,0,16704.4,0,15991.2,0,16583.6,0,19123.5,0,17838.7,0,17209.4,0,18586.5,0,16258.1,0,15141.6,0,19202.1,0,17746.5,0,19090.1,0,18040.3,0,17515.5,0,17751.8,0,21072.4,0,17170,0,19439.5,0,19795.4,0,17574.9,0,16165.4,0,19464.6,0,19932.1,0,19961.2,0,17343.4,0,18924.2,0,18574.1,0,21350.6,0,18594.6,0,19823.1,0,20844.4,0,19640.2,0,17735.4,0,19813.6,0,22160,0,20664.3,0,17877.4,0,20906.5,0,21164.1,0,21374.4,0,22952.3,0,21343.5,0,23899.3,0,22392.9,0,18274.1,0,22786.7,0,22321.5,0,17842.2,1,16373.5,1,15993.8,1,16446.1,1,17729,1,16643,1,16196.7,1,18252.1,1,17570.4,1,15836.8,1),dim=c(2,60),dimnames=list(c('uitvoer','dummy'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('uitvoer','dummy'),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 dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 17823.2 0 1 0 0 0 0 0 0 0 0 0 0 1
2 17872.0 0 0 1 0 0 0 0 0 0 0 0 0 2
3 17420.4 0 0 0 1 0 0 0 0 0 0 0 0 3
4 16704.4 0 0 0 0 1 0 0 0 0 0 0 0 4
5 15991.2 0 0 0 0 0 1 0 0 0 0 0 0 5
6 16583.6 0 0 0 0 0 0 1 0 0 0 0 0 6
7 19123.5 0 0 0 0 0 0 0 1 0 0 0 0 7
8 17838.7 0 0 0 0 0 0 0 0 1 0 0 0 8
9 17209.4 0 0 0 0 0 0 0 0 0 1 0 0 9
10 18586.5 0 0 0 0 0 0 0 0 0 0 1 0 10
11 16258.1 0 0 0 0 0 0 0 0 0 0 0 1 11
12 15141.6 0 0 0 0 0 0 0 0 0 0 0 0 12
13 19202.1 0 1 0 0 0 0 0 0 0 0 0 0 13
14 17746.5 0 0 1 0 0 0 0 0 0 0 0 0 14
15 19090.1 0 0 0 1 0 0 0 0 0 0 0 0 15
16 18040.3 0 0 0 0 1 0 0 0 0 0 0 0 16
17 17515.5 0 0 0 0 0 1 0 0 0 0 0 0 17
18 17751.8 0 0 0 0 0 0 1 0 0 0 0 0 18
19 21072.4 0 0 0 0 0 0 0 1 0 0 0 0 19
20 17170.0 0 0 0 0 0 0 0 0 1 0 0 0 20
21 19439.5 0 0 0 0 0 0 0 0 0 1 0 0 21
22 19795.4 0 0 0 0 0 0 0 0 0 0 1 0 22
23 17574.9 0 0 0 0 0 0 0 0 0 0 0 1 23
24 16165.4 0 0 0 0 0 0 0 0 0 0 0 0 24
25 19464.6 0 1 0 0 0 0 0 0 0 0 0 0 25
26 19932.1 0 0 1 0 0 0 0 0 0 0 0 0 26
27 19961.2 0 0 0 1 0 0 0 0 0 0 0 0 27
28 17343.4 0 0 0 0 1 0 0 0 0 0 0 0 28
29 18924.2 0 0 0 0 0 1 0 0 0 0 0 0 29
30 18574.1 0 0 0 0 0 0 1 0 0 0 0 0 30
31 21350.6 0 0 0 0 0 0 0 1 0 0 0 0 31
32 18594.6 0 0 0 0 0 0 0 0 1 0 0 0 32
33 19823.1 0 0 0 0 0 0 0 0 0 1 0 0 33
34 20844.4 0 0 0 0 0 0 0 0 0 0 1 0 34
35 19640.2 0 0 0 0 0 0 0 0 0 0 0 1 35
36 17735.4 0 0 0 0 0 0 0 0 0 0 0 0 36
37 19813.6 0 1 0 0 0 0 0 0 0 0 0 0 37
38 22160.0 0 0 1 0 0 0 0 0 0 0 0 0 38
39 20664.3 0 0 0 1 0 0 0 0 0 0 0 0 39
40 17877.4 0 0 0 0 1 0 0 0 0 0 0 0 40
41 20906.5 0 0 0 0 0 1 0 0 0 0 0 0 41
42 21164.1 0 0 0 0 0 0 1 0 0 0 0 0 42
43 21374.4 0 0 0 0 0 0 0 1 0 0 0 0 43
44 22952.3 0 0 0 0 0 0 0 0 1 0 0 0 44
45 21343.5 0 0 0 0 0 0 0 0 0 1 0 0 45
46 23899.3 0 0 0 0 0 0 0 0 0 0 1 0 46
47 22392.9 0 0 0 0 0 0 0 0 0 0 0 1 47
48 18274.1 0 0 0 0 0 0 0 0 0 0 0 0 48
49 22786.7 0 1 0 0 0 0 0 0 0 0 0 0 49
50 22321.5 0 0 1 0 0 0 0 0 0 0 0 0 50
51 17842.2 1 0 0 1 0 0 0 0 0 0 0 0 51
52 16373.5 1 0 0 0 1 0 0 0 0 0 0 0 52
53 15993.8 1 0 0 0 0 1 0 0 0 0 0 0 53
54 16446.1 1 0 0 0 0 0 1 0 0 0 0 0 54
55 17729.0 1 0 0 0 0 0 0 1 0 0 0 0 55
56 16643.0 1 0 0 0 0 0 0 0 1 0 0 0 56
57 16196.7 1 0 0 0 0 0 0 0 0 1 0 0 57
58 18252.1 1 0 0 0 0 0 0 0 0 0 1 0 58
59 17570.4 1 0 0 0 0 0 0 0 0 0 0 1 59
60 15836.8 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) dummy M1 M2 M3 M4
13885.5 -5222.5 3300.8 3383.9 3312.4 1479.3
M5 M6 M7 M8 M9 M10
1972.5 2104.9 4025.7 2430.1 2487.6 3855.4
M11 t
2161.9 105.3
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1698.14 -413.73 -76.63 532.38 2004.84
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13885.478 459.748 30.202 < 2e-16 ***
dummy -5222.531 392.313 -13.312 < 2e-16 ***
M1 3300.834 540.990 6.101 2.04e-07 ***
M2 3383.945 540.397 6.262 1.17e-07 ***
M3 3312.402 541.358 6.119 1.92e-07 ***
M4 1479.293 540.238 2.738 0.008756 **
M5 1972.464 539.248 3.658 0.000652 ***
M6 2104.895 538.389 3.910 0.000302 ***
M7 4025.666 537.660 7.487 1.70e-09 ***
M8 2430.136 537.063 4.525 4.24e-05 ***
M9 2487.587 536.599 4.636 2.95e-05 ***
M10 3855.418 536.267 7.189 4.74e-09 ***
M11 2161.909 536.068 4.033 0.000206 ***
t 105.269 8.441 12.471 2.32e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 847.5 on 46 degrees of freedom
Multiple R-squared: 0.8696, Adjusted R-squared: 0.8328
F-statistic: 23.6 on 13 and 46 DF, p-value: 4.712e-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.263978227 0.527956454 0.7360218
[2,] 0.130170854 0.260341709 0.8698291
[3,] 0.120962216 0.241924432 0.8790378
[4,] 0.307166303 0.614332606 0.6928337
[5,] 0.343955574 0.687911149 0.6560444
[6,] 0.236692949 0.473385897 0.7633071
[7,] 0.167070463 0.334140927 0.8329295
[8,] 0.104590271 0.209180542 0.8954097
[9,] 0.085558269 0.171116539 0.9144417
[10,] 0.057102360 0.114204720 0.9428976
[11,] 0.032489343 0.064978685 0.9675107
[12,] 0.066664048 0.133328097 0.9333360
[13,] 0.047066961 0.094133922 0.9529330
[14,] 0.027964041 0.055928083 0.9720360
[15,] 0.024908334 0.049816668 0.9750917
[16,] 0.022448906 0.044897812 0.9775511
[17,] 0.013667437 0.027334875 0.9863326
[18,] 0.007406071 0.014812142 0.9925939
[19,] 0.009034119 0.018068238 0.9909659
[20,] 0.004901642 0.009803285 0.9950984
[21,] 0.010779162 0.021558324 0.9892208
[22,] 0.014181804 0.028363608 0.9858182
[23,] 0.011886029 0.023772059 0.9881140
[24,] 0.138737756 0.277475512 0.8612622
[25,] 0.111307124 0.222614247 0.8886929
[26,] 0.079021168 0.158042336 0.9209788
[27,] 0.070990840 0.141981679 0.9290092
> postscript(file="/var/www/html/rcomp/tmp/18qsm1258560636.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/2l3cq1258560636.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/3q4kl1258560636.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/4vr1m1258560636.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/5gh2n1258560636.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
531.618571 392.038571 -93.287571 918.552429 -393.087571 -38.387571
7 8 9 10 11 12
475.472429 680.932429 -111.087571 -207.087571 -947.247571 -7.107571
13 14 15 16 17 18
647.289286 -996.690714 313.183143 991.223143 -132.016857 -133.416857
19 20 21 22 23 24
1161.143143 -1250.996857 855.783143 -261.416857 -893.676857 -246.536857
25 26 27 28 29 30
-353.440000 -74.320000 -78.946143 -968.906143 13.453857 -574.346143
31 32 33 34 35 36
176.113857 -1089.626143 -23.846143 -475.646143 -91.606143 60.233857
37 38 39 40 41 42
-1267.669286 890.350714 -639.075429 -1698.135429 732.524571 752.424571
43 44 45 46 47 48
-1063.315429 2004.844571 233.324571 1316.024571 1397.864571 -664.295429
49 50 51 52 53 54
442.201429 -211.378571 498.126000 757.266000 -220.874000 -6.274000
55 56 57 58 59 60
-749.414000 -345.154000 -954.174000 -371.874000 534.666000 857.706000
> postscript(file="/var/www/html/rcomp/tmp/6oj4j1258560636.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 531.618571 NA
1 392.038571 531.618571
2 -93.287571 392.038571
3 918.552429 -93.287571
4 -393.087571 918.552429
5 -38.387571 -393.087571
6 475.472429 -38.387571
7 680.932429 475.472429
8 -111.087571 680.932429
9 -207.087571 -111.087571
10 -947.247571 -207.087571
11 -7.107571 -947.247571
12 647.289286 -7.107571
13 -996.690714 647.289286
14 313.183143 -996.690714
15 991.223143 313.183143
16 -132.016857 991.223143
17 -133.416857 -132.016857
18 1161.143143 -133.416857
19 -1250.996857 1161.143143
20 855.783143 -1250.996857
21 -261.416857 855.783143
22 -893.676857 -261.416857
23 -246.536857 -893.676857
24 -353.440000 -246.536857
25 -74.320000 -353.440000
26 -78.946143 -74.320000
27 -968.906143 -78.946143
28 13.453857 -968.906143
29 -574.346143 13.453857
30 176.113857 -574.346143
31 -1089.626143 176.113857
32 -23.846143 -1089.626143
33 -475.646143 -23.846143
34 -91.606143 -475.646143
35 60.233857 -91.606143
36 -1267.669286 60.233857
37 890.350714 -1267.669286
38 -639.075429 890.350714
39 -1698.135429 -639.075429
40 732.524571 -1698.135429
41 752.424571 732.524571
42 -1063.315429 752.424571
43 2004.844571 -1063.315429
44 233.324571 2004.844571
45 1316.024571 233.324571
46 1397.864571 1316.024571
47 -664.295429 1397.864571
48 442.201429 -664.295429
49 -211.378571 442.201429
50 498.126000 -211.378571
51 757.266000 498.126000
52 -220.874000 757.266000
53 -6.274000 -220.874000
54 -749.414000 -6.274000
55 -345.154000 -749.414000
56 -954.174000 -345.154000
57 -371.874000 -954.174000
58 534.666000 -371.874000
59 857.706000 534.666000
60 NA 857.706000
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 392.038571 531.618571
[2,] -93.287571 392.038571
[3,] 918.552429 -93.287571
[4,] -393.087571 918.552429
[5,] -38.387571 -393.087571
[6,] 475.472429 -38.387571
[7,] 680.932429 475.472429
[8,] -111.087571 680.932429
[9,] -207.087571 -111.087571
[10,] -947.247571 -207.087571
[11,] -7.107571 -947.247571
[12,] 647.289286 -7.107571
[13,] -996.690714 647.289286
[14,] 313.183143 -996.690714
[15,] 991.223143 313.183143
[16,] -132.016857 991.223143
[17,] -133.416857 -132.016857
[18,] 1161.143143 -133.416857
[19,] -1250.996857 1161.143143
[20,] 855.783143 -1250.996857
[21,] -261.416857 855.783143
[22,] -893.676857 -261.416857
[23,] -246.536857 -893.676857
[24,] -353.440000 -246.536857
[25,] -74.320000 -353.440000
[26,] -78.946143 -74.320000
[27,] -968.906143 -78.946143
[28,] 13.453857 -968.906143
[29,] -574.346143 13.453857
[30,] 176.113857 -574.346143
[31,] -1089.626143 176.113857
[32,] -23.846143 -1089.626143
[33,] -475.646143 -23.846143
[34,] -91.606143 -475.646143
[35,] 60.233857 -91.606143
[36,] -1267.669286 60.233857
[37,] 890.350714 -1267.669286
[38,] -639.075429 890.350714
[39,] -1698.135429 -639.075429
[40,] 732.524571 -1698.135429
[41,] 752.424571 732.524571
[42,] -1063.315429 752.424571
[43,] 2004.844571 -1063.315429
[44,] 233.324571 2004.844571
[45,] 1316.024571 233.324571
[46,] 1397.864571 1316.024571
[47,] -664.295429 1397.864571
[48,] 442.201429 -664.295429
[49,] -211.378571 442.201429
[50,] 498.126000 -211.378571
[51,] 757.266000 498.126000
[52,] -220.874000 757.266000
[53,] -6.274000 -220.874000
[54,] -749.414000 -6.274000
[55,] -345.154000 -749.414000
[56,] -954.174000 -345.154000
[57,] -371.874000 -954.174000
[58,] 534.666000 -371.874000
[59,] 857.706000 534.666000
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 392.038571 531.618571
2 -93.287571 392.038571
3 918.552429 -93.287571
4 -393.087571 918.552429
5 -38.387571 -393.087571
6 475.472429 -38.387571
7 680.932429 475.472429
8 -111.087571 680.932429
9 -207.087571 -111.087571
10 -947.247571 -207.087571
11 -7.107571 -947.247571
12 647.289286 -7.107571
13 -996.690714 647.289286
14 313.183143 -996.690714
15 991.223143 313.183143
16 -132.016857 991.223143
17 -133.416857 -132.016857
18 1161.143143 -133.416857
19 -1250.996857 1161.143143
20 855.783143 -1250.996857
21 -261.416857 855.783143
22 -893.676857 -261.416857
23 -246.536857 -893.676857
24 -353.440000 -246.536857
25 -74.320000 -353.440000
26 -78.946143 -74.320000
27 -968.906143 -78.946143
28 13.453857 -968.906143
29 -574.346143 13.453857
30 176.113857 -574.346143
31 -1089.626143 176.113857
32 -23.846143 -1089.626143
33 -475.646143 -23.846143
34 -91.606143 -475.646143
35 60.233857 -91.606143
36 -1267.669286 60.233857
37 890.350714 -1267.669286
38 -639.075429 890.350714
39 -1698.135429 -639.075429
40 732.524571 -1698.135429
41 752.424571 732.524571
42 -1063.315429 752.424571
43 2004.844571 -1063.315429
44 233.324571 2004.844571
45 1316.024571 233.324571
46 1397.864571 1316.024571
47 -664.295429 1397.864571
48 442.201429 -664.295429
49 -211.378571 442.201429
50 498.126000 -211.378571
51 757.266000 498.126000
52 -220.874000 757.266000
53 -6.274000 -220.874000
54 -749.414000 -6.274000
55 -345.154000 -749.414000
56 -954.174000 -345.154000
57 -371.874000 -954.174000
58 534.666000 -371.874000
59 857.706000 534.666000
> 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/7g5u11258560636.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/8j1em1258560636.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/94ndf1258560636.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/10c2lk1258560636.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/11mmkg1258560636.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/12gso11258560636.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/138ol31258560636.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/14msre1258560636.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/15w9o01258560636.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/16stgu1258560636.tab")
+ }
>
> system("convert tmp/18qsm1258560636.ps tmp/18qsm1258560636.png")
> system("convert tmp/2l3cq1258560636.ps tmp/2l3cq1258560636.png")
> system("convert tmp/3q4kl1258560636.ps tmp/3q4kl1258560636.png")
> system("convert tmp/4vr1m1258560636.ps tmp/4vr1m1258560636.png")
> system("convert tmp/5gh2n1258560636.ps tmp/5gh2n1258560636.png")
> system("convert tmp/6oj4j1258560636.ps tmp/6oj4j1258560636.png")
> system("convert tmp/7g5u11258560636.ps tmp/7g5u11258560636.png")
> system("convert tmp/8j1em1258560636.ps tmp/8j1em1258560636.png")
> system("convert tmp/94ndf1258560636.ps tmp/94ndf1258560636.png")
> system("convert tmp/10c2lk1258560636.ps tmp/10c2lk1258560636.png")
>
>
> proc.time()
user system elapsed
2.420 1.572 2.798