R version 2.7.0 (2008-04-22)
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(565464,0,547344,0,554788,0,562325,0,560854,0,555332,0,543599,0,536662,0,542722,0,593530,0,610763,0,612613,0,611324,0,594167,0,595454,0,590865,0,589379,0,584428,0,573100,0,567456,0,569028,0,620735,0,628884,0,628232,0,612117,0,595404,0,597141,0,593408,0,590072,0,579799,0,574205,0,572775,0,572942,0,619567,0,625809,0,619916,0,587625,0,565742,0,557274,0,560576,1,548854,1,531673,1,525919,1,511038,1,498662,1,555362,1,564591,1,541657,1,527070,1,509846,1,514258,1,516922,1,507561,1,492622,1,490243,1,469357,1,477580,1,528379,1,533590,1,517945,1),dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),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 = '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
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 565464 0 1 0 0 0 0 0 0 0 0 0 0 1
2 547344 0 0 1 0 0 0 0 0 0 0 0 0 2
3 554788 0 0 0 1 0 0 0 0 0 0 0 0 3
4 562325 0 0 0 0 1 0 0 0 0 0 0 0 4
5 560854 0 0 0 0 0 1 0 0 0 0 0 0 5
6 555332 0 0 0 0 0 0 1 0 0 0 0 0 6
7 543599 0 0 0 0 0 0 0 1 0 0 0 0 7
8 536662 0 0 0 0 0 0 0 0 1 0 0 0 8
9 542722 0 0 0 0 0 0 0 0 0 1 0 0 9
10 593530 0 0 0 0 0 0 0 0 0 0 1 0 10
11 610763 0 0 0 0 0 0 0 0 0 0 0 1 11
12 612613 0 0 0 0 0 0 0 0 0 0 0 0 12
13 611324 0 1 0 0 0 0 0 0 0 0 0 0 13
14 594167 0 0 1 0 0 0 0 0 0 0 0 0 14
15 595454 0 0 0 1 0 0 0 0 0 0 0 0 15
16 590865 0 0 0 0 1 0 0 0 0 0 0 0 16
17 589379 0 0 0 0 0 1 0 0 0 0 0 0 17
18 584428 0 0 0 0 0 0 1 0 0 0 0 0 18
19 573100 0 0 0 0 0 0 0 1 0 0 0 0 19
20 567456 0 0 0 0 0 0 0 0 1 0 0 0 20
21 569028 0 0 0 0 0 0 0 0 0 1 0 0 21
22 620735 0 0 0 0 0 0 0 0 0 0 1 0 22
23 628884 0 0 0 0 0 0 0 0 0 0 0 1 23
24 628232 0 0 0 0 0 0 0 0 0 0 0 0 24
25 612117 0 1 0 0 0 0 0 0 0 0 0 0 25
26 595404 0 0 1 0 0 0 0 0 0 0 0 0 26
27 597141 0 0 0 1 0 0 0 0 0 0 0 0 27
28 593408 0 0 0 0 1 0 0 0 0 0 0 0 28
29 590072 0 0 0 0 0 1 0 0 0 0 0 0 29
30 579799 0 0 0 0 0 0 1 0 0 0 0 0 30
31 574205 0 0 0 0 0 0 0 1 0 0 0 0 31
32 572775 0 0 0 0 0 0 0 0 1 0 0 0 32
33 572942 0 0 0 0 0 0 0 0 0 1 0 0 33
34 619567 0 0 0 0 0 0 0 0 0 0 1 0 34
35 625809 0 0 0 0 0 0 0 0 0 0 0 1 35
36 619916 0 0 0 0 0 0 0 0 0 0 0 0 36
37 587625 0 1 0 0 0 0 0 0 0 0 0 0 37
38 565742 0 0 1 0 0 0 0 0 0 0 0 0 38
39 557274 0 0 0 1 0 0 0 0 0 0 0 0 39
40 560576 1 0 0 0 1 0 0 0 0 0 0 0 40
41 548854 1 0 0 0 0 1 0 0 0 0 0 0 41
42 531673 1 0 0 0 0 0 1 0 0 0 0 0 42
43 525919 1 0 0 0 0 0 0 1 0 0 0 0 43
44 511038 1 0 0 0 0 0 0 0 1 0 0 0 44
45 498662 1 0 0 0 0 0 0 0 0 1 0 0 45
46 555362 1 0 0 0 0 0 0 0 0 0 1 0 46
47 564591 1 0 0 0 0 0 0 0 0 0 0 1 47
48 541657 1 0 0 0 0 0 0 0 0 0 0 0 48
49 527070 1 1 0 0 0 0 0 0 0 0 0 0 49
50 509846 1 0 1 0 0 0 0 0 0 0 0 0 50
51 514258 1 0 0 1 0 0 0 0 0 0 0 0 51
52 516922 1 0 0 0 1 0 0 0 0 0 0 0 52
53 507561 1 0 0 0 0 1 0 0 0 0 0 0 53
54 492622 1 0 0 0 0 0 1 0 0 0 0 0 54
55 490243 1 0 0 0 0 0 0 1 0 0 0 0 55
56 469357 1 0 0 0 0 0 0 0 1 0 0 0 56
57 477580 1 0 0 0 0 0 0 0 0 1 0 0 57
58 528379 1 0 0 0 0 0 0 0 0 0 1 0 58
59 533590 1 0 0 0 0 0 0 0 0 0 0 1 59
60 517945 1 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
602426.38 -74774.94 -14776.53 -33316.93 -32355.54 -16685.36
M5 M6 M7 M8 M9 M10
-22481.56 -33375.77 -41054.37 -51330.98 -50922.78 84.01
M11 t
8975.81 321.01
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-28967 -15585 1855 11224 36770
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 602426.38 10466.94 57.555 < 2e-16 ***
X -74774.94 9127.60 -8.192 1.54e-10 ***
M1 -14776.53 11836.35 -1.248 0.21820
M2 -33316.93 11812.13 -2.821 0.00705 **
M3 -32355.54 11793.25 -2.744 0.00864 **
M4 -16685.36 11897.05 -1.402 0.16749
M5 -22481.56 11856.86 -1.896 0.06424 .
M6 -33375.77 11821.92 -2.823 0.00700 **
M7 -41054.37 11792.27 -3.481 0.00110 **
M8 -51330.98 11767.96 -4.362 7.21e-05 ***
M9 -50922.78 11749.02 -4.334 7.88e-05 ***
M10 84.01 11735.47 0.007 0.99432
M11 8975.81 11727.33 0.765 0.44796
t 321.01 252.27 1.272 0.20961
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 18540 on 46 degrees of freedom
Multiple R-squared: 0.835, Adjusted R-squared: 0.7883
F-statistic: 17.9 on 13 and 46 DF, p-value: 8.59e-14
> 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.2912699 0.58253976 0.708730119
[2,] 0.2174356 0.43487123 0.782564386
[3,] 0.1833323 0.36666459 0.816667703
[4,] 0.1416435 0.28328693 0.858356537
[5,] 0.1436404 0.28728079 0.856359604
[6,] 0.1588738 0.31774764 0.841126180
[7,] 0.3692110 0.73842192 0.630789041
[8,] 0.5095582 0.98088366 0.490441832
[9,] 0.7170719 0.56585610 0.282928050
[10,] 0.7541049 0.49179016 0.245895080
[11,] 0.7687049 0.46259025 0.231295123
[12,] 0.9080728 0.18385448 0.091927241
[13,] 0.9513400 0.09732000 0.048660002
[14,] 0.9691039 0.06179218 0.030896090
[15,] 0.9764570 0.04708607 0.023543033
[16,] 0.9629438 0.07411241 0.037056207
[17,] 0.9543284 0.09134310 0.045671550
[18,] 0.9359065 0.12818693 0.064093466
[19,] 0.9223614 0.15527710 0.077638552
[20,] 0.9770900 0.04582005 0.022910024
[21,] 0.9889628 0.02207449 0.011037244
[22,] 0.9924520 0.01509598 0.007547992
[23,] 0.9913307 0.01733865 0.008669327
[24,] 0.9865340 0.02693196 0.013465980
[25,] 0.9769453 0.04610933 0.023054664
[26,] 0.9572028 0.08559443 0.042797215
[27,] 0.9018358 0.19632831 0.098164155
> postscript(file="/var/www/html/rcomp/tmp/19iht1229683639.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/219k91229683639.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/3d1h41229683639.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/488pj1229683639.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/58uoo1229683639.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
-22506.85455 -22407.45455 -16245.85455 -24700.04242 -20695.84242 -15644.64242
7 8 9 10 11 12
-20020.04242 -17001.44242 -11670.64242 -12190.44242 -4170.24242 6334.55758
13 14 15 16 17 18
19501.07879 20563.47879 20568.07879 -12.10909 3977.09091 9599.29091
19 20 21 22 23 24
5628.89091 9940.49091 10783.29091 11162.49091 10098.69091 18101.49091
25 26 27 28 29 30
16442.01212 17948.41212 18403.01212 -1321.17576 818.02424 1118.22424
31 32 33 34 35 36
2881.82424 11407.42424 10845.22424 6142.42424 3171.62424 5933.42424
37 38 39 40 41 42
-11902.05455 -15565.65455 -25316.05455 36769.69697 30522.89697 23915.09697
43 44 45 46 47 48
25518.69697 20593.29697 7488.09697 12860.29697 12876.49697 -1402.70303
49 50 51 52 53 54
-1534.18182 -538.78182 2590.81818 -10736.36970 -14622.16970 -18987.96970
55 56 57 58 59 60
-14009.36970 -24939.76970 -17445.96970 -17974.76970 -21976.56970 -28966.76970
> postscript(file="/var/www/html/rcomp/tmp/6epq81229683640.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 -22506.85455 NA
1 -22407.45455 -22506.85455
2 -16245.85455 -22407.45455
3 -24700.04242 -16245.85455
4 -20695.84242 -24700.04242
5 -15644.64242 -20695.84242
6 -20020.04242 -15644.64242
7 -17001.44242 -20020.04242
8 -11670.64242 -17001.44242
9 -12190.44242 -11670.64242
10 -4170.24242 -12190.44242
11 6334.55758 -4170.24242
12 19501.07879 6334.55758
13 20563.47879 19501.07879
14 20568.07879 20563.47879
15 -12.10909 20568.07879
16 3977.09091 -12.10909
17 9599.29091 3977.09091
18 5628.89091 9599.29091
19 9940.49091 5628.89091
20 10783.29091 9940.49091
21 11162.49091 10783.29091
22 10098.69091 11162.49091
23 18101.49091 10098.69091
24 16442.01212 18101.49091
25 17948.41212 16442.01212
26 18403.01212 17948.41212
27 -1321.17576 18403.01212
28 818.02424 -1321.17576
29 1118.22424 818.02424
30 2881.82424 1118.22424
31 11407.42424 2881.82424
32 10845.22424 11407.42424
33 6142.42424 10845.22424
34 3171.62424 6142.42424
35 5933.42424 3171.62424
36 -11902.05455 5933.42424
37 -15565.65455 -11902.05455
38 -25316.05455 -15565.65455
39 36769.69697 -25316.05455
40 30522.89697 36769.69697
41 23915.09697 30522.89697
42 25518.69697 23915.09697
43 20593.29697 25518.69697
44 7488.09697 20593.29697
45 12860.29697 7488.09697
46 12876.49697 12860.29697
47 -1402.70303 12876.49697
48 -1534.18182 -1402.70303
49 -538.78182 -1534.18182
50 2590.81818 -538.78182
51 -10736.36970 2590.81818
52 -14622.16970 -10736.36970
53 -18987.96970 -14622.16970
54 -14009.36970 -18987.96970
55 -24939.76970 -14009.36970
56 -17445.96970 -24939.76970
57 -17974.76970 -17445.96970
58 -21976.56970 -17974.76970
59 -28966.76970 -21976.56970
60 NA -28966.76970
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -22407.45455 -22506.85455
[2,] -16245.85455 -22407.45455
[3,] -24700.04242 -16245.85455
[4,] -20695.84242 -24700.04242
[5,] -15644.64242 -20695.84242
[6,] -20020.04242 -15644.64242
[7,] -17001.44242 -20020.04242
[8,] -11670.64242 -17001.44242
[9,] -12190.44242 -11670.64242
[10,] -4170.24242 -12190.44242
[11,] 6334.55758 -4170.24242
[12,] 19501.07879 6334.55758
[13,] 20563.47879 19501.07879
[14,] 20568.07879 20563.47879
[15,] -12.10909 20568.07879
[16,] 3977.09091 -12.10909
[17,] 9599.29091 3977.09091
[18,] 5628.89091 9599.29091
[19,] 9940.49091 5628.89091
[20,] 10783.29091 9940.49091
[21,] 11162.49091 10783.29091
[22,] 10098.69091 11162.49091
[23,] 18101.49091 10098.69091
[24,] 16442.01212 18101.49091
[25,] 17948.41212 16442.01212
[26,] 18403.01212 17948.41212
[27,] -1321.17576 18403.01212
[28,] 818.02424 -1321.17576
[29,] 1118.22424 818.02424
[30,] 2881.82424 1118.22424
[31,] 11407.42424 2881.82424
[32,] 10845.22424 11407.42424
[33,] 6142.42424 10845.22424
[34,] 3171.62424 6142.42424
[35,] 5933.42424 3171.62424
[36,] -11902.05455 5933.42424
[37,] -15565.65455 -11902.05455
[38,] -25316.05455 -15565.65455
[39,] 36769.69697 -25316.05455
[40,] 30522.89697 36769.69697
[41,] 23915.09697 30522.89697
[42,] 25518.69697 23915.09697
[43,] 20593.29697 25518.69697
[44,] 7488.09697 20593.29697
[45,] 12860.29697 7488.09697
[46,] 12876.49697 12860.29697
[47,] -1402.70303 12876.49697
[48,] -1534.18182 -1402.70303
[49,] -538.78182 -1534.18182
[50,] 2590.81818 -538.78182
[51,] -10736.36970 2590.81818
[52,] -14622.16970 -10736.36970
[53,] -18987.96970 -14622.16970
[54,] -14009.36970 -18987.96970
[55,] -24939.76970 -14009.36970
[56,] -17445.96970 -24939.76970
[57,] -17974.76970 -17445.96970
[58,] -21976.56970 -17974.76970
[59,] -28966.76970 -21976.56970
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -22407.45455 -22506.85455
2 -16245.85455 -22407.45455
3 -24700.04242 -16245.85455
4 -20695.84242 -24700.04242
5 -15644.64242 -20695.84242
6 -20020.04242 -15644.64242
7 -17001.44242 -20020.04242
8 -11670.64242 -17001.44242
9 -12190.44242 -11670.64242
10 -4170.24242 -12190.44242
11 6334.55758 -4170.24242
12 19501.07879 6334.55758
13 20563.47879 19501.07879
14 20568.07879 20563.47879
15 -12.10909 20568.07879
16 3977.09091 -12.10909
17 9599.29091 3977.09091
18 5628.89091 9599.29091
19 9940.49091 5628.89091
20 10783.29091 9940.49091
21 11162.49091 10783.29091
22 10098.69091 11162.49091
23 18101.49091 10098.69091
24 16442.01212 18101.49091
25 17948.41212 16442.01212
26 18403.01212 17948.41212
27 -1321.17576 18403.01212
28 818.02424 -1321.17576
29 1118.22424 818.02424
30 2881.82424 1118.22424
31 11407.42424 2881.82424
32 10845.22424 11407.42424
33 6142.42424 10845.22424
34 3171.62424 6142.42424
35 5933.42424 3171.62424
36 -11902.05455 5933.42424
37 -15565.65455 -11902.05455
38 -25316.05455 -15565.65455
39 36769.69697 -25316.05455
40 30522.89697 36769.69697
41 23915.09697 30522.89697
42 25518.69697 23915.09697
43 20593.29697 25518.69697
44 7488.09697 20593.29697
45 12860.29697 7488.09697
46 12876.49697 12860.29697
47 -1402.70303 12876.49697
48 -1534.18182 -1402.70303
49 -538.78182 -1534.18182
50 2590.81818 -538.78182
51 -10736.36970 2590.81818
52 -14622.16970 -10736.36970
53 -18987.96970 -14622.16970
54 -14009.36970 -18987.96970
55 -24939.76970 -14009.36970
56 -17445.96970 -24939.76970
57 -17974.76970 -17445.96970
58 -21976.56970 -17974.76970
59 -28966.76970 -21976.56970
> 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/7z2n31229683640.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/8iwa01229683640.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/99up91229683640.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/10b7u81229683640.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/11ftom1229683640.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/12ij2e1229683640.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/1399du1229683640.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/14whye1229683640.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/1588v51229683640.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/165ycu1229683640.tab")
+ }
>
> system("convert tmp/19iht1229683639.ps tmp/19iht1229683639.png")
> system("convert tmp/219k91229683639.ps tmp/219k91229683639.png")
> system("convert tmp/3d1h41229683639.ps tmp/3d1h41229683639.png")
> system("convert tmp/488pj1229683639.ps tmp/488pj1229683639.png")
> system("convert tmp/58uoo1229683639.ps tmp/58uoo1229683639.png")
> system("convert tmp/6epq81229683640.ps tmp/6epq81229683640.png")
> system("convert tmp/7z2n31229683640.ps tmp/7z2n31229683640.png")
> system("convert tmp/8iwa01229683640.ps tmp/8iwa01229683640.png")
> system("convert tmp/99up91229683640.ps tmp/99up91229683640.png")
> system("convert tmp/10b7u81229683640.ps tmp/10b7u81229683640.png")
>
>
> proc.time()
user system elapsed
4.969 2.758 5.333