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(1.8,0.8,2.9,1.7,-0.1,2.9,1.4,-1.5,2.9,1.2,-4.4,1.4,1,-4.2,1.1,1.7,3.5,1.9,2.4,10,2.8,2,8.6,1.4,2.1,9.5,0.7,2,9.9,-0.8,1.8,10.4,-3.1,2.7,16,0.1,2.3,12.7,1,1.9,10.2,1.9,2,8.9,-0.5,2.3,12.6,1.5,2.8,13.6,3.9,2.4,14.8,1.9,2.3,9.5,2.6,2.7,13.7,1.7,2.7,17,1.4,2.9,14.7,2.8,3,17.4,0.5,2.2,9,1,2.3,9.1,1.5,2.8,12.2,1.8,2.8,15.9,2.7,2.8,12.9,3,2.2,10.9,-0.3,2.6,10.6,1.1,2.8,13.2,1.7,2.5,9.6,1.6,2.4,6.4,3,2.3,5.8,3.3,1.9,-1,6.7,1.7,-0.2,5.6,2,2.7,6,2.1,3.6,4.8,1.7,-0.9,5.9,1.8,0.3,4.3,1.8,-1.1,3.7,1.8,-2.5,5.6,1.3,-3.4,1.7,1.3,-3.5,3.2,1.3,-3.9,3.6,1.2,-4.6,1.7,1.4,-0.1,0.5,2.2,4.3,2.1,2.9,10.2,1.5,3.1,8.7,2.7,3.5,13.3,1.4,3.6,15,1.2,4.4,20.7,2.3,4.1,20.7,1.6,5.1,26.4,4.7,5.8,31.2,3.5,5.9,31.4,4.4,5.4,26.6,3.9,5.5,26.6,3.5,4.8,19.2,3),dim=c(3,60),dimnames=list(c('totale_inflatie','inflatie_energiedragers','inflatie_onbewerkte_levensmiddelen'),1:60))
> y <- array(NA,dim=c(3,60),dimnames=list(c('totale_inflatie','inflatie_energiedragers','inflatie_onbewerkte_levensmiddelen'),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 = '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
totale_inflatie inflatie_energiedragers inflatie_onbewerkte_levensmiddelen
1 1.8 0.8 2.9
2 1.7 -0.1 2.9
3 1.4 -1.5 2.9
4 1.2 -4.4 1.4
5 1.0 -4.2 1.1
6 1.7 3.5 1.9
7 2.4 10.0 2.8
8 2.0 8.6 1.4
9 2.1 9.5 0.7
10 2.0 9.9 -0.8
11 1.8 10.4 -3.1
12 2.7 16.0 0.1
13 2.3 12.7 1.0
14 1.9 10.2 1.9
15 2.0 8.9 -0.5
16 2.3 12.6 1.5
17 2.8 13.6 3.9
18 2.4 14.8 1.9
19 2.3 9.5 2.6
20 2.7 13.7 1.7
21 2.7 17.0 1.4
22 2.9 14.7 2.8
23 3.0 17.4 0.5
24 2.2 9.0 1.0
25 2.3 9.1 1.5
26 2.8 12.2 1.8
27 2.8 15.9 2.7
28 2.8 12.9 3.0
29 2.2 10.9 -0.3
30 2.6 10.6 1.1
31 2.8 13.2 1.7
32 2.5 9.6 1.6
33 2.4 6.4 3.0
34 2.3 5.8 3.3
35 1.9 -1.0 6.7
36 1.7 -0.2 5.6
37 2.0 2.7 6.0
38 2.1 3.6 4.8
39 1.7 -0.9 5.9
40 1.8 0.3 4.3
41 1.8 -1.1 3.7
42 1.8 -2.5 5.6
43 1.3 -3.4 1.7
44 1.3 -3.5 3.2
45 1.3 -3.9 3.6
46 1.2 -4.6 1.7
47 1.4 -0.1 0.5
48 2.2 4.3 2.1
49 2.9 10.2 1.5
50 3.1 8.7 2.7
51 3.5 13.3 1.4
52 3.6 15.0 1.2
53 4.4 20.7 2.3
54 4.1 20.7 1.6
55 5.1 26.4 4.7
56 5.8 31.2 3.5
57 5.9 31.4 4.4
58 5.4 26.6 3.9
59 5.5 26.6 3.5
60 4.8 19.2 3.0
t
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
53 53
54 54
55 55
56 56
57 57
58 58
59 59
60 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) inflatie_energiedragers
0.79305 0.11030
inflatie_onbewerkte_levensmiddelen t
0.09996 0.01690
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.51970 -0.17044 -0.03533 0.11766 0.68471
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.793046 0.080992 9.792 9.75e-14 ***
inflatie_energiedragers 0.110300 0.004348 25.366 < 2e-16 ***
inflatie_onbewerkte_levensmiddelen 0.099962 0.022784 4.387 5.12e-05 ***
t 0.016905 0.002437 6.937 4.40e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2769 on 56 degrees of freedom
Multiple R-squared: 0.9473, Adjusted R-squared: 0.9444
F-statistic: 335.3 on 3 and 56 DF, p-value: < 2.2e-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.15865117 0.31730233 0.84134883
[2,] 0.12629973 0.25259946 0.87370027
[3,] 0.06988103 0.13976206 0.93011897
[4,] 0.03500585 0.07001170 0.96499415
[5,] 0.01992973 0.03985946 0.98007027
[6,] 0.05728198 0.11456395 0.94271802
[7,] 0.03011182 0.06022363 0.96988818
[8,] 0.03178858 0.06357716 0.96821142
[9,] 0.18035878 0.36071756 0.81964122
[10,] 0.13577725 0.27155449 0.86422275
[11,] 0.24767016 0.49534031 0.75232984
[12,] 0.25918070 0.51836140 0.74081930
[13,] 0.29311092 0.58622184 0.70688908
[14,] 0.41975841 0.83951681 0.58024159
[15,] 0.41644268 0.83288536 0.58355732
[16,] 0.46937496 0.93874992 0.53062504
[17,] 0.58784507 0.82430986 0.41215493
[18,] 0.52595354 0.94809291 0.47404646
[19,] 0.47893875 0.95787751 0.52106125
[20,] 0.62007094 0.75985812 0.37992906
[21,] 0.69532059 0.60935882 0.30467941
[22,] 0.63230687 0.73538625 0.36769313
[23,] 0.60435226 0.79129548 0.39564774
[24,] 0.61042255 0.77915489 0.38957745
[25,] 0.55579588 0.88840825 0.44420412
[26,] 0.48451090 0.96902181 0.51548910
[27,] 0.51159129 0.97681741 0.48840871
[28,] 0.59259289 0.81481422 0.40740711
[29,] 0.71978980 0.56042039 0.28021020
[30,] 0.76996309 0.46007383 0.23003691
[31,] 0.75498551 0.49002897 0.24501449
[32,] 0.69279653 0.61440694 0.30720347
[33,] 0.66795122 0.66409757 0.33204878
[34,] 0.59201505 0.81596991 0.40798495
[35,] 0.67931946 0.64136108 0.32068054
[36,] 0.72207114 0.55585773 0.27792886
[37,] 0.78681539 0.42636922 0.21318461
[38,] 0.73909905 0.52180191 0.26090095
[39,] 0.67608264 0.64783472 0.32391736
[40,] 0.58418992 0.83162015 0.41581008
[41,] 0.67875764 0.64248471 0.32124236
[42,] 0.70138599 0.59722802 0.29861401
[43,] 0.70815538 0.58368924 0.29184462
[44,] 0.75150848 0.49698304 0.24849152
[45,] 0.83166290 0.33667420 0.16833710
[46,] 0.80038147 0.39923706 0.19961853
[47,] 0.97273723 0.05452553 0.02726277
> postscript(file="/var/www/html/freestat/rcomp/tmp/1nz8s1229185269.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/freestat/rcomp/tmp/2yjtq1229185269.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/freestat/rcomp/tmp/3fkb41229185269.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/freestat/rcomp/tmp/4rb111229185269.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/freestat/rcomp/tmp/55y3f1229185269.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
0.611920184 0.594285108 0.431799972 0.684707316 0.475730903 0.229547437
7 8 9 10 11 12
0.105727651 -0.016811004 0.036987376 0.025905114 -0.016237718 -0.070699689
13 14 15 16 17 18
-0.213580647 -0.444701509 0.021691620 -0.303246450 -0.170359553 -0.519700833
19 20 21 22 23 24
-0.121989676 -0.112188547 -0.463094589 -0.166256314 -0.151058883 -0.091425742
25 26 27 28 29 30
-0.069341585 0.041835286 -0.473144835 -0.189138694 -0.255570053 0.020668461
31 32 33 34 35 36
-0.142993260 -0.052822481 0.043285686 -0.037427885 -0.044163693 -0.239350616
37 38 39 40 41 42
-0.316109947 -0.212330681 -0.242844137 -0.132170126 0.065321801 0.012909298
43 44 45 46 47 48
-0.014874866 -0.170692505 -0.183462230 -0.033229915 -0.226530218 -0.088693496
49 50 51 52 53 54
0.003609304 0.232200029 0.237865915 0.153443504 0.197871268 -0.049060460
55 56 57 58 59 60
-0.004556241 0.269053491 0.240122952 0.302638295 0.425718036 0.575013069
> postscript(file="/var/www/html/freestat/rcomp/tmp/6f69j1229185269.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.611920184 NA
1 0.594285108 0.611920184
2 0.431799972 0.594285108
3 0.684707316 0.431799972
4 0.475730903 0.684707316
5 0.229547437 0.475730903
6 0.105727651 0.229547437
7 -0.016811004 0.105727651
8 0.036987376 -0.016811004
9 0.025905114 0.036987376
10 -0.016237718 0.025905114
11 -0.070699689 -0.016237718
12 -0.213580647 -0.070699689
13 -0.444701509 -0.213580647
14 0.021691620 -0.444701509
15 -0.303246450 0.021691620
16 -0.170359553 -0.303246450
17 -0.519700833 -0.170359553
18 -0.121989676 -0.519700833
19 -0.112188547 -0.121989676
20 -0.463094589 -0.112188547
21 -0.166256314 -0.463094589
22 -0.151058883 -0.166256314
23 -0.091425742 -0.151058883
24 -0.069341585 -0.091425742
25 0.041835286 -0.069341585
26 -0.473144835 0.041835286
27 -0.189138694 -0.473144835
28 -0.255570053 -0.189138694
29 0.020668461 -0.255570053
30 -0.142993260 0.020668461
31 -0.052822481 -0.142993260
32 0.043285686 -0.052822481
33 -0.037427885 0.043285686
34 -0.044163693 -0.037427885
35 -0.239350616 -0.044163693
36 -0.316109947 -0.239350616
37 -0.212330681 -0.316109947
38 -0.242844137 -0.212330681
39 -0.132170126 -0.242844137
40 0.065321801 -0.132170126
41 0.012909298 0.065321801
42 -0.014874866 0.012909298
43 -0.170692505 -0.014874866
44 -0.183462230 -0.170692505
45 -0.033229915 -0.183462230
46 -0.226530218 -0.033229915
47 -0.088693496 -0.226530218
48 0.003609304 -0.088693496
49 0.232200029 0.003609304
50 0.237865915 0.232200029
51 0.153443504 0.237865915
52 0.197871268 0.153443504
53 -0.049060460 0.197871268
54 -0.004556241 -0.049060460
55 0.269053491 -0.004556241
56 0.240122952 0.269053491
57 0.302638295 0.240122952
58 0.425718036 0.302638295
59 0.575013069 0.425718036
60 NA 0.575013069
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.594285108 0.611920184
[2,] 0.431799972 0.594285108
[3,] 0.684707316 0.431799972
[4,] 0.475730903 0.684707316
[5,] 0.229547437 0.475730903
[6,] 0.105727651 0.229547437
[7,] -0.016811004 0.105727651
[8,] 0.036987376 -0.016811004
[9,] 0.025905114 0.036987376
[10,] -0.016237718 0.025905114
[11,] -0.070699689 -0.016237718
[12,] -0.213580647 -0.070699689
[13,] -0.444701509 -0.213580647
[14,] 0.021691620 -0.444701509
[15,] -0.303246450 0.021691620
[16,] -0.170359553 -0.303246450
[17,] -0.519700833 -0.170359553
[18,] -0.121989676 -0.519700833
[19,] -0.112188547 -0.121989676
[20,] -0.463094589 -0.112188547
[21,] -0.166256314 -0.463094589
[22,] -0.151058883 -0.166256314
[23,] -0.091425742 -0.151058883
[24,] -0.069341585 -0.091425742
[25,] 0.041835286 -0.069341585
[26,] -0.473144835 0.041835286
[27,] -0.189138694 -0.473144835
[28,] -0.255570053 -0.189138694
[29,] 0.020668461 -0.255570053
[30,] -0.142993260 0.020668461
[31,] -0.052822481 -0.142993260
[32,] 0.043285686 -0.052822481
[33,] -0.037427885 0.043285686
[34,] -0.044163693 -0.037427885
[35,] -0.239350616 -0.044163693
[36,] -0.316109947 -0.239350616
[37,] -0.212330681 -0.316109947
[38,] -0.242844137 -0.212330681
[39,] -0.132170126 -0.242844137
[40,] 0.065321801 -0.132170126
[41,] 0.012909298 0.065321801
[42,] -0.014874866 0.012909298
[43,] -0.170692505 -0.014874866
[44,] -0.183462230 -0.170692505
[45,] -0.033229915 -0.183462230
[46,] -0.226530218 -0.033229915
[47,] -0.088693496 -0.226530218
[48,] 0.003609304 -0.088693496
[49,] 0.232200029 0.003609304
[50,] 0.237865915 0.232200029
[51,] 0.153443504 0.237865915
[52,] 0.197871268 0.153443504
[53,] -0.049060460 0.197871268
[54,] -0.004556241 -0.049060460
[55,] 0.269053491 -0.004556241
[56,] 0.240122952 0.269053491
[57,] 0.302638295 0.240122952
[58,] 0.425718036 0.302638295
[59,] 0.575013069 0.425718036
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.594285108 0.611920184
2 0.431799972 0.594285108
3 0.684707316 0.431799972
4 0.475730903 0.684707316
5 0.229547437 0.475730903
6 0.105727651 0.229547437
7 -0.016811004 0.105727651
8 0.036987376 -0.016811004
9 0.025905114 0.036987376
10 -0.016237718 0.025905114
11 -0.070699689 -0.016237718
12 -0.213580647 -0.070699689
13 -0.444701509 -0.213580647
14 0.021691620 -0.444701509
15 -0.303246450 0.021691620
16 -0.170359553 -0.303246450
17 -0.519700833 -0.170359553
18 -0.121989676 -0.519700833
19 -0.112188547 -0.121989676
20 -0.463094589 -0.112188547
21 -0.166256314 -0.463094589
22 -0.151058883 -0.166256314
23 -0.091425742 -0.151058883
24 -0.069341585 -0.091425742
25 0.041835286 -0.069341585
26 -0.473144835 0.041835286
27 -0.189138694 -0.473144835
28 -0.255570053 -0.189138694
29 0.020668461 -0.255570053
30 -0.142993260 0.020668461
31 -0.052822481 -0.142993260
32 0.043285686 -0.052822481
33 -0.037427885 0.043285686
34 -0.044163693 -0.037427885
35 -0.239350616 -0.044163693
36 -0.316109947 -0.239350616
37 -0.212330681 -0.316109947
38 -0.242844137 -0.212330681
39 -0.132170126 -0.242844137
40 0.065321801 -0.132170126
41 0.012909298 0.065321801
42 -0.014874866 0.012909298
43 -0.170692505 -0.014874866
44 -0.183462230 -0.170692505
45 -0.033229915 -0.183462230
46 -0.226530218 -0.033229915
47 -0.088693496 -0.226530218
48 0.003609304 -0.088693496
49 0.232200029 0.003609304
50 0.237865915 0.232200029
51 0.153443504 0.237865915
52 0.197871268 0.153443504
53 -0.049060460 0.197871268
54 -0.004556241 -0.049060460
55 0.269053491 -0.004556241
56 0.240122952 0.269053491
57 0.302638295 0.240122952
58 0.425718036 0.302638295
59 0.575013069 0.425718036
> 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/freestat/rcomp/tmp/77wc91229185269.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/freestat/rcomp/tmp/89yp11229185269.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/freestat/rcomp/tmp/92xop1229185269.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/freestat/rcomp/tmp/10356z1229185269.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/118m5a1229185269.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/freestat/rcomp/tmp/12x6i31229185269.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/freestat/rcomp/tmp/130fqb1229185270.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/freestat/rcomp/tmp/14qej41229185270.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/freestat/rcomp/tmp/157wqe1229185270.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/freestat/rcomp/tmp/16w4il1229185270.tab")
+ }
>
> system("convert tmp/1nz8s1229185269.ps tmp/1nz8s1229185269.png")
> system("convert tmp/2yjtq1229185269.ps tmp/2yjtq1229185269.png")
> system("convert tmp/3fkb41229185269.ps tmp/3fkb41229185269.png")
> system("convert tmp/4rb111229185269.ps tmp/4rb111229185269.png")
> system("convert tmp/55y3f1229185269.ps tmp/55y3f1229185269.png")
> system("convert tmp/6f69j1229185269.ps tmp/6f69j1229185269.png")
> system("convert tmp/77wc91229185269.ps tmp/77wc91229185269.png")
> system("convert tmp/89yp11229185269.ps tmp/89yp11229185269.png")
> system("convert tmp/92xop1229185269.ps tmp/92xop1229185269.png")
> system("convert tmp/10356z1229185269.ps tmp/10356z1229185269.png")
>
>
> proc.time()
user system elapsed
3.796 2.620 4.297