R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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(78.4,0,114.6,0,113.3,0,117.0,0,99.6,0,99.4,0,101.9,0,115.2,0,108.5,0,113.8,0,121.0,0,92.2,0,90.2,0,101.5,0,126.6,0,93.9,0,89.8,0,93.4,0,101.5,0,110.4,0,105.9,0,108.4,0,113.9,0,86.1,0,69.4,0,101.2,0,100.5,0,98.0,0,106.6,0,90.1,0,96.9,0,125.9,0,112.0,0,100.0,0,123.9,0,79.8,0,83.4,0,113.6,0,112.9,0,104.0,0,109.9,0,99.0,0,106.3,0,128.9,0,111.1,0,102.9,0,130.0,0,87.0,0,87.5,0,117.6,0,103.4,0,110.8,0,112.6,0,102.5,0,112.4,0,135.6,0,105.1,0,127.7,0,137.0,0,91.0,0,90.5,0,122.4,0,123.3,0,124.3,0,120.0,0,118.1,0,119.0,0,142.7,0,123.6,0,129.6,0,151.6,0,110.4,1,99.2,1,130.5,1,136.2,1,129.7,1,128.0,1,121.6,1,135.8,1,143.8,1,147.5,1,136.2,1,156.6,1,123.3,1,100.4,1),dim=c(2,85),dimnames=list(c('I','D'),1:85))
> y <- array(NA,dim=c(2,85),dimnames=list(c('I','D'),1:85))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
I D
1 78.4 0
2 114.6 0
3 113.3 0
4 117.0 0
5 99.6 0
6 99.4 0
7 101.9 0
8 115.2 0
9 108.5 0
10 113.8 0
11 121.0 0
12 92.2 0
13 90.2 0
14 101.5 0
15 126.6 0
16 93.9 0
17 89.8 0
18 93.4 0
19 101.5 0
20 110.4 0
21 105.9 0
22 108.4 0
23 113.9 0
24 86.1 0
25 69.4 0
26 101.2 0
27 100.5 0
28 98.0 0
29 106.6 0
30 90.1 0
31 96.9 0
32 125.9 0
33 112.0 0
34 100.0 0
35 123.9 0
36 79.8 0
37 83.4 0
38 113.6 0
39 112.9 0
40 104.0 0
41 109.9 0
42 99.0 0
43 106.3 0
44 128.9 0
45 111.1 0
46 102.9 0
47 130.0 0
48 87.0 0
49 87.5 0
50 117.6 0
51 103.4 0
52 110.8 0
53 112.6 0
54 102.5 0
55 112.4 0
56 135.6 0
57 105.1 0
58 127.7 0
59 137.0 0
60 91.0 0
61 90.5 0
62 122.4 0
63 123.3 0
64 124.3 0
65 120.0 0
66 118.1 0
67 119.0 0
68 142.7 0
69 123.6 0
70 129.6 0
71 151.6 0
72 110.4 1
73 99.2 1
74 130.5 1
75 136.2 1
76 129.7 1
77 128.0 1
78 121.6 1
79 135.8 1
80 143.8 1
81 147.5 1
82 136.2 1
83 156.6 1
84 123.3 1
85 100.4 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) D
108.42 20.09
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-39.024 -9.024 1.186 9.676 43.176
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 108.424 1.896 57.200 < 2e-16 ***
D 20.090 4.671 4.301 4.60e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 15.97 on 83 degrees of freedom
Multiple R-squared: 0.1823, Adjusted R-squared: 0.1724
F-statistic: 18.5 on 1 and 83 DF, p-value: 4.605e-05
> 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.73551126 0.52897749 0.2644887
[2,] 0.60024867 0.79950265 0.3997513
[3,] 0.45637084 0.91274168 0.5436292
[4,] 0.38581399 0.77162798 0.6141860
[5,] 0.27632283 0.55264566 0.7236772
[6,] 0.20923076 0.41846152 0.7907692
[7,] 0.20212646 0.40425291 0.7978735
[8,] 0.20233163 0.40466325 0.7976684
[9,] 0.21068187 0.42136375 0.7893181
[10,] 0.15121078 0.30242155 0.8487892
[11,] 0.20890020 0.41780040 0.7910998
[12,] 0.18805911 0.37611823 0.8119409
[13,] 0.19383617 0.38767234 0.8061638
[14,] 0.17162149 0.34324298 0.8283785
[15,] 0.12670576 0.25341153 0.8732942
[16,] 0.09459693 0.18919386 0.9054031
[17,] 0.06560582 0.13121163 0.9343942
[18,] 0.04518698 0.09037395 0.9548130
[19,] 0.03463433 0.06926865 0.9653657
[20,] 0.04805819 0.09611638 0.9519418
[21,] 0.21302107 0.42604215 0.7869789
[22,] 0.16977675 0.33955351 0.8302232
[23,] 0.13415024 0.26830048 0.8658498
[24,] 0.10856554 0.21713107 0.8914345
[25,] 0.08198538 0.16397076 0.9180146
[26,] 0.08444647 0.16889294 0.9155535
[27,] 0.06970142 0.13940285 0.9302986
[28,] 0.09796693 0.19593386 0.9020331
[29,] 0.07863892 0.15727785 0.9213611
[30,] 0.06193996 0.12387991 0.9380600
[31,] 0.07320028 0.14640056 0.9267997
[32,] 0.13973194 0.27946389 0.8602681
[33,] 0.20522910 0.41045821 0.7947709
[34,] 0.17702321 0.35404642 0.8229768
[35,] 0.14931266 0.29862531 0.8506873
[36,] 0.12223250 0.24446500 0.8777675
[37,] 0.09797145 0.19594290 0.9020286
[38,] 0.08614286 0.17228573 0.9138571
[39,] 0.06814701 0.13629402 0.9318530
[40,] 0.09257032 0.18514063 0.9074297
[41,] 0.07302507 0.14605015 0.9269749
[42,] 0.05985203 0.11970407 0.9401480
[43,] 0.08096075 0.16192150 0.9190392
[44,] 0.12257866 0.24515732 0.8774213
[45,] 0.18602516 0.37205032 0.8139748
[46,] 0.16225453 0.32450906 0.8377455
[47,] 0.14731823 0.29463645 0.8526818
[48,] 0.12314826 0.24629651 0.8768517
[49,] 0.10174674 0.20349347 0.8982533
[50,] 0.09809424 0.19618849 0.9019058
[51,] 0.08162214 0.16324428 0.9183779
[52,] 0.11868485 0.23736969 0.8813152
[53,] 0.11047550 0.22095100 0.8895245
[54,] 0.10884382 0.21768764 0.8911562
[55,] 0.14912698 0.29825396 0.8508730
[56,] 0.24326693 0.48653387 0.7567331
[57,] 0.44223027 0.88446054 0.5577697
[58,] 0.40408050 0.80816100 0.5959195
[59,] 0.36612190 0.73224379 0.6338781
[60,] 0.32876679 0.65753359 0.6712332
[61,] 0.29698607 0.59397214 0.7030139
[62,] 0.28083259 0.56166517 0.7191674
[63,] 0.27908406 0.55816812 0.7209159
[64,] 0.29930485 0.59860970 0.7006951
[65,] 0.28611076 0.57222153 0.7138892
[66,] 0.29451555 0.58903110 0.7054844
[67,] 0.31273575 0.62547150 0.6872642
[68,] 0.31604732 0.63209464 0.6839527
[69,] 0.53649280 0.92701439 0.4635072
[70,] 0.45664702 0.91329403 0.5433530
[71,] 0.37497734 0.74995468 0.6250227
[72,] 0.28148167 0.56296335 0.7185183
[73,] 0.19933709 0.39867418 0.8006629
[74,] 0.15325398 0.30650796 0.8467460
[75,] 0.09023566 0.18047132 0.9097643
[76,] 0.05572714 0.11145429 0.9442729
> postscript(file="/var/www/html/rcomp/tmp/1jp6d1227727739.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/2kmhh1227727739.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/3p8y41227727739.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/4g0uk1227727739.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/5o7u21227727739.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 = 85
Frequency = 1
1 2 3 4 5 6
-30.02394366 6.17605634 4.87605634 8.57605634 -8.82394366 -9.02394366
7 8 9 10 11 12
-6.52394366 6.77605634 0.07605634 5.37605634 12.57605634 -16.22394366
13 14 15 16 17 18
-18.22394366 -6.92394366 18.17605634 -14.52394366 -18.62394366 -15.02394366
19 20 21 22 23 24
-6.92394366 1.97605634 -2.52394366 -0.02394366 5.47605634 -22.32394366
25 26 27 28 29 30
-39.02394366 -7.22394366 -7.92394366 -10.42394366 -1.82394366 -18.32394366
31 32 33 34 35 36
-11.52394366 17.47605634 3.57605634 -8.42394366 15.47605634 -28.62394366
37 38 39 40 41 42
-25.02394366 5.17605634 4.47605634 -4.42394366 1.47605634 -9.42394366
43 44 45 46 47 48
-2.12394366 20.47605634 2.67605634 -5.52394366 21.57605634 -21.42394366
49 50 51 52 53 54
-20.92394366 9.17605634 -5.02394366 2.37605634 4.17605634 -5.92394366
55 56 57 58 59 60
3.97605634 27.17605634 -3.32394366 19.27605634 28.57605634 -17.42394366
61 62 63 64 65 66
-17.92394366 13.97605634 14.87605634 15.87605634 11.57605634 9.67605634
67 68 69 70 71 72
10.57605634 34.27605634 15.17605634 21.17605634 43.17605634 -18.11428571
73 74 75 76 77 78
-29.31428571 1.98571429 7.68571429 1.18571429 -0.51428571 -6.91428571
79 80 81 82 83 84
7.28571429 15.28571429 18.98571429 7.68571429 28.08571429 -5.21428571
85
-28.11428571
> postscript(file="/var/www/html/rcomp/tmp/6ndfn1227727739.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 = 85
Frequency = 1
lag(myerror, k = 1) myerror
0 -30.02394366 NA
1 6.17605634 -30.02394366
2 4.87605634 6.17605634
3 8.57605634 4.87605634
4 -8.82394366 8.57605634
5 -9.02394366 -8.82394366
6 -6.52394366 -9.02394366
7 6.77605634 -6.52394366
8 0.07605634 6.77605634
9 5.37605634 0.07605634
10 12.57605634 5.37605634
11 -16.22394366 12.57605634
12 -18.22394366 -16.22394366
13 -6.92394366 -18.22394366
14 18.17605634 -6.92394366
15 -14.52394366 18.17605634
16 -18.62394366 -14.52394366
17 -15.02394366 -18.62394366
18 -6.92394366 -15.02394366
19 1.97605634 -6.92394366
20 -2.52394366 1.97605634
21 -0.02394366 -2.52394366
22 5.47605634 -0.02394366
23 -22.32394366 5.47605634
24 -39.02394366 -22.32394366
25 -7.22394366 -39.02394366
26 -7.92394366 -7.22394366
27 -10.42394366 -7.92394366
28 -1.82394366 -10.42394366
29 -18.32394366 -1.82394366
30 -11.52394366 -18.32394366
31 17.47605634 -11.52394366
32 3.57605634 17.47605634
33 -8.42394366 3.57605634
34 15.47605634 -8.42394366
35 -28.62394366 15.47605634
36 -25.02394366 -28.62394366
37 5.17605634 -25.02394366
38 4.47605634 5.17605634
39 -4.42394366 4.47605634
40 1.47605634 -4.42394366
41 -9.42394366 1.47605634
42 -2.12394366 -9.42394366
43 20.47605634 -2.12394366
44 2.67605634 20.47605634
45 -5.52394366 2.67605634
46 21.57605634 -5.52394366
47 -21.42394366 21.57605634
48 -20.92394366 -21.42394366
49 9.17605634 -20.92394366
50 -5.02394366 9.17605634
51 2.37605634 -5.02394366
52 4.17605634 2.37605634
53 -5.92394366 4.17605634
54 3.97605634 -5.92394366
55 27.17605634 3.97605634
56 -3.32394366 27.17605634
57 19.27605634 -3.32394366
58 28.57605634 19.27605634
59 -17.42394366 28.57605634
60 -17.92394366 -17.42394366
61 13.97605634 -17.92394366
62 14.87605634 13.97605634
63 15.87605634 14.87605634
64 11.57605634 15.87605634
65 9.67605634 11.57605634
66 10.57605634 9.67605634
67 34.27605634 10.57605634
68 15.17605634 34.27605634
69 21.17605634 15.17605634
70 43.17605634 21.17605634
71 -18.11428571 43.17605634
72 -29.31428571 -18.11428571
73 1.98571429 -29.31428571
74 7.68571429 1.98571429
75 1.18571429 7.68571429
76 -0.51428571 1.18571429
77 -6.91428571 -0.51428571
78 7.28571429 -6.91428571
79 15.28571429 7.28571429
80 18.98571429 15.28571429
81 7.68571429 18.98571429
82 28.08571429 7.68571429
83 -5.21428571 28.08571429
84 -28.11428571 -5.21428571
85 NA -28.11428571
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 6.17605634 -30.02394366
[2,] 4.87605634 6.17605634
[3,] 8.57605634 4.87605634
[4,] -8.82394366 8.57605634
[5,] -9.02394366 -8.82394366
[6,] -6.52394366 -9.02394366
[7,] 6.77605634 -6.52394366
[8,] 0.07605634 6.77605634
[9,] 5.37605634 0.07605634
[10,] 12.57605634 5.37605634
[11,] -16.22394366 12.57605634
[12,] -18.22394366 -16.22394366
[13,] -6.92394366 -18.22394366
[14,] 18.17605634 -6.92394366
[15,] -14.52394366 18.17605634
[16,] -18.62394366 -14.52394366
[17,] -15.02394366 -18.62394366
[18,] -6.92394366 -15.02394366
[19,] 1.97605634 -6.92394366
[20,] -2.52394366 1.97605634
[21,] -0.02394366 -2.52394366
[22,] 5.47605634 -0.02394366
[23,] -22.32394366 5.47605634
[24,] -39.02394366 -22.32394366
[25,] -7.22394366 -39.02394366
[26,] -7.92394366 -7.22394366
[27,] -10.42394366 -7.92394366
[28,] -1.82394366 -10.42394366
[29,] -18.32394366 -1.82394366
[30,] -11.52394366 -18.32394366
[31,] 17.47605634 -11.52394366
[32,] 3.57605634 17.47605634
[33,] -8.42394366 3.57605634
[34,] 15.47605634 -8.42394366
[35,] -28.62394366 15.47605634
[36,] -25.02394366 -28.62394366
[37,] 5.17605634 -25.02394366
[38,] 4.47605634 5.17605634
[39,] -4.42394366 4.47605634
[40,] 1.47605634 -4.42394366
[41,] -9.42394366 1.47605634
[42,] -2.12394366 -9.42394366
[43,] 20.47605634 -2.12394366
[44,] 2.67605634 20.47605634
[45,] -5.52394366 2.67605634
[46,] 21.57605634 -5.52394366
[47,] -21.42394366 21.57605634
[48,] -20.92394366 -21.42394366
[49,] 9.17605634 -20.92394366
[50,] -5.02394366 9.17605634
[51,] 2.37605634 -5.02394366
[52,] 4.17605634 2.37605634
[53,] -5.92394366 4.17605634
[54,] 3.97605634 -5.92394366
[55,] 27.17605634 3.97605634
[56,] -3.32394366 27.17605634
[57,] 19.27605634 -3.32394366
[58,] 28.57605634 19.27605634
[59,] -17.42394366 28.57605634
[60,] -17.92394366 -17.42394366
[61,] 13.97605634 -17.92394366
[62,] 14.87605634 13.97605634
[63,] 15.87605634 14.87605634
[64,] 11.57605634 15.87605634
[65,] 9.67605634 11.57605634
[66,] 10.57605634 9.67605634
[67,] 34.27605634 10.57605634
[68,] 15.17605634 34.27605634
[69,] 21.17605634 15.17605634
[70,] 43.17605634 21.17605634
[71,] -18.11428571 43.17605634
[72,] -29.31428571 -18.11428571
[73,] 1.98571429 -29.31428571
[74,] 7.68571429 1.98571429
[75,] 1.18571429 7.68571429
[76,] -0.51428571 1.18571429
[77,] -6.91428571 -0.51428571
[78,] 7.28571429 -6.91428571
[79,] 15.28571429 7.28571429
[80,] 18.98571429 15.28571429
[81,] 7.68571429 18.98571429
[82,] 28.08571429 7.68571429
[83,] -5.21428571 28.08571429
[84,] -28.11428571 -5.21428571
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 6.17605634 -30.02394366
2 4.87605634 6.17605634
3 8.57605634 4.87605634
4 -8.82394366 8.57605634
5 -9.02394366 -8.82394366
6 -6.52394366 -9.02394366
7 6.77605634 -6.52394366
8 0.07605634 6.77605634
9 5.37605634 0.07605634
10 12.57605634 5.37605634
11 -16.22394366 12.57605634
12 -18.22394366 -16.22394366
13 -6.92394366 -18.22394366
14 18.17605634 -6.92394366
15 -14.52394366 18.17605634
16 -18.62394366 -14.52394366
17 -15.02394366 -18.62394366
18 -6.92394366 -15.02394366
19 1.97605634 -6.92394366
20 -2.52394366 1.97605634
21 -0.02394366 -2.52394366
22 5.47605634 -0.02394366
23 -22.32394366 5.47605634
24 -39.02394366 -22.32394366
25 -7.22394366 -39.02394366
26 -7.92394366 -7.22394366
27 -10.42394366 -7.92394366
28 -1.82394366 -10.42394366
29 -18.32394366 -1.82394366
30 -11.52394366 -18.32394366
31 17.47605634 -11.52394366
32 3.57605634 17.47605634
33 -8.42394366 3.57605634
34 15.47605634 -8.42394366
35 -28.62394366 15.47605634
36 -25.02394366 -28.62394366
37 5.17605634 -25.02394366
38 4.47605634 5.17605634
39 -4.42394366 4.47605634
40 1.47605634 -4.42394366
41 -9.42394366 1.47605634
42 -2.12394366 -9.42394366
43 20.47605634 -2.12394366
44 2.67605634 20.47605634
45 -5.52394366 2.67605634
46 21.57605634 -5.52394366
47 -21.42394366 21.57605634
48 -20.92394366 -21.42394366
49 9.17605634 -20.92394366
50 -5.02394366 9.17605634
51 2.37605634 -5.02394366
52 4.17605634 2.37605634
53 -5.92394366 4.17605634
54 3.97605634 -5.92394366
55 27.17605634 3.97605634
56 -3.32394366 27.17605634
57 19.27605634 -3.32394366
58 28.57605634 19.27605634
59 -17.42394366 28.57605634
60 -17.92394366 -17.42394366
61 13.97605634 -17.92394366
62 14.87605634 13.97605634
63 15.87605634 14.87605634
64 11.57605634 15.87605634
65 9.67605634 11.57605634
66 10.57605634 9.67605634
67 34.27605634 10.57605634
68 15.17605634 34.27605634
69 21.17605634 15.17605634
70 43.17605634 21.17605634
71 -18.11428571 43.17605634
72 -29.31428571 -18.11428571
73 1.98571429 -29.31428571
74 7.68571429 1.98571429
75 1.18571429 7.68571429
76 -0.51428571 1.18571429
77 -6.91428571 -0.51428571
78 7.28571429 -6.91428571
79 15.28571429 7.28571429
80 18.98571429 15.28571429
81 7.68571429 18.98571429
82 28.08571429 7.68571429
83 -5.21428571 28.08571429
84 -28.11428571 -5.21428571
> 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/7bi4q1227727739.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/8lqsh1227727739.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/9w6mr1227727739.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/109a7x1227727739.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/11g9py1227727739.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/12iqex1227727739.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/13goc71227727739.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/14nbh01227727739.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/159k011227727739.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/169z0l1227727739.tab")
+ }
>
> system("convert tmp/1jp6d1227727739.ps tmp/1jp6d1227727739.png")
> system("convert tmp/2kmhh1227727739.ps tmp/2kmhh1227727739.png")
> system("convert tmp/3p8y41227727739.ps tmp/3p8y41227727739.png")
> system("convert tmp/4g0uk1227727739.ps tmp/4g0uk1227727739.png")
> system("convert tmp/5o7u21227727739.ps tmp/5o7u21227727739.png")
> system("convert tmp/6ndfn1227727739.ps tmp/6ndfn1227727739.png")
> system("convert tmp/7bi4q1227727739.ps tmp/7bi4q1227727739.png")
> system("convert tmp/8lqsh1227727739.ps tmp/8lqsh1227727739.png")
> system("convert tmp/9w6mr1227727739.ps tmp/9w6mr1227727739.png")
> system("convert tmp/109a7x1227727739.ps tmp/109a7x1227727739.png")
>
>
> proc.time()
user system elapsed
2.664 1.556 3.609