R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(19,613,18,611,19,594,19,595,22,591,23,589,20,584,14,573,14,567,14,569,15,621,11,629,17,628,16,612,20,595,24,597,23,593,20,590,21,580,19,574,23,573,23,573,23,620,23,626,27,620,26,588,17,566,24,557,26,561,24,549,27,532,27,526,26,511,24,499,23,555,23,565,24,542,17,527,21,510,19,514,22,517,22,508,18,493,16,490,14,469,12,478,14,528,16,534,8,518,3,506,0,502,5,516,1,528,1,533,3,536,6,537,7,524,8,536,14,587,14,597,13,581),dim=c(2,61),dimnames=list(c('ICONS','WLH'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('ICONS','WLH'),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
ICONS WLH M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 19 613 1 0 0 0 0 0 0 0 0 0 0 1
2 18 611 0 1 0 0 0 0 0 0 0 0 0 2
3 19 594 0 0 1 0 0 0 0 0 0 0 0 3
4 19 595 0 0 0 1 0 0 0 0 0 0 0 4
5 22 591 0 0 0 0 1 0 0 0 0 0 0 5
6 23 589 0 0 0 0 0 1 0 0 0 0 0 6
7 20 584 0 0 0 0 0 0 1 0 0 0 0 7
8 14 573 0 0 0 0 0 0 0 1 0 0 0 8
9 14 567 0 0 0 0 0 0 0 0 1 0 0 9
10 14 569 0 0 0 0 0 0 0 0 0 1 0 10
11 15 621 0 0 0 0 0 0 0 0 0 0 1 11
12 11 629 0 0 0 0 0 0 0 0 0 0 0 12
13 17 628 1 0 0 0 0 0 0 0 0 0 0 13
14 16 612 0 1 0 0 0 0 0 0 0 0 0 14
15 20 595 0 0 1 0 0 0 0 0 0 0 0 15
16 24 597 0 0 0 1 0 0 0 0 0 0 0 16
17 23 593 0 0 0 0 1 0 0 0 0 0 0 17
18 20 590 0 0 0 0 0 1 0 0 0 0 0 18
19 21 580 0 0 0 0 0 0 1 0 0 0 0 19
20 19 574 0 0 0 0 0 0 0 1 0 0 0 20
21 23 573 0 0 0 0 0 0 0 0 1 0 0 21
22 23 573 0 0 0 0 0 0 0 0 0 1 0 22
23 23 620 0 0 0 0 0 0 0 0 0 0 1 23
24 23 626 0 0 0 0 0 0 0 0 0 0 0 24
25 27 620 1 0 0 0 0 0 0 0 0 0 0 25
26 26 588 0 1 0 0 0 0 0 0 0 0 0 26
27 17 566 0 0 1 0 0 0 0 0 0 0 0 27
28 24 557 0 0 0 1 0 0 0 0 0 0 0 28
29 26 561 0 0 0 0 1 0 0 0 0 0 0 29
30 24 549 0 0 0 0 0 1 0 0 0 0 0 30
31 27 532 0 0 0 0 0 0 1 0 0 0 0 31
32 27 526 0 0 0 0 0 0 0 1 0 0 0 32
33 26 511 0 0 0 0 0 0 0 0 1 0 0 33
34 24 499 0 0 0 0 0 0 0 0 0 1 0 34
35 23 555 0 0 0 0 0 0 0 0 0 0 1 35
36 23 565 0 0 0 0 0 0 0 0 0 0 0 36
37 24 542 1 0 0 0 0 0 0 0 0 0 0 37
38 17 527 0 1 0 0 0 0 0 0 0 0 0 38
39 21 510 0 0 1 0 0 0 0 0 0 0 0 39
40 19 514 0 0 0 1 0 0 0 0 0 0 0 40
41 22 517 0 0 0 0 1 0 0 0 0 0 0 41
42 22 508 0 0 0 0 0 1 0 0 0 0 0 42
43 18 493 0 0 0 0 0 0 1 0 0 0 0 43
44 16 490 0 0 0 0 0 0 0 1 0 0 0 44
45 14 469 0 0 0 0 0 0 0 0 1 0 0 45
46 12 478 0 0 0 0 0 0 0 0 0 1 0 46
47 14 528 0 0 0 0 0 0 0 0 0 0 1 47
48 16 534 0 0 0 0 0 0 0 0 0 0 0 48
49 8 518 1 0 0 0 0 0 0 0 0 0 0 49
50 3 506 0 1 0 0 0 0 0 0 0 0 0 50
51 0 502 0 0 1 0 0 0 0 0 0 0 0 51
52 5 516 0 0 0 1 0 0 0 0 0 0 0 52
53 1 528 0 0 0 0 1 0 0 0 0 0 0 53
54 1 533 0 0 0 0 0 1 0 0 0 0 0 54
55 3 536 0 0 0 0 0 0 1 0 0 0 0 55
56 6 537 0 0 0 0 0 0 0 1 0 0 0 56
57 7 524 0 0 0 0 0 0 0 0 1 0 0 57
58 8 536 0 0 0 0 0 0 0 0 0 1 0 58
59 14 587 0 0 0 0 0 0 0 0 0 0 1 59
60 14 597 0 0 0 0 0 0 0 0 0 0 0 60
61 13 581 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) WLH M1 M2 M3 M4
52.01643 -0.04146 -1.08025 -5.10599 -6.06257 -2.88120
M5 M6 M7 M8 M9 M10
-1.90811 -2.60036 -2.88331 -4.20873 -3.99119 -4.21810
M11 t
-0.21355 -0.28188
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-12.2787 -3.7593 0.9096 4.5552 10.7960
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 52.01643 23.89219 2.177 0.034527 *
WLH -0.04146 0.03643 -1.138 0.260830
M1 -1.08025 4.12055 -0.262 0.794342
M2 -5.10599 4.50271 -1.134 0.262554
M3 -6.06257 4.67507 -1.297 0.201035
M4 -2.88120 4.61366 -0.624 0.535324
M5 -1.90811 4.55921 -0.419 0.677475
M6 -2.60036 4.58919 -0.567 0.573664
M7 -2.88331 4.68833 -0.615 0.541522
M8 -4.20873 4.73821 -0.888 0.378928
M9 -3.99119 4.89852 -0.815 0.419311
M10 -4.21810 4.83003 -0.873 0.386936
M11 -0.21355 4.27421 -0.050 0.960365
t -0.28188 0.07738 -3.643 0.000671 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.735 on 47 degrees of freedom
Multiple R-squared: 0.3113, Adjusted R-squared: 0.1208
F-statistic: 1.634 on 13 and 47 DF, p-value: 0.1094
> 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.06654941 0.13309882 0.93345059
[2,] 0.04673178 0.09346357 0.95326822
[3,] 0.01714654 0.03429308 0.98285346
[4,] 0.01847515 0.03695030 0.98152485
[5,] 0.05971162 0.11942323 0.94028838
[6,] 0.08011447 0.16022894 0.91988553
[7,] 0.08634415 0.17268831 0.91365585
[8,] 0.17082036 0.34164072 0.82917964
[9,] 0.14567418 0.29134836 0.85432582
[10,] 0.09860882 0.19721763 0.90139118
[11,] 0.25618664 0.51237328 0.74381336
[12,] 0.20248126 0.40496252 0.79751874
[13,] 0.14513357 0.29026715 0.85486643
[14,] 0.11086681 0.22173362 0.88913319
[15,] 0.08337720 0.16675440 0.91662280
[16,] 0.08061362 0.16122724 0.91938638
[17,] 0.05344784 0.10689567 0.94655216
[18,] 0.03154591 0.06309183 0.96845409
[19,] 0.03172129 0.06344258 0.96827871
[20,] 0.08034056 0.16068113 0.91965944
[21,] 0.15459727 0.30919454 0.84540273
[22,] 0.42965819 0.85931639 0.57034181
[23,] 0.36329603 0.72659206 0.63670397
[24,] 0.80868240 0.38263520 0.19131760
[25,] 0.92134967 0.15730067 0.07865033
[26,] 0.92959110 0.14081780 0.07040890
[27,] 0.87211578 0.25576845 0.12788422
[28,] 0.79587878 0.40824244 0.20412122
> postscript(file="/var/www/html/rcomp/tmp/14nef1258658447.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/219qg1258658447.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/36wy71258658447.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/4mi231258658447.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/521j61258658447.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
-6.2402203 -3.0155198 -1.4818535 -4.3398954 -2.1969383 -0.3057295
7 8 9 10 11 12
-2.9481871 -7.7969383 -7.9813539 -7.3896456 -7.9564788 -11.5564788
13 14 15 16 17 18
-4.2358075 -1.5915264 2.9421399 4.1255565 2.2685136 0.1182639
19 20 21 22 23 24
1.2685136 0.6270551 4.6499321 5.1587233 3.3845975 3.7016804
25 26 27 28 29 30
8.8150591 10.7960037 2.1223774 5.8497502 7.3243756 5.8009991
31 32 33 34 35 36
8.6610391 10.0195806 8.4620382 6.4733271 4.0723280 4.5552451
37 38 39 40 41 42
5.9638288 2.6495684 7.1832347 2.4495684 4.8827352 5.4837343
43 44 45 46 47 48
1.4266914 0.9096085 -1.8966851 -3.0147671 -2.6645174 -0.3474344
49 50 51 52 53 54
-7.6486411 -8.8385259 -10.7658986 -8.0849797 -12.2786861 -11.0972677
55 56 57 58 59 60
-8.4080571 -3.7593059 -3.2339313 -1.2276377 3.1640706 3.6469877
61
3.3457810
> postscript(file="/var/www/html/rcomp/tmp/63xay1258658447.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 -6.2402203 NA
1 -3.0155198 -6.2402203
2 -1.4818535 -3.0155198
3 -4.3398954 -1.4818535
4 -2.1969383 -4.3398954
5 -0.3057295 -2.1969383
6 -2.9481871 -0.3057295
7 -7.7969383 -2.9481871
8 -7.9813539 -7.7969383
9 -7.3896456 -7.9813539
10 -7.9564788 -7.3896456
11 -11.5564788 -7.9564788
12 -4.2358075 -11.5564788
13 -1.5915264 -4.2358075
14 2.9421399 -1.5915264
15 4.1255565 2.9421399
16 2.2685136 4.1255565
17 0.1182639 2.2685136
18 1.2685136 0.1182639
19 0.6270551 1.2685136
20 4.6499321 0.6270551
21 5.1587233 4.6499321
22 3.3845975 5.1587233
23 3.7016804 3.3845975
24 8.8150591 3.7016804
25 10.7960037 8.8150591
26 2.1223774 10.7960037
27 5.8497502 2.1223774
28 7.3243756 5.8497502
29 5.8009991 7.3243756
30 8.6610391 5.8009991
31 10.0195806 8.6610391
32 8.4620382 10.0195806
33 6.4733271 8.4620382
34 4.0723280 6.4733271
35 4.5552451 4.0723280
36 5.9638288 4.5552451
37 2.6495684 5.9638288
38 7.1832347 2.6495684
39 2.4495684 7.1832347
40 4.8827352 2.4495684
41 5.4837343 4.8827352
42 1.4266914 5.4837343
43 0.9096085 1.4266914
44 -1.8966851 0.9096085
45 -3.0147671 -1.8966851
46 -2.6645174 -3.0147671
47 -0.3474344 -2.6645174
48 -7.6486411 -0.3474344
49 -8.8385259 -7.6486411
50 -10.7658986 -8.8385259
51 -8.0849797 -10.7658986
52 -12.2786861 -8.0849797
53 -11.0972677 -12.2786861
54 -8.4080571 -11.0972677
55 -3.7593059 -8.4080571
56 -3.2339313 -3.7593059
57 -1.2276377 -3.2339313
58 3.1640706 -1.2276377
59 3.6469877 3.1640706
60 3.3457810 3.6469877
61 NA 3.3457810
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.0155198 -6.2402203
[2,] -1.4818535 -3.0155198
[3,] -4.3398954 -1.4818535
[4,] -2.1969383 -4.3398954
[5,] -0.3057295 -2.1969383
[6,] -2.9481871 -0.3057295
[7,] -7.7969383 -2.9481871
[8,] -7.9813539 -7.7969383
[9,] -7.3896456 -7.9813539
[10,] -7.9564788 -7.3896456
[11,] -11.5564788 -7.9564788
[12,] -4.2358075 -11.5564788
[13,] -1.5915264 -4.2358075
[14,] 2.9421399 -1.5915264
[15,] 4.1255565 2.9421399
[16,] 2.2685136 4.1255565
[17,] 0.1182639 2.2685136
[18,] 1.2685136 0.1182639
[19,] 0.6270551 1.2685136
[20,] 4.6499321 0.6270551
[21,] 5.1587233 4.6499321
[22,] 3.3845975 5.1587233
[23,] 3.7016804 3.3845975
[24,] 8.8150591 3.7016804
[25,] 10.7960037 8.8150591
[26,] 2.1223774 10.7960037
[27,] 5.8497502 2.1223774
[28,] 7.3243756 5.8497502
[29,] 5.8009991 7.3243756
[30,] 8.6610391 5.8009991
[31,] 10.0195806 8.6610391
[32,] 8.4620382 10.0195806
[33,] 6.4733271 8.4620382
[34,] 4.0723280 6.4733271
[35,] 4.5552451 4.0723280
[36,] 5.9638288 4.5552451
[37,] 2.6495684 5.9638288
[38,] 7.1832347 2.6495684
[39,] 2.4495684 7.1832347
[40,] 4.8827352 2.4495684
[41,] 5.4837343 4.8827352
[42,] 1.4266914 5.4837343
[43,] 0.9096085 1.4266914
[44,] -1.8966851 0.9096085
[45,] -3.0147671 -1.8966851
[46,] -2.6645174 -3.0147671
[47,] -0.3474344 -2.6645174
[48,] -7.6486411 -0.3474344
[49,] -8.8385259 -7.6486411
[50,] -10.7658986 -8.8385259
[51,] -8.0849797 -10.7658986
[52,] -12.2786861 -8.0849797
[53,] -11.0972677 -12.2786861
[54,] -8.4080571 -11.0972677
[55,] -3.7593059 -8.4080571
[56,] -3.2339313 -3.7593059
[57,] -1.2276377 -3.2339313
[58,] 3.1640706 -1.2276377
[59,] 3.6469877 3.1640706
[60,] 3.3457810 3.6469877
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.0155198 -6.2402203
2 -1.4818535 -3.0155198
3 -4.3398954 -1.4818535
4 -2.1969383 -4.3398954
5 -0.3057295 -2.1969383
6 -2.9481871 -0.3057295
7 -7.7969383 -2.9481871
8 -7.9813539 -7.7969383
9 -7.3896456 -7.9813539
10 -7.9564788 -7.3896456
11 -11.5564788 -7.9564788
12 -4.2358075 -11.5564788
13 -1.5915264 -4.2358075
14 2.9421399 -1.5915264
15 4.1255565 2.9421399
16 2.2685136 4.1255565
17 0.1182639 2.2685136
18 1.2685136 0.1182639
19 0.6270551 1.2685136
20 4.6499321 0.6270551
21 5.1587233 4.6499321
22 3.3845975 5.1587233
23 3.7016804 3.3845975
24 8.8150591 3.7016804
25 10.7960037 8.8150591
26 2.1223774 10.7960037
27 5.8497502 2.1223774
28 7.3243756 5.8497502
29 5.8009991 7.3243756
30 8.6610391 5.8009991
31 10.0195806 8.6610391
32 8.4620382 10.0195806
33 6.4733271 8.4620382
34 4.0723280 6.4733271
35 4.5552451 4.0723280
36 5.9638288 4.5552451
37 2.6495684 5.9638288
38 7.1832347 2.6495684
39 2.4495684 7.1832347
40 4.8827352 2.4495684
41 5.4837343 4.8827352
42 1.4266914 5.4837343
43 0.9096085 1.4266914
44 -1.8966851 0.9096085
45 -3.0147671 -1.8966851
46 -2.6645174 -3.0147671
47 -0.3474344 -2.6645174
48 -7.6486411 -0.3474344
49 -8.8385259 -7.6486411
50 -10.7658986 -8.8385259
51 -8.0849797 -10.7658986
52 -12.2786861 -8.0849797
53 -11.0972677 -12.2786861
54 -8.4080571 -11.0972677
55 -3.7593059 -8.4080571
56 -3.2339313 -3.7593059
57 -1.2276377 -3.2339313
58 3.1640706 -1.2276377
59 3.6469877 3.1640706
60 3.3457810 3.6469877
> 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/7xxd11258658447.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/8qne51258658447.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/96wht1258658447.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/10ju3z1258658447.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/119mon1258658447.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/12j0v91258658447.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/138fxk1258658447.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/142tbn1258658447.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/15hx7f1258658448.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/16cf211258658448.tab")
+ }
>
> system("convert tmp/14nef1258658447.ps tmp/14nef1258658447.png")
> system("convert tmp/219qg1258658447.ps tmp/219qg1258658447.png")
> system("convert tmp/36wy71258658447.ps tmp/36wy71258658447.png")
> system("convert tmp/4mi231258658447.ps tmp/4mi231258658447.png")
> system("convert tmp/521j61258658447.ps tmp/521j61258658447.png")
> system("convert tmp/63xay1258658447.ps tmp/63xay1258658447.png")
> system("convert tmp/7xxd11258658447.ps tmp/7xxd11258658447.png")
> system("convert tmp/8qne51258658447.ps tmp/8qne51258658447.png")
> system("convert tmp/96wht1258658447.ps tmp/96wht1258658447.png")
> system("convert tmp/10ju3z1258658447.ps tmp/10ju3z1258658447.png")
>
>
> proc.time()
user system elapsed
2.442 1.578 2.863