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(562,573,561,572,555,566,544,555,537,548,543,554,594,605,611,622,613,624,611,622,594,605,595,606,591,602,589,600,584,595,573,584,567,578,569,580,621,632,629,640,628,639,612,623,595,606,597,608,593,604,590,601,580,591,574,585,573,584,573,584,620,631,626,637,620,631,588,599,566,577,557,568,561,572,549,560,532,543,526,537,511,522,499,510,555,566,565,576,542,553,527,538,510,521,514,525,517,528,508,519,493,504,490,501,469,480,478,489,528,539,534,545,518,529,506,517,502,513,516,527,528,539),dim=c(2,61),dimnames=list(c('Y','X'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),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 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
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
1 562 573
2 561 572
3 555 566
4 544 555
5 537 548
6 543 554
7 594 605
8 611 622
9 613 624
10 611 622
11 594 605
12 595 606
13 591 602
14 589 600
15 584 595
16 573 584
17 567 578
18 569 580
19 621 632
20 629 640
21 628 639
22 612 623
23 595 606
24 597 608
25 593 604
26 590 601
27 580 591
28 574 585
29 573 584
30 573 584
31 620 631
32 626 637
33 620 631
34 588 599
35 566 577
36 557 568
37 561 572
38 549 560
39 532 543
40 526 537
41 511 522
42 499 510
43 555 566
44 565 576
45 542 553
46 527 538
47 510 521
48 514 525
49 517 528
50 508 519
51 493 504
52 490 501
53 469 480
54 478 489
55 528 539
56 534 545
57 518 529
58 506 517
59 502 513
60 516 527
61 528 539
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
-11 1
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.408e-14 -1.580e-14 -1.428e-14 -1.203e-14 8.750e-13
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.100e+01 2.028e-13 -5.424e+13 <2e-16 ***
X 1.000e+00 3.547e-16 2.819e+15 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.149e-13 on 59 degrees of freedom
Multiple R-squared: 1, Adjusted R-squared: 1
F-statistic: 7.946e+30 on 1 and 59 DF, p-value: < 2.2e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 1.034718e-06 2.069436e-06 9.999990e-01
[2,] 4.744856e-04 9.489712e-04 9.995255e-01
[3,] 1.000000e+00 1.011138e-35 5.055692e-36
[4,] 6.744715e-01 6.510570e-01 3.255285e-01
[5,] 1.000000e+00 8.657963e-61 4.328981e-61
[6,] 4.842019e-05 9.684039e-05 9.999516e-01
[7,] 1.000000e+00 5.255403e-56 2.627702e-56
[8,] 2.797788e-15 5.595576e-15 1.000000e+00
[9,] 9.994898e-01 1.020323e-03 5.101617e-04
[10,] 4.345108e-01 8.690216e-01 5.654892e-01
[11,] 5.610952e-01 8.778096e-01 4.389048e-01
[12,] 3.868024e-23 7.736048e-23 1.000000e+00
[13,] 1.941591e-22 3.883181e-22 1.000000e+00
[14,] 1.111670e-40 2.223340e-40 1.000000e+00
[15,] 5.938406e-01 8.123187e-01 4.061594e-01
[16,] 1.000000e+00 2.958889e-83 1.479444e-83
[17,] 9.382291e-01 1.235418e-01 6.177089e-02
[18,] 9.999192e-01 1.616241e-04 8.081207e-05
[19,] 9.998695e-01 2.610429e-04 1.305214e-04
[20,] 9.998721e-01 2.557588e-04 1.278794e-04
[21,] 3.240242e-32 6.480484e-32 1.000000e+00
[22,] 3.627900e-25 7.255801e-25 1.000000e+00
[23,] 1.000000e+00 6.497235e-35 3.248618e-35
[24,] 1.000000e+00 1.147244e-54 5.736220e-55
[25,] 1.000000e+00 9.857964e-17 4.928982e-17
[26,] 3.938790e-07 7.877580e-07 9.999996e-01
[27,] 2.949270e-45 5.898539e-45 1.000000e+00
[28,] 2.381870e-03 4.763740e-03 9.976181e-01
[29,] 1.000000e+00 3.384530e-17 1.692265e-17
[30,] 4.898402e-03 9.796804e-03 9.951016e-01
[31,] 9.997524e-01 4.951856e-04 2.475928e-04
[32,] 7.401602e-48 1.480320e-47 1.000000e+00
[33,] 2.518046e-04 5.036091e-04 9.997482e-01
[34,] 4.860152e-01 9.720303e-01 5.139848e-01
[35,] 1.000000e+00 3.389268e-28 1.694634e-28
[36,] 7.603189e-20 1.520638e-19 1.000000e+00
[37,] 1.000000e+00 1.562183e-24 7.810913e-25
[38,] 1.000000e+00 3.688974e-36 1.844487e-36
[39,] 1.000000e+00 4.510000e-23 2.255000e-23
[40,] 6.590613e-04 1.318123e-03 9.993409e-01
[41,] 1.000000e+00 4.490292e-22 2.245146e-22
[42,] 1.000000e+00 1.828123e-13 9.140616e-14
[43,] 1.000000e+00 1.266541e-17 6.332704e-18
[44,] 8.477792e-33 1.695558e-32 1.000000e+00
[45,] 2.369519e-02 4.739038e-02 9.763048e-01
[46,] 1.056088e-54 2.112176e-54 1.000000e+00
[47,] 1.247903e-03 2.495806e-03 9.987521e-01
[48,] 1.000000e+00 4.750750e-10 2.375375e-10
[49,] 3.334930e-45 6.669860e-45 1.000000e+00
[50,] 9.238394e-01 1.523213e-01 7.616064e-02
[51,] 9.483107e-01 1.033786e-01 5.168931e-02
[52,] 2.986325e-01 5.972650e-01 7.013675e-01
> postscript(file="/var/www/html/rcomp/tmp/194q61258732760.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/21gp41258732760.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/3irly1258732760.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/4aott1258732760.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/5npga1258732760.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
8.749829e-13 -1.274652e-14 -1.458400e-14 -1.434817e-14 -1.726636e-14
6 7 8 9 10
-1.578012e-14 -1.202887e-14 -1.788389e-14 -1.146729e-14 -1.788389e-14
11 12 13 14 15
-1.202887e-14 -1.947871e-14 -1.454835e-14 -1.385953e-14 -1.569018e-14
16 17 18 19 20
-1.545435e-14 -1.427606e-14 -1.407670e-14 -1.422259e-14 -2.408331e-14
21 22 23 24 25
-9.528046e-15 -1.112287e-14 -1.947871e-14 -2.016754e-14 -1.878989e-14
26 27 28 29 30
-1.420394e-14 -1.786524e-14 -1.579877e-14 -1.545435e-14 -1.545435e-14
31 32 33 34 35
-1.387817e-14 -2.305008e-14 -1.387817e-14 -1.351511e-14 -1.481982e-14
36 37 38 39 40
-1.394056e-14 -1.443003e-14 -1.251752e-14 -1.199158e-14 -9.925105e-15
41 42 43 44 45
-1.186434e-14 -7.731394e-15 -1.458400e-14 -1.447541e-14 -1.543571e-14
46 47 48 49 50
-1.737494e-14 -1.151993e-14 -1.289758e-14 -1.393082e-14 -1.083111e-14
51 52 53 54 55
-1.987577e-14 -1.884254e-14 -1.160987e-14 -1.470959e-14 -1.061393e-14
56 57 58 59 60
-1.268041e-14 -7.169805e-15 -1.724771e-14 -1.587006e-14 -1.358641e-14
61
-1.061393e-14
> postscript(file="/var/www/html/rcomp/tmp/6acsl1258732760.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 8.749829e-13 NA
1 -1.274652e-14 8.749829e-13
2 -1.458400e-14 -1.274652e-14
3 -1.434817e-14 -1.458400e-14
4 -1.726636e-14 -1.434817e-14
5 -1.578012e-14 -1.726636e-14
6 -1.202887e-14 -1.578012e-14
7 -1.788389e-14 -1.202887e-14
8 -1.146729e-14 -1.788389e-14
9 -1.788389e-14 -1.146729e-14
10 -1.202887e-14 -1.788389e-14
11 -1.947871e-14 -1.202887e-14
12 -1.454835e-14 -1.947871e-14
13 -1.385953e-14 -1.454835e-14
14 -1.569018e-14 -1.385953e-14
15 -1.545435e-14 -1.569018e-14
16 -1.427606e-14 -1.545435e-14
17 -1.407670e-14 -1.427606e-14
18 -1.422259e-14 -1.407670e-14
19 -2.408331e-14 -1.422259e-14
20 -9.528046e-15 -2.408331e-14
21 -1.112287e-14 -9.528046e-15
22 -1.947871e-14 -1.112287e-14
23 -2.016754e-14 -1.947871e-14
24 -1.878989e-14 -2.016754e-14
25 -1.420394e-14 -1.878989e-14
26 -1.786524e-14 -1.420394e-14
27 -1.579877e-14 -1.786524e-14
28 -1.545435e-14 -1.579877e-14
29 -1.545435e-14 -1.545435e-14
30 -1.387817e-14 -1.545435e-14
31 -2.305008e-14 -1.387817e-14
32 -1.387817e-14 -2.305008e-14
33 -1.351511e-14 -1.387817e-14
34 -1.481982e-14 -1.351511e-14
35 -1.394056e-14 -1.481982e-14
36 -1.443003e-14 -1.394056e-14
37 -1.251752e-14 -1.443003e-14
38 -1.199158e-14 -1.251752e-14
39 -9.925105e-15 -1.199158e-14
40 -1.186434e-14 -9.925105e-15
41 -7.731394e-15 -1.186434e-14
42 -1.458400e-14 -7.731394e-15
43 -1.447541e-14 -1.458400e-14
44 -1.543571e-14 -1.447541e-14
45 -1.737494e-14 -1.543571e-14
46 -1.151993e-14 -1.737494e-14
47 -1.289758e-14 -1.151993e-14
48 -1.393082e-14 -1.289758e-14
49 -1.083111e-14 -1.393082e-14
50 -1.987577e-14 -1.083111e-14
51 -1.884254e-14 -1.987577e-14
52 -1.160987e-14 -1.884254e-14
53 -1.470959e-14 -1.160987e-14
54 -1.061393e-14 -1.470959e-14
55 -1.268041e-14 -1.061393e-14
56 -7.169805e-15 -1.268041e-14
57 -1.724771e-14 -7.169805e-15
58 -1.587006e-14 -1.724771e-14
59 -1.358641e-14 -1.587006e-14
60 -1.061393e-14 -1.358641e-14
61 NA -1.061393e-14
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.274652e-14 8.749829e-13
[2,] -1.458400e-14 -1.274652e-14
[3,] -1.434817e-14 -1.458400e-14
[4,] -1.726636e-14 -1.434817e-14
[5,] -1.578012e-14 -1.726636e-14
[6,] -1.202887e-14 -1.578012e-14
[7,] -1.788389e-14 -1.202887e-14
[8,] -1.146729e-14 -1.788389e-14
[9,] -1.788389e-14 -1.146729e-14
[10,] -1.202887e-14 -1.788389e-14
[11,] -1.947871e-14 -1.202887e-14
[12,] -1.454835e-14 -1.947871e-14
[13,] -1.385953e-14 -1.454835e-14
[14,] -1.569018e-14 -1.385953e-14
[15,] -1.545435e-14 -1.569018e-14
[16,] -1.427606e-14 -1.545435e-14
[17,] -1.407670e-14 -1.427606e-14
[18,] -1.422259e-14 -1.407670e-14
[19,] -2.408331e-14 -1.422259e-14
[20,] -9.528046e-15 -2.408331e-14
[21,] -1.112287e-14 -9.528046e-15
[22,] -1.947871e-14 -1.112287e-14
[23,] -2.016754e-14 -1.947871e-14
[24,] -1.878989e-14 -2.016754e-14
[25,] -1.420394e-14 -1.878989e-14
[26,] -1.786524e-14 -1.420394e-14
[27,] -1.579877e-14 -1.786524e-14
[28,] -1.545435e-14 -1.579877e-14
[29,] -1.545435e-14 -1.545435e-14
[30,] -1.387817e-14 -1.545435e-14
[31,] -2.305008e-14 -1.387817e-14
[32,] -1.387817e-14 -2.305008e-14
[33,] -1.351511e-14 -1.387817e-14
[34,] -1.481982e-14 -1.351511e-14
[35,] -1.394056e-14 -1.481982e-14
[36,] -1.443003e-14 -1.394056e-14
[37,] -1.251752e-14 -1.443003e-14
[38,] -1.199158e-14 -1.251752e-14
[39,] -9.925105e-15 -1.199158e-14
[40,] -1.186434e-14 -9.925105e-15
[41,] -7.731394e-15 -1.186434e-14
[42,] -1.458400e-14 -7.731394e-15
[43,] -1.447541e-14 -1.458400e-14
[44,] -1.543571e-14 -1.447541e-14
[45,] -1.737494e-14 -1.543571e-14
[46,] -1.151993e-14 -1.737494e-14
[47,] -1.289758e-14 -1.151993e-14
[48,] -1.393082e-14 -1.289758e-14
[49,] -1.083111e-14 -1.393082e-14
[50,] -1.987577e-14 -1.083111e-14
[51,] -1.884254e-14 -1.987577e-14
[52,] -1.160987e-14 -1.884254e-14
[53,] -1.470959e-14 -1.160987e-14
[54,] -1.061393e-14 -1.470959e-14
[55,] -1.268041e-14 -1.061393e-14
[56,] -7.169805e-15 -1.268041e-14
[57,] -1.724771e-14 -7.169805e-15
[58,] -1.587006e-14 -1.724771e-14
[59,] -1.358641e-14 -1.587006e-14
[60,] -1.061393e-14 -1.358641e-14
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.274652e-14 8.749829e-13
2 -1.458400e-14 -1.274652e-14
3 -1.434817e-14 -1.458400e-14
4 -1.726636e-14 -1.434817e-14
5 -1.578012e-14 -1.726636e-14
6 -1.202887e-14 -1.578012e-14
7 -1.788389e-14 -1.202887e-14
8 -1.146729e-14 -1.788389e-14
9 -1.788389e-14 -1.146729e-14
10 -1.202887e-14 -1.788389e-14
11 -1.947871e-14 -1.202887e-14
12 -1.454835e-14 -1.947871e-14
13 -1.385953e-14 -1.454835e-14
14 -1.569018e-14 -1.385953e-14
15 -1.545435e-14 -1.569018e-14
16 -1.427606e-14 -1.545435e-14
17 -1.407670e-14 -1.427606e-14
18 -1.422259e-14 -1.407670e-14
19 -2.408331e-14 -1.422259e-14
20 -9.528046e-15 -2.408331e-14
21 -1.112287e-14 -9.528046e-15
22 -1.947871e-14 -1.112287e-14
23 -2.016754e-14 -1.947871e-14
24 -1.878989e-14 -2.016754e-14
25 -1.420394e-14 -1.878989e-14
26 -1.786524e-14 -1.420394e-14
27 -1.579877e-14 -1.786524e-14
28 -1.545435e-14 -1.579877e-14
29 -1.545435e-14 -1.545435e-14
30 -1.387817e-14 -1.545435e-14
31 -2.305008e-14 -1.387817e-14
32 -1.387817e-14 -2.305008e-14
33 -1.351511e-14 -1.387817e-14
34 -1.481982e-14 -1.351511e-14
35 -1.394056e-14 -1.481982e-14
36 -1.443003e-14 -1.394056e-14
37 -1.251752e-14 -1.443003e-14
38 -1.199158e-14 -1.251752e-14
39 -9.925105e-15 -1.199158e-14
40 -1.186434e-14 -9.925105e-15
41 -7.731394e-15 -1.186434e-14
42 -1.458400e-14 -7.731394e-15
43 -1.447541e-14 -1.458400e-14
44 -1.543571e-14 -1.447541e-14
45 -1.737494e-14 -1.543571e-14
46 -1.151993e-14 -1.737494e-14
47 -1.289758e-14 -1.151993e-14
48 -1.393082e-14 -1.289758e-14
49 -1.083111e-14 -1.393082e-14
50 -1.987577e-14 -1.083111e-14
51 -1.884254e-14 -1.987577e-14
52 -1.160987e-14 -1.884254e-14
53 -1.470959e-14 -1.160987e-14
54 -1.061393e-14 -1.470959e-14
55 -1.268041e-14 -1.061393e-14
56 -7.169805e-15 -1.268041e-14
57 -1.724771e-14 -7.169805e-15
58 -1.587006e-14 -1.724771e-14
59 -1.358641e-14 -1.587006e-14
60 -1.061393e-14 -1.358641e-14
> 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/7g2dj1258732760.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/86awc1258732760.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/9e5kh1258732760.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/10e7g51258732760.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/11smsa1258732760.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/12l0bk1258732760.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/13xt381258732760.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/14ip1e1258732760.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/158khk1258732760.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/16jdhw1258732760.tab")
+ }
>
> system("convert tmp/194q61258732760.ps tmp/194q61258732760.png")
> system("convert tmp/21gp41258732760.ps tmp/21gp41258732760.png")
> system("convert tmp/3irly1258732760.ps tmp/3irly1258732760.png")
> system("convert tmp/4aott1258732760.ps tmp/4aott1258732760.png")
> system("convert tmp/5npga1258732760.ps tmp/5npga1258732760.png")
> system("convert tmp/6acsl1258732760.ps tmp/6acsl1258732760.png")
> system("convert tmp/7g2dj1258732760.ps tmp/7g2dj1258732760.png")
> system("convert tmp/86awc1258732760.ps tmp/86awc1258732760.png")
> system("convert tmp/9e5kh1258732760.ps tmp/9e5kh1258732760.png")
> system("convert tmp/10e7g51258732760.ps tmp/10e7g51258732760.png")
>
>
> proc.time()
user system elapsed
2.500 1.562 2.891