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(103.63,100.30,103.64,98.50,103.66,95.10,103.77,93.10,103.88,92.20,103.91,89.00,103.91,86.40,103.92,84.50,104.05,82.70,104.23,80.80,104.30,81.80,104.31,81.80,104.31,82.90,104.34,83.80,104.55,86.20,104.65,86.10,104.73,86.20,104.75,88.80,104.75,89.60,104.76,87.80,104.94,88.30,105.29,88.60,105.38,91.00,105.43,91.50,105.43,95.40,105.42,98.70,105.52,99.90,105.69,98.60,105.72,100.30,105.74,100.20,105.74,100.40,105.74,101.40,105.95,103.00,106.17,109.10,106.34,111.40,106.37,114.10,106.37,121.80,106.36,127.60,106.44,129.90,106.29,128.00,106.23,123.50,106.23,124.00,106.23,127.40,106.23,127.60,106.34,128.40,106.44,131.40,106.44,135.10,106.48,134.00,106.50,144.50,106.57,147.30,106.40,150.90,106.37,148.70,106.25,141.40,106.21,138.90,106.21,139.80,106.24,145.60,106.19,147.90,106.08,148.50,106.13,151.10,106.09,157.50),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 103.63 100.3 1 0 0 0 0 0 0 0 0 0 0
2 103.64 98.5 0 1 0 0 0 0 0 0 0 0 0
3 103.66 95.1 0 0 1 0 0 0 0 0 0 0 0
4 103.77 93.1 0 0 0 1 0 0 0 0 0 0 0
5 103.88 92.2 0 0 0 0 1 0 0 0 0 0 0
6 103.91 89.0 0 0 0 0 0 1 0 0 0 0 0
7 103.91 86.4 0 0 0 0 0 0 1 0 0 0 0
8 103.92 84.5 0 0 0 0 0 0 0 1 0 0 0
9 104.05 82.7 0 0 0 0 0 0 0 0 1 0 0
10 104.23 80.8 0 0 0 0 0 0 0 0 0 1 0
11 104.30 81.8 0 0 0 0 0 0 0 0 0 0 1
12 104.31 81.8 0 0 0 0 0 0 0 0 0 0 0
13 104.31 82.9 1 0 0 0 0 0 0 0 0 0 0
14 104.34 83.8 0 1 0 0 0 0 0 0 0 0 0
15 104.55 86.2 0 0 1 0 0 0 0 0 0 0 0
16 104.65 86.1 0 0 0 1 0 0 0 0 0 0 0
17 104.73 86.2 0 0 0 0 1 0 0 0 0 0 0
18 104.75 88.8 0 0 0 0 0 1 0 0 0 0 0
19 104.75 89.6 0 0 0 0 0 0 1 0 0 0 0
20 104.76 87.8 0 0 0 0 0 0 0 1 0 0 0
21 104.94 88.3 0 0 0 0 0 0 0 0 1 0 0
22 105.29 88.6 0 0 0 0 0 0 0 0 0 1 0
23 105.38 91.0 0 0 0 0 0 0 0 0 0 0 1
24 105.43 91.5 0 0 0 0 0 0 0 0 0 0 0
25 105.43 95.4 1 0 0 0 0 0 0 0 0 0 0
26 105.42 98.7 0 1 0 0 0 0 0 0 0 0 0
27 105.52 99.9 0 0 1 0 0 0 0 0 0 0 0
28 105.69 98.6 0 0 0 1 0 0 0 0 0 0 0
29 105.72 100.3 0 0 0 0 1 0 0 0 0 0 0
30 105.74 100.2 0 0 0 0 0 1 0 0 0 0 0
31 105.74 100.4 0 0 0 0 0 0 1 0 0 0 0
32 105.74 101.4 0 0 0 0 0 0 0 1 0 0 0
33 105.95 103.0 0 0 0 0 0 0 0 0 1 0 0
34 106.17 109.1 0 0 0 0 0 0 0 0 0 1 0
35 106.34 111.4 0 0 0 0 0 0 0 0 0 0 1
36 106.37 114.1 0 0 0 0 0 0 0 0 0 0 0
37 106.37 121.8 1 0 0 0 0 0 0 0 0 0 0
38 106.36 127.6 0 1 0 0 0 0 0 0 0 0 0
39 106.44 129.9 0 0 1 0 0 0 0 0 0 0 0
40 106.29 128.0 0 0 0 1 0 0 0 0 0 0 0
41 106.23 123.5 0 0 0 0 1 0 0 0 0 0 0
42 106.23 124.0 0 0 0 0 0 1 0 0 0 0 0
43 106.23 127.4 0 0 0 0 0 0 1 0 0 0 0
44 106.23 127.6 0 0 0 0 0 0 0 1 0 0 0
45 106.34 128.4 0 0 0 0 0 0 0 0 1 0 0
46 106.44 131.4 0 0 0 0 0 0 0 0 0 1 0
47 106.44 135.1 0 0 0 0 0 0 0 0 0 0 1
48 106.48 134.0 0 0 0 0 0 0 0 0 0 0 0
49 106.50 144.5 1 0 0 0 0 0 0 0 0 0 0
50 106.57 147.3 0 1 0 0 0 0 0 0 0 0 0
51 106.40 150.9 0 0 1 0 0 0 0 0 0 0 0
52 106.37 148.7 0 0 0 1 0 0 0 0 0 0 0
53 106.25 141.4 0 0 0 0 1 0 0 0 0 0 0
54 106.21 138.9 0 0 0 0 0 1 0 0 0 0 0
55 106.21 139.8 0 0 0 0 0 0 1 0 0 0 0
56 106.24 145.6 0 0 0 0 0 0 0 1 0 0 0
57 106.19 147.9 0 0 0 0 0 0 0 0 1 0 0
58 106.08 148.5 0 0 0 0 0 0 0 0 0 1 0
59 106.13 151.1 0 0 0 0 0 0 0 0 0 0 1
60 106.09 157.5 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
102.00581 0.03222 -0.26892 -0.32180 -0.31310 -0.22478
M5 M6 M7 M8 M9 M10
-0.14654 -0.12314 -0.14054 -0.15181 -0.05771 0.03809
M11
0.03677
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.33835 -0.34293 0.09428 0.49621 0.73228
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 102.005814 0.492211 207.240 < 2e-16 ***
X 0.032218 0.003473 9.277 3.41e-12 ***
M1 -0.268918 0.402177 -0.669 0.507
M2 -0.321798 0.401801 -0.801 0.427
M3 -0.313104 0.401655 -0.780 0.440
M4 -0.224777 0.401841 -0.559 0.579
M5 -0.146542 0.402231 -0.364 0.717
M6 -0.123144 0.402350 -0.306 0.761
M7 -0.140542 0.402231 -0.349 0.728
M8 -0.151806 0.402098 -0.378 0.707
M9 -0.057714 0.401975 -0.144 0.886
M10 0.038093 0.401736 0.095 0.925
M11 0.036770 0.401527 0.092 0.927
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6348 on 47 degrees of freedom
Multiple R-squared: 0.657, Adjusted R-squared: 0.5694
F-statistic: 7.502 on 12 and 47 DF, p-value: 1.774e-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.4159266 8.318532e-01 5.840734e-01
[2,] 0.4588540 9.177080e-01 5.411460e-01
[3,] 0.7192261 5.615477e-01 2.807739e-01
[4,] 0.9212587 1.574826e-01 7.874131e-02
[5,] 0.9803186 3.936283e-02 1.968141e-02
[6,] 0.9967057 6.588691e-03 3.294345e-03
[7,] 0.9992925 1.414937e-03 7.074685e-04
[8,] 0.9997652 4.696877e-04 2.348439e-04
[9,] 0.9998794 2.412109e-04 1.206055e-04
[10,] 0.9999867 2.661416e-05 1.330708e-05
[11,] 0.9999988 2.404948e-06 1.202474e-06
[12,] 0.9999998 4.011650e-07 2.005825e-07
[13,] 0.9999999 2.270108e-07 1.135054e-07
[14,] 0.9999999 2.192938e-07 1.096469e-07
[15,] 0.9999999 2.288451e-07 1.144226e-07
[16,] 0.9999999 1.864168e-07 9.320841e-08
[17,] 1.0000000 5.711688e-08 2.855844e-08
[18,] 1.0000000 3.717682e-08 1.858841e-08
[19,] 0.9999999 1.228788e-07 6.143941e-08
[20,] 0.9999997 6.760027e-07 3.380013e-07
[21,] 0.9999982 3.557998e-06 1.778999e-06
[22,] 0.9999951 9.876143e-06 4.938071e-06
[23,] 0.9999941 1.170178e-05 5.850892e-06
[24,] 0.9999730 5.402487e-05 2.701244e-05
[25,] 0.9999486 1.027422e-04 5.137109e-05
[26,] 0.9998537 2.925348e-04 1.462674e-04
[27,] 0.9994188 1.162309e-03 5.811545e-04
[28,] 0.9975179 4.964243e-03 2.482122e-03
[29,] 0.9971025 5.794957e-03 2.897478e-03
> postscript(file="/var/www/html/rcomp/tmp/14y7t1258204842.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/2thtu1258204842.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/3jnsa1258204842.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/4hljy1258204842.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/5duos1258204842.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
-1.338348797 -1.217477275 -1.096630667 -1.010521727 -0.949760614 -0.840061052
7 8 9 10 11 12
-0.738896907 -0.656419133 -0.562518789 -0.417111850 -0.378006817 -0.331236420
13 14 15 16 17 18
-0.097757676 -0.043874432 0.080108469 0.095003437 0.093546669 0.006382524
19 20 21 22 23 24
-0.001994125 0.077261861 0.147061080 0.391588682 0.405588682 0.476250139
25 26 27 28 29 30
0.619518817 0.556079149 0.608723506 0.732279930 0.629274554 0.629098686
31 32 33 34 35 36
0.640052766 0.619098686 0.683458236 0.611122132 0.708343920 0.688126039
37 38 39 40 41 42
0.708966772 0.564982402 0.562187091 0.385074243 0.391819726 0.352313130
43 44 45 46 47 48
0.260169992 0.264990217 0.255124071 0.162663396 0.044780152 0.156990217
49 50 51 52 53 54
0.107620884 0.140290156 -0.154388400 -0.201835883 -0.164880335 -0.147733289
55 56 57 58 59 60
-0.159331726 -0.304931632 -0.523124599 -0.748262360 -0.780705937 -0.990129975
> postscript(file="/var/www/html/rcomp/tmp/6ckft1258204842.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 -1.338348797 NA
1 -1.217477275 -1.338348797
2 -1.096630667 -1.217477275
3 -1.010521727 -1.096630667
4 -0.949760614 -1.010521727
5 -0.840061052 -0.949760614
6 -0.738896907 -0.840061052
7 -0.656419133 -0.738896907
8 -0.562518789 -0.656419133
9 -0.417111850 -0.562518789
10 -0.378006817 -0.417111850
11 -0.331236420 -0.378006817
12 -0.097757676 -0.331236420
13 -0.043874432 -0.097757676
14 0.080108469 -0.043874432
15 0.095003437 0.080108469
16 0.093546669 0.095003437
17 0.006382524 0.093546669
18 -0.001994125 0.006382524
19 0.077261861 -0.001994125
20 0.147061080 0.077261861
21 0.391588682 0.147061080
22 0.405588682 0.391588682
23 0.476250139 0.405588682
24 0.619518817 0.476250139
25 0.556079149 0.619518817
26 0.608723506 0.556079149
27 0.732279930 0.608723506
28 0.629274554 0.732279930
29 0.629098686 0.629274554
30 0.640052766 0.629098686
31 0.619098686 0.640052766
32 0.683458236 0.619098686
33 0.611122132 0.683458236
34 0.708343920 0.611122132
35 0.688126039 0.708343920
36 0.708966772 0.688126039
37 0.564982402 0.708966772
38 0.562187091 0.564982402
39 0.385074243 0.562187091
40 0.391819726 0.385074243
41 0.352313130 0.391819726
42 0.260169992 0.352313130
43 0.264990217 0.260169992
44 0.255124071 0.264990217
45 0.162663396 0.255124071
46 0.044780152 0.162663396
47 0.156990217 0.044780152
48 0.107620884 0.156990217
49 0.140290156 0.107620884
50 -0.154388400 0.140290156
51 -0.201835883 -0.154388400
52 -0.164880335 -0.201835883
53 -0.147733289 -0.164880335
54 -0.159331726 -0.147733289
55 -0.304931632 -0.159331726
56 -0.523124599 -0.304931632
57 -0.748262360 -0.523124599
58 -0.780705937 -0.748262360
59 -0.990129975 -0.780705937
60 NA -0.990129975
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.217477275 -1.338348797
[2,] -1.096630667 -1.217477275
[3,] -1.010521727 -1.096630667
[4,] -0.949760614 -1.010521727
[5,] -0.840061052 -0.949760614
[6,] -0.738896907 -0.840061052
[7,] -0.656419133 -0.738896907
[8,] -0.562518789 -0.656419133
[9,] -0.417111850 -0.562518789
[10,] -0.378006817 -0.417111850
[11,] -0.331236420 -0.378006817
[12,] -0.097757676 -0.331236420
[13,] -0.043874432 -0.097757676
[14,] 0.080108469 -0.043874432
[15,] 0.095003437 0.080108469
[16,] 0.093546669 0.095003437
[17,] 0.006382524 0.093546669
[18,] -0.001994125 0.006382524
[19,] 0.077261861 -0.001994125
[20,] 0.147061080 0.077261861
[21,] 0.391588682 0.147061080
[22,] 0.405588682 0.391588682
[23,] 0.476250139 0.405588682
[24,] 0.619518817 0.476250139
[25,] 0.556079149 0.619518817
[26,] 0.608723506 0.556079149
[27,] 0.732279930 0.608723506
[28,] 0.629274554 0.732279930
[29,] 0.629098686 0.629274554
[30,] 0.640052766 0.629098686
[31,] 0.619098686 0.640052766
[32,] 0.683458236 0.619098686
[33,] 0.611122132 0.683458236
[34,] 0.708343920 0.611122132
[35,] 0.688126039 0.708343920
[36,] 0.708966772 0.688126039
[37,] 0.564982402 0.708966772
[38,] 0.562187091 0.564982402
[39,] 0.385074243 0.562187091
[40,] 0.391819726 0.385074243
[41,] 0.352313130 0.391819726
[42,] 0.260169992 0.352313130
[43,] 0.264990217 0.260169992
[44,] 0.255124071 0.264990217
[45,] 0.162663396 0.255124071
[46,] 0.044780152 0.162663396
[47,] 0.156990217 0.044780152
[48,] 0.107620884 0.156990217
[49,] 0.140290156 0.107620884
[50,] -0.154388400 0.140290156
[51,] -0.201835883 -0.154388400
[52,] -0.164880335 -0.201835883
[53,] -0.147733289 -0.164880335
[54,] -0.159331726 -0.147733289
[55,] -0.304931632 -0.159331726
[56,] -0.523124599 -0.304931632
[57,] -0.748262360 -0.523124599
[58,] -0.780705937 -0.748262360
[59,] -0.990129975 -0.780705937
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.217477275 -1.338348797
2 -1.096630667 -1.217477275
3 -1.010521727 -1.096630667
4 -0.949760614 -1.010521727
5 -0.840061052 -0.949760614
6 -0.738896907 -0.840061052
7 -0.656419133 -0.738896907
8 -0.562518789 -0.656419133
9 -0.417111850 -0.562518789
10 -0.378006817 -0.417111850
11 -0.331236420 -0.378006817
12 -0.097757676 -0.331236420
13 -0.043874432 -0.097757676
14 0.080108469 -0.043874432
15 0.095003437 0.080108469
16 0.093546669 0.095003437
17 0.006382524 0.093546669
18 -0.001994125 0.006382524
19 0.077261861 -0.001994125
20 0.147061080 0.077261861
21 0.391588682 0.147061080
22 0.405588682 0.391588682
23 0.476250139 0.405588682
24 0.619518817 0.476250139
25 0.556079149 0.619518817
26 0.608723506 0.556079149
27 0.732279930 0.608723506
28 0.629274554 0.732279930
29 0.629098686 0.629274554
30 0.640052766 0.629098686
31 0.619098686 0.640052766
32 0.683458236 0.619098686
33 0.611122132 0.683458236
34 0.708343920 0.611122132
35 0.688126039 0.708343920
36 0.708966772 0.688126039
37 0.564982402 0.708966772
38 0.562187091 0.564982402
39 0.385074243 0.562187091
40 0.391819726 0.385074243
41 0.352313130 0.391819726
42 0.260169992 0.352313130
43 0.264990217 0.260169992
44 0.255124071 0.264990217
45 0.162663396 0.255124071
46 0.044780152 0.162663396
47 0.156990217 0.044780152
48 0.107620884 0.156990217
49 0.140290156 0.107620884
50 -0.154388400 0.140290156
51 -0.201835883 -0.154388400
52 -0.164880335 -0.201835883
53 -0.147733289 -0.164880335
54 -0.159331726 -0.147733289
55 -0.304931632 -0.159331726
56 -0.523124599 -0.304931632
57 -0.748262360 -0.523124599
58 -0.780705937 -0.748262360
59 -0.990129975 -0.780705937
> 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/767kf1258204842.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/8odpk1258204842.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/9xr321258204842.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/10q3oj1258204842.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/112fpv1258204842.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/12ncne1258204842.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/13ry8q1258204842.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/1474s91258204842.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/15vju71258204842.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/16auwr1258204842.tab")
+ }
>
> system("convert tmp/14y7t1258204842.ps tmp/14y7t1258204842.png")
> system("convert tmp/2thtu1258204842.ps tmp/2thtu1258204842.png")
> system("convert tmp/3jnsa1258204842.ps tmp/3jnsa1258204842.png")
> system("convert tmp/4hljy1258204842.ps tmp/4hljy1258204842.png")
> system("convert tmp/5duos1258204842.ps tmp/5duos1258204842.png")
> system("convert tmp/6ckft1258204842.ps tmp/6ckft1258204842.png")
> system("convert tmp/767kf1258204842.ps tmp/767kf1258204842.png")
> system("convert tmp/8odpk1258204842.ps tmp/8odpk1258204842.png")
> system("convert tmp/9xr321258204842.ps tmp/9xr321258204842.png")
> system("convert tmp/10q3oj1258204842.ps tmp/10q3oj1258204842.png")
>
>
> proc.time()
user system elapsed
2.508 1.634 3.925