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(106.54
+ ,107.89
+ ,1
+ ,106.44
+ ,107.26
+ ,1
+ ,106.57
+ ,107.76
+ ,1
+ ,106.12
+ ,107.32
+ ,1
+ ,106.13
+ ,107.15
+ ,1
+ ,106.26
+ ,108.04
+ ,1
+ ,105.78
+ ,106.52
+ ,1
+ ,105.77
+ ,106.62
+ ,0
+ ,105.2
+ ,106.47
+ ,0
+ ,105.15
+ ,105.46
+ ,0
+ ,105.01
+ ,106.13
+ ,0
+ ,104.75
+ ,105.15
+ ,0
+ ,104.96
+ ,105.39
+ ,0
+ ,105.26
+ ,104.57
+ ,0
+ ,105.13
+ ,104.29
+ ,0
+ ,104.77
+ ,104.09
+ ,0
+ ,104.79
+ ,104.51
+ ,0
+ ,104.4
+ ,103.39
+ ,0
+ ,103.89
+ ,102.71
+ ,0
+ ,103.93
+ ,102.62
+ ,0
+ ,103.48
+ ,101.94
+ ,0
+ ,103.45
+ ,101.65
+ ,0
+ ,103.47
+ ,101.86
+ ,0
+ ,103.5
+ ,101.27
+ ,0
+ ,103.69
+ ,101.21
+ ,0
+ ,103.57
+ ,102.15
+ ,0
+ ,103.47
+ ,102.07
+ ,0
+ ,102.85
+ ,102.8
+ ,0
+ ,102.54
+ ,103.39
+ ,0
+ ,102.39
+ ,102.71
+ ,0
+ ,102.16
+ ,102.65
+ ,0
+ ,101.51
+ ,101.12
+ ,0
+ ,100.83
+ ,100.29
+ ,0
+ ,100.55
+ ,99.79
+ ,0
+ ,100.88
+ ,100.11
+ ,0
+ ,101
+ ,99.76
+ ,0
+ ,100.51
+ ,99.96
+ ,0
+ ,100.44
+ ,99.98
+ ,0
+ ,100.32
+ ,100.49
+ ,0
+ ,99.98
+ ,100.75
+ ,0
+ ,100.03
+ ,100.84
+ ,0
+ ,99.64
+ ,100.44
+ ,0
+ ,99.11
+ ,99.57
+ ,0
+ ,98.97
+ ,99.22
+ ,0
+ ,98.6
+ ,99.08
+ ,0
+ ,98.31
+ ,98.04
+ ,0
+ ,98.37
+ ,98.73
+ ,0
+ ,98.19
+ ,98.72
+ ,0
+ ,98.51
+ ,100.07
+ ,0
+ ,98.23
+ ,99.02
+ ,0
+ ,97.96
+ ,98.94
+ ,0
+ ,97.77
+ ,99
+ ,0
+ ,97.49
+ ,98.54
+ ,0
+ ,97.76
+ ,98.42
+ ,0
+ ,98.01
+ ,97.9
+ ,0
+ ,97.73
+ ,97.46
+ ,0
+ ,97.06
+ ,97
+ ,0
+ ,96.63
+ ,95.97
+ ,0
+ ,96.58
+ ,96.55
+ ,0
+ ,96.66
+ ,96.51
+ ,0
+ ,96.77
+ ,96.76
+ ,0
+ ,96.5
+ ,96.05
+ ,0
+ ,96.53
+ ,96.47
+ ,0
+ ,96.22
+ ,96.38
+ ,0
+ ,96.49
+ ,97.27
+ ,0
+ ,96.34
+ ,96.67
+ ,0
+ ,96.31
+ ,96.59
+ ,0
+ ,96.06
+ ,96.06
+ ,0
+ ,95.9
+ ,96.92
+ ,0
+ ,95.33
+ ,94.96
+ ,0
+ ,95.53
+ ,95.59
+ ,0
+ ,95.42
+ ,95.68
+ ,0
+ ,95.57
+ ,95.35
+ ,0
+ ,95.3
+ ,95.41
+ ,0
+ ,95.31
+ ,95.32
+ ,0
+ ,95.38
+ ,95.8
+ ,0
+ ,95.22
+ ,95.46
+ ,0
+ ,94.62
+ ,94.16
+ ,0
+ ,93.81
+ ,92.49
+ ,0
+ ,93.6
+ ,91.58
+ ,0
+ ,93.2
+ ,91.5
+ ,0
+ ,93.29
+ ,90.83
+ ,0
+ ,93.54
+ ,91.28
+ ,0
+ ,93.23
+ ,90.57
+ ,0
+ ,93.46
+ ,90.93
+ ,0
+ ,92.82
+ ,90.9
+ ,0
+ ,92.85
+ ,91.49
+ ,0
+ ,92.67
+ ,91.38
+ ,0
+ ,92.32
+ ,90.91
+ ,0
+ ,92.06
+ ,90.72
+ ,0
+ ,91.88
+ ,89.53
+ ,0
+ ,91.53
+ ,89.47
+ ,0
+ ,91.19
+ ,89.28
+ ,0)
+ ,dim=c(3
+ ,93)
+ ,dimnames=list(c('X'
+ ,'Y'
+ ,'D')
+ ,1:93))
> y <- array(NA,dim=c(3,93),dimnames=list(c('X','Y','D'),1:93))
> 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 = 'Include Monthly Dummies'
> par1 = '2'
> #'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
Y X D M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 107.89 106.54 1 1 0 0 0 0 0 0 0 0 0 0
2 107.26 106.44 1 0 1 0 0 0 0 0 0 0 0 0
3 107.76 106.57 1 0 0 1 0 0 0 0 0 0 0 0
4 107.32 106.12 1 0 0 0 1 0 0 0 0 0 0 0
5 107.15 106.13 1 0 0 0 0 1 0 0 0 0 0 0
6 108.04 106.26 1 0 0 0 0 0 1 0 0 0 0 0
7 106.52 105.78 1 0 0 0 0 0 0 1 0 0 0 0
8 106.62 105.77 0 0 0 0 0 0 0 0 1 0 0 0
9 106.47 105.20 0 0 0 0 0 0 0 0 0 1 0 0
10 105.46 105.15 0 0 0 0 0 0 0 0 0 0 1 0
11 106.13 105.01 0 0 0 0 0 0 0 0 0 0 0 1
12 105.15 104.75 0 0 0 0 0 0 0 0 0 0 0 0
13 105.39 104.96 0 1 0 0 0 0 0 0 0 0 0 0
14 104.57 105.26 0 0 1 0 0 0 0 0 0 0 0 0
15 104.29 105.13 0 0 0 1 0 0 0 0 0 0 0 0
16 104.09 104.77 0 0 0 0 1 0 0 0 0 0 0 0
17 104.51 104.79 0 0 0 0 0 1 0 0 0 0 0 0
18 103.39 104.40 0 0 0 0 0 0 1 0 0 0 0 0
19 102.71 103.89 0 0 0 0 0 0 0 1 0 0 0 0
20 102.62 103.93 0 0 0 0 0 0 0 0 1 0 0 0
21 101.94 103.48 0 0 0 0 0 0 0 0 0 1 0 0
22 101.65 103.45 0 0 0 0 0 0 0 0 0 0 1 0
23 101.86 103.47 0 0 0 0 0 0 0 0 0 0 0 1
24 101.27 103.50 0 0 0 0 0 0 0 0 0 0 0 0
25 101.21 103.69 0 1 0 0 0 0 0 0 0 0 0 0
26 102.15 103.57 0 0 1 0 0 0 0 0 0 0 0 0
27 102.07 103.47 0 0 0 1 0 0 0 0 0 0 0 0
28 102.80 102.85 0 0 0 0 1 0 0 0 0 0 0 0
29 103.39 102.54 0 0 0 0 0 1 0 0 0 0 0 0
30 102.71 102.39 0 0 0 0 0 0 1 0 0 0 0 0
31 102.65 102.16 0 0 0 0 0 0 0 1 0 0 0 0
32 101.12 101.51 0 0 0 0 0 0 0 0 1 0 0 0
33 100.29 100.83 0 0 0 0 0 0 0 0 0 1 0 0
34 99.79 100.55 0 0 0 0 0 0 0 0 0 0 1 0
35 100.11 100.88 0 0 0 0 0 0 0 0 0 0 0 1
36 99.76 101.00 0 0 0 0 0 0 0 0 0 0 0 0
37 99.96 100.51 0 1 0 0 0 0 0 0 0 0 0 0
38 99.98 100.44 0 0 1 0 0 0 0 0 0 0 0 0
39 100.49 100.32 0 0 0 1 0 0 0 0 0 0 0 0
40 100.75 99.98 0 0 0 0 1 0 0 0 0 0 0 0
41 100.84 100.03 0 0 0 0 0 1 0 0 0 0 0 0
42 100.44 99.64 0 0 0 0 0 0 1 0 0 0 0 0
43 99.57 99.11 0 0 0 0 0 0 0 1 0 0 0 0
44 99.22 98.97 0 0 0 0 0 0 0 0 1 0 0 0
45 99.08 98.60 0 0 0 0 0 0 0 0 0 1 0 0
46 98.04 98.31 0 0 0 0 0 0 0 0 0 0 1 0
47 98.73 98.37 0 0 0 0 0 0 0 0 0 0 0 1
48 98.72 98.19 0 0 0 0 0 0 0 0 0 0 0 0
49 100.07 98.51 0 1 0 0 0 0 0 0 0 0 0 0
50 99.02 98.23 0 0 1 0 0 0 0 0 0 0 0 0
51 98.94 97.96 0 0 0 1 0 0 0 0 0 0 0 0
52 99.00 97.77 0 0 0 0 1 0 0 0 0 0 0 0
53 98.54 97.49 0 0 0 0 0 1 0 0 0 0 0 0
54 98.42 97.76 0 0 0 0 0 0 1 0 0 0 0 0
55 97.90 98.01 0 0 0 0 0 0 0 1 0 0 0 0
56 97.46 97.73 0 0 0 0 0 0 0 0 1 0 0 0
57 97.00 97.06 0 0 0 0 0 0 0 0 0 1 0 0
58 95.97 96.63 0 0 0 0 0 0 0 0 0 0 1 0
59 96.55 96.58 0 0 0 0 0 0 0 0 0 0 0 1
60 96.51 96.66 0 0 0 0 0 0 0 0 0 0 0 0
61 96.76 96.77 0 1 0 0 0 0 0 0 0 0 0 0
62 96.05 96.50 0 0 1 0 0 0 0 0 0 0 0 0
63 96.47 96.53 0 0 0 1 0 0 0 0 0 0 0 0
64 96.38 96.22 0 0 0 0 1 0 0 0 0 0 0 0
65 97.27 96.49 0 0 0 0 0 1 0 0 0 0 0 0
66 96.67 96.34 0 0 0 0 0 0 1 0 0 0 0 0
67 96.59 96.31 0 0 0 0 0 0 0 1 0 0 0 0
68 96.06 96.06 0 0 0 0 0 0 0 0 1 0 0 0
69 96.92 95.90 0 0 0 0 0 0 0 0 0 1 0 0
70 94.96 95.33 0 0 0 0 0 0 0 0 0 0 1 0
71 95.59 95.53 0 0 0 0 0 0 0 0 0 0 0 1
72 95.68 95.42 0 0 0 0 0 0 0 0 0 0 0 0
73 95.35 95.57 0 1 0 0 0 0 0 0 0 0 0 0
74 95.41 95.30 0 0 1 0 0 0 0 0 0 0 0 0
75 95.32 95.31 0 0 0 1 0 0 0 0 0 0 0 0
76 95.80 95.38 0 0 0 0 1 0 0 0 0 0 0 0
77 95.46 95.22 0 0 0 0 0 1 0 0 0 0 0 0
78 94.16 94.62 0 0 0 0 0 0 1 0 0 0 0 0
79 92.49 93.81 0 0 0 0 0 0 0 1 0 0 0 0
80 91.58 93.60 0 0 0 0 0 0 0 0 1 0 0 0
81 91.50 93.20 0 0 0 0 0 0 0 0 0 1 0 0
82 90.83 93.29 0 0 0 0 0 0 0 0 0 0 1 0
83 91.28 93.54 0 0 0 0 0 0 0 0 0 0 0 1
84 90.57 93.23 0 0 0 0 0 0 0 0 0 0 0 0
85 90.93 93.46 0 1 0 0 0 0 0 0 0 0 0 0
86 90.90 92.82 0 0 1 0 0 0 0 0 0 0 0 0
87 91.49 92.85 0 0 0 1 0 0 0 0 0 0 0 0
88 91.38 92.67 0 0 0 0 1 0 0 0 0 0 0 0
89 90.91 92.32 0 0 0 0 0 1 0 0 0 0 0 0
90 90.72 92.06 0 0 0 0 0 0 1 0 0 0 0 0
91 89.53 91.88 0 0 0 0 0 0 0 1 0 0 0 0
92 89.47 91.53 0 0 0 0 0 0 0 0 1 0 0 0
93 89.28 91.19 0 0 0 0 0 0 0 0 0 1 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X D M1 M2 M3
-7.2530 1.0659 0.8957 0.2405 0.1563 0.3985
M4 M5 M6 M7 M8 M9
0.8018 0.9705 0.7357 0.2477 0.1299 0.4062
M10 M11
-0.1311 0.2741
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.3050 -0.9179 0.2834 0.7308 2.0765
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -7.25303 2.65600 -2.731 0.00779 **
X 1.06594 0.02656 40.137 < 2e-16 ***
D 0.89571 0.45806 1.955 0.05407 .
M1 0.24055 0.52698 0.456 0.64930
M2 0.15625 0.52698 0.297 0.76762
M3 0.39846 0.52699 0.756 0.45183
M4 0.80183 0.52712 1.521 0.13221
M5 0.97051 0.52718 1.841 0.06938 .
M6 0.73571 0.52735 1.395 0.16689
M7 0.24773 0.52773 0.469 0.64006
M8 0.12994 0.52455 0.248 0.80499
M9 0.40620 0.52489 0.774 0.44132
M10 -0.13105 0.54168 -0.242 0.80946
M11 0.27407 0.54169 0.506 0.61430
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.013 on 79 degrees of freedom
Multiple R-Squared: 0.9647, Adjusted R-squared: 0.9588
F-statistic: 165.9 on 13 and 79 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/rcomp/tmp/1vhed1195470118.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/2ypyp1195470118.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/32cov1195470118.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/4dgbp1195470118.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/5ygaj1195470118.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 = 93
Frequency = 1
1 2 3 4 5 6
0.441324370 0.002216592 0.121432200 -0.242261664 -0.591603133 0.394630613
7 8 9 10 11 12
-0.125738978 0.998419587 1.179752902 0.760297028 1.174411899 0.745622017
13 14 15 16 17 18
0.521224764 -0.534259763 -0.917899268 -1.137527901 -0.907528789 -1.377005269
19 20 21 22 23 24
-1.025396604 -1.040247366 -1.516827075 -1.237601787 -1.454037616 -1.801950641
25 26 27 28 29 30
-2.305029057 -1.152817997 -1.368435758 -0.380919504 0.370840427 0.085537897
31 32 33 34 35 36
0.758682838 0.039331968 -0.342081110 -0.006370353 -0.443248164 -0.647095957
37 38 39 40 41 42
-0.165333899 0.013580068 0.409281144 0.628333674 0.496354529 0.746878049
43 44 45 46 47 48
0.929805552 0.846824327 0.824969268 0.631339444 0.852265939 1.308200708
49 50 51 52 53 54
2.076549848 1.409311608 1.374903966 1.234065214 0.903846888 0.730848772
55 56 57 58 59 60
0.432341613 0.408592250 0.386519753 0.352121791 0.580301893 0.729091774
61 62 63 64 65 66
0.621288708 0.283391050 0.429200845 0.266275118 0.699788762 0.494486232
67 68 69 70 71 72
0.934442798 0.788715179 1.543012326 0.727846227 0.739540860 1.220859698
73 74 75 76 77 78
0.490418957 0.922521298 0.579649931 0.581666292 0.243534941 -0.182093745
79 80 81 82 83 84
-0.500702518 -1.069067812 -0.998944615 -1.227632351 -1.449234811 -1.554727599
85 86 87 88 89 90
-1.680443690 -0.943942856 -0.628133060 -0.949631230 -1.215233625 -0.893282549
91 92 93
-1.403434702 -0.972568133 -1.076401449
> postscript(file="/var/www/html/rcomp/tmp/63hoc1195470118.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 = 93
Frequency = 1
lag(myerror, k = 1) myerror
0 0.441324370 NA
1 0.002216592 0.441324370
2 0.121432200 0.002216592
3 -0.242261664 0.121432200
4 -0.591603133 -0.242261664
5 0.394630613 -0.591603133
6 -0.125738978 0.394630613
7 0.998419587 -0.125738978
8 1.179752902 0.998419587
9 0.760297028 1.179752902
10 1.174411899 0.760297028
11 0.745622017 1.174411899
12 0.521224764 0.745622017
13 -0.534259763 0.521224764
14 -0.917899268 -0.534259763
15 -1.137527901 -0.917899268
16 -0.907528789 -1.137527901
17 -1.377005269 -0.907528789
18 -1.025396604 -1.377005269
19 -1.040247366 -1.025396604
20 -1.516827075 -1.040247366
21 -1.237601787 -1.516827075
22 -1.454037616 -1.237601787
23 -1.801950641 -1.454037616
24 -2.305029057 -1.801950641
25 -1.152817997 -2.305029057
26 -1.368435758 -1.152817997
27 -0.380919504 -1.368435758
28 0.370840427 -0.380919504
29 0.085537897 0.370840427
30 0.758682838 0.085537897
31 0.039331968 0.758682838
32 -0.342081110 0.039331968
33 -0.006370353 -0.342081110
34 -0.443248164 -0.006370353
35 -0.647095957 -0.443248164
36 -0.165333899 -0.647095957
37 0.013580068 -0.165333899
38 0.409281144 0.013580068
39 0.628333674 0.409281144
40 0.496354529 0.628333674
41 0.746878049 0.496354529
42 0.929805552 0.746878049
43 0.846824327 0.929805552
44 0.824969268 0.846824327
45 0.631339444 0.824969268
46 0.852265939 0.631339444
47 1.308200708 0.852265939
48 2.076549848 1.308200708
49 1.409311608 2.076549848
50 1.374903966 1.409311608
51 1.234065214 1.374903966
52 0.903846888 1.234065214
53 0.730848772 0.903846888
54 0.432341613 0.730848772
55 0.408592250 0.432341613
56 0.386519753 0.408592250
57 0.352121791 0.386519753
58 0.580301893 0.352121791
59 0.729091774 0.580301893
60 0.621288708 0.729091774
61 0.283391050 0.621288708
62 0.429200845 0.283391050
63 0.266275118 0.429200845
64 0.699788762 0.266275118
65 0.494486232 0.699788762
66 0.934442798 0.494486232
67 0.788715179 0.934442798
68 1.543012326 0.788715179
69 0.727846227 1.543012326
70 0.739540860 0.727846227
71 1.220859698 0.739540860
72 0.490418957 1.220859698
73 0.922521298 0.490418957
74 0.579649931 0.922521298
75 0.581666292 0.579649931
76 0.243534941 0.581666292
77 -0.182093745 0.243534941
78 -0.500702518 -0.182093745
79 -1.069067812 -0.500702518
80 -0.998944615 -1.069067812
81 -1.227632351 -0.998944615
82 -1.449234811 -1.227632351
83 -1.554727599 -1.449234811
84 -1.680443690 -1.554727599
85 -0.943942856 -1.680443690
86 -0.628133060 -0.943942856
87 -0.949631230 -0.628133060
88 -1.215233625 -0.949631230
89 -0.893282549 -1.215233625
90 -1.403434702 -0.893282549
91 -0.972568133 -1.403434702
92 -1.076401449 -0.972568133
93 NA -1.076401449
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.002216592 0.441324370
[2,] 0.121432200 0.002216592
[3,] -0.242261664 0.121432200
[4,] -0.591603133 -0.242261664
[5,] 0.394630613 -0.591603133
[6,] -0.125738978 0.394630613
[7,] 0.998419587 -0.125738978
[8,] 1.179752902 0.998419587
[9,] 0.760297028 1.179752902
[10,] 1.174411899 0.760297028
[11,] 0.745622017 1.174411899
[12,] 0.521224764 0.745622017
[13,] -0.534259763 0.521224764
[14,] -0.917899268 -0.534259763
[15,] -1.137527901 -0.917899268
[16,] -0.907528789 -1.137527901
[17,] -1.377005269 -0.907528789
[18,] -1.025396604 -1.377005269
[19,] -1.040247366 -1.025396604
[20,] -1.516827075 -1.040247366
[21,] -1.237601787 -1.516827075
[22,] -1.454037616 -1.237601787
[23,] -1.801950641 -1.454037616
[24,] -2.305029057 -1.801950641
[25,] -1.152817997 -2.305029057
[26,] -1.368435758 -1.152817997
[27,] -0.380919504 -1.368435758
[28,] 0.370840427 -0.380919504
[29,] 0.085537897 0.370840427
[30,] 0.758682838 0.085537897
[31,] 0.039331968 0.758682838
[32,] -0.342081110 0.039331968
[33,] -0.006370353 -0.342081110
[34,] -0.443248164 -0.006370353
[35,] -0.647095957 -0.443248164
[36,] -0.165333899 -0.647095957
[37,] 0.013580068 -0.165333899
[38,] 0.409281144 0.013580068
[39,] 0.628333674 0.409281144
[40,] 0.496354529 0.628333674
[41,] 0.746878049 0.496354529
[42,] 0.929805552 0.746878049
[43,] 0.846824327 0.929805552
[44,] 0.824969268 0.846824327
[45,] 0.631339444 0.824969268
[46,] 0.852265939 0.631339444
[47,] 1.308200708 0.852265939
[48,] 2.076549848 1.308200708
[49,] 1.409311608 2.076549848
[50,] 1.374903966 1.409311608
[51,] 1.234065214 1.374903966
[52,] 0.903846888 1.234065214
[53,] 0.730848772 0.903846888
[54,] 0.432341613 0.730848772
[55,] 0.408592250 0.432341613
[56,] 0.386519753 0.408592250
[57,] 0.352121791 0.386519753
[58,] 0.580301893 0.352121791
[59,] 0.729091774 0.580301893
[60,] 0.621288708 0.729091774
[61,] 0.283391050 0.621288708
[62,] 0.429200845 0.283391050
[63,] 0.266275118 0.429200845
[64,] 0.699788762 0.266275118
[65,] 0.494486232 0.699788762
[66,] 0.934442798 0.494486232
[67,] 0.788715179 0.934442798
[68,] 1.543012326 0.788715179
[69,] 0.727846227 1.543012326
[70,] 0.739540860 0.727846227
[71,] 1.220859698 0.739540860
[72,] 0.490418957 1.220859698
[73,] 0.922521298 0.490418957
[74,] 0.579649931 0.922521298
[75,] 0.581666292 0.579649931
[76,] 0.243534941 0.581666292
[77,] -0.182093745 0.243534941
[78,] -0.500702518 -0.182093745
[79,] -1.069067812 -0.500702518
[80,] -0.998944615 -1.069067812
[81,] -1.227632351 -0.998944615
[82,] -1.449234811 -1.227632351
[83,] -1.554727599 -1.449234811
[84,] -1.680443690 -1.554727599
[85,] -0.943942856 -1.680443690
[86,] -0.628133060 -0.943942856
[87,] -0.949631230 -0.628133060
[88,] -1.215233625 -0.949631230
[89,] -0.893282549 -1.215233625
[90,] -1.403434702 -0.893282549
[91,] -0.972568133 -1.403434702
[92,] -1.076401449 -0.972568133
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.002216592 0.441324370
2 0.121432200 0.002216592
3 -0.242261664 0.121432200
4 -0.591603133 -0.242261664
5 0.394630613 -0.591603133
6 -0.125738978 0.394630613
7 0.998419587 -0.125738978
8 1.179752902 0.998419587
9 0.760297028 1.179752902
10 1.174411899 0.760297028
11 0.745622017 1.174411899
12 0.521224764 0.745622017
13 -0.534259763 0.521224764
14 -0.917899268 -0.534259763
15 -1.137527901 -0.917899268
16 -0.907528789 -1.137527901
17 -1.377005269 -0.907528789
18 -1.025396604 -1.377005269
19 -1.040247366 -1.025396604
20 -1.516827075 -1.040247366
21 -1.237601787 -1.516827075
22 -1.454037616 -1.237601787
23 -1.801950641 -1.454037616
24 -2.305029057 -1.801950641
25 -1.152817997 -2.305029057
26 -1.368435758 -1.152817997
27 -0.380919504 -1.368435758
28 0.370840427 -0.380919504
29 0.085537897 0.370840427
30 0.758682838 0.085537897
31 0.039331968 0.758682838
32 -0.342081110 0.039331968
33 -0.006370353 -0.342081110
34 -0.443248164 -0.006370353
35 -0.647095957 -0.443248164
36 -0.165333899 -0.647095957
37 0.013580068 -0.165333899
38 0.409281144 0.013580068
39 0.628333674 0.409281144
40 0.496354529 0.628333674
41 0.746878049 0.496354529
42 0.929805552 0.746878049
43 0.846824327 0.929805552
44 0.824969268 0.846824327
45 0.631339444 0.824969268
46 0.852265939 0.631339444
47 1.308200708 0.852265939
48 2.076549848 1.308200708
49 1.409311608 2.076549848
50 1.374903966 1.409311608
51 1.234065214 1.374903966
52 0.903846888 1.234065214
53 0.730848772 0.903846888
54 0.432341613 0.730848772
55 0.408592250 0.432341613
56 0.386519753 0.408592250
57 0.352121791 0.386519753
58 0.580301893 0.352121791
59 0.729091774 0.580301893
60 0.621288708 0.729091774
61 0.283391050 0.621288708
62 0.429200845 0.283391050
63 0.266275118 0.429200845
64 0.699788762 0.266275118
65 0.494486232 0.699788762
66 0.934442798 0.494486232
67 0.788715179 0.934442798
68 1.543012326 0.788715179
69 0.727846227 1.543012326
70 0.739540860 0.727846227
71 1.220859698 0.739540860
72 0.490418957 1.220859698
73 0.922521298 0.490418957
74 0.579649931 0.922521298
75 0.581666292 0.579649931
76 0.243534941 0.581666292
77 -0.182093745 0.243534941
78 -0.500702518 -0.182093745
79 -1.069067812 -0.500702518
80 -0.998944615 -1.069067812
81 -1.227632351 -0.998944615
82 -1.449234811 -1.227632351
83 -1.554727599 -1.449234811
84 -1.680443690 -1.554727599
85 -0.943942856 -1.680443690
86 -0.628133060 -0.943942856
87 -0.949631230 -0.628133060
88 -1.215233625 -0.949631230
89 -0.893282549 -1.215233625
90 -1.403434702 -0.893282549
91 -0.972568133 -1.403434702
92 -1.076401449 -0.972568133
> 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/76o1n1195470118.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/80hhe1195470118.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/9su0h1195470118.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/10o5n91195470118.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/11gxrf1195470118.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/12les11195470119.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/13cygh1195470119.tab")
>
> system("convert tmp/1vhed1195470118.ps tmp/1vhed1195470118.png")
> system("convert tmp/2ypyp1195470118.ps tmp/2ypyp1195470118.png")
> system("convert tmp/32cov1195470118.ps tmp/32cov1195470118.png")
> system("convert tmp/4dgbp1195470118.ps tmp/4dgbp1195470118.png")
> system("convert tmp/5ygaj1195470118.ps tmp/5ygaj1195470118.png")
> system("convert tmp/63hoc1195470118.ps tmp/63hoc1195470118.png")
> system("convert tmp/76o1n1195470118.ps tmp/76o1n1195470118.png")
> system("convert tmp/80hhe1195470118.ps tmp/80hhe1195470118.png")
> system("convert tmp/9su0h1195470118.ps tmp/9su0h1195470118.png")
>
>
> proc.time()
user system elapsed
2.414 1.497 2.832