R version 2.6.0 (2007-10-03)
Copyright (C) 2007 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(7272.2
+ ,0
+ ,6680.1
+ ,0
+ ,8427.6
+ ,0
+ ,8752.8
+ ,0
+ ,7952.7
+ ,0
+ ,8694.3
+ ,0
+ ,7787
+ ,0
+ ,8474.2
+ ,0
+ ,9154.7
+ ,0
+ ,8557.2
+ ,0
+ ,7951.1
+ ,0
+ ,9156.7
+ ,0
+ ,7865.7
+ ,0
+ ,7337.4
+ ,0
+ ,9131.7
+ ,0
+ ,8814.6
+ ,0
+ ,8598.8
+ ,0
+ ,8439.6
+ ,0
+ ,7451.8
+ ,0
+ ,8016.2
+ ,0
+ ,9544.1
+ ,0
+ ,8270.7
+ ,0
+ ,8102.2
+ ,0
+ ,9369
+ ,0
+ ,7657.7
+ ,0
+ ,7816.6
+ ,0
+ ,9391.3
+ ,0
+ ,9445.4
+ ,0
+ ,9533.1
+ ,0
+ ,10068.7
+ ,0
+ ,8955.5
+ ,0
+ ,10423.9
+ ,0
+ ,11617.2
+ ,0
+ ,9391.1
+ ,0
+ ,10872
+ ,0
+ ,10230.4
+ ,0
+ ,9221
+ ,0
+ ,9428.6
+ ,0
+ ,10934.5
+ ,0
+ ,10986
+ ,0
+ ,11724.6
+ ,0
+ ,11180.9
+ ,0
+ ,11163.2
+ ,0
+ ,11240.9
+ ,0
+ ,12107.1
+ ,0
+ ,10762.3
+ ,0
+ ,11340.4
+ ,0
+ ,11266.8
+ ,0
+ ,9542.7
+ ,0
+ ,9227.7
+ ,0
+ ,10571.9
+ ,0
+ ,10774.4
+ ,0
+ ,10392.8
+ ,0
+ ,9920.2
+ ,0
+ ,9884.9
+ ,1
+ ,10174.5
+ ,1
+ ,11395.4
+ ,1
+ ,10760.2
+ ,1
+ ,10570.1
+ ,1
+ ,10536
+ ,1
+ ,9902.6
+ ,1
+ ,8889
+ ,1
+ ,10837.3
+ ,1
+ ,11624.1
+ ,1
+ ,10509
+ ,1
+ ,10984.9
+ ,1
+ ,10649.1
+ ,1
+ ,10855.7
+ ,1
+ ,11677.4
+ ,1
+ ,10760.2
+ ,1
+ ,10046.2
+ ,1
+ ,10772.8
+ ,1
+ ,9987.7
+ ,1
+ ,8638.7
+ ,1
+ ,11063.7
+ ,1
+ ,11855.7
+ ,1
+ ,10684.5
+ ,1
+ ,11337.4
+ ,1
+ ,10478
+ ,1
+ ,11123.9
+ ,1
+ ,12909.3
+ ,1
+ ,11339.9
+ ,1
+ ,10462.2
+ ,1
+ ,12733.5
+ ,1
+ ,10519.2
+ ,1
+ ,10414.9
+ ,1
+ ,12476.8
+ ,1
+ ,12384.6
+ ,1
+ ,12266.7
+ ,1
+ ,12919.9
+ ,1
+ ,11497.3
+ ,1
+ ,12142
+ ,1
+ ,13919.4
+ ,1
+ ,12656.8
+ ,1
+ ,12034.1
+ ,1
+ ,13199.7
+ ,1
+ ,10881.3
+ ,1
+ ,11301.2
+ ,1
+ ,13643.9
+ ,1
+ ,12517
+ ,1
+ ,13981.1
+ ,1
+ ,14275.7
+ ,1
+ ,13435
+ ,1
+ ,13565.7
+ ,1
+ ,16216.3
+ ,1
+ ,12970
+ ,1
+ ,14079.9
+ ,1
+ ,14235
+ ,1
+ ,12213.4
+ ,1
+ ,12581
+ ,1
+ ,14130.4
+ ,1
+ ,14210.8
+ ,1
+ ,14378.5
+ ,1
+ ,13142.8
+ ,1
+ ,13714.7
+ ,1
+ ,13621.9
+ ,1
+ ,15379.8
+ ,1
+ ,13306.3
+ ,1
+ ,14391.2
+ ,1
+ ,14909.9
+ ,1
+ ,14552.7
+ ,1)
+ ,dim=c(2
+ ,121)
+ ,dimnames=list(c('Invoer'
+ ,'X')
+ ,1:121))
> y <- array(NA,dim=c(2,121),dimnames=list(c('Invoer','X'),1:121))
> 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)
> 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
Invoer X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 7272.2 0 1 0 0 0 0 0 0 0 0 0 0 1
2 6680.1 0 0 1 0 0 0 0 0 0 0 0 0 2
3 8427.6 0 0 0 1 0 0 0 0 0 0 0 0 3
4 8752.8 0 0 0 0 1 0 0 0 0 0 0 0 4
5 7952.7 0 0 0 0 0 1 0 0 0 0 0 0 5
6 8694.3 0 0 0 0 0 0 1 0 0 0 0 0 6
7 7787.0 0 0 0 0 0 0 0 1 0 0 0 0 7
8 8474.2 0 0 0 0 0 0 0 0 1 0 0 0 8
9 9154.7 0 0 0 0 0 0 0 0 0 1 0 0 9
10 8557.2 0 0 0 0 0 0 0 0 0 0 1 0 10
11 7951.1 0 0 0 0 0 0 0 0 0 0 0 1 11
12 9156.7 0 0 0 0 0 0 0 0 0 0 0 0 12
13 7865.7 0 1 0 0 0 0 0 0 0 0 0 0 13
14 7337.4 0 0 1 0 0 0 0 0 0 0 0 0 14
15 9131.7 0 0 0 1 0 0 0 0 0 0 0 0 15
16 8814.6 0 0 0 0 1 0 0 0 0 0 0 0 16
17 8598.8 0 0 0 0 0 1 0 0 0 0 0 0 17
18 8439.6 0 0 0 0 0 0 1 0 0 0 0 0 18
19 7451.8 0 0 0 0 0 0 0 1 0 0 0 0 19
20 8016.2 0 0 0 0 0 0 0 0 1 0 0 0 20
21 9544.1 0 0 0 0 0 0 0 0 0 1 0 0 21
22 8270.7 0 0 0 0 0 0 0 0 0 0 1 0 22
23 8102.2 0 0 0 0 0 0 0 0 0 0 0 1 23
24 9369.0 0 0 0 0 0 0 0 0 0 0 0 0 24
25 7657.7 0 1 0 0 0 0 0 0 0 0 0 0 25
26 7816.6 0 0 1 0 0 0 0 0 0 0 0 0 26
27 9391.3 0 0 0 1 0 0 0 0 0 0 0 0 27
28 9445.4 0 0 0 0 1 0 0 0 0 0 0 0 28
29 9533.1 0 0 0 0 0 1 0 0 0 0 0 0 29
30 10068.7 0 0 0 0 0 0 1 0 0 0 0 0 30
31 8955.5 0 0 0 0 0 0 0 1 0 0 0 0 31
32 10423.9 0 0 0 0 0 0 0 0 1 0 0 0 32
33 11617.2 0 0 0 0 0 0 0 0 0 1 0 0 33
34 9391.1 0 0 0 0 0 0 0 0 0 0 1 0 34
35 10872.0 0 0 0 0 0 0 0 0 0 0 0 1 35
36 10230.4 0 0 0 0 0 0 0 0 0 0 0 0 36
37 9221.0 0 1 0 0 0 0 0 0 0 0 0 0 37
38 9428.6 0 0 1 0 0 0 0 0 0 0 0 0 38
39 10934.5 0 0 0 1 0 0 0 0 0 0 0 0 39
40 10986.0 0 0 0 0 1 0 0 0 0 0 0 0 40
41 11724.6 0 0 0 0 0 1 0 0 0 0 0 0 41
42 11180.9 0 0 0 0 0 0 1 0 0 0 0 0 42
43 11163.2 0 0 0 0 0 0 0 1 0 0 0 0 43
44 11240.9 0 0 0 0 0 0 0 0 1 0 0 0 44
45 12107.1 0 0 0 0 0 0 0 0 0 1 0 0 45
46 10762.3 0 0 0 0 0 0 0 0 0 0 1 0 46
47 11340.4 0 0 0 0 0 0 0 0 0 0 0 1 47
48 11266.8 0 0 0 0 0 0 0 0 0 0 0 0 48
49 9542.7 0 1 0 0 0 0 0 0 0 0 0 0 49
50 9227.7 0 0 1 0 0 0 0 0 0 0 0 0 50
51 10571.9 0 0 0 1 0 0 0 0 0 0 0 0 51
52 10774.4 0 0 0 0 1 0 0 0 0 0 0 0 52
53 10392.8 0 0 0 0 0 1 0 0 0 0 0 0 53
54 9920.2 0 0 0 0 0 0 1 0 0 0 0 0 54
55 9884.9 1 0 0 0 0 0 0 1 0 0 0 0 55
56 10174.5 1 0 0 0 0 0 0 0 1 0 0 0 56
57 11395.4 1 0 0 0 0 0 0 0 0 1 0 0 57
58 10760.2 1 0 0 0 0 0 0 0 0 0 1 0 58
59 10570.1 1 0 0 0 0 0 0 0 0 0 0 1 59
60 10536.0 1 0 0 0 0 0 0 0 0 0 0 0 60
61 9902.6 1 1 0 0 0 0 0 0 0 0 0 0 61
62 8889.0 1 0 1 0 0 0 0 0 0 0 0 0 62
63 10837.3 1 0 0 1 0 0 0 0 0 0 0 0 63
64 11624.1 1 0 0 0 1 0 0 0 0 0 0 0 64
65 10509.0 1 0 0 0 0 1 0 0 0 0 0 0 65
66 10984.9 1 0 0 0 0 0 1 0 0 0 0 0 66
67 10649.1 1 0 0 0 0 0 0 1 0 0 0 0 67
68 10855.7 1 0 0 0 0 0 0 0 1 0 0 0 68
69 11677.4 1 0 0 0 0 0 0 0 0 1 0 0 69
70 10760.2 1 0 0 0 0 0 0 0 0 0 1 0 70
71 10046.2 1 0 0 0 0 0 0 0 0 0 0 1 71
72 10772.8 1 0 0 0 0 0 0 0 0 0 0 0 72
73 9987.7 1 1 0 0 0 0 0 0 0 0 0 0 73
74 8638.7 1 0 1 0 0 0 0 0 0 0 0 0 74
75 11063.7 1 0 0 1 0 0 0 0 0 0 0 0 75
76 11855.7 1 0 0 0 1 0 0 0 0 0 0 0 76
77 10684.5 1 0 0 0 0 1 0 0 0 0 0 0 77
78 11337.4 1 0 0 0 0 0 1 0 0 0 0 0 78
79 10478.0 1 0 0 0 0 0 0 1 0 0 0 0 79
80 11123.9 1 0 0 0 0 0 0 0 1 0 0 0 80
81 12909.3 1 0 0 0 0 0 0 0 0 1 0 0 81
82 11339.9 1 0 0 0 0 0 0 0 0 0 1 0 82
83 10462.2 1 0 0 0 0 0 0 0 0 0 0 1 83
84 12733.5 1 0 0 0 0 0 0 0 0 0 0 0 84
85 10519.2 1 1 0 0 0 0 0 0 0 0 0 0 85
86 10414.9 1 0 1 0 0 0 0 0 0 0 0 0 86
87 12476.8 1 0 0 1 0 0 0 0 0 0 0 0 87
88 12384.6 1 0 0 0 1 0 0 0 0 0 0 0 88
89 12266.7 1 0 0 0 0 1 0 0 0 0 0 0 89
90 12919.9 1 0 0 0 0 0 1 0 0 0 0 0 90
91 11497.3 1 0 0 0 0 0 0 1 0 0 0 0 91
92 12142.0 1 0 0 0 0 0 0 0 1 0 0 0 92
93 13919.4 1 0 0 0 0 0 0 0 0 1 0 0 93
94 12656.8 1 0 0 0 0 0 0 0 0 0 1 0 94
95 12034.1 1 0 0 0 0 0 0 0 0 0 0 1 95
96 13199.7 1 0 0 0 0 0 0 0 0 0 0 0 96
97 10881.3 1 1 0 0 0 0 0 0 0 0 0 0 97
98 11301.2 1 0 1 0 0 0 0 0 0 0 0 0 98
99 13643.9 1 0 0 1 0 0 0 0 0 0 0 0 99
100 12517.0 1 0 0 0 1 0 0 0 0 0 0 0 100
101 13981.1 1 0 0 0 0 1 0 0 0 0 0 0 101
102 14275.7 1 0 0 0 0 0 1 0 0 0 0 0 102
103 13435.0 1 0 0 0 0 0 0 1 0 0 0 0 103
104 13565.7 1 0 0 0 0 0 0 0 1 0 0 0 104
105 16216.3 1 0 0 0 0 0 0 0 0 1 0 0 105
106 12970.0 1 0 0 0 0 0 0 0 0 0 1 0 106
107 14079.9 1 0 0 0 0 0 0 0 0 0 0 1 107
108 14235.0 1 0 0 0 0 0 0 0 0 0 0 0 108
109 12213.4 1 1 0 0 0 0 0 0 0 0 0 0 109
110 12581.0 1 0 1 0 0 0 0 0 0 0 0 0 110
111 14130.4 1 0 0 1 0 0 0 0 0 0 0 0 111
112 14210.8 1 0 0 0 1 0 0 0 0 0 0 0 112
113 14378.5 1 0 0 0 0 1 0 0 0 0 0 0 113
114 13142.8 1 0 0 0 0 0 1 0 0 0 0 0 114
115 13714.7 1 0 0 0 0 0 0 1 0 0 0 0 115
116 13621.9 1 0 0 0 0 0 0 0 1 0 0 0 116
117 15379.8 1 0 0 0 0 0 0 0 0 1 0 0 117
118 13306.3 1 0 0 0 0 0 0 0 0 0 1 0 118
119 14391.2 1 0 0 0 0 0 0 0 0 0 0 1 119
120 14909.9 1 0 0 0 0 0 0 0 0 0 0 0 120
121 14552.7 1 1 0 0 0 0 0 0 0 0 0 0 121
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
7993.75 -1443.30 -1412.69 -1869.97 -108.96 -101.71
M5 M6 M7 M8 M9 M10
-304.46 -278.58 -797.42 -403.56 956.24 -626.75
M11 t
-587.66 68.38
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1487.60 -378.00 49.76 378.50 1529.51
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7993.749 220.327 36.281 < 2e-16 ***
X -1443.303 216.338 -6.672 1.15e-09 ***
M1 -1412.686 261.758 -5.397 4.11e-07 ***
M2 -1869.970 268.295 -6.970 2.71e-10 ***
M3 -108.962 268.173 -0.406 0.685325
M4 -101.714 268.087 -0.379 0.705137
M5 -304.456 268.036 -1.136 0.258546
M6 -278.578 268.020 -1.039 0.300966
M7 -797.420 268.236 -2.973 0.003646 **
M8 -403.562 268.077 -1.505 0.135169
M9 956.236 267.954 3.569 0.000539 ***
M10 -626.746 267.865 -2.340 0.021151 *
M11 -587.658 267.812 -2.194 0.030377 *
t 68.382 3.076 22.229 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 598.8 on 107 degrees of freedom
Multiple R-Squared: 0.9232, Adjusted R-squared: 0.9138
F-statistic: 98.89 on 13 and 107 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/rcomp/tmp/190h11198247559.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/2p0px1198247559.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/3fsey1198247559.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/4mpku1198247559.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/5xnko1198247559.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 121
Frequency = 1
1 2 3 4 5 6
622.755354 419.557064 337.667064 587.237064 -78.502936 568.837064
7 8 9 10 11 12
111.996767 336.956767 -410.723233 506.376767 -207.193233 342.366767
13 14 15 16 17 18
395.671231 256.272942 221.182942 -171.547058 -252.987058 -506.447058
19 20 21 22 23 24
-1043.787356 -941.627356 -841.907356 -600.707356 -876.677356 -265.917356
25 26 27 28 29 30
-632.912891 -85.111181 -339.801181 -361.331181 -139.271181 302.068819
31 32 33 34 35 36
-360.671479 645.488521 410.608521 -300.891479 1072.538521 -225.101479
37 38 39 40 41 42
109.802986 706.304696 382.814696 358.684696 1231.644696 593.684696
43 44 45 46 47 48
1026.444399 641.904399 79.924399 249.724399 720.354399 -9.285601
49 50 51 52 53 54
-389.081137 -315.179427 -800.369427 -673.499427 -920.739427 -1487.599427
55 56 57 58 59 60
370.863252 198.223252 -9.056748 870.343252 572.773252 -117.366748
61 62 63 64 65 66
593.537716 -31.160573 87.749427 798.919427 -181.820573 199.819427
67 68 69 70 71 72
314.479129 58.839129 -547.640871 49.759129 -771.710871 -701.150871
73 74 75 76 77 78
-141.946406 -1102.044696 -506.434696 209.935304 -826.904696 -268.264696
79 80 81 82 83 84
-677.204994 -493.544994 -136.324994 -191.124994 -1176.294994 438.965006
85 86 87 88 89 90
-431.030529 -146.428819 86.081181 -81.748819 -65.288819 493.651181
91 92 93 94 95 96
-478.489117 -296.029117 53.190883 305.190883 -424.979117 84.580883
97 98 99 100 101 102
-889.514652 -80.712942 432.597058 -769.932942 828.527058 1028.867058
103 104 105 106 107 108
638.626761 307.086761 1529.506761 -202.193239 800.236761 299.296761
109 110 111 112 113 114
-377.998775 378.502936 98.512936 103.282936 405.342936 -924.617064
115 116 117 118 119 120
97.742638 -457.297362 -127.577362 -686.477362 290.952638 153.612638
121
1140.717103
> postscript(file="/var/www/html/rcomp/tmp/60mn11198247559.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 = 121
Frequency = 1
lag(myerror, k = 1) myerror
0 622.755354 NA
1 419.557064 622.755354
2 337.667064 419.557064
3 587.237064 337.667064
4 -78.502936 587.237064
5 568.837064 -78.502936
6 111.996767 568.837064
7 336.956767 111.996767
8 -410.723233 336.956767
9 506.376767 -410.723233
10 -207.193233 506.376767
11 342.366767 -207.193233
12 395.671231 342.366767
13 256.272942 395.671231
14 221.182942 256.272942
15 -171.547058 221.182942
16 -252.987058 -171.547058
17 -506.447058 -252.987058
18 -1043.787356 -506.447058
19 -941.627356 -1043.787356
20 -841.907356 -941.627356
21 -600.707356 -841.907356
22 -876.677356 -600.707356
23 -265.917356 -876.677356
24 -632.912891 -265.917356
25 -85.111181 -632.912891
26 -339.801181 -85.111181
27 -361.331181 -339.801181
28 -139.271181 -361.331181
29 302.068819 -139.271181
30 -360.671479 302.068819
31 645.488521 -360.671479
32 410.608521 645.488521
33 -300.891479 410.608521
34 1072.538521 -300.891479
35 -225.101479 1072.538521
36 109.802986 -225.101479
37 706.304696 109.802986
38 382.814696 706.304696
39 358.684696 382.814696
40 1231.644696 358.684696
41 593.684696 1231.644696
42 1026.444399 593.684696
43 641.904399 1026.444399
44 79.924399 641.904399
45 249.724399 79.924399
46 720.354399 249.724399
47 -9.285601 720.354399
48 -389.081137 -9.285601
49 -315.179427 -389.081137
50 -800.369427 -315.179427
51 -673.499427 -800.369427
52 -920.739427 -673.499427
53 -1487.599427 -920.739427
54 370.863252 -1487.599427
55 198.223252 370.863252
56 -9.056748 198.223252
57 870.343252 -9.056748
58 572.773252 870.343252
59 -117.366748 572.773252
60 593.537716 -117.366748
61 -31.160573 593.537716
62 87.749427 -31.160573
63 798.919427 87.749427
64 -181.820573 798.919427
65 199.819427 -181.820573
66 314.479129 199.819427
67 58.839129 314.479129
68 -547.640871 58.839129
69 49.759129 -547.640871
70 -771.710871 49.759129
71 -701.150871 -771.710871
72 -141.946406 -701.150871
73 -1102.044696 -141.946406
74 -506.434696 -1102.044696
75 209.935304 -506.434696
76 -826.904696 209.935304
77 -268.264696 -826.904696
78 -677.204994 -268.264696
79 -493.544994 -677.204994
80 -136.324994 -493.544994
81 -191.124994 -136.324994
82 -1176.294994 -191.124994
83 438.965006 -1176.294994
84 -431.030529 438.965006
85 -146.428819 -431.030529
86 86.081181 -146.428819
87 -81.748819 86.081181
88 -65.288819 -81.748819
89 493.651181 -65.288819
90 -478.489117 493.651181
91 -296.029117 -478.489117
92 53.190883 -296.029117
93 305.190883 53.190883
94 -424.979117 305.190883
95 84.580883 -424.979117
96 -889.514652 84.580883
97 -80.712942 -889.514652
98 432.597058 -80.712942
99 -769.932942 432.597058
100 828.527058 -769.932942
101 1028.867058 828.527058
102 638.626761 1028.867058
103 307.086761 638.626761
104 1529.506761 307.086761
105 -202.193239 1529.506761
106 800.236761 -202.193239
107 299.296761 800.236761
108 -377.998775 299.296761
109 378.502936 -377.998775
110 98.512936 378.502936
111 103.282936 98.512936
112 405.342936 103.282936
113 -924.617064 405.342936
114 97.742638 -924.617064
115 -457.297362 97.742638
116 -127.577362 -457.297362
117 -686.477362 -127.577362
118 290.952638 -686.477362
119 153.612638 290.952638
120 1140.717103 153.612638
121 NA 1140.717103
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 419.557064 622.755354
[2,] 337.667064 419.557064
[3,] 587.237064 337.667064
[4,] -78.502936 587.237064
[5,] 568.837064 -78.502936
[6,] 111.996767 568.837064
[7,] 336.956767 111.996767
[8,] -410.723233 336.956767
[9,] 506.376767 -410.723233
[10,] -207.193233 506.376767
[11,] 342.366767 -207.193233
[12,] 395.671231 342.366767
[13,] 256.272942 395.671231
[14,] 221.182942 256.272942
[15,] -171.547058 221.182942
[16,] -252.987058 -171.547058
[17,] -506.447058 -252.987058
[18,] -1043.787356 -506.447058
[19,] -941.627356 -1043.787356
[20,] -841.907356 -941.627356
[21,] -600.707356 -841.907356
[22,] -876.677356 -600.707356
[23,] -265.917356 -876.677356
[24,] -632.912891 -265.917356
[25,] -85.111181 -632.912891
[26,] -339.801181 -85.111181
[27,] -361.331181 -339.801181
[28,] -139.271181 -361.331181
[29,] 302.068819 -139.271181
[30,] -360.671479 302.068819
[31,] 645.488521 -360.671479
[32,] 410.608521 645.488521
[33,] -300.891479 410.608521
[34,] 1072.538521 -300.891479
[35,] -225.101479 1072.538521
[36,] 109.802986 -225.101479
[37,] 706.304696 109.802986
[38,] 382.814696 706.304696
[39,] 358.684696 382.814696
[40,] 1231.644696 358.684696
[41,] 593.684696 1231.644696
[42,] 1026.444399 593.684696
[43,] 641.904399 1026.444399
[44,] 79.924399 641.904399
[45,] 249.724399 79.924399
[46,] 720.354399 249.724399
[47,] -9.285601 720.354399
[48,] -389.081137 -9.285601
[49,] -315.179427 -389.081137
[50,] -800.369427 -315.179427
[51,] -673.499427 -800.369427
[52,] -920.739427 -673.499427
[53,] -1487.599427 -920.739427
[54,] 370.863252 -1487.599427
[55,] 198.223252 370.863252
[56,] -9.056748 198.223252
[57,] 870.343252 -9.056748
[58,] 572.773252 870.343252
[59,] -117.366748 572.773252
[60,] 593.537716 -117.366748
[61,] -31.160573 593.537716
[62,] 87.749427 -31.160573
[63,] 798.919427 87.749427
[64,] -181.820573 798.919427
[65,] 199.819427 -181.820573
[66,] 314.479129 199.819427
[67,] 58.839129 314.479129
[68,] -547.640871 58.839129
[69,] 49.759129 -547.640871
[70,] -771.710871 49.759129
[71,] -701.150871 -771.710871
[72,] -141.946406 -701.150871
[73,] -1102.044696 -141.946406
[74,] -506.434696 -1102.044696
[75,] 209.935304 -506.434696
[76,] -826.904696 209.935304
[77,] -268.264696 -826.904696
[78,] -677.204994 -268.264696
[79,] -493.544994 -677.204994
[80,] -136.324994 -493.544994
[81,] -191.124994 -136.324994
[82,] -1176.294994 -191.124994
[83,] 438.965006 -1176.294994
[84,] -431.030529 438.965006
[85,] -146.428819 -431.030529
[86,] 86.081181 -146.428819
[87,] -81.748819 86.081181
[88,] -65.288819 -81.748819
[89,] 493.651181 -65.288819
[90,] -478.489117 493.651181
[91,] -296.029117 -478.489117
[92,] 53.190883 -296.029117
[93,] 305.190883 53.190883
[94,] -424.979117 305.190883
[95,] 84.580883 -424.979117
[96,] -889.514652 84.580883
[97,] -80.712942 -889.514652
[98,] 432.597058 -80.712942
[99,] -769.932942 432.597058
[100,] 828.527058 -769.932942
[101,] 1028.867058 828.527058
[102,] 638.626761 1028.867058
[103,] 307.086761 638.626761
[104,] 1529.506761 307.086761
[105,] -202.193239 1529.506761
[106,] 800.236761 -202.193239
[107,] 299.296761 800.236761
[108,] -377.998775 299.296761
[109,] 378.502936 -377.998775
[110,] 98.512936 378.502936
[111,] 103.282936 98.512936
[112,] 405.342936 103.282936
[113,] -924.617064 405.342936
[114,] 97.742638 -924.617064
[115,] -457.297362 97.742638
[116,] -127.577362 -457.297362
[117,] -686.477362 -127.577362
[118,] 290.952638 -686.477362
[119,] 153.612638 290.952638
[120,] 1140.717103 153.612638
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 419.557064 622.755354
2 337.667064 419.557064
3 587.237064 337.667064
4 -78.502936 587.237064
5 568.837064 -78.502936
6 111.996767 568.837064
7 336.956767 111.996767
8 -410.723233 336.956767
9 506.376767 -410.723233
10 -207.193233 506.376767
11 342.366767 -207.193233
12 395.671231 342.366767
13 256.272942 395.671231
14 221.182942 256.272942
15 -171.547058 221.182942
16 -252.987058 -171.547058
17 -506.447058 -252.987058
18 -1043.787356 -506.447058
19 -941.627356 -1043.787356
20 -841.907356 -941.627356
21 -600.707356 -841.907356
22 -876.677356 -600.707356
23 -265.917356 -876.677356
24 -632.912891 -265.917356
25 -85.111181 -632.912891
26 -339.801181 -85.111181
27 -361.331181 -339.801181
28 -139.271181 -361.331181
29 302.068819 -139.271181
30 -360.671479 302.068819
31 645.488521 -360.671479
32 410.608521 645.488521
33 -300.891479 410.608521
34 1072.538521 -300.891479
35 -225.101479 1072.538521
36 109.802986 -225.101479
37 706.304696 109.802986
38 382.814696 706.304696
39 358.684696 382.814696
40 1231.644696 358.684696
41 593.684696 1231.644696
42 1026.444399 593.684696
43 641.904399 1026.444399
44 79.924399 641.904399
45 249.724399 79.924399
46 720.354399 249.724399
47 -9.285601 720.354399
48 -389.081137 -9.285601
49 -315.179427 -389.081137
50 -800.369427 -315.179427
51 -673.499427 -800.369427
52 -920.739427 -673.499427
53 -1487.599427 -920.739427
54 370.863252 -1487.599427
55 198.223252 370.863252
56 -9.056748 198.223252
57 870.343252 -9.056748
58 572.773252 870.343252
59 -117.366748 572.773252
60 593.537716 -117.366748
61 -31.160573 593.537716
62 87.749427 -31.160573
63 798.919427 87.749427
64 -181.820573 798.919427
65 199.819427 -181.820573
66 314.479129 199.819427
67 58.839129 314.479129
68 -547.640871 58.839129
69 49.759129 -547.640871
70 -771.710871 49.759129
71 -701.150871 -771.710871
72 -141.946406 -701.150871
73 -1102.044696 -141.946406
74 -506.434696 -1102.044696
75 209.935304 -506.434696
76 -826.904696 209.935304
77 -268.264696 -826.904696
78 -677.204994 -268.264696
79 -493.544994 -677.204994
80 -136.324994 -493.544994
81 -191.124994 -136.324994
82 -1176.294994 -191.124994
83 438.965006 -1176.294994
84 -431.030529 438.965006
85 -146.428819 -431.030529
86 86.081181 -146.428819
87 -81.748819 86.081181
88 -65.288819 -81.748819
89 493.651181 -65.288819
90 -478.489117 493.651181
91 -296.029117 -478.489117
92 53.190883 -296.029117
93 305.190883 53.190883
94 -424.979117 305.190883
95 84.580883 -424.979117
96 -889.514652 84.580883
97 -80.712942 -889.514652
98 432.597058 -80.712942
99 -769.932942 432.597058
100 828.527058 -769.932942
101 1028.867058 828.527058
102 638.626761 1028.867058
103 307.086761 638.626761
104 1529.506761 307.086761
105 -202.193239 1529.506761
106 800.236761 -202.193239
107 299.296761 800.236761
108 -377.998775 299.296761
109 378.502936 -377.998775
110 98.512936 378.502936
111 103.282936 98.512936
112 405.342936 103.282936
113 -924.617064 405.342936
114 97.742638 -924.617064
115 -457.297362 97.742638
116 -127.577362 -457.297362
117 -686.477362 -127.577362
118 290.952638 -686.477362
119 153.612638 290.952638
120 1140.717103 153.612638
> 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/77yi21198247559.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/8emvd1198247559.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/99e181198247559.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
> 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/105zpz1198247559.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/11g3ex1198247559.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/12hfm81198247560.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/13niav1198247560.tab")
>
> system("convert tmp/190h11198247559.ps tmp/190h11198247559.png")
> system("convert tmp/2p0px1198247559.ps tmp/2p0px1198247559.png")
> system("convert tmp/3fsey1198247559.ps tmp/3fsey1198247559.png")
> system("convert tmp/4mpku1198247559.ps tmp/4mpku1198247559.png")
> system("convert tmp/5xnko1198247559.ps tmp/5xnko1198247559.png")
> system("convert tmp/60mn11198247559.ps tmp/60mn11198247559.png")
> system("convert tmp/77yi21198247559.ps tmp/77yi21198247559.png")
> system("convert tmp/8emvd1198247559.ps tmp/8emvd1198247559.png")
> system("convert tmp/99e181198247559.ps tmp/99e181198247559.png")
>
>
> proc.time()
user system elapsed
2.550 1.517 2.885