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(105.67
+ ,96.90
+ ,96.33
+ ,123.61
+ ,95.10
+ ,96.33
+ ,113.08
+ ,97.00
+ ,95.05
+ ,106.46
+ ,112.70
+ ,96.84
+ ,123.38
+ ,102.90
+ ,96.92
+ ,109.87
+ ,97.40
+ ,97.44
+ ,95.74
+ ,111.40
+ ,97.78
+ ,123.06
+ ,87.40
+ ,97.69
+ ,123.39
+ ,96.80
+ ,96.67
+ ,120.28
+ ,114.10
+ ,98.29
+ ,115.33
+ ,110.30
+ ,98.20
+ ,110.40
+ ,103.90
+ ,98.71
+ ,114.49
+ ,101.60
+ ,98.54
+ ,132.03
+ ,94.60
+ ,98.20
+ ,123.16
+ ,95.90
+ ,100.80
+ ,118.82
+ ,104.70
+ ,101.33
+ ,128.32
+ ,102.80
+ ,101.88
+ ,112.24
+ ,98.10
+ ,101.85
+ ,104.53
+ ,113.90
+ ,102.04
+ ,132.57
+ ,80.90
+ ,102.22
+ ,122.52
+ ,95.70
+ ,102.63
+ ,131.80
+ ,113.20
+ ,102.65
+ ,124.55
+ ,105.90
+ ,102.54
+ ,120.96
+ ,108.80
+ ,102.37
+ ,122.60
+ ,102.30
+ ,102.68
+ ,145.52
+ ,99.00
+ ,102.76
+ ,118.57
+ ,100.70
+ ,102.82
+ ,134.25
+ ,115.50
+ ,103.31
+ ,136.70
+ ,100.70
+ ,103.23
+ ,121.37
+ ,109.90
+ ,103.60
+ ,111.63
+ ,114.60
+ ,103.95
+ ,134.42
+ ,85.40
+ ,103.93
+ ,137.65
+ ,100.50
+ ,104.25
+ ,137.86
+ ,114.80
+ ,104.38
+ ,119.77
+ ,116.50
+ ,104.36
+ ,130.69
+ ,112.90
+ ,104.32
+ ,128.28
+ ,102.00
+ ,104.58
+ ,147.45
+ ,106.00
+ ,104.68
+ ,128.42
+ ,105.30
+ ,104.92
+ ,136.90
+ ,118.80
+ ,105.46
+ ,143.95
+ ,106.10
+ ,105.23
+ ,135.64
+ ,109.30
+ ,105.58
+ ,122.48
+ ,117.20
+ ,105.34
+ ,136.83
+ ,92.50
+ ,105.28
+ ,153.04
+ ,104.20
+ ,105.70
+ ,142.71
+ ,112.50
+ ,105.67
+ ,123.46
+ ,122.40
+ ,105.71
+ ,144.37
+ ,113.30
+ ,106.19
+ ,146.15
+ ,100.00
+ ,106.93
+ ,147.61
+ ,110.70
+ ,107.44
+ ,158.51
+ ,112.80
+ ,107.85
+ ,147.40
+ ,109.80
+ ,108.71
+ ,165.05
+ ,117.30
+ ,109.32
+ ,154.64
+ ,109.10
+ ,109.49
+ ,126.20
+ ,115.90
+ ,110.20
+ ,157.36
+ ,96.00
+ ,110.62
+ ,154.15
+ ,99.80
+ ,111.22
+ ,123.21
+ ,116.80
+ ,110.88
+ ,113.07
+ ,115.70
+ ,111.15
+ ,110.45
+ ,99.40
+ ,111.29
+ ,113.57
+ ,94.30
+ ,111.09
+ ,122.44
+ ,91.00
+ ,111.24
+ ,114.93
+ ,93.20
+ ,111.45
+ ,111.85
+ ,103.10
+ ,111.75
+ ,126.04
+ ,94.10
+ ,111.07
+ ,121.34
+ ,91.80
+ ,111.17)
+ ,dim=c(3
+ ,66)
+ ,dimnames=list(c('Uitvoer'
+ ,'TIP'
+ ,'cons')
+ ,1:66))
> y <- array(NA,dim=c(3,66),dimnames=list(c('Uitvoer','TIP','cons'),1:66))
> 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
Uitvoer TIP cons M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 105.67 96.9 96.33 1 0 0 0 0 0 0 0 0 0 0 1
2 123.61 95.1 96.33 0 1 0 0 0 0 0 0 0 0 0 2
3 113.08 97.0 95.05 0 0 1 0 0 0 0 0 0 0 0 3
4 106.46 112.7 96.84 0 0 0 1 0 0 0 0 0 0 0 4
5 123.38 102.9 96.92 0 0 0 0 1 0 0 0 0 0 0 5
6 109.87 97.4 97.44 0 0 0 0 0 1 0 0 0 0 0 6
7 95.74 111.4 97.78 0 0 0 0 0 0 1 0 0 0 0 7
8 123.06 87.4 97.69 0 0 0 0 0 0 0 1 0 0 0 8
9 123.39 96.8 96.67 0 0 0 0 0 0 0 0 1 0 0 9
10 120.28 114.1 98.29 0 0 0 0 0 0 0 0 0 1 0 10
11 115.33 110.3 98.20 0 0 0 0 0 0 0 0 0 0 1 11
12 110.40 103.9 98.71 0 0 0 0 0 0 0 0 0 0 0 12
13 114.49 101.6 98.54 1 0 0 0 0 0 0 0 0 0 0 13
14 132.03 94.6 98.20 0 1 0 0 0 0 0 0 0 0 0 14
15 123.16 95.9 100.80 0 0 1 0 0 0 0 0 0 0 0 15
16 118.82 104.7 101.33 0 0 0 1 0 0 0 0 0 0 0 16
17 128.32 102.8 101.88 0 0 0 0 1 0 0 0 0 0 0 17
18 112.24 98.1 101.85 0 0 0 0 0 1 0 0 0 0 0 18
19 104.53 113.9 102.04 0 0 0 0 0 0 1 0 0 0 0 19
20 132.57 80.9 102.22 0 0 0 0 0 0 0 1 0 0 0 20
21 122.52 95.7 102.63 0 0 0 0 0 0 0 0 1 0 0 21
22 131.80 113.2 102.65 0 0 0 0 0 0 0 0 0 1 0 22
23 124.55 105.9 102.54 0 0 0 0 0 0 0 0 0 0 1 23
24 120.96 108.8 102.37 0 0 0 0 0 0 0 0 0 0 0 24
25 122.60 102.3 102.68 1 0 0 0 0 0 0 0 0 0 0 25
26 145.52 99.0 102.76 0 1 0 0 0 0 0 0 0 0 0 26
27 118.57 100.7 102.82 0 0 1 0 0 0 0 0 0 0 0 27
28 134.25 115.5 103.31 0 0 0 1 0 0 0 0 0 0 0 28
29 136.70 100.7 103.23 0 0 0 0 1 0 0 0 0 0 0 29
30 121.37 109.9 103.60 0 0 0 0 0 1 0 0 0 0 0 30
31 111.63 114.6 103.95 0 0 0 0 0 0 1 0 0 0 0 31
32 134.42 85.4 103.93 0 0 0 0 0 0 0 1 0 0 0 32
33 137.65 100.5 104.25 0 0 0 0 0 0 0 0 1 0 0 33
34 137.86 114.8 104.38 0 0 0 0 0 0 0 0 0 1 0 34
35 119.77 116.5 104.36 0 0 0 0 0 0 0 0 0 0 1 35
36 130.69 112.9 104.32 0 0 0 0 0 0 0 0 0 0 0 36
37 128.28 102.0 104.58 1 0 0 0 0 0 0 0 0 0 0 37
38 147.45 106.0 104.68 0 1 0 0 0 0 0 0 0 0 0 38
39 128.42 105.3 104.92 0 0 1 0 0 0 0 0 0 0 0 39
40 136.90 118.8 105.46 0 0 0 1 0 0 0 0 0 0 0 40
41 143.95 106.1 105.23 0 0 0 0 1 0 0 0 0 0 0 41
42 135.64 109.3 105.58 0 0 0 0 0 1 0 0 0 0 0 42
43 122.48 117.2 105.34 0 0 0 0 0 0 1 0 0 0 0 43
44 136.83 92.5 105.28 0 0 0 0 0 0 0 1 0 0 0 44
45 153.04 104.2 105.70 0 0 0 0 0 0 0 0 1 0 0 45
46 142.71 112.5 105.67 0 0 0 0 0 0 0 0 0 1 0 46
47 123.46 122.4 105.71 0 0 0 0 0 0 0 0 0 0 1 47
48 144.37 113.3 106.19 0 0 0 0 0 0 0 0 0 0 0 48
49 146.15 100.0 106.93 1 0 0 0 0 0 0 0 0 0 0 49
50 147.61 110.7 107.44 0 1 0 0 0 0 0 0 0 0 0 50
51 158.51 112.8 107.85 0 0 1 0 0 0 0 0 0 0 0 51
52 147.40 109.8 108.71 0 0 0 1 0 0 0 0 0 0 0 52
53 165.05 117.3 109.32 0 0 0 0 1 0 0 0 0 0 0 53
54 154.64 109.1 109.49 0 0 0 0 0 1 0 0 0 0 0 54
55 126.20 115.9 110.20 0 0 0 0 0 0 1 0 0 0 0 55
56 157.36 96.0 110.62 0 0 0 0 0 0 0 1 0 0 0 56
57 154.15 99.8 111.22 0 0 0 0 0 0 0 0 1 0 0 57
58 123.21 116.8 110.88 0 0 0 0 0 0 0 0 0 1 0 58
59 113.07 115.7 111.15 0 0 0 0 0 0 0 0 0 0 1 59
60 110.45 99.4 111.29 0 0 0 0 0 0 0 0 0 0 0 60
61 113.57 94.3 111.09 1 0 0 0 0 0 0 0 0 0 0 61
62 122.44 91.0 111.24 0 1 0 0 0 0 0 0 0 0 0 62
63 114.93 93.2 111.45 0 0 1 0 0 0 0 0 0 0 0 63
64 111.85 103.1 111.75 0 0 0 1 0 0 0 0 0 0 0 64
65 126.04 94.1 111.07 0 0 0 0 1 0 0 0 0 0 0 65
66 121.34 91.8 111.17 0 0 0 0 0 1 0 0 0 0 0 66
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) TIP cons M1 M2 M3
-41.76356 1.39215 0.06118 11.06124 25.62242 13.04957
M4 M5 M6 M7 M8 M9
-1.25944 19.22863 9.50321 -19.64517 41.25407 27.04305
M10 M11 t
-0.91341 -12.92958 0.24613
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-17.7755 -5.4782 -0.9078 5.4917 19.8801
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -41.76356 140.65049 -0.297 0.76772
TIP 1.39215 0.22145 6.287 7.28e-08 ***
cons 0.06118 1.39356 0.044 0.96515
M1 11.06124 5.89340 1.877 0.06626 .
M2 25.62242 5.92073 4.328 7.04e-05 ***
M3 13.04957 5.81684 2.243 0.02924 *
M4 -1.25944 5.71937 -0.220 0.82659
M5 19.22863 5.67704 3.387 0.00137 **
M6 9.50321 5.72605 1.660 0.10312
M7 -19.64517 6.16226 -3.188 0.00245 **
M8 41.25407 7.18472 5.742 5.19e-07 ***
M9 27.04305 6.12781 4.413 5.30e-05 ***
M10 -0.91341 6.08757 -0.150 0.88132
M11 -12.92958 6.04955 -2.137 0.03739 *
t 0.24613 0.34175 0.720 0.47468
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 9.278 on 51 degrees of freedom
Multiple R-squared: 0.6972, Adjusted R-squared: 0.614
F-statistic: 8.386 on 14 and 51 DF, p-value: 6.13e-09
> 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,] 2.310352e-02 4.620704e-02 0.9768965
[2,] 6.497080e-03 1.299416e-02 0.9935029
[3,] 1.378113e-03 2.756227e-03 0.9986219
[4,] 1.722068e-03 3.444135e-03 0.9982779
[5,] 7.394619e-04 1.478924e-03 0.9992605
[6,] 4.013060e-04 8.026120e-04 0.9995987
[7,] 1.886331e-04 3.772662e-04 0.9998114
[8,] 4.964778e-05 9.929556e-05 0.9999504
[9,] 7.418207e-05 1.483641e-04 0.9999258
[10,] 9.731327e-04 1.946265e-03 0.9990269
[11,] 1.515785e-03 3.031570e-03 0.9984842
[12,] 8.425075e-04 1.685015e-03 0.9991575
[13,] 8.229451e-04 1.645890e-03 0.9991771
[14,] 3.582658e-04 7.165315e-04 0.9996417
[15,] 2.620157e-04 5.240315e-04 0.9997380
[16,] 1.437037e-04 2.874075e-04 0.9998563
[17,] 6.233647e-05 1.246729e-04 0.9999377
[18,] 2.275757e-04 4.551513e-04 0.9997724
[19,] 1.131961e-04 2.263922e-04 0.9998868
[20,] 4.745227e-05 9.490454e-05 0.9999525
[21,] 2.061116e-05 4.122233e-05 0.9999794
[22,] 1.148667e-05 2.297334e-05 0.9999885
[23,] 8.783179e-06 1.756636e-05 0.9999912
[24,] 2.888292e-06 5.776583e-06 0.9999971
[25,] 5.178371e-05 1.035674e-04 0.9999482
[26,] 4.463603e-05 8.927206e-05 0.9999554
[27,] 5.457667e-03 1.091533e-02 0.9945423
[28,] 8.604610e-02 1.720922e-01 0.9139539
[29,] 5.060002e-02 1.012000e-01 0.9494000
[30,] 3.630518e-01 7.261036e-01 0.6369482
[31,] 2.568323e-01 5.136646e-01 0.7431677
> postscript(file="/var/www/html/rcomp/tmp/1b7pz1260905290.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/2stj11260905290.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/3exhc1260905290.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/4batb1260905290.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/51p0k1260905290.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 = 66
Frequency = 1
1 2 3 4 5 6
-4.66653520 0.97201517 0.20195937 -14.32142631 -4.49745310 -0.90315897
7 8 9 10 11 12
-5.64181403 -6.05008993 -4.77900115 -4.36198393 7.75373454 -1.47342492
13 14 15 16 17 18
-5.47845235 7.02007773 8.50793578 5.94746942 -2.67529473 -2.73107175
19 20 21 22 23 24
-3.54641946 9.27813400 -7.43587242 5.19060186 19.88006806 -0.91248213
25 26 27 28 29 30
-1.54984670 11.15203395 -5.84157227 3.26751002 5.59202071 -13.08910965
31 32 33 34 35 36
-0.49138379 1.80523648 -2.04090871 5.96371505 -2.72167269 0.03679721
37 38 39 40 41 42
1.47795053 0.26591438 -5.47754472 -1.76172672 2.24844640 -1.05856185
43 44 45 46 47 48
3.70038064 -8.70522582 5.15582022 10.98313121 -10.28155528 10.09192499
49 50 51 52 53 54
19.03487161 -9.23965144 11.03846965 18.11518121 4.55253860 15.02704985
55 56 57 58 59 60
5.97923665 3.67194527 9.09996207 -17.77546419 -14.63057464 -7.74281515
61 62 63 64 65 66
-8.81798789 -10.17038979 -8.42924780 -11.24700763 -5.22025788 2.75485237
> postscript(file="/var/www/html/rcomp/tmp/69w251260905290.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 = 66
Frequency = 1
lag(myerror, k = 1) myerror
0 -4.66653520 NA
1 0.97201517 -4.66653520
2 0.20195937 0.97201517
3 -14.32142631 0.20195937
4 -4.49745310 -14.32142631
5 -0.90315897 -4.49745310
6 -5.64181403 -0.90315897
7 -6.05008993 -5.64181403
8 -4.77900115 -6.05008993
9 -4.36198393 -4.77900115
10 7.75373454 -4.36198393
11 -1.47342492 7.75373454
12 -5.47845235 -1.47342492
13 7.02007773 -5.47845235
14 8.50793578 7.02007773
15 5.94746942 8.50793578
16 -2.67529473 5.94746942
17 -2.73107175 -2.67529473
18 -3.54641946 -2.73107175
19 9.27813400 -3.54641946
20 -7.43587242 9.27813400
21 5.19060186 -7.43587242
22 19.88006806 5.19060186
23 -0.91248213 19.88006806
24 -1.54984670 -0.91248213
25 11.15203395 -1.54984670
26 -5.84157227 11.15203395
27 3.26751002 -5.84157227
28 5.59202071 3.26751002
29 -13.08910965 5.59202071
30 -0.49138379 -13.08910965
31 1.80523648 -0.49138379
32 -2.04090871 1.80523648
33 5.96371505 -2.04090871
34 -2.72167269 5.96371505
35 0.03679721 -2.72167269
36 1.47795053 0.03679721
37 0.26591438 1.47795053
38 -5.47754472 0.26591438
39 -1.76172672 -5.47754472
40 2.24844640 -1.76172672
41 -1.05856185 2.24844640
42 3.70038064 -1.05856185
43 -8.70522582 3.70038064
44 5.15582022 -8.70522582
45 10.98313121 5.15582022
46 -10.28155528 10.98313121
47 10.09192499 -10.28155528
48 19.03487161 10.09192499
49 -9.23965144 19.03487161
50 11.03846965 -9.23965144
51 18.11518121 11.03846965
52 4.55253860 18.11518121
53 15.02704985 4.55253860
54 5.97923665 15.02704985
55 3.67194527 5.97923665
56 9.09996207 3.67194527
57 -17.77546419 9.09996207
58 -14.63057464 -17.77546419
59 -7.74281515 -14.63057464
60 -8.81798789 -7.74281515
61 -10.17038979 -8.81798789
62 -8.42924780 -10.17038979
63 -11.24700763 -8.42924780
64 -5.22025788 -11.24700763
65 2.75485237 -5.22025788
66 NA 2.75485237
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.97201517 -4.66653520
[2,] 0.20195937 0.97201517
[3,] -14.32142631 0.20195937
[4,] -4.49745310 -14.32142631
[5,] -0.90315897 -4.49745310
[6,] -5.64181403 -0.90315897
[7,] -6.05008993 -5.64181403
[8,] -4.77900115 -6.05008993
[9,] -4.36198393 -4.77900115
[10,] 7.75373454 -4.36198393
[11,] -1.47342492 7.75373454
[12,] -5.47845235 -1.47342492
[13,] 7.02007773 -5.47845235
[14,] 8.50793578 7.02007773
[15,] 5.94746942 8.50793578
[16,] -2.67529473 5.94746942
[17,] -2.73107175 -2.67529473
[18,] -3.54641946 -2.73107175
[19,] 9.27813400 -3.54641946
[20,] -7.43587242 9.27813400
[21,] 5.19060186 -7.43587242
[22,] 19.88006806 5.19060186
[23,] -0.91248213 19.88006806
[24,] -1.54984670 -0.91248213
[25,] 11.15203395 -1.54984670
[26,] -5.84157227 11.15203395
[27,] 3.26751002 -5.84157227
[28,] 5.59202071 3.26751002
[29,] -13.08910965 5.59202071
[30,] -0.49138379 -13.08910965
[31,] 1.80523648 -0.49138379
[32,] -2.04090871 1.80523648
[33,] 5.96371505 -2.04090871
[34,] -2.72167269 5.96371505
[35,] 0.03679721 -2.72167269
[36,] 1.47795053 0.03679721
[37,] 0.26591438 1.47795053
[38,] -5.47754472 0.26591438
[39,] -1.76172672 -5.47754472
[40,] 2.24844640 -1.76172672
[41,] -1.05856185 2.24844640
[42,] 3.70038064 -1.05856185
[43,] -8.70522582 3.70038064
[44,] 5.15582022 -8.70522582
[45,] 10.98313121 5.15582022
[46,] -10.28155528 10.98313121
[47,] 10.09192499 -10.28155528
[48,] 19.03487161 10.09192499
[49,] -9.23965144 19.03487161
[50,] 11.03846965 -9.23965144
[51,] 18.11518121 11.03846965
[52,] 4.55253860 18.11518121
[53,] 15.02704985 4.55253860
[54,] 5.97923665 15.02704985
[55,] 3.67194527 5.97923665
[56,] 9.09996207 3.67194527
[57,] -17.77546419 9.09996207
[58,] -14.63057464 -17.77546419
[59,] -7.74281515 -14.63057464
[60,] -8.81798789 -7.74281515
[61,] -10.17038979 -8.81798789
[62,] -8.42924780 -10.17038979
[63,] -11.24700763 -8.42924780
[64,] -5.22025788 -11.24700763
[65,] 2.75485237 -5.22025788
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.97201517 -4.66653520
2 0.20195937 0.97201517
3 -14.32142631 0.20195937
4 -4.49745310 -14.32142631
5 -0.90315897 -4.49745310
6 -5.64181403 -0.90315897
7 -6.05008993 -5.64181403
8 -4.77900115 -6.05008993
9 -4.36198393 -4.77900115
10 7.75373454 -4.36198393
11 -1.47342492 7.75373454
12 -5.47845235 -1.47342492
13 7.02007773 -5.47845235
14 8.50793578 7.02007773
15 5.94746942 8.50793578
16 -2.67529473 5.94746942
17 -2.73107175 -2.67529473
18 -3.54641946 -2.73107175
19 9.27813400 -3.54641946
20 -7.43587242 9.27813400
21 5.19060186 -7.43587242
22 19.88006806 5.19060186
23 -0.91248213 19.88006806
24 -1.54984670 -0.91248213
25 11.15203395 -1.54984670
26 -5.84157227 11.15203395
27 3.26751002 -5.84157227
28 5.59202071 3.26751002
29 -13.08910965 5.59202071
30 -0.49138379 -13.08910965
31 1.80523648 -0.49138379
32 -2.04090871 1.80523648
33 5.96371505 -2.04090871
34 -2.72167269 5.96371505
35 0.03679721 -2.72167269
36 1.47795053 0.03679721
37 0.26591438 1.47795053
38 -5.47754472 0.26591438
39 -1.76172672 -5.47754472
40 2.24844640 -1.76172672
41 -1.05856185 2.24844640
42 3.70038064 -1.05856185
43 -8.70522582 3.70038064
44 5.15582022 -8.70522582
45 10.98313121 5.15582022
46 -10.28155528 10.98313121
47 10.09192499 -10.28155528
48 19.03487161 10.09192499
49 -9.23965144 19.03487161
50 11.03846965 -9.23965144
51 18.11518121 11.03846965
52 4.55253860 18.11518121
53 15.02704985 4.55253860
54 5.97923665 15.02704985
55 3.67194527 5.97923665
56 9.09996207 3.67194527
57 -17.77546419 9.09996207
58 -14.63057464 -17.77546419
59 -7.74281515 -14.63057464
60 -8.81798789 -7.74281515
61 -10.17038979 -8.81798789
62 -8.42924780 -10.17038979
63 -11.24700763 -8.42924780
64 -5.22025788 -11.24700763
65 2.75485237 -5.22025788
> 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/70xvz1260905290.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/8s4k91260905290.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/9em651260905290.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/101jqx1260905290.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/112u3k1260905290.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/12cfrc1260905290.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/13g9b21260905290.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/14txki1260905290.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/15pkmu1260905290.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/16t3wd1260905291.tab")
+ }
>
> try(system("convert tmp/1b7pz1260905290.ps tmp/1b7pz1260905290.png",intern=TRUE))
character(0)
> try(system("convert tmp/2stj11260905290.ps tmp/2stj11260905290.png",intern=TRUE))
character(0)
> try(system("convert tmp/3exhc1260905290.ps tmp/3exhc1260905290.png",intern=TRUE))
character(0)
> try(system("convert tmp/4batb1260905290.ps tmp/4batb1260905290.png",intern=TRUE))
character(0)
> try(system("convert tmp/51p0k1260905290.ps tmp/51p0k1260905290.png",intern=TRUE))
character(0)
> try(system("convert tmp/69w251260905290.ps tmp/69w251260905290.png",intern=TRUE))
character(0)
> try(system("convert tmp/70xvz1260905290.ps tmp/70xvz1260905290.png",intern=TRUE))
character(0)
> try(system("convert tmp/8s4k91260905290.ps tmp/8s4k91260905290.png",intern=TRUE))
character(0)
> try(system("convert tmp/9em651260905290.ps tmp/9em651260905290.png",intern=TRUE))
character(0)
> try(system("convert tmp/101jqx1260905290.ps tmp/101jqx1260905290.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.513 1.572 3.309