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(23,25.7,19,24.7,18,24.2,19,23.6,19,24.4,22,22.5,23,19.4,20,18.1,14,18.1,14,20.7,14,19.1,15,18.3,11,16.9,17,17.9,16,20.2,20,21.2,24,23.8,23,24,20,26.6,21,25.3,19,27.6,23,24.7,23,26.6,23,24.4,23,24.6,27,26,26,24.8,17,24,24,22.7,26,23,24,24.1,27,24,27,22.7,26,22.6,24,23.1,23,24.4,23,23,24,22,17,21.3,21,21.5,19,21.3,22,23.2,22,21.8,18,23.3,16,21,14,22.4,12,20.4,14,19.9,16,21.3,8,18.9,3,15.6,0,12.5,5,7.8,1,5.5,1,4,3,3.3,6,3.7,7,3.1,8,5,14,6.3),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 = '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
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 23 25.7 1 0 0 0 0 0 0 0 0 0 0
2 19 24.7 0 1 0 0 0 0 0 0 0 0 0
3 18 24.2 0 0 1 0 0 0 0 0 0 0 0
4 19 23.6 0 0 0 1 0 0 0 0 0 0 0
5 19 24.4 0 0 0 0 1 0 0 0 0 0 0
6 22 22.5 0 0 0 0 0 1 0 0 0 0 0
7 23 19.4 0 0 0 0 0 0 1 0 0 0 0
8 20 18.1 0 0 0 0 0 0 0 1 0 0 0
9 14 18.1 0 0 0 0 0 0 0 0 1 0 0
10 14 20.7 0 0 0 0 0 0 0 0 0 1 0
11 14 19.1 0 0 0 0 0 0 0 0 0 0 1
12 15 18.3 0 0 0 0 0 0 0 0 0 0 0
13 11 16.9 1 0 0 0 0 0 0 0 0 0 0
14 17 17.9 0 1 0 0 0 0 0 0 0 0 0
15 16 20.2 0 0 1 0 0 0 0 0 0 0 0
16 20 21.2 0 0 0 1 0 0 0 0 0 0 0
17 24 23.8 0 0 0 0 1 0 0 0 0 0 0
18 23 24.0 0 0 0 0 0 1 0 0 0 0 0
19 20 26.6 0 0 0 0 0 0 1 0 0 0 0
20 21 25.3 0 0 0 0 0 0 0 1 0 0 0
21 19 27.6 0 0 0 0 0 0 0 0 1 0 0
22 23 24.7 0 0 0 0 0 0 0 0 0 1 0
23 23 26.6 0 0 0 0 0 0 0 0 0 0 1
24 23 24.4 0 0 0 0 0 0 0 0 0 0 0
25 23 24.6 1 0 0 0 0 0 0 0 0 0 0
26 27 26.0 0 1 0 0 0 0 0 0 0 0 0
27 26 24.8 0 0 1 0 0 0 0 0 0 0 0
28 17 24.0 0 0 0 1 0 0 0 0 0 0 0
29 24 22.7 0 0 0 0 1 0 0 0 0 0 0
30 26 23.0 0 0 0 0 0 1 0 0 0 0 0
31 24 24.1 0 0 0 0 0 0 1 0 0 0 0
32 27 24.0 0 0 0 0 0 0 0 1 0 0 0
33 27 22.7 0 0 0 0 0 0 0 0 1 0 0
34 26 22.6 0 0 0 0 0 0 0 0 0 1 0
35 24 23.1 0 0 0 0 0 0 0 0 0 0 1
36 23 24.4 0 0 0 0 0 0 0 0 0 0 0
37 23 23.0 1 0 0 0 0 0 0 0 0 0 0
38 24 22.0 0 1 0 0 0 0 0 0 0 0 0
39 17 21.3 0 0 1 0 0 0 0 0 0 0 0
40 21 21.5 0 0 0 1 0 0 0 0 0 0 0
41 19 21.3 0 0 0 0 1 0 0 0 0 0 0
42 22 23.2 0 0 0 0 0 1 0 0 0 0 0
43 22 21.8 0 0 0 0 0 0 1 0 0 0 0
44 18 23.3 0 0 0 0 0 0 0 1 0 0 0
45 16 21.0 0 0 0 0 0 0 0 0 1 0 0
46 14 22.4 0 0 0 0 0 0 0 0 0 1 0
47 12 20.4 0 0 0 0 0 0 0 0 0 0 1
48 14 19.9 0 0 0 0 0 0 0 0 0 0 0
49 16 21.3 1 0 0 0 0 0 0 0 0 0 0
50 8 18.9 0 1 0 0 0 0 0 0 0 0 0
51 3 15.6 0 0 1 0 0 0 0 0 0 0 0
52 0 12.5 0 0 0 1 0 0 0 0 0 0 0
53 5 7.8 0 0 0 0 1 0 0 0 0 0 0
54 1 5.5 0 0 0 0 0 1 0 0 0 0 0
55 1 4.0 0 0 0 0 0 0 1 0 0 0 0
56 3 3.3 0 0 0 0 0 0 0 1 0 0 0
57 6 3.7 0 0 0 0 0 0 0 0 1 0 0
58 7 3.1 0 0 0 0 0 0 0 0 0 1 0
59 8 5.0 0 0 0 0 0 0 0 0 0 0 1
60 14 6.3 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) X M1 M2 M3 M4
0.60178 0.92166 -1.95485 -1.78619 -4.15946 -4.15116
M5 M6 M7 M8 M9 M10
-0.83503 0.09677 -0.27926 -0.12903 -1.36313 -1.03687
M11
-1.76590
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-8.23501 -2.64287 0.05022 3.32143 7.59175
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.60178 2.58434 0.233 0.817
X 0.92166 0.08917 10.337 1.09e-13 ***
M1 -1.95485 2.81536 -0.694 0.491
M2 -1.78619 2.81148 -0.635 0.528
M3 -4.15946 2.80589 -1.482 0.145
M4 -4.15116 2.80172 -1.482 0.145
M5 -0.83503 2.79915 -0.298 0.767
M6 0.09677 2.79796 0.035 0.973
M7 -0.27926 2.79698 -0.100 0.921
M8 -0.12903 2.79662 -0.046 0.963
M9 -1.36313 2.79660 -0.487 0.628
M10 -1.03687 2.79660 -0.371 0.712
M11 -1.76590 2.79664 -0.631 0.531
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 4.422 on 47 degrees of freedom
Multiple R-squared: 0.7033, Adjusted R-squared: 0.6275
F-statistic: 9.283 on 12 and 47 DF, p-value: 8.098e-09
> 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.18032727 0.36065454 0.8196727
[2,] 0.17345064 0.34690129 0.8265494
[3,] 0.08429642 0.16859284 0.9157036
[4,] 0.14332843 0.28665685 0.8566716
[5,] 0.08719204 0.17438408 0.9128080
[6,] 0.05676269 0.11352538 0.9432373
[7,] 0.07054751 0.14109502 0.9294525
[8,] 0.05415687 0.10831374 0.9458431
[9,] 0.03759552 0.07519104 0.9624045
[10,] 0.02636530 0.05273059 0.9736347
[11,] 0.02803284 0.05606568 0.9719672
[12,] 0.05030105 0.10060209 0.9496990
[13,] 0.03571891 0.07143782 0.9642811
[14,] 0.02643309 0.05286619 0.9735669
[15,] 0.02201658 0.04403316 0.9779834
[16,] 0.01254288 0.02508577 0.9874571
[17,] 0.01220050 0.02440099 0.9877995
[18,] 0.03694048 0.07388096 0.9630595
[19,] 0.05019235 0.10038470 0.9498076
[20,] 0.04541827 0.09083654 0.9545817
[21,] 0.02630173 0.05260347 0.9736983
[22,] 0.01923007 0.03846013 0.9807699
[23,] 0.03727644 0.07455287 0.9627236
[24,] 0.04036554 0.08073108 0.9596345
[25,] 0.13396510 0.26793019 0.8660349
[26,] 0.09962302 0.19924605 0.9003770
[27,] 0.16073375 0.32146749 0.8392663
[28,] 0.49352462 0.98704925 0.5064754
[29,] 0.68077159 0.63845681 0.3192284
> postscript(file="/var/www/html/rcomp/tmp/13q8x1258624117.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/2gfo51258624117.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/3m2ky1258624117.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/4j5be1258624117.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/51z241258624117.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
0.66634798 -2.58065461 -0.74655383 0.79814643 -3.25531438 0.56404565
7 8 9 10 11 12
4.79723428 2.84516365 -1.92073557 -4.64332472 -2.43963221 -2.46820155
13 14 15 16 17 18
-3.22302326 1.68664944 0.94009561 4.01013609 2.29768304 0.18155211
19 20 21 22 23 24
-4.83873470 -2.79080533 -5.67652798 0.67002585 -0.35209991 -0.09034194
25 26 27 28 29 30
1.68017657 4.22118433 6.70044875 -1.57051852 3.31151163 4.10321447
31 32 33 34 35 36
1.46542119 4.40735573 6.83961757 5.60551680 3.87371835 -0.09034194
37 38 39 40 41 42
3.15483635 4.90783376 0.92626701 4.73363738 -0.39816107 -0.08111800
43 44 45 46 47 48
1.58524462 -3.94748062 -2.59355641 -6.21015073 -5.63779328 -4.94286133
49 50 51 52 53 54
-2.27833764 -8.23501292 -7.82025754 -7.97140139 -1.95571922 -4.76769424
55 56 57 58 59 60
-3.00916539 -0.51423343 3.35120240 4.57793280 4.55580705 7.59174676
> postscript(file="/var/www/html/rcomp/tmp/6b2f61258624117.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 0.66634798 NA
1 -2.58065461 0.66634798
2 -0.74655383 -2.58065461
3 0.79814643 -0.74655383
4 -3.25531438 0.79814643
5 0.56404565 -3.25531438
6 4.79723428 0.56404565
7 2.84516365 4.79723428
8 -1.92073557 2.84516365
9 -4.64332472 -1.92073557
10 -2.43963221 -4.64332472
11 -2.46820155 -2.43963221
12 -3.22302326 -2.46820155
13 1.68664944 -3.22302326
14 0.94009561 1.68664944
15 4.01013609 0.94009561
16 2.29768304 4.01013609
17 0.18155211 2.29768304
18 -4.83873470 0.18155211
19 -2.79080533 -4.83873470
20 -5.67652798 -2.79080533
21 0.67002585 -5.67652798
22 -0.35209991 0.67002585
23 -0.09034194 -0.35209991
24 1.68017657 -0.09034194
25 4.22118433 1.68017657
26 6.70044875 4.22118433
27 -1.57051852 6.70044875
28 3.31151163 -1.57051852
29 4.10321447 3.31151163
30 1.46542119 4.10321447
31 4.40735573 1.46542119
32 6.83961757 4.40735573
33 5.60551680 6.83961757
34 3.87371835 5.60551680
35 -0.09034194 3.87371835
36 3.15483635 -0.09034194
37 4.90783376 3.15483635
38 0.92626701 4.90783376
39 4.73363738 0.92626701
40 -0.39816107 4.73363738
41 -0.08111800 -0.39816107
42 1.58524462 -0.08111800
43 -3.94748062 1.58524462
44 -2.59355641 -3.94748062
45 -6.21015073 -2.59355641
46 -5.63779328 -6.21015073
47 -4.94286133 -5.63779328
48 -2.27833764 -4.94286133
49 -8.23501292 -2.27833764
50 -7.82025754 -8.23501292
51 -7.97140139 -7.82025754
52 -1.95571922 -7.97140139
53 -4.76769424 -1.95571922
54 -3.00916539 -4.76769424
55 -0.51423343 -3.00916539
56 3.35120240 -0.51423343
57 4.57793280 3.35120240
58 4.55580705 4.57793280
59 7.59174676 4.55580705
60 NA 7.59174676
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -2.58065461 0.66634798
[2,] -0.74655383 -2.58065461
[3,] 0.79814643 -0.74655383
[4,] -3.25531438 0.79814643
[5,] 0.56404565 -3.25531438
[6,] 4.79723428 0.56404565
[7,] 2.84516365 4.79723428
[8,] -1.92073557 2.84516365
[9,] -4.64332472 -1.92073557
[10,] -2.43963221 -4.64332472
[11,] -2.46820155 -2.43963221
[12,] -3.22302326 -2.46820155
[13,] 1.68664944 -3.22302326
[14,] 0.94009561 1.68664944
[15,] 4.01013609 0.94009561
[16,] 2.29768304 4.01013609
[17,] 0.18155211 2.29768304
[18,] -4.83873470 0.18155211
[19,] -2.79080533 -4.83873470
[20,] -5.67652798 -2.79080533
[21,] 0.67002585 -5.67652798
[22,] -0.35209991 0.67002585
[23,] -0.09034194 -0.35209991
[24,] 1.68017657 -0.09034194
[25,] 4.22118433 1.68017657
[26,] 6.70044875 4.22118433
[27,] -1.57051852 6.70044875
[28,] 3.31151163 -1.57051852
[29,] 4.10321447 3.31151163
[30,] 1.46542119 4.10321447
[31,] 4.40735573 1.46542119
[32,] 6.83961757 4.40735573
[33,] 5.60551680 6.83961757
[34,] 3.87371835 5.60551680
[35,] -0.09034194 3.87371835
[36,] 3.15483635 -0.09034194
[37,] 4.90783376 3.15483635
[38,] 0.92626701 4.90783376
[39,] 4.73363738 0.92626701
[40,] -0.39816107 4.73363738
[41,] -0.08111800 -0.39816107
[42,] 1.58524462 -0.08111800
[43,] -3.94748062 1.58524462
[44,] -2.59355641 -3.94748062
[45,] -6.21015073 -2.59355641
[46,] -5.63779328 -6.21015073
[47,] -4.94286133 -5.63779328
[48,] -2.27833764 -4.94286133
[49,] -8.23501292 -2.27833764
[50,] -7.82025754 -8.23501292
[51,] -7.97140139 -7.82025754
[52,] -1.95571922 -7.97140139
[53,] -4.76769424 -1.95571922
[54,] -3.00916539 -4.76769424
[55,] -0.51423343 -3.00916539
[56,] 3.35120240 -0.51423343
[57,] 4.57793280 3.35120240
[58,] 4.55580705 4.57793280
[59,] 7.59174676 4.55580705
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -2.58065461 0.66634798
2 -0.74655383 -2.58065461
3 0.79814643 -0.74655383
4 -3.25531438 0.79814643
5 0.56404565 -3.25531438
6 4.79723428 0.56404565
7 2.84516365 4.79723428
8 -1.92073557 2.84516365
9 -4.64332472 -1.92073557
10 -2.43963221 -4.64332472
11 -2.46820155 -2.43963221
12 -3.22302326 -2.46820155
13 1.68664944 -3.22302326
14 0.94009561 1.68664944
15 4.01013609 0.94009561
16 2.29768304 4.01013609
17 0.18155211 2.29768304
18 -4.83873470 0.18155211
19 -2.79080533 -4.83873470
20 -5.67652798 -2.79080533
21 0.67002585 -5.67652798
22 -0.35209991 0.67002585
23 -0.09034194 -0.35209991
24 1.68017657 -0.09034194
25 4.22118433 1.68017657
26 6.70044875 4.22118433
27 -1.57051852 6.70044875
28 3.31151163 -1.57051852
29 4.10321447 3.31151163
30 1.46542119 4.10321447
31 4.40735573 1.46542119
32 6.83961757 4.40735573
33 5.60551680 6.83961757
34 3.87371835 5.60551680
35 -0.09034194 3.87371835
36 3.15483635 -0.09034194
37 4.90783376 3.15483635
38 0.92626701 4.90783376
39 4.73363738 0.92626701
40 -0.39816107 4.73363738
41 -0.08111800 -0.39816107
42 1.58524462 -0.08111800
43 -3.94748062 1.58524462
44 -2.59355641 -3.94748062
45 -6.21015073 -2.59355641
46 -5.63779328 -6.21015073
47 -4.94286133 -5.63779328
48 -2.27833764 -4.94286133
49 -8.23501292 -2.27833764
50 -7.82025754 -8.23501292
51 -7.97140139 -7.82025754
52 -1.95571922 -7.97140139
53 -4.76769424 -1.95571922
54 -3.00916539 -4.76769424
55 -0.51423343 -3.00916539
56 3.35120240 -0.51423343
57 4.57793280 3.35120240
58 4.55580705 4.57793280
59 7.59174676 4.55580705
> 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/788u11258624117.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/89f061258624117.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/9zar21258624117.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/10atr31258624117.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/11jvh81258624117.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/12t0w51258624117.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/13xeo91258624117.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/14f8kz1258624117.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/156nkn1258624117.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/162wgl1258624117.tab")
+ }
>
> system("convert tmp/13q8x1258624117.ps tmp/13q8x1258624117.png")
> system("convert tmp/2gfo51258624117.ps tmp/2gfo51258624117.png")
> system("convert tmp/3m2ky1258624117.ps tmp/3m2ky1258624117.png")
> system("convert tmp/4j5be1258624117.ps tmp/4j5be1258624117.png")
> system("convert tmp/51z241258624117.ps tmp/51z241258624117.png")
> system("convert tmp/6b2f61258624117.ps tmp/6b2f61258624117.png")
> system("convert tmp/788u11258624117.ps tmp/788u11258624117.png")
> system("convert tmp/89f061258624117.ps tmp/89f061258624117.png")
> system("convert tmp/9zar21258624117.ps tmp/9zar21258624117.png")
> system("convert tmp/10atr31258624117.ps tmp/10atr31258624117.png")
>
>
> proc.time()
user system elapsed
2.378 1.541 2.997