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(12919.9
+ ,12973.9
+ ,12919.9
+ ,12266.7
+ ,12384.6
+ ,12476.8
+ ,11497.3
+ ,12509.8
+ ,11497.3
+ ,12919.9
+ ,12266.7
+ ,12384.6
+ ,12142
+ ,12934.1
+ ,12142
+ ,11497.3
+ ,12919.9
+ ,12266.7
+ ,13919.4
+ ,14908.3
+ ,13919.4
+ ,12142
+ ,11497.3
+ ,12919.9
+ ,12656.8
+ ,13772.1
+ ,12656.8
+ ,13919.4
+ ,12142
+ ,11497.3
+ ,12034.1
+ ,13012.6
+ ,12034.1
+ ,12656.8
+ ,13919.4
+ ,12142
+ ,13199.7
+ ,14049.9
+ ,13199.7
+ ,12034.1
+ ,12656.8
+ ,13919.4
+ ,10881.3
+ ,11816.5
+ ,10881.3
+ ,13199.7
+ ,12034.1
+ ,12656.8
+ ,11301.2
+ ,11593.2
+ ,11301.2
+ ,10881.3
+ ,13199.7
+ ,12034.1
+ ,13643.9
+ ,14466.2
+ ,13643.9
+ ,11301.2
+ ,10881.3
+ ,13199.7
+ ,12517
+ ,13615.9
+ ,12517
+ ,13643.9
+ ,11301.2
+ ,10881.3
+ ,13981.1
+ ,14733.9
+ ,13981.1
+ ,12517
+ ,13643.9
+ ,11301.2
+ ,14275.7
+ ,13880.7
+ ,14275.7
+ ,13981.1
+ ,12517
+ ,13643.9
+ ,13435
+ ,13527.5
+ ,13435
+ ,14275.7
+ ,13981.1
+ ,12517
+ ,13565.7
+ ,13584
+ ,13565.7
+ ,13435
+ ,14275.7
+ ,13981.1
+ ,16216.3
+ ,16170.2
+ ,16216.3
+ ,13565.7
+ ,13435
+ ,14275.7
+ ,12970
+ ,13260.6
+ ,12970
+ ,16216.3
+ ,13565.7
+ ,13435
+ ,14079.9
+ ,14741.9
+ ,14079.9
+ ,12970
+ ,16216.3
+ ,13565.7
+ ,14235
+ ,15486.5
+ ,14235
+ ,14079.9
+ ,12970
+ ,16216.3
+ ,12213.4
+ ,13154.5
+ ,12213.4
+ ,14235
+ ,14079.9
+ ,12970
+ ,12581
+ ,12621.2
+ ,12581
+ ,12213.4
+ ,14235
+ ,14079.9
+ ,14130.4
+ ,15031.6
+ ,14130.4
+ ,12581
+ ,12213.4
+ ,14235
+ ,14210.8
+ ,15452.4
+ ,14210.8
+ ,14130.4
+ ,12581
+ ,12213.4
+ ,14378.5
+ ,15428
+ ,14378.5
+ ,14210.8
+ ,14130.4
+ ,12581
+ ,13142.8
+ ,13105.9
+ ,13142.8
+ ,14378.5
+ ,14210.8
+ ,14130.4
+ ,13714.7
+ ,14716.8
+ ,13714.7
+ ,13142.8
+ ,14378.5
+ ,14210.8
+ ,13621.9
+ ,14180
+ ,13621.9
+ ,13714.7
+ ,13142.8
+ ,14378.5
+ ,15379.8
+ ,16202.2
+ ,15379.8
+ ,13621.9
+ ,13714.7
+ ,13142.8
+ ,13306.3
+ ,14392.4
+ ,13306.3
+ ,15379.8
+ ,13621.9
+ ,13714.7
+ ,14391.2
+ ,15140.6
+ ,14391.2
+ ,13306.3
+ ,15379.8
+ ,13621.9
+ ,14909.9
+ ,15960.1
+ ,14909.9
+ ,14391.2
+ ,13306.3
+ ,15379.8
+ ,14025.4
+ ,14351.3
+ ,14025.4
+ ,14909.9
+ ,14391.2
+ ,13306.3
+ ,12951.2
+ ,13230.2
+ ,12951.2
+ ,14025.4
+ ,14909.9
+ ,14391.2
+ ,14344.3
+ ,15202.1
+ ,14344.3
+ ,12951.2
+ ,14025.4
+ ,14909.9
+ ,16093.4
+ ,17056
+ ,16093.4
+ ,14344.3
+ ,12951.2
+ ,14025.4
+ ,15413.6
+ ,16077.7
+ ,15413.6
+ ,16093.4
+ ,14344.3
+ ,12951.2
+ ,14705.7
+ ,13348.2
+ ,14705.7
+ ,15413.6
+ ,16093.4
+ ,14344.3
+ ,15972.8
+ ,16402.4
+ ,15972.8
+ ,14705.7
+ ,15413.6
+ ,16093.4
+ ,16241.4
+ ,16559.1
+ ,16241.4
+ ,15972.8
+ ,14705.7
+ ,15413.6
+ ,16626.4
+ ,16579
+ ,16626.4
+ ,16241.4
+ ,15972.8
+ ,14705.7
+ ,17136.2
+ ,17561.2
+ ,17136.2
+ ,16626.4
+ ,16241.4
+ ,15972.8
+ ,15622.9
+ ,16129.6
+ ,15622.9
+ ,17136.2
+ ,16626.4
+ ,16241.4
+ ,18003.9
+ ,18484.3
+ ,18003.9
+ ,15622.9
+ ,17136.2
+ ,16626.4
+ ,16136.1
+ ,16402.6
+ ,16136.1
+ ,18003.9
+ ,15622.9
+ ,17136.2
+ ,14423.7
+ ,14032.3
+ ,14423.7
+ ,16136.1
+ ,18003.9
+ ,15622.9
+ ,16789.4
+ ,17109.1
+ ,16789.4
+ ,14423.7
+ ,16136.1
+ ,18003.9
+ ,16782.2
+ ,17157.2
+ ,16782.2
+ ,16789.4
+ ,14423.7
+ ,16136.1
+ ,14133.8
+ ,13879.8
+ ,14133.8
+ ,16782.2
+ ,16789.4
+ ,14423.7
+ ,12607
+ ,12362.4
+ ,12607
+ ,14133.8
+ ,16782.2
+ ,16789.4
+ ,12004.5
+ ,12683.5
+ ,12004.5
+ ,12607
+ ,14133.8
+ ,16782.2
+ ,12175.4
+ ,12608.8
+ ,12175.4
+ ,12004.5
+ ,12607
+ ,14133.8
+ ,13268
+ ,13583.7
+ ,13268
+ ,12175.4
+ ,12004.5
+ ,12607
+ ,12299.3
+ ,12846.3
+ ,12299.3
+ ,13268
+ ,12175.4
+ ,12004.5
+ ,11800.6
+ ,12347.1
+ ,11800.6
+ ,12299.3
+ ,13268
+ ,12175.4
+ ,13873.3
+ ,13967
+ ,13873.3
+ ,11800.6
+ ,12299.3
+ ,13268
+ ,12269.6
+ ,13114.3
+ ,12269.6
+ ,13873.3
+ ,11800.6
+ ,12299.3)
+ ,dim=c(6
+ ,56)
+ ,dimnames=list(c('In_IEU'
+ ,'Uit_IEU'
+ ,'Yt-1'
+ ,'Yt-2'
+ ,'Yt-3'
+ ,'Yt-4')
+ ,1:56))
> y <- array(NA,dim=c(6,56),dimnames=list(c('In_IEU','Uit_IEU','Yt-1','Yt-2','Yt-3','Yt-4'),1:56))
> 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
In_IEU Uit_IEU Yt-1 Yt-2 Yt-3 Yt-4 M1 M2 M3 M4 M5 M6 M7 M8 M9
1 12919.9 12973.9 12919.9 12266.7 12384.6 12476.8 1 0 0 0 0 0 0 0 0
2 11497.3 12509.8 11497.3 12919.9 12266.7 12384.6 0 1 0 0 0 0 0 0 0
3 12142.0 12934.1 12142.0 11497.3 12919.9 12266.7 0 0 1 0 0 0 0 0 0
4 13919.4 14908.3 13919.4 12142.0 11497.3 12919.9 0 0 0 1 0 0 0 0 0
5 12656.8 13772.1 12656.8 13919.4 12142.0 11497.3 0 0 0 0 1 0 0 0 0
6 12034.1 13012.6 12034.1 12656.8 13919.4 12142.0 0 0 0 0 0 1 0 0 0
7 13199.7 14049.9 13199.7 12034.1 12656.8 13919.4 0 0 0 0 0 0 1 0 0
8 10881.3 11816.5 10881.3 13199.7 12034.1 12656.8 0 0 0 0 0 0 0 1 0
9 11301.2 11593.2 11301.2 10881.3 13199.7 12034.1 0 0 0 0 0 0 0 0 1
10 13643.9 14466.2 13643.9 11301.2 10881.3 13199.7 0 0 0 0 0 0 0 0 0
11 12517.0 13615.9 12517.0 13643.9 11301.2 10881.3 0 0 0 0 0 0 0 0 0
12 13981.1 14733.9 13981.1 12517.0 13643.9 11301.2 0 0 0 0 0 0 0 0 0
13 14275.7 13880.7 14275.7 13981.1 12517.0 13643.9 1 0 0 0 0 0 0 0 0
14 13435.0 13527.5 13435.0 14275.7 13981.1 12517.0 0 1 0 0 0 0 0 0 0
15 13565.7 13584.0 13565.7 13435.0 14275.7 13981.1 0 0 1 0 0 0 0 0 0
16 16216.3 16170.2 16216.3 13565.7 13435.0 14275.7 0 0 0 1 0 0 0 0 0
17 12970.0 13260.6 12970.0 16216.3 13565.7 13435.0 0 0 0 0 1 0 0 0 0
18 14079.9 14741.9 14079.9 12970.0 16216.3 13565.7 0 0 0 0 0 1 0 0 0
19 14235.0 15486.5 14235.0 14079.9 12970.0 16216.3 0 0 0 0 0 0 1 0 0
20 12213.4 13154.5 12213.4 14235.0 14079.9 12970.0 0 0 0 0 0 0 0 1 0
21 12581.0 12621.2 12581.0 12213.4 14235.0 14079.9 0 0 0 0 0 0 0 0 1
22 14130.4 15031.6 14130.4 12581.0 12213.4 14235.0 0 0 0 0 0 0 0 0 0
23 14210.8 15452.4 14210.8 14130.4 12581.0 12213.4 0 0 0 0 0 0 0 0 0
24 14378.5 15428.0 14378.5 14210.8 14130.4 12581.0 0 0 0 0 0 0 0 0 0
25 13142.8 13105.9 13142.8 14378.5 14210.8 14130.4 1 0 0 0 0 0 0 0 0
26 13714.7 14716.8 13714.7 13142.8 14378.5 14210.8 0 1 0 0 0 0 0 0 0
27 13621.9 14180.0 13621.9 13714.7 13142.8 14378.5 0 0 1 0 0 0 0 0 0
28 15379.8 16202.2 15379.8 13621.9 13714.7 13142.8 0 0 0 1 0 0 0 0 0
29 13306.3 14392.4 13306.3 15379.8 13621.9 13714.7 0 0 0 0 1 0 0 0 0
30 14391.2 15140.6 14391.2 13306.3 15379.8 13621.9 0 0 0 0 0 1 0 0 0
31 14909.9 15960.1 14909.9 14391.2 13306.3 15379.8 0 0 0 0 0 0 1 0 0
32 14025.4 14351.3 14025.4 14909.9 14391.2 13306.3 0 0 0 0 0 0 0 1 0
33 12951.2 13230.2 12951.2 14025.4 14909.9 14391.2 0 0 0 0 0 0 0 0 1
34 14344.3 15202.1 14344.3 12951.2 14025.4 14909.9 0 0 0 0 0 0 0 0 0
35 16093.4 17056.0 16093.4 14344.3 12951.2 14025.4 0 0 0 0 0 0 0 0 0
36 15413.6 16077.7 15413.6 16093.4 14344.3 12951.2 0 0 0 0 0 0 0 0 0
37 14705.7 13348.2 14705.7 15413.6 16093.4 14344.3 1 0 0 0 0 0 0 0 0
38 15972.8 16402.4 15972.8 14705.7 15413.6 16093.4 0 1 0 0 0 0 0 0 0
39 16241.4 16559.1 16241.4 15972.8 14705.7 15413.6 0 0 1 0 0 0 0 0 0
40 16626.4 16579.0 16626.4 16241.4 15972.8 14705.7 0 0 0 1 0 0 0 0 0
41 17136.2 17561.2 17136.2 16626.4 16241.4 15972.8 0 0 0 0 1 0 0 0 0
42 15622.9 16129.6 15622.9 17136.2 16626.4 16241.4 0 0 0 0 0 1 0 0 0
43 18003.9 18484.3 18003.9 15622.9 17136.2 16626.4 0 0 0 0 0 0 1 0 0
44 16136.1 16402.6 16136.1 18003.9 15622.9 17136.2 0 0 0 0 0 0 0 1 0
45 14423.7 14032.3 14423.7 16136.1 18003.9 15622.9 0 0 0 0 0 0 0 0 1
46 16789.4 17109.1 16789.4 14423.7 16136.1 18003.9 0 0 0 0 0 0 0 0 0
47 16782.2 17157.2 16782.2 16789.4 14423.7 16136.1 0 0 0 0 0 0 0 0 0
48 14133.8 13879.8 14133.8 16782.2 16789.4 14423.7 0 0 0 0 0 0 0 0 0
49 12607.0 12362.4 12607.0 14133.8 16782.2 16789.4 1 0 0 0 0 0 0 0 0
50 12004.5 12683.5 12004.5 12607.0 14133.8 16782.2 0 1 0 0 0 0 0 0 0
51 12175.4 12608.8 12175.4 12004.5 12607.0 14133.8 0 0 1 0 0 0 0 0 0
52 13268.0 13583.7 13268.0 12175.4 12004.5 12607.0 0 0 0 1 0 0 0 0 0
53 12299.3 12846.3 12299.3 13268.0 12175.4 12004.5 0 0 0 0 1 0 0 0 0
54 11800.6 12347.1 11800.6 12299.3 13268.0 12175.4 0 0 0 0 0 1 0 0 0
55 13873.3 13967.0 13873.3 11800.6 12299.3 13268.0 0 0 0 0 0 0 1 0 0
56 12269.6 13114.3 12269.6 13873.3 11800.6 12299.3 0 0 0 0 0 0 0 1 0
M10 M11 t
1 0 0 1
2 0 0 2
3 0 0 3
4 0 0 4
5 0 0 5
6 0 0 6
7 0 0 7
8 0 0 8
9 0 0 9
10 1 0 10
11 0 1 11
12 0 0 12
13 0 0 13
14 0 0 14
15 0 0 15
16 0 0 16
17 0 0 17
18 0 0 18
19 0 0 19
20 0 0 20
21 0 0 21
22 1 0 22
23 0 1 23
24 0 0 24
25 0 0 25
26 0 0 26
27 0 0 27
28 0 0 28
29 0 0 29
30 0 0 30
31 0 0 31
32 0 0 32
33 0 0 33
34 1 0 34
35 0 1 35
36 0 0 36
37 0 0 37
38 0 0 38
39 0 0 39
40 0 0 40
41 0 0 41
42 0 0 42
43 0 0 43
44 0 0 44
45 0 0 45
46 1 0 46
47 0 1 47
48 0 0 48
49 0 0 49
50 0 0 50
51 0 0 51
52 0 0 52
53 0 0 53
54 0 0 54
55 0 0 55
56 0 0 56
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Uit_IEU `Yt-1` `Yt-2` `Yt-3` `Yt-4`
9.338e-13 6.080e-16 1.000e+00 -3.413e-17 5.631e-17 -1.543e-17
M1 M2 M3 M4 M5 M6
-5.147e-14 -5.594e-14 2.955e-13 3.653e-14 5.838e-14 -9.648e-14
M7 M8 M9 M10 M11 t
2.906e-14 4.923e-14 -8.810e-14 1.132e-14 4.891e-14 -1.699e-15
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-3.461e-13 -5.989e-14 -4.836e-16 3.605e-14 1.064e-12
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.338e-13 4.120e-13 2.267e+00 0.0292 *
Uit_IEU 6.080e-16 1.045e-16 5.821e+00 1.00e-06 ***
`Yt-1` 1.000e+00 1.068e-16 9.365e+15 < 2e-16 ***
`Yt-2` -3.413e-17 3.841e-17 -8.890e-01 0.3798
`Yt-3` 5.631e-17 3.929e-17 1.433e+00 0.1600
`Yt-4` -1.543e-17 3.879e-17 -3.980e-01 0.6930
M1 -5.147e-14 2.089e-13 -2.460e-01 0.8067
M2 -5.594e-14 1.721e-13 -3.250e-01 0.7468
M3 2.955e-13 1.756e-13 1.683e+00 0.1006
M4 3.653e-14 1.718e-13 2.130e-01 0.8327
M5 5.838e-14 1.514e-13 3.850e-01 0.7020
M6 -9.648e-14 1.528e-13 -6.310e-01 0.5315
M7 2.906e-14 1.867e-13 1.560e-01 0.8771
M8 4.923e-14 1.577e-13 3.120e-01 0.7567
M9 -8.810e-14 1.935e-13 -4.550e-01 0.6515
M10 1.132e-14 2.099e-13 5.400e-02 0.9573
M11 4.891e-14 1.693e-13 2.890e-01 0.7743
t -1.699e-15 2.306e-15 -7.370e-01 0.4657
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.069e-13 on 38 degrees of freedom
Multiple R-squared: 1, Adjusted R-squared: 1
F-statistic: 2.006e+32 on 17 and 38 DF, p-value: < 2.2e-16
> 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.99999924 1.510626e-06 7.553129e-07
[2,] 0.40542895 8.108579e-01 5.945710e-01
[3,] 0.43230718 8.646144e-01 5.676928e-01
[4,] 0.32409819 6.481964e-01 6.759018e-01
[5,] 0.99990554 1.889254e-04 9.446268e-05
[6,] 0.99706727 5.865455e-03 2.932728e-03
[7,] 0.99930665 1.386704e-03 6.933522e-04
[8,] 0.21310441 4.262088e-01 7.868956e-01
[9,] 0.63228963 7.354207e-01 3.677104e-01
[10,] 0.50189247 9.962151e-01 4.981075e-01
[11,] 0.96498120 7.003760e-02 3.501880e-02
[12,] 0.02353331 4.706662e-02 9.764667e-01
[13,] 1.00000000 0.000000e+00 0.000000e+00
[14,] 0.87738603 2.452279e-01 1.226140e-01
[15,] 1.00000000 0.000000e+00 0.000000e+00
> postscript(file="/var/www/html/rcomp/tmp/1x2yu1258902125.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/2iu5f1258902125.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/3sdbb1258902125.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/4ryvd1258902125.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/5fh711258902125.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 = 56
Frequency = 1
1 2 3 4 5
-1.156877e-13 -1.115712e-13 1.063598e-12 -4.059934e-14 -2.517740e-14
6 7 8 9 10
-6.001217e-14 -8.469273e-14 -4.194247e-14 -6.587842e-14 -3.459077e-15
11 12 13 14 15
-9.846966e-14 -9.750453e-14 1.338399e-13 -4.156013e-15 -3.460933e-13
16 17 18 19 20
3.338443e-14 2.491795e-15 -8.972590e-14 1.454115e-14 -7.947469e-14
21 22 23 24 25
7.045276e-15 3.654011e-14 -4.063845e-14 -2.517414e-14 3.069532e-14
26 27 28 29 30
-1.626560e-14 -2.567876e-13 -5.985020e-14 1.267373e-14 -5.896345e-14
31 32 33 34 35
5.962869e-14 -4.513233e-14 3.588482e-14 -3.590447e-14 2.453452e-14
36 37 38 39 40
6.263026e-14 1.866389e-14 7.022272e-14 -2.067317e-13 3.331493e-14
41 42 43 44 45
-1.239905e-14 1.274569e-13 -5.399890e-14 1.146352e-13 2.294832e-14
46 47 48 49 50
2.823433e-15 1.145736e-13 6.004841e-14 -6.751142e-14 6.177004e-14
51 52 53 54 55
-2.539856e-13 3.375018e-14 2.241093e-14 8.124462e-14 6.452178e-14
56
5.191432e-14
> postscript(file="/var/www/html/rcomp/tmp/6gnpt1258902125.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 = 56
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.156877e-13 NA
1 -1.115712e-13 -1.156877e-13
2 1.063598e-12 -1.115712e-13
3 -4.059934e-14 1.063598e-12
4 -2.517740e-14 -4.059934e-14
5 -6.001217e-14 -2.517740e-14
6 -8.469273e-14 -6.001217e-14
7 -4.194247e-14 -8.469273e-14
8 -6.587842e-14 -4.194247e-14
9 -3.459077e-15 -6.587842e-14
10 -9.846966e-14 -3.459077e-15
11 -9.750453e-14 -9.846966e-14
12 1.338399e-13 -9.750453e-14
13 -4.156013e-15 1.338399e-13
14 -3.460933e-13 -4.156013e-15
15 3.338443e-14 -3.460933e-13
16 2.491795e-15 3.338443e-14
17 -8.972590e-14 2.491795e-15
18 1.454115e-14 -8.972590e-14
19 -7.947469e-14 1.454115e-14
20 7.045276e-15 -7.947469e-14
21 3.654011e-14 7.045276e-15
22 -4.063845e-14 3.654011e-14
23 -2.517414e-14 -4.063845e-14
24 3.069532e-14 -2.517414e-14
25 -1.626560e-14 3.069532e-14
26 -2.567876e-13 -1.626560e-14
27 -5.985020e-14 -2.567876e-13
28 1.267373e-14 -5.985020e-14
29 -5.896345e-14 1.267373e-14
30 5.962869e-14 -5.896345e-14
31 -4.513233e-14 5.962869e-14
32 3.588482e-14 -4.513233e-14
33 -3.590447e-14 3.588482e-14
34 2.453452e-14 -3.590447e-14
35 6.263026e-14 2.453452e-14
36 1.866389e-14 6.263026e-14
37 7.022272e-14 1.866389e-14
38 -2.067317e-13 7.022272e-14
39 3.331493e-14 -2.067317e-13
40 -1.239905e-14 3.331493e-14
41 1.274569e-13 -1.239905e-14
42 -5.399890e-14 1.274569e-13
43 1.146352e-13 -5.399890e-14
44 2.294832e-14 1.146352e-13
45 2.823433e-15 2.294832e-14
46 1.145736e-13 2.823433e-15
47 6.004841e-14 1.145736e-13
48 -6.751142e-14 6.004841e-14
49 6.177004e-14 -6.751142e-14
50 -2.539856e-13 6.177004e-14
51 3.375018e-14 -2.539856e-13
52 2.241093e-14 3.375018e-14
53 8.124462e-14 2.241093e-14
54 6.452178e-14 8.124462e-14
55 5.191432e-14 6.452178e-14
56 NA 5.191432e-14
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.115712e-13 -1.156877e-13
[2,] 1.063598e-12 -1.115712e-13
[3,] -4.059934e-14 1.063598e-12
[4,] -2.517740e-14 -4.059934e-14
[5,] -6.001217e-14 -2.517740e-14
[6,] -8.469273e-14 -6.001217e-14
[7,] -4.194247e-14 -8.469273e-14
[8,] -6.587842e-14 -4.194247e-14
[9,] -3.459077e-15 -6.587842e-14
[10,] -9.846966e-14 -3.459077e-15
[11,] -9.750453e-14 -9.846966e-14
[12,] 1.338399e-13 -9.750453e-14
[13,] -4.156013e-15 1.338399e-13
[14,] -3.460933e-13 -4.156013e-15
[15,] 3.338443e-14 -3.460933e-13
[16,] 2.491795e-15 3.338443e-14
[17,] -8.972590e-14 2.491795e-15
[18,] 1.454115e-14 -8.972590e-14
[19,] -7.947469e-14 1.454115e-14
[20,] 7.045276e-15 -7.947469e-14
[21,] 3.654011e-14 7.045276e-15
[22,] -4.063845e-14 3.654011e-14
[23,] -2.517414e-14 -4.063845e-14
[24,] 3.069532e-14 -2.517414e-14
[25,] -1.626560e-14 3.069532e-14
[26,] -2.567876e-13 -1.626560e-14
[27,] -5.985020e-14 -2.567876e-13
[28,] 1.267373e-14 -5.985020e-14
[29,] -5.896345e-14 1.267373e-14
[30,] 5.962869e-14 -5.896345e-14
[31,] -4.513233e-14 5.962869e-14
[32,] 3.588482e-14 -4.513233e-14
[33,] -3.590447e-14 3.588482e-14
[34,] 2.453452e-14 -3.590447e-14
[35,] 6.263026e-14 2.453452e-14
[36,] 1.866389e-14 6.263026e-14
[37,] 7.022272e-14 1.866389e-14
[38,] -2.067317e-13 7.022272e-14
[39,] 3.331493e-14 -2.067317e-13
[40,] -1.239905e-14 3.331493e-14
[41,] 1.274569e-13 -1.239905e-14
[42,] -5.399890e-14 1.274569e-13
[43,] 1.146352e-13 -5.399890e-14
[44,] 2.294832e-14 1.146352e-13
[45,] 2.823433e-15 2.294832e-14
[46,] 1.145736e-13 2.823433e-15
[47,] 6.004841e-14 1.145736e-13
[48,] -6.751142e-14 6.004841e-14
[49,] 6.177004e-14 -6.751142e-14
[50,] -2.539856e-13 6.177004e-14
[51,] 3.375018e-14 -2.539856e-13
[52,] 2.241093e-14 3.375018e-14
[53,] 8.124462e-14 2.241093e-14
[54,] 6.452178e-14 8.124462e-14
[55,] 5.191432e-14 6.452178e-14
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.115712e-13 -1.156877e-13
2 1.063598e-12 -1.115712e-13
3 -4.059934e-14 1.063598e-12
4 -2.517740e-14 -4.059934e-14
5 -6.001217e-14 -2.517740e-14
6 -8.469273e-14 -6.001217e-14
7 -4.194247e-14 -8.469273e-14
8 -6.587842e-14 -4.194247e-14
9 -3.459077e-15 -6.587842e-14
10 -9.846966e-14 -3.459077e-15
11 -9.750453e-14 -9.846966e-14
12 1.338399e-13 -9.750453e-14
13 -4.156013e-15 1.338399e-13
14 -3.460933e-13 -4.156013e-15
15 3.338443e-14 -3.460933e-13
16 2.491795e-15 3.338443e-14
17 -8.972590e-14 2.491795e-15
18 1.454115e-14 -8.972590e-14
19 -7.947469e-14 1.454115e-14
20 7.045276e-15 -7.947469e-14
21 3.654011e-14 7.045276e-15
22 -4.063845e-14 3.654011e-14
23 -2.517414e-14 -4.063845e-14
24 3.069532e-14 -2.517414e-14
25 -1.626560e-14 3.069532e-14
26 -2.567876e-13 -1.626560e-14
27 -5.985020e-14 -2.567876e-13
28 1.267373e-14 -5.985020e-14
29 -5.896345e-14 1.267373e-14
30 5.962869e-14 -5.896345e-14
31 -4.513233e-14 5.962869e-14
32 3.588482e-14 -4.513233e-14
33 -3.590447e-14 3.588482e-14
34 2.453452e-14 -3.590447e-14
35 6.263026e-14 2.453452e-14
36 1.866389e-14 6.263026e-14
37 7.022272e-14 1.866389e-14
38 -2.067317e-13 7.022272e-14
39 3.331493e-14 -2.067317e-13
40 -1.239905e-14 3.331493e-14
41 1.274569e-13 -1.239905e-14
42 -5.399890e-14 1.274569e-13
43 1.146352e-13 -5.399890e-14
44 2.294832e-14 1.146352e-13
45 2.823433e-15 2.294832e-14
46 1.145736e-13 2.823433e-15
47 6.004841e-14 1.145736e-13
48 -6.751142e-14 6.004841e-14
49 6.177004e-14 -6.751142e-14
50 -2.539856e-13 6.177004e-14
51 3.375018e-14 -2.539856e-13
52 2.241093e-14 3.375018e-14
53 8.124462e-14 2.241093e-14
54 6.452178e-14 8.124462e-14
55 5.191432e-14 6.452178e-14
> 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/7qqlh1258902125.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/8jqfc1258902125.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/9ke4n1258902125.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/10oxen1258902125.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/119by41258902125.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/1267ms1258902125.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/13k1fd1258902125.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/14lrqv1258902125.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/1535ji1258902125.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/16cc981258902125.tab")
+ }
>
> system("convert tmp/1x2yu1258902125.ps tmp/1x2yu1258902125.png")
> system("convert tmp/2iu5f1258902125.ps tmp/2iu5f1258902125.png")
> system("convert tmp/3sdbb1258902125.ps tmp/3sdbb1258902125.png")
> system("convert tmp/4ryvd1258902125.ps tmp/4ryvd1258902125.png")
> system("convert tmp/5fh711258902125.ps tmp/5fh711258902125.png")
> system("convert tmp/6gnpt1258902125.ps tmp/6gnpt1258902125.png")
> system("convert tmp/7qqlh1258902125.ps tmp/7qqlh1258902125.png")
> system("convert tmp/8jqfc1258902125.ps tmp/8jqfc1258902125.png")
> system("convert tmp/9ke4n1258902125.ps tmp/9ke4n1258902125.png")
> system("convert tmp/10oxen1258902125.ps tmp/10oxen1258902125.png")
>
>
> proc.time()
user system elapsed
2.343 1.565 3.200