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,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,506174,1,501866,1,516141,1,528222,1,532638,1,536322,1,536535,1,523597,1,536214,1,586570,1,596594,1),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 0 1 0 0 0 0 0 0 0 0 0 0
2 611324 0 0 1 0 0 0 0 0 0 0 0 0
3 594167 0 0 0 1 0 0 0 0 0 0 0 0
4 595454 0 0 0 0 1 0 0 0 0 0 0 0
5 590865 0 0 0 0 0 1 0 0 0 0 0 0
6 589379 0 0 0 0 0 0 1 0 0 0 0 0
7 584428 0 0 0 0 0 0 0 1 0 0 0 0
8 573100 0 0 0 0 0 0 0 0 1 0 0 0
9 567456 0 0 0 0 0 0 0 0 0 1 0 0
10 569028 0 0 0 0 0 0 0 0 0 0 1 0
11 620735 0 0 0 0 0 0 0 0 0 0 0 1
12 628884 0 0 0 0 0 0 0 0 0 0 0 0
13 628232 0 1 0 0 0 0 0 0 0 0 0 0
14 612117 0 0 1 0 0 0 0 0 0 0 0 0
15 595404 0 0 0 1 0 0 0 0 0 0 0 0
16 597141 0 0 0 0 1 0 0 0 0 0 0 0
17 593408 0 0 0 0 0 1 0 0 0 0 0 0
18 590072 0 0 0 0 0 0 1 0 0 0 0 0
19 579799 0 0 0 0 0 0 0 1 0 0 0 0
20 574205 0 0 0 0 0 0 0 0 1 0 0 0
21 572775 0 0 0 0 0 0 0 0 0 1 0 0
22 572942 0 0 0 0 0 0 0 0 0 0 1 0
23 619567 0 0 0 0 0 0 0 0 0 0 0 1
24 625809 0 0 0 0 0 0 0 0 0 0 0 0
25 619916 0 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 1 0 0 0 0 1 0 0 0 0 0 0
30 548854 1 0 0 0 0 0 1 0 0 0 0 0
31 531673 1 0 0 0 0 0 0 1 0 0 0 0
32 525919 1 0 0 0 0 0 0 0 1 0 0 0
33 511038 1 0 0 0 0 0 0 0 0 1 0 0
34 498662 1 0 0 0 0 0 0 0 0 0 1 0
35 555362 1 0 0 0 0 0 0 0 0 0 0 1
36 564591 1 0 0 0 0 0 0 0 0 0 0 0
37 541657 1 1 0 0 0 0 0 0 0 0 0 0
38 527070 1 0 1 0 0 0 0 0 0 0 0 0
39 509846 1 0 0 1 0 0 0 0 0 0 0 0
40 514258 1 0 0 0 1 0 0 0 0 0 0 0
41 516922 1 0 0 0 0 1 0 0 0 0 0 0
42 507561 1 0 0 0 0 0 1 0 0 0 0 0
43 492622 1 0 0 0 0 0 0 1 0 0 0 0
44 490243 1 0 0 0 0 0 0 0 1 0 0 0
45 469357 1 0 0 0 0 0 0 0 0 1 0 0
46 477580 1 0 0 0 0 0 0 0 0 0 1 0
47 528379 1 0 0 0 0 0 0 0 0 0 0 1
48 533590 1 0 0 0 0 0 0 0 0 0 0 0
49 517945 1 1 0 0 0 0 0 0 0 0 0 0
50 506174 1 0 1 0 0 0 0 0 0 0 0 0
51 501866 1 0 0 1 0 0 0 0 0 0 0 0
52 516141 1 0 0 0 1 0 0 0 0 0 0 0
53 528222 1 0 0 0 0 1 0 0 0 0 0 0
54 532638 1 0 0 0 0 0 1 0 0 0 0 0
55 536322 1 0 0 0 0 0 0 1 0 0 0 0
56 536535 1 0 0 0 0 0 0 0 1 0 0 0
57 523597 1 0 0 0 0 0 0 0 0 1 0 0
58 536214 1 0 0 0 0 0 0 0 0 0 1 0
59 586570 1 0 0 0 0 0 0 0 0 0 0 1
60 596594 1 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
630954 -68434 -19508 -34718 -50175 -47527
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
-32114 -8019 -1836 13316 34074
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 630954 8652 72.926 < 2e-16 ***
dummies -68434 4807 -14.237 < 2e-16 ***
M1 -19508 11576 -1.685 0.098581 .
M2 -34718 11576 -2.999 0.004319 **
M3 -50175 11576 -4.334 7.65e-05 ***
M4 -47527 11576 -4.106 0.000160 ***
M5 -31895 11536 -2.765 0.008111 **
M6 -36193 11536 -3.137 0.002941 **
M7 -44925 11536 -3.894 0.000310 ***
M8 -49893 11536 -4.325 7.89e-05 ***
M9 -61049 11536 -5.292 3.11e-06 ***
M10 -59008 11536 -5.115 5.69e-06 ***
M11 -7771 11536 -0.674 0.503847
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 18240 on 47 degrees of freedom
Multiple R-squared: 0.852, Adjusted R-squared: 0.8142
F-statistic: 22.55 on 12 and 47 DF, p-value: 1.593e-15
> 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,] 4.094286e-02 8.188572e-02 0.9590571
[2,] 1.074152e-02 2.148304e-02 0.9892585
[3,] 2.436777e-03 4.873555e-03 0.9975632
[4,] 6.301630e-04 1.260326e-03 0.9993698
[5,] 1.265452e-04 2.530904e-04 0.9998735
[6,] 3.343144e-05 6.686288e-05 0.9999666
[7,] 7.300204e-06 1.460041e-05 0.9999927
[8,] 1.254685e-06 2.509370e-06 0.9999987
[9,] 2.320605e-07 4.641210e-07 0.9999998
[10,] 4.491713e-08 8.983426e-08 1.0000000
[11,] 1.098753e-05 2.197506e-05 0.9999890
[12,] 2.025023e-04 4.050046e-04 0.9997975
[13,] 2.813390e-03 5.626780e-03 0.9971866
[14,] 1.946036e-03 3.892073e-03 0.9980540
[15,] 1.213220e-03 2.426441e-03 0.9987868
[16,] 7.286746e-04 1.457349e-03 0.9992713
[17,] 3.338863e-04 6.677726e-04 0.9996661
[18,] 2.168047e-04 4.336095e-04 0.9997832
[19,] 2.452860e-04 4.905720e-04 0.9997547
[20,] 1.261748e-04 2.523495e-04 0.9998738
[21,] 5.350339e-05 1.070068e-04 0.9999465
[22,] 6.497553e-05 1.299511e-04 0.9999350
[23,] 4.931154e-05 9.862307e-05 0.9999507
[24,] 2.501189e-05 5.002378e-05 0.9999750
[25,] 8.624113e-06 1.724823e-05 0.9999914
[26,] 6.433775e-06 1.286755e-05 0.9999936
[27,] 6.618573e-06 1.323715e-05 0.9999934
[28,] 1.396406e-05 2.792812e-05 0.9999860
[29,] 2.064771e-05 4.129543e-05 0.9999794
> postscript(file="/var/www/html/rcomp/tmp/1n2is1262207793.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/2181t1262207793.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/3hr3w1262207793.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/4b92d1262207793.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/5ner91262207793.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
1166.7278 15088.3278 13388.3278 12026.7278 -8194.1083 -5382.3083
7 8 9 10 11 12
-1601.3083 -7960.9083 -2449.1083 -2917.7083 -2448.1083 -2070.1083
13 14 15 16 17 18
16785.7278 15881.3278 14625.3278 13713.7278 -5651.1083 -4689.3083
19 20 21 22 23 24
-6230.3083 -6855.9083 2869.8917 996.2917 -3616.1083 -5145.1083
25 26 27 28 29 30
8469.7278 -8610.6722 -15036.6722 -26153.2722 29951.0722 22526.8722
31 32 33 34 35 36
14077.8722 13292.2722 9567.0722 -4849.5278 613.0722 2071.0722
37 38 39 40 41 42
-1355.0917 -731.4917 -2498.4917 -735.0917 -13702.9278 -18766.1278
43 44 45 46 47 48
-24973.1278 -22383.7278 -32113.9278 -25931.5278 -26369.9278 -28929.9278
49 50 51 52 53 54
-25067.0917 -21627.4917 -10478.4917 1147.9083 -2402.9278 6310.8722
55 56 57 58 59 60
18726.8722 23908.2722 22126.0722 32702.4722 31821.0722 34074.0722
> postscript(file="/var/www/html/rcomp/tmp/6g6981262207793.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 1166.7278 NA
1 15088.3278 1166.7278
2 13388.3278 15088.3278
3 12026.7278 13388.3278
4 -8194.1083 12026.7278
5 -5382.3083 -8194.1083
6 -1601.3083 -5382.3083
7 -7960.9083 -1601.3083
8 -2449.1083 -7960.9083
9 -2917.7083 -2449.1083
10 -2448.1083 -2917.7083
11 -2070.1083 -2448.1083
12 16785.7278 -2070.1083
13 15881.3278 16785.7278
14 14625.3278 15881.3278
15 13713.7278 14625.3278
16 -5651.1083 13713.7278
17 -4689.3083 -5651.1083
18 -6230.3083 -4689.3083
19 -6855.9083 -6230.3083
20 2869.8917 -6855.9083
21 996.2917 2869.8917
22 -3616.1083 996.2917
23 -5145.1083 -3616.1083
24 8469.7278 -5145.1083
25 -8610.6722 8469.7278
26 -15036.6722 -8610.6722
27 -26153.2722 -15036.6722
28 29951.0722 -26153.2722
29 22526.8722 29951.0722
30 14077.8722 22526.8722
31 13292.2722 14077.8722
32 9567.0722 13292.2722
33 -4849.5278 9567.0722
34 613.0722 -4849.5278
35 2071.0722 613.0722
36 -1355.0917 2071.0722
37 -731.4917 -1355.0917
38 -2498.4917 -731.4917
39 -735.0917 -2498.4917
40 -13702.9278 -735.0917
41 -18766.1278 -13702.9278
42 -24973.1278 -18766.1278
43 -22383.7278 -24973.1278
44 -32113.9278 -22383.7278
45 -25931.5278 -32113.9278
46 -26369.9278 -25931.5278
47 -28929.9278 -26369.9278
48 -25067.0917 -28929.9278
49 -21627.4917 -25067.0917
50 -10478.4917 -21627.4917
51 1147.9083 -10478.4917
52 -2402.9278 1147.9083
53 6310.8722 -2402.9278
54 18726.8722 6310.8722
55 23908.2722 18726.8722
56 22126.0722 23908.2722
57 32702.4722 22126.0722
58 31821.0722 32702.4722
59 34074.0722 31821.0722
60 NA 34074.0722
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 15088.3278 1166.7278
[2,] 13388.3278 15088.3278
[3,] 12026.7278 13388.3278
[4,] -8194.1083 12026.7278
[5,] -5382.3083 -8194.1083
[6,] -1601.3083 -5382.3083
[7,] -7960.9083 -1601.3083
[8,] -2449.1083 -7960.9083
[9,] -2917.7083 -2449.1083
[10,] -2448.1083 -2917.7083
[11,] -2070.1083 -2448.1083
[12,] 16785.7278 -2070.1083
[13,] 15881.3278 16785.7278
[14,] 14625.3278 15881.3278
[15,] 13713.7278 14625.3278
[16,] -5651.1083 13713.7278
[17,] -4689.3083 -5651.1083
[18,] -6230.3083 -4689.3083
[19,] -6855.9083 -6230.3083
[20,] 2869.8917 -6855.9083
[21,] 996.2917 2869.8917
[22,] -3616.1083 996.2917
[23,] -5145.1083 -3616.1083
[24,] 8469.7278 -5145.1083
[25,] -8610.6722 8469.7278
[26,] -15036.6722 -8610.6722
[27,] -26153.2722 -15036.6722
[28,] 29951.0722 -26153.2722
[29,] 22526.8722 29951.0722
[30,] 14077.8722 22526.8722
[31,] 13292.2722 14077.8722
[32,] 9567.0722 13292.2722
[33,] -4849.5278 9567.0722
[34,] 613.0722 -4849.5278
[35,] 2071.0722 613.0722
[36,] -1355.0917 2071.0722
[37,] -731.4917 -1355.0917
[38,] -2498.4917 -731.4917
[39,] -735.0917 -2498.4917
[40,] -13702.9278 -735.0917
[41,] -18766.1278 -13702.9278
[42,] -24973.1278 -18766.1278
[43,] -22383.7278 -24973.1278
[44,] -32113.9278 -22383.7278
[45,] -25931.5278 -32113.9278
[46,] -26369.9278 -25931.5278
[47,] -28929.9278 -26369.9278
[48,] -25067.0917 -28929.9278
[49,] -21627.4917 -25067.0917
[50,] -10478.4917 -21627.4917
[51,] 1147.9083 -10478.4917
[52,] -2402.9278 1147.9083
[53,] 6310.8722 -2402.9278
[54,] 18726.8722 6310.8722
[55,] 23908.2722 18726.8722
[56,] 22126.0722 23908.2722
[57,] 32702.4722 22126.0722
[58,] 31821.0722 32702.4722
[59,] 34074.0722 31821.0722
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 15088.3278 1166.7278
2 13388.3278 15088.3278
3 12026.7278 13388.3278
4 -8194.1083 12026.7278
5 -5382.3083 -8194.1083
6 -1601.3083 -5382.3083
7 -7960.9083 -1601.3083
8 -2449.1083 -7960.9083
9 -2917.7083 -2449.1083
10 -2448.1083 -2917.7083
11 -2070.1083 -2448.1083
12 16785.7278 -2070.1083
13 15881.3278 16785.7278
14 14625.3278 15881.3278
15 13713.7278 14625.3278
16 -5651.1083 13713.7278
17 -4689.3083 -5651.1083
18 -6230.3083 -4689.3083
19 -6855.9083 -6230.3083
20 2869.8917 -6855.9083
21 996.2917 2869.8917
22 -3616.1083 996.2917
23 -5145.1083 -3616.1083
24 8469.7278 -5145.1083
25 -8610.6722 8469.7278
26 -15036.6722 -8610.6722
27 -26153.2722 -15036.6722
28 29951.0722 -26153.2722
29 22526.8722 29951.0722
30 14077.8722 22526.8722
31 13292.2722 14077.8722
32 9567.0722 13292.2722
33 -4849.5278 9567.0722
34 613.0722 -4849.5278
35 2071.0722 613.0722
36 -1355.0917 2071.0722
37 -731.4917 -1355.0917
38 -2498.4917 -731.4917
39 -735.0917 -2498.4917
40 -13702.9278 -735.0917
41 -18766.1278 -13702.9278
42 -24973.1278 -18766.1278
43 -22383.7278 -24973.1278
44 -32113.9278 -22383.7278
45 -25931.5278 -32113.9278
46 -26369.9278 -25931.5278
47 -28929.9278 -26369.9278
48 -25067.0917 -28929.9278
49 -21627.4917 -25067.0917
50 -10478.4917 -21627.4917
51 1147.9083 -10478.4917
52 -2402.9278 1147.9083
53 6310.8722 -2402.9278
54 18726.8722 6310.8722
55 23908.2722 18726.8722
56 22126.0722 23908.2722
57 32702.4722 22126.0722
58 31821.0722 32702.4722
59 34074.0722 31821.0722
> 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/7fsrv1262207793.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/8dcg31262207793.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/9yuef1262207793.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/10q59c1262207793.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/11b4321262207793.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/12oj121262207793.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/13si151262207793.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/1430qn1262207793.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/15ocxl1262207793.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/163i4z1262207794.tab")
+ }
>
> try(system("convert tmp/1n2is1262207793.ps tmp/1n2is1262207793.png",intern=TRUE))
character(0)
> try(system("convert tmp/2181t1262207793.ps tmp/2181t1262207793.png",intern=TRUE))
character(0)
> try(system("convert tmp/3hr3w1262207793.ps tmp/3hr3w1262207793.png",intern=TRUE))
character(0)
> try(system("convert tmp/4b92d1262207793.ps tmp/4b92d1262207793.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ner91262207793.ps tmp/5ner91262207793.png",intern=TRUE))
character(0)
> try(system("convert tmp/6g6981262207793.ps tmp/6g6981262207793.png",intern=TRUE))
character(0)
> try(system("convert tmp/7fsrv1262207793.ps tmp/7fsrv1262207793.png",intern=TRUE))
character(0)
> try(system("convert tmp/8dcg31262207793.ps tmp/8dcg31262207793.png",intern=TRUE))
character(0)
> try(system("convert tmp/9yuef1262207793.ps tmp/9yuef1262207793.png",intern=TRUE))
character(0)
> try(system("convert tmp/10q59c1262207793.ps tmp/10q59c1262207793.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.389 1.556 2.923