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(612613,1,611324,1,594167,1,595454,1,590865,1,589379,1,584428,1,573100,1,567456,1,569028,1,620735,1,628884,1,628232,1,612117,1,595404,1,597141,1,593408,1,590072,1,579799,1,574205,1,572775,1,572942,1,619567,1,625809,1,619916,1,587625,0,565742,0,557274,0,560576,0,548854,0,531673,0,525919,0,511038,0,498662,0,555362,0,564591,0,541657,0,527070,0,509846,0,514258,0,516922,0,507561,0,492622,0,490243,0,469357,0,477580,0,528379,0,533590,0,517945,0,506174,0,501866,0,516141,0,528222,0,532638,0,536322,0,536535,0,523597,0,536214,0,586570,0,596594,0),dim=c(2,60),dimnames=list(c('wlh','dummies'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('wlh','dummies'),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 = '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
wlh dummies M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 612613 1 1 0 0 0 0 0 0 0 0 0 0
2 611324 1 0 1 0 0 0 0 0 0 0 0 0
3 594167 1 0 0 1 0 0 0 0 0 0 0 0
4 595454 1 0 0 0 1 0 0 0 0 0 0 0
5 590865 1 0 0 0 0 1 0 0 0 0 0 0
6 589379 1 0 0 0 0 0 1 0 0 0 0 0
7 584428 1 0 0 0 0 0 0 1 0 0 0 0
8 573100 1 0 0 0 0 0 0 0 1 0 0 0
9 567456 1 0 0 0 0 0 0 0 0 1 0 0
10 569028 1 0 0 0 0 0 0 0 0 0 1 0
11 620735 1 0 0 0 0 0 0 0 0 0 0 1
12 628884 1 0 0 0 0 0 0 0 0 0 0 0
13 628232 1 1 0 0 0 0 0 0 0 0 0 0
14 612117 1 0 1 0 0 0 0 0 0 0 0 0
15 595404 1 0 0 1 0 0 0 0 0 0 0 0
16 597141 1 0 0 0 1 0 0 0 0 0 0 0
17 593408 1 0 0 0 0 1 0 0 0 0 0 0
18 590072 1 0 0 0 0 0 1 0 0 0 0 0
19 579799 1 0 0 0 0 0 0 1 0 0 0 0
20 574205 1 0 0 0 0 0 0 0 1 0 0 0
21 572775 1 0 0 0 0 0 0 0 0 1 0 0
22 572942 1 0 0 0 0 0 0 0 0 0 1 0
23 619567 1 0 0 0 0 0 0 0 0 0 0 1
24 625809 1 0 0 0 0 0 0 0 0 0 0 0
25 619916 1 1 0 0 0 0 0 0 0 0 0 0
26 587625 0 0 1 0 0 0 0 0 0 0 0 0
27 565742 0 0 0 1 0 0 0 0 0 0 0 0
28 557274 0 0 0 0 1 0 0 0 0 0 0 0
29 560576 0 0 0 0 0 1 0 0 0 0 0 0
30 548854 0 0 0 0 0 0 1 0 0 0 0 0
31 531673 0 0 0 0 0 0 0 1 0 0 0 0
32 525919 0 0 0 0 0 0 0 0 1 0 0 0
33 511038 0 0 0 0 0 0 0 0 0 1 0 0
34 498662 0 0 0 0 0 0 0 0 0 0 1 0
35 555362 0 0 0 0 0 0 0 0 0 0 0 1
36 564591 0 0 0 0 0 0 0 0 0 0 0 0
37 541657 0 1 0 0 0 0 0 0 0 0 0 0
38 527070 0 0 1 0 0 0 0 0 0 0 0 0
39 509846 0 0 0 1 0 0 0 0 0 0 0 0
40 514258 0 0 0 0 1 0 0 0 0 0 0 0
41 516922 0 0 0 0 0 1 0 0 0 0 0 0
42 507561 0 0 0 0 0 0 1 0 0 0 0 0
43 492622 0 0 0 0 0 0 0 1 0 0 0 0
44 490243 0 0 0 0 0 0 0 0 1 0 0 0
45 469357 0 0 0 0 0 0 0 0 0 1 0 0
46 477580 0 0 0 0 0 0 0 0 0 0 1 0
47 528379 0 0 0 0 0 0 0 0 0 0 0 1
48 533590 0 0 0 0 0 0 0 0 0 0 0 0
49 517945 0 1 0 0 0 0 0 0 0 0 0 0
50 506174 0 0 1 0 0 0 0 0 0 0 0 0
51 501866 0 0 0 1 0 0 0 0 0 0 0 0
52 516141 0 0 0 0 1 0 0 0 0 0 0 0
53 528222 0 0 0 0 0 1 0 0 0 0 0 0
54 532638 0 0 0 0 0 0 1 0 0 0 0 0
55 536322 0 0 0 0 0 0 0 1 0 0 0 0
56 536535 0 0 0 0 0 0 0 0 1 0 0 0
57 523597 0 0 0 0 0 0 0 0 0 1 0 0
58 536214 0 0 0 0 0 0 0 0 0 0 1 0
59 586570 0 0 0 0 0 0 0 0 0 0 0 1
60 596594 0 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) dummies M1 M2 M3 M4
563418 66190 -19059 -21032 -36489 -33840
M5 M6 M7 M8 M9 M10
-31895 -36193 -44925 -49893 -61049 -59008
M11
-7771
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-36212.1 -8494.7 -912.4 8843.8 45238.9
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 563418 9475 59.462 < 2e-16 ***
dummies 66190 5434 12.180 3.81e-16 ***
M1 -19059 13088 -1.456 0.151977
M2 -21032 13043 -1.613 0.113543
M3 -36489 13043 -2.798 0.007439 **
M4 -33840 13043 -2.595 0.012593 *
M5 -31895 13043 -2.445 0.018268 *
M6 -36193 13043 -2.775 0.007898 **
M7 -44925 13043 -3.444 0.001214 **
M8 -49893 13043 -3.825 0.000384 ***
M9 -61049 13043 -4.681 2.45e-05 ***
M10 -59008 13043 -4.524 4.12e-05 ***
M11 -7771 13043 -0.596 0.554158
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 20620 on 47 degrees of freedom
Multiple R-squared: 0.8108, Adjusted R-squared: 0.7625
F-statistic: 16.79 on 12 and 47 DF, p-value: 4.033e-13
> 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,] 2.273041e-02 4.546083e-02 0.9772696
[2,] 4.874378e-03 9.748756e-03 0.9951256
[3,] 9.029883e-04 1.805977e-03 0.9990970
[4,] 1.915274e-04 3.830547e-04 0.9998085
[5,] 3.154235e-05 6.308470e-05 0.9999685
[6,] 6.775970e-06 1.355194e-05 0.9999932
[7,] 1.203916e-06 2.407832e-06 0.9999988
[8,] 1.713340e-07 3.426681e-07 0.9999998
[9,] 2.803571e-08 5.607141e-08 1.0000000
[10,] 3.479599e-09 6.959198e-09 1.0000000
[11,] 1.417713e-09 2.835426e-09 1.0000000
[12,] 7.495148e-10 1.499030e-09 1.0000000
[13,] 2.108073e-09 4.216146e-09 1.0000000
[14,] 6.046378e-10 1.209276e-09 1.0000000
[15,] 6.566676e-10 1.313335e-09 1.0000000
[16,] 5.577430e-09 1.115486e-08 1.0000000
[17,] 4.571225e-09 9.142450e-09 1.0000000
[18,] 3.670489e-08 7.340978e-08 1.0000000
[19,] 1.224578e-06 2.449155e-06 0.9999988
[20,] 1.498317e-06 2.996635e-06 0.9999985
[21,] 9.965404e-07 1.993081e-06 0.9999990
[22,] 5.570196e-06 1.114039e-05 0.9999944
[23,] 7.653201e-05 1.530640e-04 0.9999235
[24,] 2.119105e-04 4.238211e-04 0.9997881
[25,] 2.181902e-04 4.363804e-04 0.9997818
[26,] 1.518921e-04 3.037841e-04 0.9998481
[27,] 1.336744e-04 2.673487e-04 0.9998663
[28,] 2.087626e-04 4.175252e-04 0.9997912
[29,] 2.572466e-04 5.144932e-04 0.9997428
> postscript(file="/var/www/html/rcomp/tmp/1rl591261768976.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/2jb9g1261768976.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/3y2kn1261768976.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/4bwdw1261768976.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/5k5r21261768976.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
2064.5167 2748.1750 1048.1750 -313.4250 -6847.4250 -4035.6250
7 8 9 10 11 12
-254.6250 -6614.2250 -1102.4250 -1571.0250 -1101.4250 -723.4250
13 14 15 16 17 18
17683.5167 3541.1750 2285.1750 1373.5750 -4304.4250 -3342.6250
19 20 21 22 23 24
-4883.6250 -5509.2250 4216.5750 2342.9750 -2269.4250 -3798.4250
25 26 27 28 29 30
9367.5167 45238.8833 38812.8833 27696.2833 29053.2833 21629.0833
31 32 33 34 35 36
13180.0833 12394.4833 8669.2833 -5747.3167 -284.7167 1173.2833
37 38 39 40 41 42
-2701.7750 -15316.1167 -17083.1167 -15319.7167 -14600.7167 -19663.9167
43 44 45 46 47 48
-25870.9167 -23281.5167 -33011.7167 -26829.3167 -27267.7167 -29827.7167
49 50 51 52 53 54
-26413.7750 -36212.1167 -25063.1167 -13436.7167 -3300.7167 5413.0833
55 56 57 58 59 60
17829.0833 23010.4833 21228.2833 31804.6833 30923.2833 33176.2833
> postscript(file="/var/www/html/rcomp/tmp/6rxjs1261768976.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 2064.5167 NA
1 2748.1750 2064.5167
2 1048.1750 2748.1750
3 -313.4250 1048.1750
4 -6847.4250 -313.4250
5 -4035.6250 -6847.4250
6 -254.6250 -4035.6250
7 -6614.2250 -254.6250
8 -1102.4250 -6614.2250
9 -1571.0250 -1102.4250
10 -1101.4250 -1571.0250
11 -723.4250 -1101.4250
12 17683.5167 -723.4250
13 3541.1750 17683.5167
14 2285.1750 3541.1750
15 1373.5750 2285.1750
16 -4304.4250 1373.5750
17 -3342.6250 -4304.4250
18 -4883.6250 -3342.6250
19 -5509.2250 -4883.6250
20 4216.5750 -5509.2250
21 2342.9750 4216.5750
22 -2269.4250 2342.9750
23 -3798.4250 -2269.4250
24 9367.5167 -3798.4250
25 45238.8833 9367.5167
26 38812.8833 45238.8833
27 27696.2833 38812.8833
28 29053.2833 27696.2833
29 21629.0833 29053.2833
30 13180.0833 21629.0833
31 12394.4833 13180.0833
32 8669.2833 12394.4833
33 -5747.3167 8669.2833
34 -284.7167 -5747.3167
35 1173.2833 -284.7167
36 -2701.7750 1173.2833
37 -15316.1167 -2701.7750
38 -17083.1167 -15316.1167
39 -15319.7167 -17083.1167
40 -14600.7167 -15319.7167
41 -19663.9167 -14600.7167
42 -25870.9167 -19663.9167
43 -23281.5167 -25870.9167
44 -33011.7167 -23281.5167
45 -26829.3167 -33011.7167
46 -27267.7167 -26829.3167
47 -29827.7167 -27267.7167
48 -26413.7750 -29827.7167
49 -36212.1167 -26413.7750
50 -25063.1167 -36212.1167
51 -13436.7167 -25063.1167
52 -3300.7167 -13436.7167
53 5413.0833 -3300.7167
54 17829.0833 5413.0833
55 23010.4833 17829.0833
56 21228.2833 23010.4833
57 31804.6833 21228.2833
58 30923.2833 31804.6833
59 33176.2833 30923.2833
60 NA 33176.2833
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2748.1750 2064.5167
[2,] 1048.1750 2748.1750
[3,] -313.4250 1048.1750
[4,] -6847.4250 -313.4250
[5,] -4035.6250 -6847.4250
[6,] -254.6250 -4035.6250
[7,] -6614.2250 -254.6250
[8,] -1102.4250 -6614.2250
[9,] -1571.0250 -1102.4250
[10,] -1101.4250 -1571.0250
[11,] -723.4250 -1101.4250
[12,] 17683.5167 -723.4250
[13,] 3541.1750 17683.5167
[14,] 2285.1750 3541.1750
[15,] 1373.5750 2285.1750
[16,] -4304.4250 1373.5750
[17,] -3342.6250 -4304.4250
[18,] -4883.6250 -3342.6250
[19,] -5509.2250 -4883.6250
[20,] 4216.5750 -5509.2250
[21,] 2342.9750 4216.5750
[22,] -2269.4250 2342.9750
[23,] -3798.4250 -2269.4250
[24,] 9367.5167 -3798.4250
[25,] 45238.8833 9367.5167
[26,] 38812.8833 45238.8833
[27,] 27696.2833 38812.8833
[28,] 29053.2833 27696.2833
[29,] 21629.0833 29053.2833
[30,] 13180.0833 21629.0833
[31,] 12394.4833 13180.0833
[32,] 8669.2833 12394.4833
[33,] -5747.3167 8669.2833
[34,] -284.7167 -5747.3167
[35,] 1173.2833 -284.7167
[36,] -2701.7750 1173.2833
[37,] -15316.1167 -2701.7750
[38,] -17083.1167 -15316.1167
[39,] -15319.7167 -17083.1167
[40,] -14600.7167 -15319.7167
[41,] -19663.9167 -14600.7167
[42,] -25870.9167 -19663.9167
[43,] -23281.5167 -25870.9167
[44,] -33011.7167 -23281.5167
[45,] -26829.3167 -33011.7167
[46,] -27267.7167 -26829.3167
[47,] -29827.7167 -27267.7167
[48,] -26413.7750 -29827.7167
[49,] -36212.1167 -26413.7750
[50,] -25063.1167 -36212.1167
[51,] -13436.7167 -25063.1167
[52,] -3300.7167 -13436.7167
[53,] 5413.0833 -3300.7167
[54,] 17829.0833 5413.0833
[55,] 23010.4833 17829.0833
[56,] 21228.2833 23010.4833
[57,] 31804.6833 21228.2833
[58,] 30923.2833 31804.6833
[59,] 33176.2833 30923.2833
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2748.1750 2064.5167
2 1048.1750 2748.1750
3 -313.4250 1048.1750
4 -6847.4250 -313.4250
5 -4035.6250 -6847.4250
6 -254.6250 -4035.6250
7 -6614.2250 -254.6250
8 -1102.4250 -6614.2250
9 -1571.0250 -1102.4250
10 -1101.4250 -1571.0250
11 -723.4250 -1101.4250
12 17683.5167 -723.4250
13 3541.1750 17683.5167
14 2285.1750 3541.1750
15 1373.5750 2285.1750
16 -4304.4250 1373.5750
17 -3342.6250 -4304.4250
18 -4883.6250 -3342.6250
19 -5509.2250 -4883.6250
20 4216.5750 -5509.2250
21 2342.9750 4216.5750
22 -2269.4250 2342.9750
23 -3798.4250 -2269.4250
24 9367.5167 -3798.4250
25 45238.8833 9367.5167
26 38812.8833 45238.8833
27 27696.2833 38812.8833
28 29053.2833 27696.2833
29 21629.0833 29053.2833
30 13180.0833 21629.0833
31 12394.4833 13180.0833
32 8669.2833 12394.4833
33 -5747.3167 8669.2833
34 -284.7167 -5747.3167
35 1173.2833 -284.7167
36 -2701.7750 1173.2833
37 -15316.1167 -2701.7750
38 -17083.1167 -15316.1167
39 -15319.7167 -17083.1167
40 -14600.7167 -15319.7167
41 -19663.9167 -14600.7167
42 -25870.9167 -19663.9167
43 -23281.5167 -25870.9167
44 -33011.7167 -23281.5167
45 -26829.3167 -33011.7167
46 -27267.7167 -26829.3167
47 -29827.7167 -27267.7167
48 -26413.7750 -29827.7167
49 -36212.1167 -26413.7750
50 -25063.1167 -36212.1167
51 -13436.7167 -25063.1167
52 -3300.7167 -13436.7167
53 5413.0833 -3300.7167
54 17829.0833 5413.0833
55 23010.4833 17829.0833
56 21228.2833 23010.4833
57 31804.6833 21228.2833
58 30923.2833 31804.6833
59 33176.2833 30923.2833
> 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/7xomb1261768976.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/8g3491261768976.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/9ef8q1261768976.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/10o1ey1261768976.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/11jszz1261768976.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/12wrn71261768976.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/13dijo1261768976.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/14mqmb1261768976.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/151zh11261768976.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/16jzgg1261768976.tab")
+ }
>
> try(system("convert tmp/1rl591261768976.ps tmp/1rl591261768976.png",intern=TRUE))
character(0)
> try(system("convert tmp/2jb9g1261768976.ps tmp/2jb9g1261768976.png",intern=TRUE))
character(0)
> try(system("convert tmp/3y2kn1261768976.ps tmp/3y2kn1261768976.png",intern=TRUE))
character(0)
> try(system("convert tmp/4bwdw1261768976.ps tmp/4bwdw1261768976.png",intern=TRUE))
character(0)
> try(system("convert tmp/5k5r21261768976.ps tmp/5k5r21261768976.png",intern=TRUE))
character(0)
> try(system("convert tmp/6rxjs1261768976.ps tmp/6rxjs1261768976.png",intern=TRUE))
character(0)
> try(system("convert tmp/7xomb1261768976.ps tmp/7xomb1261768976.png",intern=TRUE))
character(0)
> try(system("convert tmp/8g3491261768976.ps tmp/8g3491261768976.png",intern=TRUE))
character(0)
> try(system("convert tmp/9ef8q1261768976.ps tmp/9ef8q1261768976.png",intern=TRUE))
character(0)
> try(system("convert tmp/10o1ey1261768976.ps tmp/10o1ey1261768976.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.411 1.560 3.426