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(56.6,0,56,0,54.8,0,52.7,0,50.9,0,50.6,0,52.1,0,53.3,0,53.9,0,54.3,0,54.2,0,54.2,0,53.5,0,51.4,0,50.5,0,50.3,0,49.8,0,50.7,0,52.8,0,55.3,0,57.3,0,57.5,0,56.8,0,56.4,0,56.3,0,56.4,0,57,0,57.9,0,58.9,0,58.8,0,56.5,1,51.9,1,47.4,1,44.9,1,43.9,1,43.4,1,42.9,1,42.6,1,42.2,1,41.2,1,40.2,1,39.3,1,38.5,1,38.3,1,37.9,1,37.6,1,37.3,1,36,1,34.5,1,33.5,1,32.9,1,32.9,1,32.8,1,31.9,1,30.5,1,29.2,1,28.7,1,28.4,1,28,1,27.4,1,26.9,1),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 = '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 t
1 56.6 0 1 0 0 0 0 0 0 0 0 0 0 1
2 56.0 0 0 1 0 0 0 0 0 0 0 0 0 2
3 54.8 0 0 0 1 0 0 0 0 0 0 0 0 3
4 52.7 0 0 0 0 1 0 0 0 0 0 0 0 4
5 50.9 0 0 0 0 0 1 0 0 0 0 0 0 5
6 50.6 0 0 0 0 0 0 1 0 0 0 0 0 6
7 52.1 0 0 0 0 0 0 0 1 0 0 0 0 7
8 53.3 0 0 0 0 0 0 0 0 1 0 0 0 8
9 53.9 0 0 0 0 0 0 0 0 0 1 0 0 9
10 54.3 0 0 0 0 0 0 0 0 0 0 1 0 10
11 54.2 0 0 0 0 0 0 0 0 0 0 0 1 11
12 54.2 0 0 0 0 0 0 0 0 0 0 0 0 12
13 53.5 0 1 0 0 0 0 0 0 0 0 0 0 13
14 51.4 0 0 1 0 0 0 0 0 0 0 0 0 14
15 50.5 0 0 0 1 0 0 0 0 0 0 0 0 15
16 50.3 0 0 0 0 1 0 0 0 0 0 0 0 16
17 49.8 0 0 0 0 0 1 0 0 0 0 0 0 17
18 50.7 0 0 0 0 0 0 1 0 0 0 0 0 18
19 52.8 0 0 0 0 0 0 0 1 0 0 0 0 19
20 55.3 0 0 0 0 0 0 0 0 1 0 0 0 20
21 57.3 0 0 0 0 0 0 0 0 0 1 0 0 21
22 57.5 0 0 0 0 0 0 0 0 0 0 1 0 22
23 56.8 0 0 0 0 0 0 0 0 0 0 0 1 23
24 56.4 0 0 0 0 0 0 0 0 0 0 0 0 24
25 56.3 0 1 0 0 0 0 0 0 0 0 0 0 25
26 56.4 0 0 1 0 0 0 0 0 0 0 0 0 26
27 57.0 0 0 0 1 0 0 0 0 0 0 0 0 27
28 57.9 0 0 0 0 1 0 0 0 0 0 0 0 28
29 58.9 0 0 0 0 0 1 0 0 0 0 0 0 29
30 58.8 0 0 0 0 0 0 1 0 0 0 0 0 30
31 56.5 1 0 0 0 0 0 0 1 0 0 0 0 31
32 51.9 1 0 0 0 0 0 0 0 1 0 0 0 32
33 47.4 1 0 0 0 0 0 0 0 0 1 0 0 33
34 44.9 1 0 0 0 0 0 0 0 0 0 1 0 34
35 43.9 1 0 0 0 0 0 0 0 0 0 0 1 35
36 43.4 1 0 0 0 0 0 0 0 0 0 0 0 36
37 42.9 1 1 0 0 0 0 0 0 0 0 0 0 37
38 42.6 1 0 1 0 0 0 0 0 0 0 0 0 38
39 42.2 1 0 0 1 0 0 0 0 0 0 0 0 39
40 41.2 1 0 0 0 1 0 0 0 0 0 0 0 40
41 40.2 1 0 0 0 0 1 0 0 0 0 0 0 41
42 39.3 1 0 0 0 0 0 1 0 0 0 0 0 42
43 38.5 1 0 0 0 0 0 0 1 0 0 0 0 43
44 38.3 1 0 0 0 0 0 0 0 1 0 0 0 44
45 37.9 1 0 0 0 0 0 0 0 0 1 0 0 45
46 37.6 1 0 0 0 0 0 0 0 0 0 1 0 46
47 37.3 1 0 0 0 0 0 0 0 0 0 0 1 47
48 36.0 1 0 0 0 0 0 0 0 0 0 0 0 48
49 34.5 1 1 0 0 0 0 0 0 0 0 0 0 49
50 33.5 1 0 1 0 0 0 0 0 0 0 0 0 50
51 32.9 1 0 0 1 0 0 0 0 0 0 0 0 51
52 32.9 1 0 0 0 1 0 0 0 0 0 0 0 52
53 32.8 1 0 0 0 0 1 0 0 0 0 0 0 53
54 31.9 1 0 0 0 0 0 1 0 0 0 0 0 54
55 30.5 1 0 0 0 0 0 0 1 0 0 0 0 55
56 29.2 1 0 0 0 0 0 0 0 1 0 0 0 56
57 28.7 1 0 0 0 0 0 0 0 0 1 0 0 57
58 28.4 1 0 0 0 0 0 0 0 0 0 1 0 58
59 28.0 1 0 0 0 0 0 0 0 0 0 0 1 59
60 27.4 1 0 0 0 0 0 0 0 0 0 0 0 60
61 26.9 1 1 0 0 0 0 0 0 0 0 0 0 61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
59.5323 -7.2106 -0.7130 -0.1993 -0.3736 -0.5279
M5 M6 M7 M8 M9 M10
-0.6822 -0.6164 0.9714 0.8171 0.5828 0.4086
M11 t
0.2343 -0.3257
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.362 -3.382 -1.148 2.955 13.304
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 59.53231 2.82315 21.087 < 2e-16 ***
X -7.21058 2.72550 -2.646 0.011056 *
M1 -0.71300 3.16838 -0.225 0.822927
M2 -0.19933 3.32719 -0.060 0.952483
M3 -0.37361 3.32115 -0.112 0.910912
M4 -0.52788 3.31689 -0.159 0.874232
M5 -0.68216 3.31442 -0.206 0.837823
M6 -0.61644 3.31374 -0.186 0.853225
M7 0.97139 3.32495 0.292 0.771455
M8 0.81712 3.31689 0.246 0.806484
M9 0.58284 3.31061 0.176 0.861010
M10 0.40856 3.30611 0.124 0.902178
M11 0.23428 3.30341 0.071 0.943762
t -0.32572 0.07712 -4.224 0.000109 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.222 on 47 degrees of freedom
Multiple R-squared: 0.7937, Adjusted R-squared: 0.7367
F-statistic: 13.91 on 13 and 47 DF, p-value: 5.629e-12
> 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.04834886 9.669771e-02 9.516511e-01
[2,] 0.08810756 1.762151e-01 9.118924e-01
[3,] 0.18129537 3.625907e-01 8.187046e-01
[4,] 0.35091951 7.018390e-01 6.490805e-01
[5,] 0.52973450 9.405310e-01 4.702655e-01
[6,] 0.59574899 8.085020e-01 4.042510e-01
[7,] 0.61608537 7.678293e-01 3.839146e-01
[8,] 0.62266521 7.546696e-01 3.773348e-01
[9,] 0.61082230 7.783554e-01 3.891777e-01
[10,] 0.61063231 7.787354e-01 3.893677e-01
[11,] 0.65644736 6.871053e-01 3.435526e-01
[12,] 0.74947833 5.010433e-01 2.505217e-01
[13,] 0.84986476 3.002705e-01 1.501352e-01
[14,] 0.86806739 2.638652e-01 1.319326e-01
[15,] 0.99763410 4.731793e-03 2.365897e-03
[16,] 0.99999909 1.815476e-06 9.077378e-07
[17,] 0.99999990 2.017929e-07 1.008964e-07
[18,] 0.99999987 2.630941e-07 1.315470e-07
[19,] 0.99999989 2.148752e-07 1.074376e-07
[20,] 0.99999981 3.884512e-07 1.942256e-07
[21,] 0.99999944 1.121822e-06 5.609108e-07
[22,] 0.99999775 4.503019e-06 2.251510e-06
[23,] 0.99999238 1.524070e-05 7.620351e-06
[24,] 0.99995745 8.510219e-05 4.255109e-05
[25,] 0.99988781 2.243809e-04 1.121905e-04
[26,] 0.99978532 4.293612e-04 2.146806e-04
[27,] 0.99932092 1.358156e-03 6.790780e-04
[28,] 0.99578031 8.439388e-03 4.219694e-03
> postscript(file="/var/www/html/rcomp/tmp/1g5cn1258705389.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/2ivih1258705389.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/35awt1258705389.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/4dkct1258705389.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/57l661258705389.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 6
-1.89358974 -2.68153846 -3.38153846 -5.00153846 -6.32153846 -6.36153846
7 8 9 10 11 12
-6.12365385 -4.44365385 -3.28365385 -2.38365385 -1.98365385 -1.42365385
13 14 15 16 17 18
-1.08493590 -3.37288462 -3.77288462 -3.49288462 -3.51288462 -2.35288462
19 20 21 22 23 24
-1.51500000 1.46500000 4.02500000 4.72500000 4.52500000 4.68500000
25 26 27 28 29 30
5.62371795 5.53576923 6.63576923 8.01576923 9.49576923 9.65576923
31 32 33 34 35 36
13.30423077 9.18423077 5.24423077 3.24423077 2.74423077 2.80423077
37 38 39 40 41 42
3.34294872 2.85500000 2.95500000 2.43500000 1.91500000 1.27500000
43 44 45 46 47 48
-0.78711538 -0.50711538 -0.34711538 -0.14711538 0.05288462 -0.68711538
49 50 51 52 53 54
-1.14839744 -2.33634615 -2.43634615 -1.95634615 -1.57634615 -2.21634615
55 56 57 58 59 60
-4.87846154 -5.69846154 -5.63846154 -5.43846154 -5.33846154 -5.37846154
61
-4.83974359
> postscript(file="/var/www/html/rcomp/tmp/6s7m21258705389.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 -1.89358974 NA
1 -2.68153846 -1.89358974
2 -3.38153846 -2.68153846
3 -5.00153846 -3.38153846
4 -6.32153846 -5.00153846
5 -6.36153846 -6.32153846
6 -6.12365385 -6.36153846
7 -4.44365385 -6.12365385
8 -3.28365385 -4.44365385
9 -2.38365385 -3.28365385
10 -1.98365385 -2.38365385
11 -1.42365385 -1.98365385
12 -1.08493590 -1.42365385
13 -3.37288462 -1.08493590
14 -3.77288462 -3.37288462
15 -3.49288462 -3.77288462
16 -3.51288462 -3.49288462
17 -2.35288462 -3.51288462
18 -1.51500000 -2.35288462
19 1.46500000 -1.51500000
20 4.02500000 1.46500000
21 4.72500000 4.02500000
22 4.52500000 4.72500000
23 4.68500000 4.52500000
24 5.62371795 4.68500000
25 5.53576923 5.62371795
26 6.63576923 5.53576923
27 8.01576923 6.63576923
28 9.49576923 8.01576923
29 9.65576923 9.49576923
30 13.30423077 9.65576923
31 9.18423077 13.30423077
32 5.24423077 9.18423077
33 3.24423077 5.24423077
34 2.74423077 3.24423077
35 2.80423077 2.74423077
36 3.34294872 2.80423077
37 2.85500000 3.34294872
38 2.95500000 2.85500000
39 2.43500000 2.95500000
40 1.91500000 2.43500000
41 1.27500000 1.91500000
42 -0.78711538 1.27500000
43 -0.50711538 -0.78711538
44 -0.34711538 -0.50711538
45 -0.14711538 -0.34711538
46 0.05288462 -0.14711538
47 -0.68711538 0.05288462
48 -1.14839744 -0.68711538
49 -2.33634615 -1.14839744
50 -2.43634615 -2.33634615
51 -1.95634615 -2.43634615
52 -1.57634615 -1.95634615
53 -2.21634615 -1.57634615
54 -4.87846154 -2.21634615
55 -5.69846154 -4.87846154
56 -5.63846154 -5.69846154
57 -5.43846154 -5.63846154
58 -5.33846154 -5.43846154
59 -5.37846154 -5.33846154
60 -4.83974359 -5.37846154
61 NA -4.83974359
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -2.68153846 -1.89358974
[2,] -3.38153846 -2.68153846
[3,] -5.00153846 -3.38153846
[4,] -6.32153846 -5.00153846
[5,] -6.36153846 -6.32153846
[6,] -6.12365385 -6.36153846
[7,] -4.44365385 -6.12365385
[8,] -3.28365385 -4.44365385
[9,] -2.38365385 -3.28365385
[10,] -1.98365385 -2.38365385
[11,] -1.42365385 -1.98365385
[12,] -1.08493590 -1.42365385
[13,] -3.37288462 -1.08493590
[14,] -3.77288462 -3.37288462
[15,] -3.49288462 -3.77288462
[16,] -3.51288462 -3.49288462
[17,] -2.35288462 -3.51288462
[18,] -1.51500000 -2.35288462
[19,] 1.46500000 -1.51500000
[20,] 4.02500000 1.46500000
[21,] 4.72500000 4.02500000
[22,] 4.52500000 4.72500000
[23,] 4.68500000 4.52500000
[24,] 5.62371795 4.68500000
[25,] 5.53576923 5.62371795
[26,] 6.63576923 5.53576923
[27,] 8.01576923 6.63576923
[28,] 9.49576923 8.01576923
[29,] 9.65576923 9.49576923
[30,] 13.30423077 9.65576923
[31,] 9.18423077 13.30423077
[32,] 5.24423077 9.18423077
[33,] 3.24423077 5.24423077
[34,] 2.74423077 3.24423077
[35,] 2.80423077 2.74423077
[36,] 3.34294872 2.80423077
[37,] 2.85500000 3.34294872
[38,] 2.95500000 2.85500000
[39,] 2.43500000 2.95500000
[40,] 1.91500000 2.43500000
[41,] 1.27500000 1.91500000
[42,] -0.78711538 1.27500000
[43,] -0.50711538 -0.78711538
[44,] -0.34711538 -0.50711538
[45,] -0.14711538 -0.34711538
[46,] 0.05288462 -0.14711538
[47,] -0.68711538 0.05288462
[48,] -1.14839744 -0.68711538
[49,] -2.33634615 -1.14839744
[50,] -2.43634615 -2.33634615
[51,] -1.95634615 -2.43634615
[52,] -1.57634615 -1.95634615
[53,] -2.21634615 -1.57634615
[54,] -4.87846154 -2.21634615
[55,] -5.69846154 -4.87846154
[56,] -5.63846154 -5.69846154
[57,] -5.43846154 -5.63846154
[58,] -5.33846154 -5.43846154
[59,] -5.37846154 -5.33846154
[60,] -4.83974359 -5.37846154
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -2.68153846 -1.89358974
2 -3.38153846 -2.68153846
3 -5.00153846 -3.38153846
4 -6.32153846 -5.00153846
5 -6.36153846 -6.32153846
6 -6.12365385 -6.36153846
7 -4.44365385 -6.12365385
8 -3.28365385 -4.44365385
9 -2.38365385 -3.28365385
10 -1.98365385 -2.38365385
11 -1.42365385 -1.98365385
12 -1.08493590 -1.42365385
13 -3.37288462 -1.08493590
14 -3.77288462 -3.37288462
15 -3.49288462 -3.77288462
16 -3.51288462 -3.49288462
17 -2.35288462 -3.51288462
18 -1.51500000 -2.35288462
19 1.46500000 -1.51500000
20 4.02500000 1.46500000
21 4.72500000 4.02500000
22 4.52500000 4.72500000
23 4.68500000 4.52500000
24 5.62371795 4.68500000
25 5.53576923 5.62371795
26 6.63576923 5.53576923
27 8.01576923 6.63576923
28 9.49576923 8.01576923
29 9.65576923 9.49576923
30 13.30423077 9.65576923
31 9.18423077 13.30423077
32 5.24423077 9.18423077
33 3.24423077 5.24423077
34 2.74423077 3.24423077
35 2.80423077 2.74423077
36 3.34294872 2.80423077
37 2.85500000 3.34294872
38 2.95500000 2.85500000
39 2.43500000 2.95500000
40 1.91500000 2.43500000
41 1.27500000 1.91500000
42 -0.78711538 1.27500000
43 -0.50711538 -0.78711538
44 -0.34711538 -0.50711538
45 -0.14711538 -0.34711538
46 0.05288462 -0.14711538
47 -0.68711538 0.05288462
48 -1.14839744 -0.68711538
49 -2.33634615 -1.14839744
50 -2.43634615 -2.33634615
51 -1.95634615 -2.43634615
52 -1.57634615 -1.95634615
53 -2.21634615 -1.57634615
54 -4.87846154 -2.21634615
55 -5.69846154 -4.87846154
56 -5.63846154 -5.69846154
57 -5.43846154 -5.63846154
58 -5.33846154 -5.43846154
59 -5.37846154 -5.33846154
60 -4.83974359 -5.37846154
> 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/73k071258705389.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/8ci7m1258705389.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/93bpd1258705389.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/10ic0e1258705389.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/11phnm1258705389.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/127hcz1258705389.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/13ye441258705389.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/1473rv1258705389.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/15hdi41258705389.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/16421l1258705389.tab")
+ }
>
> system("convert tmp/1g5cn1258705389.ps tmp/1g5cn1258705389.png")
> system("convert tmp/2ivih1258705389.ps tmp/2ivih1258705389.png")
> system("convert tmp/35awt1258705389.ps tmp/35awt1258705389.png")
> system("convert tmp/4dkct1258705389.ps tmp/4dkct1258705389.png")
> system("convert tmp/57l661258705389.ps tmp/57l661258705389.png")
> system("convert tmp/6s7m21258705389.ps tmp/6s7m21258705389.png")
> system("convert tmp/73k071258705389.ps tmp/73k071258705389.png")
> system("convert tmp/8ci7m1258705389.ps tmp/8ci7m1258705389.png")
> system("convert tmp/93bpd1258705389.ps tmp/93bpd1258705389.png")
> system("convert tmp/10ic0e1258705389.ps tmp/10ic0e1258705389.png")
>
>
> proc.time()
user system elapsed
2.381 1.534 3.200