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(123.9,0,124.9,0,112.7,0,121.9,0,100.6,0,104.3,0,120.4,0,107.5,0,102.9,0,125.6,0,107.5,0,108.8,0,128.4,0,121.1,0,119.5,0,128.7,0,108.7,0,105.5,0,119.8,0,111.3,0,110.6,0,120.1,0,97.5,0,107.7,0,127.3,0,117.2,0,119.8,0,116.2,0,111,0,112.4,0,130.6,0,109.1,0,118.8,0,123.9,0,101.6,0,112.8,0,128,0,129.6,0,125.8,0,119.5,0,115.7,0,113.6,0,129.7,0,112,0,116.8,0,127,1,112.1,1,114.2,1,121.1,1,131.6,1,125,1,120.4,1,117.7,1,117.5,1,120.6,1,127.5,1,112.3,1,124.5,1,115.2,1,105.4,1),dim=c(2,60),dimnames=list(c('Consumptieindex','Dummy'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Consumptieindex','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 = 'No 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
Consumptieindex Dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 123.9 0 1 0 0 0 0 0 0 0 0 0 0
2 124.9 0 0 1 0 0 0 0 0 0 0 0 0
3 112.7 0 0 0 1 0 0 0 0 0 0 0 0
4 121.9 0 0 0 0 1 0 0 0 0 0 0 0
5 100.6 0 0 0 0 0 1 0 0 0 0 0 0
6 104.3 0 0 0 0 0 0 1 0 0 0 0 0
7 120.4 0 0 0 0 0 0 0 1 0 0 0 0
8 107.5 0 0 0 0 0 0 0 0 1 0 0 0
9 102.9 0 0 0 0 0 0 0 0 0 1 0 0
10 125.6 0 0 0 0 0 0 0 0 0 0 1 0
11 107.5 0 0 0 0 0 0 0 0 0 0 0 1
12 108.8 0 0 0 0 0 0 0 0 0 0 0 0
13 128.4 0 1 0 0 0 0 0 0 0 0 0 0
14 121.1 0 0 1 0 0 0 0 0 0 0 0 0
15 119.5 0 0 0 1 0 0 0 0 0 0 0 0
16 128.7 0 0 0 0 1 0 0 0 0 0 0 0
17 108.7 0 0 0 0 0 1 0 0 0 0 0 0
18 105.5 0 0 0 0 0 0 1 0 0 0 0 0
19 119.8 0 0 0 0 0 0 0 1 0 0 0 0
20 111.3 0 0 0 0 0 0 0 0 1 0 0 0
21 110.6 0 0 0 0 0 0 0 0 0 1 0 0
22 120.1 0 0 0 0 0 0 0 0 0 0 1 0
23 97.5 0 0 0 0 0 0 0 0 0 0 0 1
24 107.7 0 0 0 0 0 0 0 0 0 0 0 0
25 127.3 0 1 0 0 0 0 0 0 0 0 0 0
26 117.2 0 0 1 0 0 0 0 0 0 0 0 0
27 119.8 0 0 0 1 0 0 0 0 0 0 0 0
28 116.2 0 0 0 0 1 0 0 0 0 0 0 0
29 111.0 0 0 0 0 0 1 0 0 0 0 0 0
30 112.4 0 0 0 0 0 0 1 0 0 0 0 0
31 130.6 0 0 0 0 0 0 0 1 0 0 0 0
32 109.1 0 0 0 0 0 0 0 0 1 0 0 0
33 118.8 0 0 0 0 0 0 0 0 0 1 0 0
34 123.9 0 0 0 0 0 0 0 0 0 0 1 0
35 101.6 0 0 0 0 0 0 0 0 0 0 0 1
36 112.8 0 0 0 0 0 0 0 0 0 0 0 0
37 128.0 0 1 0 0 0 0 0 0 0 0 0 0
38 129.6 0 0 1 0 0 0 0 0 0 0 0 0
39 125.8 0 0 0 1 0 0 0 0 0 0 0 0
40 119.5 0 0 0 0 1 0 0 0 0 0 0 0
41 115.7 0 0 0 0 0 1 0 0 0 0 0 0
42 113.6 0 0 0 0 0 0 1 0 0 0 0 0
43 129.7 0 0 0 0 0 0 0 1 0 0 0 0
44 112.0 0 0 0 0 0 0 0 0 1 0 0 0
45 116.8 0 0 0 0 0 0 0 0 0 1 0 0
46 127.0 1 0 0 0 0 0 0 0 0 0 1 0
47 112.1 1 0 0 0 0 0 0 0 0 0 0 1
48 114.2 1 0 0 0 0 0 0 0 0 0 0 0
49 121.1 1 1 0 0 0 0 0 0 0 0 0 0
50 131.6 1 0 1 0 0 0 0 0 0 0 0 0
51 125.0 1 0 0 1 0 0 0 0 0 0 0 0
52 120.4 1 0 0 0 1 0 0 0 0 0 0 0
53 117.7 1 0 0 0 0 1 0 0 0 0 0 0
54 117.5 1 0 0 0 0 0 1 0 0 0 0 0
55 120.6 1 0 0 0 0 0 0 1 0 0 0 0
56 127.5 1 0 0 0 0 0 0 0 1 0 0 0
57 112.3 1 0 0 0 0 0 0 0 0 1 0 0
58 124.5 1 0 0 0 0 0 0 0 0 0 1 0
59 115.2 1 0 0 0 0 0 0 0 0 0 0 1
60 105.4 1 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Dummy M1 M2 M3 M4
108.053 4.319 16.824 15.964 11.644 12.424
M5 M6 M7 M8 M9 M10
1.824 1.744 15.304 4.564 3.364 14.440
M11
-3.000
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-9.2763 -3.4685 0.1463 3.2952 10.5652
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 108.053 2.440 44.277 < 2e-16 ***
Dummy 4.319 1.602 2.695 0.009724 **
M1 16.824 3.345 5.029 7.63e-06 ***
M2 15.964 3.345 4.772 1.81e-05 ***
M3 11.644 3.345 3.480 0.001091 **
M4 12.424 3.345 3.714 0.000541 ***
M5 1.824 3.345 0.545 0.588245
M6 1.744 3.345 0.521 0.604666
M7 15.304 3.345 4.574 3.49e-05 ***
M8 4.564 3.345 1.364 0.179020
M9 3.364 3.345 1.005 0.319830
M10 14.440 3.330 4.336 7.61e-05 ***
M11 -3.000 3.330 -0.901 0.372248
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.265 on 47 degrees of freedom
Multiple R-squared: 0.6919, Adjusted R-squared: 0.6132
F-statistic: 8.794 on 12 and 47 DF, p-value: 1.820e-08
> 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.5033407 0.9933185 0.4966593
[2,] 0.5313001 0.9373997 0.4686999
[3,] 0.4106870 0.8213739 0.5893130
[4,] 0.2961621 0.5923243 0.7038379
[5,] 0.2257139 0.4514277 0.7742861
[6,] 0.2529947 0.5059894 0.7470053
[7,] 0.2172789 0.4345579 0.7827211
[8,] 0.3581879 0.7163759 0.6418121
[9,] 0.2646164 0.5292328 0.7353836
[10,] 0.1948106 0.3896212 0.8051894
[11,] 0.2810828 0.5621656 0.7189172
[12,] 0.2409781 0.4819562 0.7590219
[13,] 0.3032391 0.6064782 0.6967609
[14,] 0.3022532 0.6045063 0.6977468
[15,] 0.3007995 0.6015989 0.6992005
[16,] 0.3937757 0.7875514 0.6062243
[17,] 0.4291112 0.8582224 0.5708888
[18,] 0.5282694 0.9434612 0.4717306
[19,] 0.4287517 0.8575035 0.5712483
[20,] 0.5509627 0.8980745 0.4490373
[21,] 0.4845026 0.9690052 0.5154974
[22,] 0.4708048 0.9416096 0.5291952
[23,] 0.4312804 0.8625608 0.5687196
[24,] 0.3858382 0.7716763 0.6141618
[25,] 0.2834543 0.5669085 0.7165457
[26,] 0.2309452 0.4618903 0.7690548
[27,] 0.1656558 0.3313117 0.8343442
[28,] 0.2485531 0.4971063 0.7514469
[29,] 0.6061875 0.7876249 0.3938125
> postscript(file="/var/www/html/rcomp/tmp/1arvl1227824701.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/229231227824701.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/3s05b1227824701.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/4qm001227824701.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/5pzi81227824701.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 7
-0.9762963 0.8837037 -6.9962963 1.4237037 -9.2762963 -5.4962963 -2.9562963
8 9 10 11 12 13 14
-5.1162963 -8.5162963 3.1074074 2.4474074 0.7474074 3.5237037 -2.9162963
15 16 17 18 19 20 21
-0.1962963 8.2237037 -1.1762963 -4.2962963 -3.5562963 -1.3162963 -0.8162963
22 23 24 25 26 27 28
-2.3925926 -7.5525926 -0.3525926 2.4237037 -6.8162963 0.1037037 -4.2762963
29 30 31 32 33 34 35
1.1237037 2.6037037 7.2437037 -3.5162963 7.3837037 1.4074074 -3.4525926
36 37 38 39 40 41 42
4.7474074 3.1237037 5.5837037 6.1037037 -0.9762963 5.8237037 3.8037037
43 44 45 46 47 48 49
6.3437037 -0.6162963 5.3837037 0.1888889 2.7288889 1.8288889 -8.0948148
50 51 52 53 54 55 56
3.2651852 0.9851852 -4.3948148 3.5051852 3.3851852 -7.0748148 10.5651852
57 58 59 60
-3.4348148 -2.3111111 5.8288889 -6.9711111
> postscript(file="/var/www/html/rcomp/tmp/6swm41227824701.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 -0.9762963 NA
1 0.8837037 -0.9762963
2 -6.9962963 0.8837037
3 1.4237037 -6.9962963
4 -9.2762963 1.4237037
5 -5.4962963 -9.2762963
6 -2.9562963 -5.4962963
7 -5.1162963 -2.9562963
8 -8.5162963 -5.1162963
9 3.1074074 -8.5162963
10 2.4474074 3.1074074
11 0.7474074 2.4474074
12 3.5237037 0.7474074
13 -2.9162963 3.5237037
14 -0.1962963 -2.9162963
15 8.2237037 -0.1962963
16 -1.1762963 8.2237037
17 -4.2962963 -1.1762963
18 -3.5562963 -4.2962963
19 -1.3162963 -3.5562963
20 -0.8162963 -1.3162963
21 -2.3925926 -0.8162963
22 -7.5525926 -2.3925926
23 -0.3525926 -7.5525926
24 2.4237037 -0.3525926
25 -6.8162963 2.4237037
26 0.1037037 -6.8162963
27 -4.2762963 0.1037037
28 1.1237037 -4.2762963
29 2.6037037 1.1237037
30 7.2437037 2.6037037
31 -3.5162963 7.2437037
32 7.3837037 -3.5162963
33 1.4074074 7.3837037
34 -3.4525926 1.4074074
35 4.7474074 -3.4525926
36 3.1237037 4.7474074
37 5.5837037 3.1237037
38 6.1037037 5.5837037
39 -0.9762963 6.1037037
40 5.8237037 -0.9762963
41 3.8037037 5.8237037
42 6.3437037 3.8037037
43 -0.6162963 6.3437037
44 5.3837037 -0.6162963
45 0.1888889 5.3837037
46 2.7288889 0.1888889
47 1.8288889 2.7288889
48 -8.0948148 1.8288889
49 3.2651852 -8.0948148
50 0.9851852 3.2651852
51 -4.3948148 0.9851852
52 3.5051852 -4.3948148
53 3.3851852 3.5051852
54 -7.0748148 3.3851852
55 10.5651852 -7.0748148
56 -3.4348148 10.5651852
57 -2.3111111 -3.4348148
58 5.8288889 -2.3111111
59 -6.9711111 5.8288889
60 NA -6.9711111
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.8837037 -0.9762963
[2,] -6.9962963 0.8837037
[3,] 1.4237037 -6.9962963
[4,] -9.2762963 1.4237037
[5,] -5.4962963 -9.2762963
[6,] -2.9562963 -5.4962963
[7,] -5.1162963 -2.9562963
[8,] -8.5162963 -5.1162963
[9,] 3.1074074 -8.5162963
[10,] 2.4474074 3.1074074
[11,] 0.7474074 2.4474074
[12,] 3.5237037 0.7474074
[13,] -2.9162963 3.5237037
[14,] -0.1962963 -2.9162963
[15,] 8.2237037 -0.1962963
[16,] -1.1762963 8.2237037
[17,] -4.2962963 -1.1762963
[18,] -3.5562963 -4.2962963
[19,] -1.3162963 -3.5562963
[20,] -0.8162963 -1.3162963
[21,] -2.3925926 -0.8162963
[22,] -7.5525926 -2.3925926
[23,] -0.3525926 -7.5525926
[24,] 2.4237037 -0.3525926
[25,] -6.8162963 2.4237037
[26,] 0.1037037 -6.8162963
[27,] -4.2762963 0.1037037
[28,] 1.1237037 -4.2762963
[29,] 2.6037037 1.1237037
[30,] 7.2437037 2.6037037
[31,] -3.5162963 7.2437037
[32,] 7.3837037 -3.5162963
[33,] 1.4074074 7.3837037
[34,] -3.4525926 1.4074074
[35,] 4.7474074 -3.4525926
[36,] 3.1237037 4.7474074
[37,] 5.5837037 3.1237037
[38,] 6.1037037 5.5837037
[39,] -0.9762963 6.1037037
[40,] 5.8237037 -0.9762963
[41,] 3.8037037 5.8237037
[42,] 6.3437037 3.8037037
[43,] -0.6162963 6.3437037
[44,] 5.3837037 -0.6162963
[45,] 0.1888889 5.3837037
[46,] 2.7288889 0.1888889
[47,] 1.8288889 2.7288889
[48,] -8.0948148 1.8288889
[49,] 3.2651852 -8.0948148
[50,] 0.9851852 3.2651852
[51,] -4.3948148 0.9851852
[52,] 3.5051852 -4.3948148
[53,] 3.3851852 3.5051852
[54,] -7.0748148 3.3851852
[55,] 10.5651852 -7.0748148
[56,] -3.4348148 10.5651852
[57,] -2.3111111 -3.4348148
[58,] 5.8288889 -2.3111111
[59,] -6.9711111 5.8288889
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.8837037 -0.9762963
2 -6.9962963 0.8837037
3 1.4237037 -6.9962963
4 -9.2762963 1.4237037
5 -5.4962963 -9.2762963
6 -2.9562963 -5.4962963
7 -5.1162963 -2.9562963
8 -8.5162963 -5.1162963
9 3.1074074 -8.5162963
10 2.4474074 3.1074074
11 0.7474074 2.4474074
12 3.5237037 0.7474074
13 -2.9162963 3.5237037
14 -0.1962963 -2.9162963
15 8.2237037 -0.1962963
16 -1.1762963 8.2237037
17 -4.2962963 -1.1762963
18 -3.5562963 -4.2962963
19 -1.3162963 -3.5562963
20 -0.8162963 -1.3162963
21 -2.3925926 -0.8162963
22 -7.5525926 -2.3925926
23 -0.3525926 -7.5525926
24 2.4237037 -0.3525926
25 -6.8162963 2.4237037
26 0.1037037 -6.8162963
27 -4.2762963 0.1037037
28 1.1237037 -4.2762963
29 2.6037037 1.1237037
30 7.2437037 2.6037037
31 -3.5162963 7.2437037
32 7.3837037 -3.5162963
33 1.4074074 7.3837037
34 -3.4525926 1.4074074
35 4.7474074 -3.4525926
36 3.1237037 4.7474074
37 5.5837037 3.1237037
38 6.1037037 5.5837037
39 -0.9762963 6.1037037
40 5.8237037 -0.9762963
41 3.8037037 5.8237037
42 6.3437037 3.8037037
43 -0.6162963 6.3437037
44 5.3837037 -0.6162963
45 0.1888889 5.3837037
46 2.7288889 0.1888889
47 1.8288889 2.7288889
48 -8.0948148 1.8288889
49 3.2651852 -8.0948148
50 0.9851852 3.2651852
51 -4.3948148 0.9851852
52 3.5051852 -4.3948148
53 3.3851852 3.5051852
54 -7.0748148 3.3851852
55 10.5651852 -7.0748148
56 -3.4348148 10.5651852
57 -2.3111111 -3.4348148
58 5.8288889 -2.3111111
59 -6.9711111 5.8288889
> 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/7zwm31227824701.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/8hen51227824701.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/9vdsb1227824701.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/10ah6k1227824701.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/117j0a1227824701.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/12f5bf1227824701.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/13medu1227824701.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/14fzie1227824701.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/15yrrj1227824701.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/16xvh91227824702.tab")
+ }
>
> system("convert tmp/1arvl1227824701.ps tmp/1arvl1227824701.png")
> system("convert tmp/229231227824701.ps tmp/229231227824701.png")
> system("convert tmp/3s05b1227824701.ps tmp/3s05b1227824701.png")
> system("convert tmp/4qm001227824701.ps tmp/4qm001227824701.png")
> system("convert tmp/5pzi81227824701.ps tmp/5pzi81227824701.png")
> system("convert tmp/6swm41227824701.ps tmp/6swm41227824701.png")
> system("convert tmp/7zwm31227824701.ps tmp/7zwm31227824701.png")
> system("convert tmp/8hen51227824701.ps tmp/8hen51227824701.png")
> system("convert tmp/9vdsb1227824701.ps tmp/9vdsb1227824701.png")
> system("convert tmp/10ah6k1227824701.ps tmp/10ah6k1227824701.png")
>
>
> proc.time()
user system elapsed
2.488 1.608 2.983