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(89.1,0,82.6,0,102.7,0,91.8,0,94.1,0,103.1,0,93.2,0,91,0,94.3,0,99.4,0,115.7,0,116.8,0,99.8,0,96,0,115.9,0,109.1,0,117.3,0,109.8,0,112.8,0,110.7,0,100,0,113.3,0,122.4,0,112.5,0,104.2,0,92.5,0,117.2,0,109.3,0,106.1,0,118.8,0,105.3,0,106,0,102,0,112.9,0,116.5,0,114.8,0,100.5,0,85.4,0,114.6,0,109.9,0,100.7,0,115.5,0,100.7,1,99,1,102.3,1,108.8,1,105.9,1,113.2,1,95.7,1,80.9,1,113.9,1,98.1,1,102.8,1,104.7,1,95.9,1,94.6,1,101.6,1,103.9,1,110.3,1,114.1,1),dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = '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 89.1 0 1 0 0 0 0 0 0 0 0 0 0
2 82.6 0 0 1 0 0 0 0 0 0 0 0 0
3 102.7 0 0 0 1 0 0 0 0 0 0 0 0
4 91.8 0 0 0 0 1 0 0 0 0 0 0 0
5 94.1 0 0 0 0 0 1 0 0 0 0 0 0
6 103.1 0 0 0 0 0 0 1 0 0 0 0 0
7 93.2 0 0 0 0 0 0 0 1 0 0 0 0
8 91.0 0 0 0 0 0 0 0 0 1 0 0 0
9 94.3 0 0 0 0 0 0 0 0 0 1 0 0
10 99.4 0 0 0 0 0 0 0 0 0 0 1 0
11 115.7 0 0 0 0 0 0 0 0 0 0 0 1
12 116.8 0 0 0 0 0 0 0 0 0 0 0 0
13 99.8 0 1 0 0 0 0 0 0 0 0 0 0
14 96.0 0 0 1 0 0 0 0 0 0 0 0 0
15 115.9 0 0 0 1 0 0 0 0 0 0 0 0
16 109.1 0 0 0 0 1 0 0 0 0 0 0 0
17 117.3 0 0 0 0 0 1 0 0 0 0 0 0
18 109.8 0 0 0 0 0 0 1 0 0 0 0 0
19 112.8 0 0 0 0 0 0 0 1 0 0 0 0
20 110.7 0 0 0 0 0 0 0 0 1 0 0 0
21 100.0 0 0 0 0 0 0 0 0 0 1 0 0
22 113.3 0 0 0 0 0 0 0 0 0 0 1 0
23 122.4 0 0 0 0 0 0 0 0 0 0 0 1
24 112.5 0 0 0 0 0 0 0 0 0 0 0 0
25 104.2 0 1 0 0 0 0 0 0 0 0 0 0
26 92.5 0 0 1 0 0 0 0 0 0 0 0 0
27 117.2 0 0 0 1 0 0 0 0 0 0 0 0
28 109.3 0 0 0 0 1 0 0 0 0 0 0 0
29 106.1 0 0 0 0 0 1 0 0 0 0 0 0
30 118.8 0 0 0 0 0 0 1 0 0 0 0 0
31 105.3 0 0 0 0 0 0 0 1 0 0 0 0
32 106.0 0 0 0 0 0 0 0 0 1 0 0 0
33 102.0 0 0 0 0 0 0 0 0 0 1 0 0
34 112.9 0 0 0 0 0 0 0 0 0 0 1 0
35 116.5 0 0 0 0 0 0 0 0 0 0 0 1
36 114.8 0 0 0 0 0 0 0 0 0 0 0 0
37 100.5 0 1 0 0 0 0 0 0 0 0 0 0
38 85.4 0 0 1 0 0 0 0 0 0 0 0 0
39 114.6 0 0 0 1 0 0 0 0 0 0 0 0
40 109.9 0 0 0 0 1 0 0 0 0 0 0 0
41 100.7 0 0 0 0 0 1 0 0 0 0 0 0
42 115.5 0 0 0 0 0 0 1 0 0 0 0 0
43 100.7 1 0 0 0 0 0 0 1 0 0 0 0
44 99.0 1 0 0 0 0 0 0 0 1 0 0 0
45 102.3 1 0 0 0 0 0 0 0 0 1 0 0
46 108.8 1 0 0 0 0 0 0 0 0 0 1 0
47 105.9 1 0 0 0 0 0 0 0 0 0 0 1
48 113.2 1 0 0 0 0 0 0 0 0 0 0 0
49 95.7 1 1 0 0 0 0 0 0 0 0 0 0
50 80.9 1 0 1 0 0 0 0 0 0 0 0 0
51 113.9 1 0 0 1 0 0 0 0 0 0 0 0
52 98.1 1 0 0 0 1 0 0 0 0 0 0 0
53 102.8 1 0 0 0 0 1 0 0 0 0 0 0
54 104.7 1 0 0 0 0 0 1 0 0 0 0 0
55 95.9 1 0 0 0 0 0 0 1 0 0 0 0
56 94.6 1 0 0 0 0 0 0 0 1 0 0 0
57 101.6 1 0 0 0 0 0 0 0 0 1 0 0
58 103.9 1 0 0 0 0 0 0 0 0 0 1 0
59 110.3 1 0 0 0 0 0 0 0 0 0 0 1
60 114.1 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) X M1 M2 M3 M4
115.813 -3.832 -17.186 -27.566 -2.186 -11.406
M5 M6 M7 M8 M9 M10
-10.846 -4.666 -12.700 -14.020 -14.240 -6.620
M11
-0.120
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-12.606 -3.325 1.013 4.106 12.334
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 115.813 2.912 39.770 < 2e-16 ***
X -3.832 1.820 -2.105 0.040640 *
M1 -17.186 4.004 -4.292 8.77e-05 ***
M2 -27.566 4.004 -6.885 1.22e-08 ***
M3 -2.186 4.004 -0.546 0.587631
M4 -11.406 4.004 -2.849 0.006495 **
M5 -10.846 4.004 -2.709 0.009390 **
M6 -4.666 4.004 -1.165 0.249741
M7 -12.700 3.987 -3.185 0.002571 **
M8 -14.020 3.987 -3.516 0.000982 ***
M9 -14.240 3.987 -3.571 0.000833 ***
M10 -6.620 3.987 -1.660 0.103536
M11 -0.120 3.987 -0.030 0.976120
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.305 on 47 degrees of freedom
Multiple R-squared: 0.6582, Adjusted R-squared: 0.571
F-statistic: 7.543 on 12 and 47 DF, p-value: 1.644e-07
> 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.9993309 1.338219e-03 6.691096e-04
[2,] 0.9999912 1.764188e-05 8.820939e-06
[3,] 0.9999842 3.165237e-05 1.582618e-05
[4,] 0.9999979 4.140459e-06 2.070229e-06
[5,] 0.9999996 8.757295e-07 4.378648e-07
[6,] 0.9999994 1.238984e-06 6.194922e-07
[7,] 0.9999990 2.017609e-06 1.008804e-06
[8,] 0.9999993 1.477273e-06 7.386367e-07
[9,] 0.9999989 2.109303e-06 1.054651e-06
[10,] 0.9999981 3.706976e-06 1.853488e-06
[11,] 0.9999980 4.036021e-06 2.018010e-06
[12,] 0.9999947 1.053456e-05 5.267281e-06
[13,] 0.9999892 2.162096e-05 1.081048e-05
[14,] 0.9999682 6.358915e-05 3.179458e-05
[15,] 0.9999768 4.646895e-05 2.323448e-05
[16,] 0.9999352 1.295662e-04 6.478311e-05
[17,] 0.9998908 2.184245e-04 1.092122e-04
[18,] 0.9998385 3.229943e-04 1.614972e-04
[19,] 0.9995986 8.028178e-04 4.014089e-04
[20,] 0.9992191 1.561803e-03 7.809014e-04
[21,] 0.9984469 3.106246e-03 1.553123e-03
[22,] 0.9959822 8.035579e-03 4.017790e-03
[23,] 0.9905451 1.890976e-02 9.454879e-03
[24,] 0.9853830 2.923409e-02 1.461704e-02
[25,] 0.9815144 3.697118e-02 1.848559e-02
[26,] 0.9922629 1.547425e-02 7.737124e-03
[27,] 0.9771784 4.564329e-02 2.282164e-02
[28,] 0.9632199 7.356016e-02 3.678008e-02
[29,] 0.9348842 1.302315e-01 6.511575e-02
> postscript(file="/var/www/html/rcomp/tmp/1hizb1258724679.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/2idzz1258724679.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/3hwqm1258724679.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/4oq1e1258724679.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/5x7ql1258724679.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
-9.526333333 -5.646333333 -10.926333333 -12.606333333 -10.866333333
6 7 8 9 10
-8.046333333 -9.912666667 -10.792666667 -7.272666667 -9.792666667
11 12 13 14 15
0.007333333 0.987333333 1.173666667 7.753666667 2.273666667
16 17 18 19 20
4.693666667 12.333666667 -1.346333333 9.687333333 8.907333333
21 22 23 24 25
-1.572666667 4.107333333 6.707333333 -3.312666667 5.573666667
26 27 28 29 30
4.253666667 3.573666667 4.893666667 1.133666667 7.653666667
31 32 33 34 35
2.187333333 4.207333333 0.427333333 3.707333333 0.807333333
36 37 38 39 40
-1.012666667 1.873666667 -2.846333333 0.973666667 5.493666667
41 42 43 44 45
-4.266333333 4.353666667 1.419000000 1.039000000 4.559000000
46 47 48 49 50
3.439000000 -5.961000000 1.219000000 0.905333333 -3.514666667
51 52 53 54 55
4.105333333 -2.474666667 1.665333333 -2.614666667 -3.381000000
56 57 58 59 60
-3.361000000 3.859000000 -1.461000000 -1.561000000 2.119000000
> postscript(file="/var/www/html/rcomp/tmp/61x0f1258724679.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 -9.526333333 NA
1 -5.646333333 -9.526333333
2 -10.926333333 -5.646333333
3 -12.606333333 -10.926333333
4 -10.866333333 -12.606333333
5 -8.046333333 -10.866333333
6 -9.912666667 -8.046333333
7 -10.792666667 -9.912666667
8 -7.272666667 -10.792666667
9 -9.792666667 -7.272666667
10 0.007333333 -9.792666667
11 0.987333333 0.007333333
12 1.173666667 0.987333333
13 7.753666667 1.173666667
14 2.273666667 7.753666667
15 4.693666667 2.273666667
16 12.333666667 4.693666667
17 -1.346333333 12.333666667
18 9.687333333 -1.346333333
19 8.907333333 9.687333333
20 -1.572666667 8.907333333
21 4.107333333 -1.572666667
22 6.707333333 4.107333333
23 -3.312666667 6.707333333
24 5.573666667 -3.312666667
25 4.253666667 5.573666667
26 3.573666667 4.253666667
27 4.893666667 3.573666667
28 1.133666667 4.893666667
29 7.653666667 1.133666667
30 2.187333333 7.653666667
31 4.207333333 2.187333333
32 0.427333333 4.207333333
33 3.707333333 0.427333333
34 0.807333333 3.707333333
35 -1.012666667 0.807333333
36 1.873666667 -1.012666667
37 -2.846333333 1.873666667
38 0.973666667 -2.846333333
39 5.493666667 0.973666667
40 -4.266333333 5.493666667
41 4.353666667 -4.266333333
42 1.419000000 4.353666667
43 1.039000000 1.419000000
44 4.559000000 1.039000000
45 3.439000000 4.559000000
46 -5.961000000 3.439000000
47 1.219000000 -5.961000000
48 0.905333333 1.219000000
49 -3.514666667 0.905333333
50 4.105333333 -3.514666667
51 -2.474666667 4.105333333
52 1.665333333 -2.474666667
53 -2.614666667 1.665333333
54 -3.381000000 -2.614666667
55 -3.361000000 -3.381000000
56 3.859000000 -3.361000000
57 -1.461000000 3.859000000
58 -1.561000000 -1.461000000
59 2.119000000 -1.561000000
60 NA 2.119000000
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -5.646333333 -9.526333333
[2,] -10.926333333 -5.646333333
[3,] -12.606333333 -10.926333333
[4,] -10.866333333 -12.606333333
[5,] -8.046333333 -10.866333333
[6,] -9.912666667 -8.046333333
[7,] -10.792666667 -9.912666667
[8,] -7.272666667 -10.792666667
[9,] -9.792666667 -7.272666667
[10,] 0.007333333 -9.792666667
[11,] 0.987333333 0.007333333
[12,] 1.173666667 0.987333333
[13,] 7.753666667 1.173666667
[14,] 2.273666667 7.753666667
[15,] 4.693666667 2.273666667
[16,] 12.333666667 4.693666667
[17,] -1.346333333 12.333666667
[18,] 9.687333333 -1.346333333
[19,] 8.907333333 9.687333333
[20,] -1.572666667 8.907333333
[21,] 4.107333333 -1.572666667
[22,] 6.707333333 4.107333333
[23,] -3.312666667 6.707333333
[24,] 5.573666667 -3.312666667
[25,] 4.253666667 5.573666667
[26,] 3.573666667 4.253666667
[27,] 4.893666667 3.573666667
[28,] 1.133666667 4.893666667
[29,] 7.653666667 1.133666667
[30,] 2.187333333 7.653666667
[31,] 4.207333333 2.187333333
[32,] 0.427333333 4.207333333
[33,] 3.707333333 0.427333333
[34,] 0.807333333 3.707333333
[35,] -1.012666667 0.807333333
[36,] 1.873666667 -1.012666667
[37,] -2.846333333 1.873666667
[38,] 0.973666667 -2.846333333
[39,] 5.493666667 0.973666667
[40,] -4.266333333 5.493666667
[41,] 4.353666667 -4.266333333
[42,] 1.419000000 4.353666667
[43,] 1.039000000 1.419000000
[44,] 4.559000000 1.039000000
[45,] 3.439000000 4.559000000
[46,] -5.961000000 3.439000000
[47,] 1.219000000 -5.961000000
[48,] 0.905333333 1.219000000
[49,] -3.514666667 0.905333333
[50,] 4.105333333 -3.514666667
[51,] -2.474666667 4.105333333
[52,] 1.665333333 -2.474666667
[53,] -2.614666667 1.665333333
[54,] -3.381000000 -2.614666667
[55,] -3.361000000 -3.381000000
[56,] 3.859000000 -3.361000000
[57,] -1.461000000 3.859000000
[58,] -1.561000000 -1.461000000
[59,] 2.119000000 -1.561000000
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -5.646333333 -9.526333333
2 -10.926333333 -5.646333333
3 -12.606333333 -10.926333333
4 -10.866333333 -12.606333333
5 -8.046333333 -10.866333333
6 -9.912666667 -8.046333333
7 -10.792666667 -9.912666667
8 -7.272666667 -10.792666667
9 -9.792666667 -7.272666667
10 0.007333333 -9.792666667
11 0.987333333 0.007333333
12 1.173666667 0.987333333
13 7.753666667 1.173666667
14 2.273666667 7.753666667
15 4.693666667 2.273666667
16 12.333666667 4.693666667
17 -1.346333333 12.333666667
18 9.687333333 -1.346333333
19 8.907333333 9.687333333
20 -1.572666667 8.907333333
21 4.107333333 -1.572666667
22 6.707333333 4.107333333
23 -3.312666667 6.707333333
24 5.573666667 -3.312666667
25 4.253666667 5.573666667
26 3.573666667 4.253666667
27 4.893666667 3.573666667
28 1.133666667 4.893666667
29 7.653666667 1.133666667
30 2.187333333 7.653666667
31 4.207333333 2.187333333
32 0.427333333 4.207333333
33 3.707333333 0.427333333
34 0.807333333 3.707333333
35 -1.012666667 0.807333333
36 1.873666667 -1.012666667
37 -2.846333333 1.873666667
38 0.973666667 -2.846333333
39 5.493666667 0.973666667
40 -4.266333333 5.493666667
41 4.353666667 -4.266333333
42 1.419000000 4.353666667
43 1.039000000 1.419000000
44 4.559000000 1.039000000
45 3.439000000 4.559000000
46 -5.961000000 3.439000000
47 1.219000000 -5.961000000
48 0.905333333 1.219000000
49 -3.514666667 0.905333333
50 4.105333333 -3.514666667
51 -2.474666667 4.105333333
52 1.665333333 -2.474666667
53 -2.614666667 1.665333333
54 -3.381000000 -2.614666667
55 -3.361000000 -3.381000000
56 3.859000000 -3.361000000
57 -1.461000000 3.859000000
58 -1.561000000 -1.461000000
59 2.119000000 -1.561000000
> 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/7wrei1258724679.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/853yr1258724679.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/9gyzy1258724679.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/10ijs61258724679.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/11qltr1258724679.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/12qpzp1258724679.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/13woxr1258724679.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/14zw091258724679.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/15sin51258724679.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/165qke1258724679.tab")
+ }
>
> system("convert tmp/1hizb1258724679.ps tmp/1hizb1258724679.png")
> system("convert tmp/2idzz1258724679.ps tmp/2idzz1258724679.png")
> system("convert tmp/3hwqm1258724679.ps tmp/3hwqm1258724679.png")
> system("convert tmp/4oq1e1258724679.ps tmp/4oq1e1258724679.png")
> system("convert tmp/5x7ql1258724679.ps tmp/5x7ql1258724679.png")
> system("convert tmp/61x0f1258724679.ps tmp/61x0f1258724679.png")
> system("convert tmp/7wrei1258724679.ps tmp/7wrei1258724679.png")
> system("convert tmp/853yr1258724679.ps tmp/853yr1258724679.png")
> system("convert tmp/9gyzy1258724679.ps tmp/9gyzy1258724679.png")
> system("convert tmp/10ijs61258724679.ps tmp/10ijs61258724679.png")
>
>
> proc.time()
user system elapsed
2.413 1.587 3.041