R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(-5,-6,33,5,15,-1,-3,24,6,17,-2,-4,24,6,13,-5,-7,31,5,12,-4,-7,25,5,13,-6,-7,28,3,10,-2,-3,24,5,14,-2,0,25,5,13,-2,-5,16,5,10,-2,-3,17,3,11,2,3,11,6,12,1,2,12,6,7,-8,-7,39,4,11,-1,-1,19,6,9,1,0,14,5,13,-1,-3,15,4,12,2,4,7,5,5,2,2,12,5,13,1,3,12,4,11,-1,0,14,3,8,-2,-10,9,2,8,-2,-10,8,3,8,-1,-9,4,2,8,-8,-22,7,-1,0,-4,-16,3,0,3,-6,-18,5,-2,0,-3,-14,0,1,-1,-3,-12,-2,-2,-1,-7,-17,6,-2,-4,-9,-23,11,-2,1,-11,-28,9,-6,-1,-13,-31,17,-4,0,-11,-21,21,-2,-1,-9,-19,21,0,6,-17,-22,41,-5,0,-22,-22,57,-4,-3,-25,-25,65,-5,-3,-20,-16,68,-1,4,-24,-22,73,-2,1,-24,-21,71,-4,0,-22,-10,71,-1,-4,-19,-7,70,1,-2,-18,-5,69,1,3,-17,-4,65,-2,2,-11,7,57,1,5,-11,6,57,1,6,-12,3,57,3,6,-10,10,55,3,3,-15,0,65,1,4,-15,-2,65,1,7,-15,-1,64,0,5,-13,2,60,2,6,-8,8,43,2,1,-13,-6,47,-1,3,-9,-4,40,1,6,-7,4,31,0,0,-4,7,27,1,3,-4,3,24,1,4,-2,3,23,3,7,0,8,17,2,6),dim=c(5,60),dimnames=list(c('CVI','EconSit','Werkloos','FinSit','Sparen
'),1:60))
> y <- array(NA,dim=c(5,60),dimnames=list(c('CVI','EconSit','Werkloos','FinSit','Sparen
'),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 = '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
> 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
CVI EconSit Werkloos FinSit Sparen\r
1 -5 -6 33 5 15
2 -1 -3 24 6 17
3 -2 -4 24 6 13
4 -5 -7 31 5 12
5 -4 -7 25 5 13
6 -6 -7 28 3 10
7 -2 -3 24 5 14
8 -2 0 25 5 13
9 -2 -5 16 5 10
10 -2 -3 17 3 11
11 2 3 11 6 12
12 1 2 12 6 7
13 -8 -7 39 4 11
14 -1 -1 19 6 9
15 1 0 14 5 13
16 -1 -3 15 4 12
17 2 4 7 5 5
18 2 2 12 5 13
19 1 3 12 4 11
20 -1 0 14 3 8
21 -2 -10 9 2 8
22 -2 -10 8 3 8
23 -1 -9 4 2 8
24 -8 -22 7 -1 0
25 -4 -16 3 0 3
26 -6 -18 5 -2 0
27 -3 -14 0 1 -1
28 -3 -12 -2 -2 -1
29 -7 -17 6 -2 -4
30 -9 -23 11 -2 1
31 -11 -28 9 -6 -1
32 -13 -31 17 -4 0
33 -11 -21 21 -2 -1
34 -9 -19 21 0 6
35 -17 -22 41 -5 0
36 -22 -22 57 -4 -3
37 -25 -25 65 -5 -3
38 -20 -16 68 -1 4
39 -24 -22 73 -2 1
40 -24 -21 71 -4 0
41 -22 -10 71 -1 -4
42 -19 -7 70 1 -2
43 -18 -5 69 1 3
44 -17 -4 65 -2 2
45 -11 7 57 1 5
46 -11 6 57 1 6
47 -12 3 57 3 6
48 -10 10 55 3 3
49 -15 0 65 1 4
50 -15 -2 65 1 7
51 -15 -1 64 0 5
52 -13 2 60 2 6
53 -8 8 43 2 1
54 -13 -6 47 -1 3
55 -9 -4 40 1 6
56 -7 4 31 0 0
57 -4 7 27 1 3
58 -4 3 24 1 4
59 -2 3 23 3 7
60 0 8 17 2 6
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) EconSit Werkloos FinSit `Sparen\r`
0.1301 0.2529 -0.2529 0.2681 0.2248
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.62808 -0.30191 0.03917 0.21078 0.54920
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.130074 0.117933 1.103 0.275
EconSit 0.252863 0.006310 40.075 < 2e-16 ***
Werkloos -0.252879 0.001989 -127.139 < 2e-16 ***
FinSit 0.268136 0.033069 8.108 5.81e-11 ***
`Sparen\r` 0.224849 0.015009 14.981 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.311 on 55 degrees of freedom
Multiple R-squared: 0.9984, Adjusted R-squared: 0.9983
F-statistic: 8472 on 4 and 55 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.5498611 0.90027778 0.450138889
[2,] 0.4557714 0.91154272 0.544228641
[3,] 0.4532158 0.90643168 0.546784159
[4,] 0.4322690 0.86453791 0.567731046
[5,] 0.4174309 0.83486189 0.582569055
[6,] 0.3900847 0.78016950 0.609915251
[7,] 0.3219472 0.64389444 0.678052778
[8,] 0.3369539 0.67390778 0.663046111
[9,] 0.2638726 0.52774518 0.736127408
[10,] 0.2399438 0.47988753 0.760056235
[11,] 0.2077064 0.41541285 0.792293577
[12,] 0.1894367 0.37887350 0.810563251
[13,] 0.1581862 0.31637244 0.841813779
[14,] 0.3915215 0.78304301 0.608478493
[15,] 0.3426751 0.68535018 0.657324911
[16,] 0.2809479 0.56189587 0.719052064
[17,] 0.3181970 0.63639404 0.681802978
[18,] 0.3036032 0.60720635 0.696396824
[19,] 0.3896283 0.77925654 0.610371732
[20,] 0.3995462 0.79909245 0.600453776
[21,] 0.3825016 0.76500328 0.617498360
[22,] 0.3281011 0.65620229 0.671898855
[23,] 0.2848027 0.56960537 0.715197313
[24,] 0.2463744 0.49274872 0.753625642
[25,] 0.1889990 0.37799804 0.811000978
[26,] 0.1695231 0.33904626 0.830476870
[27,] 0.2330830 0.46616605 0.766916974
[28,] 0.1778816 0.35576314 0.822118429
[29,] 0.2356515 0.47130299 0.764348506
[30,] 0.2887416 0.57748310 0.711258448
[31,] 0.3450228 0.69004560 0.654977198
[32,] 0.2755670 0.55113398 0.724433010
[33,] 0.2167401 0.43348015 0.783259923
[34,] 0.3113383 0.62267662 0.688661690
[35,] 0.6916613 0.61667742 0.308338709
[36,] 0.6331646 0.73367086 0.366835432
[37,] 0.7030637 0.59387251 0.296936256
[38,] 0.6204666 0.75906674 0.379533371
[39,] 0.5313272 0.93734561 0.468672805
[40,] 0.8646941 0.27061177 0.135305886
[41,] 0.7975582 0.40488353 0.202441764
[42,] 0.7739371 0.45212586 0.226062928
[43,] 0.6622514 0.67549728 0.337748640
[44,] 0.8994095 0.20118110 0.100590549
[45,] 0.9931492 0.01370165 0.006850823
> postscript(file="/var/www/rcomp/tmp/1cjzu1293004438.ps",horizontal=F,onefile=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/rcomp/tmp/2cjzu1293004438.ps",horizontal=F,onefile=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/rcomp/tmp/3cjzu1293004438.ps",horizontal=F,onefile=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/rcomp/tmp/45agx1293004438.ps",horizontal=F,onefile=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/rcomp/tmp/55agx1293004438.ps",horizontal=F,onefile=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
0.0186890152 0.2663601272 0.4186175503 0.4403407046 -0.3017792823
6 7 8 9 10
-0.3323265275 0.2090415705 -0.0718202414 -0.4088665183 -0.3502913074
11 12 13 14 15
-0.4139961241 0.2159884696 -0.0436465604 0.2950301805 0.1465155626
16 17 18 19 20
-0.3490326628 0.1637025010 0.1350324477 -0.3999977103 -0.1929701580
21 22 23 24 25
0.3394025889 -0.1816115960 -0.1778532216 -0.5288028849 -0.0001765463
26 27 28 29 30
0.2221236335 0.3667205829 0.1596443329 0.1215336317 -0.2211386233
31 32 33 34 35
0.0596589219 0.0801565601 0.2516182356 -0.3643192467 0.1416107528
36 37 38 39 40
-0.4059220346 -0.3561689244 0.4802170808 0.2044693055 0.2069690353
41 42 43 44 45
-0.4795363363 0.5230276602 -0.3598199276 0.4050582972 0.1215841687
46 47 48 49 50
0.1495985556 -0.6280837052 -0.2293359691 0.1395022412 -0.0293175922
51 52 53 54 55
0.1827736865 -0.3484493996 -0.0403199039 -0.1340140823 0.3792929215
56 57 58 59 60
-0.3022908361 -0.0150755150 0.0128921645 0.5491965363 0.2605944147
> postscript(file="/var/www/rcomp/tmp/65agx1293004438.ps",horizontal=F,onefile=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.0186890152 NA
1 0.2663601272 0.0186890152
2 0.4186175503 0.2663601272
3 0.4403407046 0.4186175503
4 -0.3017792823 0.4403407046
5 -0.3323265275 -0.3017792823
6 0.2090415705 -0.3323265275
7 -0.0718202414 0.2090415705
8 -0.4088665183 -0.0718202414
9 -0.3502913074 -0.4088665183
10 -0.4139961241 -0.3502913074
11 0.2159884696 -0.4139961241
12 -0.0436465604 0.2159884696
13 0.2950301805 -0.0436465604
14 0.1465155626 0.2950301805
15 -0.3490326628 0.1465155626
16 0.1637025010 -0.3490326628
17 0.1350324477 0.1637025010
18 -0.3999977103 0.1350324477
19 -0.1929701580 -0.3999977103
20 0.3394025889 -0.1929701580
21 -0.1816115960 0.3394025889
22 -0.1778532216 -0.1816115960
23 -0.5288028849 -0.1778532216
24 -0.0001765463 -0.5288028849
25 0.2221236335 -0.0001765463
26 0.3667205829 0.2221236335
27 0.1596443329 0.3667205829
28 0.1215336317 0.1596443329
29 -0.2211386233 0.1215336317
30 0.0596589219 -0.2211386233
31 0.0801565601 0.0596589219
32 0.2516182356 0.0801565601
33 -0.3643192467 0.2516182356
34 0.1416107528 -0.3643192467
35 -0.4059220346 0.1416107528
36 -0.3561689244 -0.4059220346
37 0.4802170808 -0.3561689244
38 0.2044693055 0.4802170808
39 0.2069690353 0.2044693055
40 -0.4795363363 0.2069690353
41 0.5230276602 -0.4795363363
42 -0.3598199276 0.5230276602
43 0.4050582972 -0.3598199276
44 0.1215841687 0.4050582972
45 0.1495985556 0.1215841687
46 -0.6280837052 0.1495985556
47 -0.2293359691 -0.6280837052
48 0.1395022412 -0.2293359691
49 -0.0293175922 0.1395022412
50 0.1827736865 -0.0293175922
51 -0.3484493996 0.1827736865
52 -0.0403199039 -0.3484493996
53 -0.1340140823 -0.0403199039
54 0.3792929215 -0.1340140823
55 -0.3022908361 0.3792929215
56 -0.0150755150 -0.3022908361
57 0.0128921645 -0.0150755150
58 0.5491965363 0.0128921645
59 0.2605944147 0.5491965363
60 NA 0.2605944147
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.2663601272 0.0186890152
[2,] 0.4186175503 0.2663601272
[3,] 0.4403407046 0.4186175503
[4,] -0.3017792823 0.4403407046
[5,] -0.3323265275 -0.3017792823
[6,] 0.2090415705 -0.3323265275
[7,] -0.0718202414 0.2090415705
[8,] -0.4088665183 -0.0718202414
[9,] -0.3502913074 -0.4088665183
[10,] -0.4139961241 -0.3502913074
[11,] 0.2159884696 -0.4139961241
[12,] -0.0436465604 0.2159884696
[13,] 0.2950301805 -0.0436465604
[14,] 0.1465155626 0.2950301805
[15,] -0.3490326628 0.1465155626
[16,] 0.1637025010 -0.3490326628
[17,] 0.1350324477 0.1637025010
[18,] -0.3999977103 0.1350324477
[19,] -0.1929701580 -0.3999977103
[20,] 0.3394025889 -0.1929701580
[21,] -0.1816115960 0.3394025889
[22,] -0.1778532216 -0.1816115960
[23,] -0.5288028849 -0.1778532216
[24,] -0.0001765463 -0.5288028849
[25,] 0.2221236335 -0.0001765463
[26,] 0.3667205829 0.2221236335
[27,] 0.1596443329 0.3667205829
[28,] 0.1215336317 0.1596443329
[29,] -0.2211386233 0.1215336317
[30,] 0.0596589219 -0.2211386233
[31,] 0.0801565601 0.0596589219
[32,] 0.2516182356 0.0801565601
[33,] -0.3643192467 0.2516182356
[34,] 0.1416107528 -0.3643192467
[35,] -0.4059220346 0.1416107528
[36,] -0.3561689244 -0.4059220346
[37,] 0.4802170808 -0.3561689244
[38,] 0.2044693055 0.4802170808
[39,] 0.2069690353 0.2044693055
[40,] -0.4795363363 0.2069690353
[41,] 0.5230276602 -0.4795363363
[42,] -0.3598199276 0.5230276602
[43,] 0.4050582972 -0.3598199276
[44,] 0.1215841687 0.4050582972
[45,] 0.1495985556 0.1215841687
[46,] -0.6280837052 0.1495985556
[47,] -0.2293359691 -0.6280837052
[48,] 0.1395022412 -0.2293359691
[49,] -0.0293175922 0.1395022412
[50,] 0.1827736865 -0.0293175922
[51,] -0.3484493996 0.1827736865
[52,] -0.0403199039 -0.3484493996
[53,] -0.1340140823 -0.0403199039
[54,] 0.3792929215 -0.1340140823
[55,] -0.3022908361 0.3792929215
[56,] -0.0150755150 -0.3022908361
[57,] 0.0128921645 -0.0150755150
[58,] 0.5491965363 0.0128921645
[59,] 0.2605944147 0.5491965363
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.2663601272 0.0186890152
2 0.4186175503 0.2663601272
3 0.4403407046 0.4186175503
4 -0.3017792823 0.4403407046
5 -0.3323265275 -0.3017792823
6 0.2090415705 -0.3323265275
7 -0.0718202414 0.2090415705
8 -0.4088665183 -0.0718202414
9 -0.3502913074 -0.4088665183
10 -0.4139961241 -0.3502913074
11 0.2159884696 -0.4139961241
12 -0.0436465604 0.2159884696
13 0.2950301805 -0.0436465604
14 0.1465155626 0.2950301805
15 -0.3490326628 0.1465155626
16 0.1637025010 -0.3490326628
17 0.1350324477 0.1637025010
18 -0.3999977103 0.1350324477
19 -0.1929701580 -0.3999977103
20 0.3394025889 -0.1929701580
21 -0.1816115960 0.3394025889
22 -0.1778532216 -0.1816115960
23 -0.5288028849 -0.1778532216
24 -0.0001765463 -0.5288028849
25 0.2221236335 -0.0001765463
26 0.3667205829 0.2221236335
27 0.1596443329 0.3667205829
28 0.1215336317 0.1596443329
29 -0.2211386233 0.1215336317
30 0.0596589219 -0.2211386233
31 0.0801565601 0.0596589219
32 0.2516182356 0.0801565601
33 -0.3643192467 0.2516182356
34 0.1416107528 -0.3643192467
35 -0.4059220346 0.1416107528
36 -0.3561689244 -0.4059220346
37 0.4802170808 -0.3561689244
38 0.2044693055 0.4802170808
39 0.2069690353 0.2044693055
40 -0.4795363363 0.2069690353
41 0.5230276602 -0.4795363363
42 -0.3598199276 0.5230276602
43 0.4050582972 -0.3598199276
44 0.1215841687 0.4050582972
45 0.1495985556 0.1215841687
46 -0.6280837052 0.1495985556
47 -0.2293359691 -0.6280837052
48 0.1395022412 -0.2293359691
49 -0.0293175922 0.1395022412
50 0.1827736865 -0.0293175922
51 -0.3484493996 0.1827736865
52 -0.0403199039 -0.3484493996
53 -0.1340140823 -0.0403199039
54 0.3792929215 -0.1340140823
55 -0.3022908361 0.3792929215
56 -0.0150755150 -0.3022908361
57 0.0128921645 -0.0150755150
58 0.5491965363 0.0128921645
59 0.2605944147 0.5491965363
> 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/rcomp/tmp/7x2x01293004438.ps",horizontal=F,onefile=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/rcomp/tmp/88bx31293004438.ps",horizontal=F,onefile=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/rcomp/tmp/98bx31293004438.ps",horizontal=F,onefile=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/rcomp/tmp/108bx31293004438.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11bud81293004438.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/rcomp/tmp/12fcuw1293004438.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/rcomp/tmp/13md981293004438.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/rcomp/tmp/14w48b1293004438.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/rcomp/tmp/150noh1293004438.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/rcomp/tmp/16ln5n1293004438.tab")
+ }
>
> try(system("convert tmp/1cjzu1293004438.ps tmp/1cjzu1293004438.png",intern=TRUE))
character(0)
> try(system("convert tmp/2cjzu1293004438.ps tmp/2cjzu1293004438.png",intern=TRUE))
character(0)
> try(system("convert tmp/3cjzu1293004438.ps tmp/3cjzu1293004438.png",intern=TRUE))
character(0)
> try(system("convert tmp/45agx1293004438.ps tmp/45agx1293004438.png",intern=TRUE))
character(0)
> try(system("convert tmp/55agx1293004438.ps tmp/55agx1293004438.png",intern=TRUE))
character(0)
> try(system("convert tmp/65agx1293004438.ps tmp/65agx1293004438.png",intern=TRUE))
character(0)
> try(system("convert tmp/7x2x01293004438.ps tmp/7x2x01293004438.png",intern=TRUE))
character(0)
> try(system("convert tmp/88bx31293004438.ps tmp/88bx31293004438.png",intern=TRUE))
character(0)
> try(system("convert tmp/98bx31293004438.ps tmp/98bx31293004438.png",intern=TRUE))
character(0)
> try(system("convert tmp/108bx31293004438.ps tmp/108bx31293004438.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.060 1.850 5.009