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(569,0,580,0,578,0,565,0,547,0,555,0,562,0,561,0,555,0,544,0,537,0,543,0,594,0,611,0,613,0,611,0,594,0,595,0,591,0,589,0,584,0,573,0,567,0,569,0,621,0,629,0,628,0,612,0,595,0,597,0,593,0,590,0,580,0,574,0,573,0,573,0,620,0,626,0,620,0,588,0,566,0,557,0,561,0,549,0,532,0,526,0,511,0,499,0,555,0,565,0,542,0,527,0,510,0,514,0,517,0,508,0,493,1,490,1,469,1,478,1,528,1),dim=c(2,61),dimnames=list(c('werkloosheid_in_duizenden','dummy'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('werkloosheid_in_duizenden','dummy'),1:61))
> 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
werkloosheid_in_duizenden dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 569 0 1 0 0 0 0 0 0 0 0 0 0 1
2 580 0 0 1 0 0 0 0 0 0 0 0 0 2
3 578 0 0 0 1 0 0 0 0 0 0 0 0 3
4 565 0 0 0 0 1 0 0 0 0 0 0 0 4
5 547 0 0 0 0 0 1 0 0 0 0 0 0 5
6 555 0 0 0 0 0 0 1 0 0 0 0 0 6
7 562 0 0 0 0 0 0 0 1 0 0 0 0 7
8 561 0 0 0 0 0 0 0 0 1 0 0 0 8
9 555 0 0 0 0 0 0 0 0 0 1 0 0 9
10 544 0 0 0 0 0 0 0 0 0 0 1 0 10
11 537 0 0 0 0 0 0 0 0 0 0 0 1 11
12 543 0 0 0 0 0 0 0 0 0 0 0 0 12
13 594 0 1 0 0 0 0 0 0 0 0 0 0 13
14 611 0 0 1 0 0 0 0 0 0 0 0 0 14
15 613 0 0 0 1 0 0 0 0 0 0 0 0 15
16 611 0 0 0 0 1 0 0 0 0 0 0 0 16
17 594 0 0 0 0 0 1 0 0 0 0 0 0 17
18 595 0 0 0 0 0 0 1 0 0 0 0 0 18
19 591 0 0 0 0 0 0 0 1 0 0 0 0 19
20 589 0 0 0 0 0 0 0 0 1 0 0 0 20
21 584 0 0 0 0 0 0 0 0 0 1 0 0 21
22 573 0 0 0 0 0 0 0 0 0 0 1 0 22
23 567 0 0 0 0 0 0 0 0 0 0 0 1 23
24 569 0 0 0 0 0 0 0 0 0 0 0 0 24
25 621 0 1 0 0 0 0 0 0 0 0 0 0 25
26 629 0 0 1 0 0 0 0 0 0 0 0 0 26
27 628 0 0 0 1 0 0 0 0 0 0 0 0 27
28 612 0 0 0 0 1 0 0 0 0 0 0 0 28
29 595 0 0 0 0 0 1 0 0 0 0 0 0 29
30 597 0 0 0 0 0 0 1 0 0 0 0 0 30
31 593 0 0 0 0 0 0 0 1 0 0 0 0 31
32 590 0 0 0 0 0 0 0 0 1 0 0 0 32
33 580 0 0 0 0 0 0 0 0 0 1 0 0 33
34 574 0 0 0 0 0 0 0 0 0 0 1 0 34
35 573 0 0 0 0 0 0 0 0 0 0 0 1 35
36 573 0 0 0 0 0 0 0 0 0 0 0 0 36
37 620 0 1 0 0 0 0 0 0 0 0 0 0 37
38 626 0 0 1 0 0 0 0 0 0 0 0 0 38
39 620 0 0 0 1 0 0 0 0 0 0 0 0 39
40 588 0 0 0 0 1 0 0 0 0 0 0 0 40
41 566 0 0 0 0 0 1 0 0 0 0 0 0 41
42 557 0 0 0 0 0 0 1 0 0 0 0 0 42
43 561 0 0 0 0 0 0 0 1 0 0 0 0 43
44 549 0 0 0 0 0 0 0 0 1 0 0 0 44
45 532 0 0 0 0 0 0 0 0 0 1 0 0 45
46 526 0 0 0 0 0 0 0 0 0 0 1 0 46
47 511 0 0 0 0 0 0 0 0 0 0 0 1 47
48 499 0 0 0 0 0 0 0 0 0 0 0 0 48
49 555 0 1 0 0 0 0 0 0 0 0 0 0 49
50 565 0 0 1 0 0 0 0 0 0 0 0 0 50
51 542 0 0 0 1 0 0 0 0 0 0 0 0 51
52 527 0 0 0 0 1 0 0 0 0 0 0 0 52
53 510 0 0 0 0 0 1 0 0 0 0 0 0 53
54 514 0 0 0 0 0 0 1 0 0 0 0 0 54
55 517 0 0 0 0 0 0 0 1 0 0 0 0 55
56 508 0 0 0 0 0 0 0 0 1 0 0 0 56
57 493 1 0 0 0 0 0 0 0 0 1 0 0 57
58 490 1 0 0 0 0 0 0 0 0 0 1 0 58
59 469 1 0 0 0 0 0 0 0 0 0 0 1 59
60 478 1 0 0 0 0 0 0 0 0 0 0 0 60
61 528 1 1 0 0 0 0 0 0 0 0 0 0 61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) dummy M1 M2 M3 M4
566.6871 -47.1485 43.7426 53.4655 48.1559 33.2464
M5 M6 M7 M8 M9 M10
15.7369 17.6274 19.5179 14.8084 14.3285 7.6190
M11 t
-1.6905 -0.6905
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-40.739 -21.544 1.686 23.114 35.118
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 566.6871 14.7404 38.445 < 2e-16 ***
dummy -47.1485 15.8986 -2.966 0.00474 **
M1 43.7426 17.1686 2.548 0.01417 *
M2 53.4655 18.1409 2.947 0.00498 **
M3 48.1559 18.1309 2.656 0.01076 *
M4 33.2464 18.1240 1.834 0.07293 .
M5 15.7369 18.1202 0.868 0.38955
M6 17.6274 18.1194 0.973 0.33561
M7 19.5179 18.1217 1.077 0.28696
M8 14.8084 18.1270 0.817 0.41810
M9 14.3285 17.9127 0.800 0.42779
M10 7.6190 17.9050 0.426 0.67240
M11 -1.6905 17.9003 -0.094 0.92516
t -0.6905 0.2356 -2.930 0.00521 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 28.3 on 47 degrees of freedom
Multiple R-squared: 0.5967, Adjusted R-squared: 0.4851
F-statistic: 5.348 on 13 and 47 DF, p-value: 9.021e-06
> 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.125131008 0.250262017 0.874868992
[2,] 0.053284880 0.106569761 0.946715120
[3,] 0.032059028 0.064118057 0.967940972
[4,] 0.020324881 0.040649762 0.979675119
[5,] 0.011013372 0.022026744 0.988986628
[6,] 0.007508645 0.015017290 0.992491355
[7,] 0.004841645 0.009683290 0.995158355
[8,] 0.004583866 0.009167731 0.995416134
[9,] 0.008076955 0.016153909 0.991923045
[10,] 0.030360239 0.060720478 0.969639761
[11,] 0.054310042 0.108620084 0.945689958
[12,] 0.134557066 0.269114132 0.865442934
[13,] 0.203699225 0.407398449 0.796300775
[14,] 0.272866984 0.545733968 0.727133016
[15,] 0.548499181 0.903001637 0.451500819
[16,] 0.777483013 0.445033975 0.222516987
[17,] 0.823964564 0.352070871 0.176035436
[18,] 0.829116169 0.341767661 0.170883831
[19,] 0.794411810 0.411176379 0.205588190
[20,] 0.792821486 0.414357029 0.207178514
[21,] 0.756847080 0.486305841 0.243152920
[22,] 0.729492867 0.541014265 0.270507133
[23,] 0.947476189 0.105047621 0.052523811
[24,] 0.983242924 0.033514152 0.016757076
[25,] 0.991705075 0.016589850 0.008294925
[26,] 0.987275537 0.025448925 0.012724463
[27,] 0.971386947 0.057226105 0.028613053
[28,] 0.932240366 0.135519269 0.067759634
> postscript(file="/var/www/html/rcomp/tmp/1a29a1227112102.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/2kmj91227112102.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/3u5621227112102.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/49f3o1227112102.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/5f0sf1227112102.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 = 61
Frequency = 1
1 2 3 4 5 6
-40.7392739 -38.7716172 -34.7716172 -32.1716172 -31.9716172 -25.1716172
7 8 9 10 11 12
-19.3716172 -14.9716172 -19.8013201 -23.4013201 -20.4013201 -15.4013201
13 14 15 16 17 18
-7.4534653 0.5141914 8.5141914 22.1141914 23.3141914 23.1141914
19 20 21 22 23 24
17.9141914 21.3141914 17.4844884 13.8844884 17.8844884 18.8844884
25 26 27 28 29 30
27.8323432 26.8000000 31.8000000 31.4000000 32.6000000 33.4000000
31 32 33 34 35 36
28.2000000 30.6000000 21.7702970 23.1702970 32.1702970 31.1702970
37 38 39 40 41 42
35.1181518 32.0858086 32.0858086 15.6858086 11.8858086 1.6858086
43 44 45 46 47 48
4.4858086 -2.1141914 -17.9438944 -16.5438944 -21.5438944 -34.5438944
49 50 51 52 53 54
-21.5960396 -20.6283828 -37.6283828 -37.0283828 -35.8283828 -33.0283828
55 56 57 58 59 60
-31.2283828 -34.8283828 -1.5095710 2.8904290 -8.1095710 -0.1095710
61
6.8382838
> postscript(file="/var/www/html/rcomp/tmp/63gko1227112102.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 -40.7392739 NA
1 -38.7716172 -40.7392739
2 -34.7716172 -38.7716172
3 -32.1716172 -34.7716172
4 -31.9716172 -32.1716172
5 -25.1716172 -31.9716172
6 -19.3716172 -25.1716172
7 -14.9716172 -19.3716172
8 -19.8013201 -14.9716172
9 -23.4013201 -19.8013201
10 -20.4013201 -23.4013201
11 -15.4013201 -20.4013201
12 -7.4534653 -15.4013201
13 0.5141914 -7.4534653
14 8.5141914 0.5141914
15 22.1141914 8.5141914
16 23.3141914 22.1141914
17 23.1141914 23.3141914
18 17.9141914 23.1141914
19 21.3141914 17.9141914
20 17.4844884 21.3141914
21 13.8844884 17.4844884
22 17.8844884 13.8844884
23 18.8844884 17.8844884
24 27.8323432 18.8844884
25 26.8000000 27.8323432
26 31.8000000 26.8000000
27 31.4000000 31.8000000
28 32.6000000 31.4000000
29 33.4000000 32.6000000
30 28.2000000 33.4000000
31 30.6000000 28.2000000
32 21.7702970 30.6000000
33 23.1702970 21.7702970
34 32.1702970 23.1702970
35 31.1702970 32.1702970
36 35.1181518 31.1702970
37 32.0858086 35.1181518
38 32.0858086 32.0858086
39 15.6858086 32.0858086
40 11.8858086 15.6858086
41 1.6858086 11.8858086
42 4.4858086 1.6858086
43 -2.1141914 4.4858086
44 -17.9438944 -2.1141914
45 -16.5438944 -17.9438944
46 -21.5438944 -16.5438944
47 -34.5438944 -21.5438944
48 -21.5960396 -34.5438944
49 -20.6283828 -21.5960396
50 -37.6283828 -20.6283828
51 -37.0283828 -37.6283828
52 -35.8283828 -37.0283828
53 -33.0283828 -35.8283828
54 -31.2283828 -33.0283828
55 -34.8283828 -31.2283828
56 -1.5095710 -34.8283828
57 2.8904290 -1.5095710
58 -8.1095710 2.8904290
59 -0.1095710 -8.1095710
60 6.8382838 -0.1095710
61 NA 6.8382838
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -38.7716172 -40.7392739
[2,] -34.7716172 -38.7716172
[3,] -32.1716172 -34.7716172
[4,] -31.9716172 -32.1716172
[5,] -25.1716172 -31.9716172
[6,] -19.3716172 -25.1716172
[7,] -14.9716172 -19.3716172
[8,] -19.8013201 -14.9716172
[9,] -23.4013201 -19.8013201
[10,] -20.4013201 -23.4013201
[11,] -15.4013201 -20.4013201
[12,] -7.4534653 -15.4013201
[13,] 0.5141914 -7.4534653
[14,] 8.5141914 0.5141914
[15,] 22.1141914 8.5141914
[16,] 23.3141914 22.1141914
[17,] 23.1141914 23.3141914
[18,] 17.9141914 23.1141914
[19,] 21.3141914 17.9141914
[20,] 17.4844884 21.3141914
[21,] 13.8844884 17.4844884
[22,] 17.8844884 13.8844884
[23,] 18.8844884 17.8844884
[24,] 27.8323432 18.8844884
[25,] 26.8000000 27.8323432
[26,] 31.8000000 26.8000000
[27,] 31.4000000 31.8000000
[28,] 32.6000000 31.4000000
[29,] 33.4000000 32.6000000
[30,] 28.2000000 33.4000000
[31,] 30.6000000 28.2000000
[32,] 21.7702970 30.6000000
[33,] 23.1702970 21.7702970
[34,] 32.1702970 23.1702970
[35,] 31.1702970 32.1702970
[36,] 35.1181518 31.1702970
[37,] 32.0858086 35.1181518
[38,] 32.0858086 32.0858086
[39,] 15.6858086 32.0858086
[40,] 11.8858086 15.6858086
[41,] 1.6858086 11.8858086
[42,] 4.4858086 1.6858086
[43,] -2.1141914 4.4858086
[44,] -17.9438944 -2.1141914
[45,] -16.5438944 -17.9438944
[46,] -21.5438944 -16.5438944
[47,] -34.5438944 -21.5438944
[48,] -21.5960396 -34.5438944
[49,] -20.6283828 -21.5960396
[50,] -37.6283828 -20.6283828
[51,] -37.0283828 -37.6283828
[52,] -35.8283828 -37.0283828
[53,] -33.0283828 -35.8283828
[54,] -31.2283828 -33.0283828
[55,] -34.8283828 -31.2283828
[56,] -1.5095710 -34.8283828
[57,] 2.8904290 -1.5095710
[58,] -8.1095710 2.8904290
[59,] -0.1095710 -8.1095710
[60,] 6.8382838 -0.1095710
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -38.7716172 -40.7392739
2 -34.7716172 -38.7716172
3 -32.1716172 -34.7716172
4 -31.9716172 -32.1716172
5 -25.1716172 -31.9716172
6 -19.3716172 -25.1716172
7 -14.9716172 -19.3716172
8 -19.8013201 -14.9716172
9 -23.4013201 -19.8013201
10 -20.4013201 -23.4013201
11 -15.4013201 -20.4013201
12 -7.4534653 -15.4013201
13 0.5141914 -7.4534653
14 8.5141914 0.5141914
15 22.1141914 8.5141914
16 23.3141914 22.1141914
17 23.1141914 23.3141914
18 17.9141914 23.1141914
19 21.3141914 17.9141914
20 17.4844884 21.3141914
21 13.8844884 17.4844884
22 17.8844884 13.8844884
23 18.8844884 17.8844884
24 27.8323432 18.8844884
25 26.8000000 27.8323432
26 31.8000000 26.8000000
27 31.4000000 31.8000000
28 32.6000000 31.4000000
29 33.4000000 32.6000000
30 28.2000000 33.4000000
31 30.6000000 28.2000000
32 21.7702970 30.6000000
33 23.1702970 21.7702970
34 32.1702970 23.1702970
35 31.1702970 32.1702970
36 35.1181518 31.1702970
37 32.0858086 35.1181518
38 32.0858086 32.0858086
39 15.6858086 32.0858086
40 11.8858086 15.6858086
41 1.6858086 11.8858086
42 4.4858086 1.6858086
43 -2.1141914 4.4858086
44 -17.9438944 -2.1141914
45 -16.5438944 -17.9438944
46 -21.5438944 -16.5438944
47 -34.5438944 -21.5438944
48 -21.5960396 -34.5438944
49 -20.6283828 -21.5960396
50 -37.6283828 -20.6283828
51 -37.0283828 -37.6283828
52 -35.8283828 -37.0283828
53 -33.0283828 -35.8283828
54 -31.2283828 -33.0283828
55 -34.8283828 -31.2283828
56 -1.5095710 -34.8283828
57 2.8904290 -1.5095710
58 -8.1095710 2.8904290
59 -0.1095710 -8.1095710
60 6.8382838 -0.1095710
> 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/76t6h1227112102.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/8eqbg1227112102.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/9snc51227112102.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/103rhg1227112102.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/11b6do1227112102.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/124lur1227112102.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/13bz321227112102.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/14uo381227112102.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/15y8za1227112102.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/16r74k1227112102.tab")
+ }
>
> system("convert tmp/1a29a1227112102.ps tmp/1a29a1227112102.png")
> system("convert tmp/2kmj91227112102.ps tmp/2kmj91227112102.png")
> system("convert tmp/3u5621227112102.ps tmp/3u5621227112102.png")
> system("convert tmp/49f3o1227112102.ps tmp/49f3o1227112102.png")
> system("convert tmp/5f0sf1227112102.ps tmp/5f0sf1227112102.png")
> system("convert tmp/63gko1227112102.ps tmp/63gko1227112102.png")
> system("convert tmp/76t6h1227112102.ps tmp/76t6h1227112102.png")
> system("convert tmp/8eqbg1227112102.ps tmp/8eqbg1227112102.png")
> system("convert tmp/9snc51227112102.ps tmp/9snc51227112102.png")
> system("convert tmp/103rhg1227112102.ps tmp/103rhg1227112102.png")
>
>
> proc.time()
user system elapsed
2.423 1.581 2.963