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(511,0,492,0,492,0,493,0,481,0,462,0,457,0,442,0,439,0,488,0,521,0,501,0,485,0,464,0,460,0,467,0,460,0,448,0,443,0,436,0,431,0,484,0,510,0,513,0,503,0,471,0,471,0,476,0,475,0,470,0,461,0,455,0,456,0,517,0,525,0,523,0,519,0,509,0,512,0,519,0,517,0,510,0,509,0,501,1,507,1,569,1,580,1,578,1,565,1,547,1,555,1,562,1,561,1,555,1,544,1,537,1,543,1,594,1,611,1,613,1,611,1,594,1,595,1,591,1,589,1,584,1,573,1,567,1,569,1,621,1,629,1,628,1,612,1,595,1,597,1,593,1,590,1,580,1,574,1,573,1,573,1,620,1,626,1,620,1,588,1,566,1,557,1,561,1,549,1,532,1,526,1,511,1,499,1,555,1,565,1,542,1,527,1),dim=c(2,97),dimnames=list(c('y','x'),1:97))
> y <- array(NA,dim=c(2,97),dimnames=list(c('y','x'),1:97))
> 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
y x M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 511 0 1 0 0 0 0 0 0 0 0 0 0 1
2 492 0 0 1 0 0 0 0 0 0 0 0 0 2
3 492 0 0 0 1 0 0 0 0 0 0 0 0 3
4 493 0 0 0 0 1 0 0 0 0 0 0 0 4
5 481 0 0 0 0 0 1 0 0 0 0 0 0 5
6 462 0 0 0 0 0 0 1 0 0 0 0 0 6
7 457 0 0 0 0 0 0 0 1 0 0 0 0 7
8 442 0 0 0 0 0 0 0 0 1 0 0 0 8
9 439 0 0 0 0 0 0 0 0 0 1 0 0 9
10 488 0 0 0 0 0 0 0 0 0 0 1 0 10
11 521 0 0 0 0 0 0 0 0 0 0 0 1 11
12 501 0 0 0 0 0 0 0 0 0 0 0 0 12
13 485 0 1 0 0 0 0 0 0 0 0 0 0 13
14 464 0 0 1 0 0 0 0 0 0 0 0 0 14
15 460 0 0 0 1 0 0 0 0 0 0 0 0 15
16 467 0 0 0 0 1 0 0 0 0 0 0 0 16
17 460 0 0 0 0 0 1 0 0 0 0 0 0 17
18 448 0 0 0 0 0 0 1 0 0 0 0 0 18
19 443 0 0 0 0 0 0 0 1 0 0 0 0 19
20 436 0 0 0 0 0 0 0 0 1 0 0 0 20
21 431 0 0 0 0 0 0 0 0 0 1 0 0 21
22 484 0 0 0 0 0 0 0 0 0 0 1 0 22
23 510 0 0 0 0 0 0 0 0 0 0 0 1 23
24 513 0 0 0 0 0 0 0 0 0 0 0 0 24
25 503 0 1 0 0 0 0 0 0 0 0 0 0 25
26 471 0 0 1 0 0 0 0 0 0 0 0 0 26
27 471 0 0 0 1 0 0 0 0 0 0 0 0 27
28 476 0 0 0 0 1 0 0 0 0 0 0 0 28
29 475 0 0 0 0 0 1 0 0 0 0 0 0 29
30 470 0 0 0 0 0 0 1 0 0 0 0 0 30
31 461 0 0 0 0 0 0 0 1 0 0 0 0 31
32 455 0 0 0 0 0 0 0 0 1 0 0 0 32
33 456 0 0 0 0 0 0 0 0 0 1 0 0 33
34 517 0 0 0 0 0 0 0 0 0 0 1 0 34
35 525 0 0 0 0 0 0 0 0 0 0 0 1 35
36 523 0 0 0 0 0 0 0 0 0 0 0 0 36
37 519 0 1 0 0 0 0 0 0 0 0 0 0 37
38 509 0 0 1 0 0 0 0 0 0 0 0 0 38
39 512 0 0 0 1 0 0 0 0 0 0 0 0 39
40 519 0 0 0 0 1 0 0 0 0 0 0 0 40
41 517 0 0 0 0 0 1 0 0 0 0 0 0 41
42 510 0 0 0 0 0 0 1 0 0 0 0 0 42
43 509 0 0 0 0 0 0 0 1 0 0 0 0 43
44 501 1 0 0 0 0 0 0 0 1 0 0 0 44
45 507 1 0 0 0 0 0 0 0 0 1 0 0 45
46 569 1 0 0 0 0 0 0 0 0 0 1 0 46
47 580 1 0 0 0 0 0 0 0 0 0 0 1 47
48 578 1 0 0 0 0 0 0 0 0 0 0 0 48
49 565 1 1 0 0 0 0 0 0 0 0 0 0 49
50 547 1 0 1 0 0 0 0 0 0 0 0 0 50
51 555 1 0 0 1 0 0 0 0 0 0 0 0 51
52 562 1 0 0 0 1 0 0 0 0 0 0 0 52
53 561 1 0 0 0 0 1 0 0 0 0 0 0 53
54 555 1 0 0 0 0 0 1 0 0 0 0 0 54
55 544 1 0 0 0 0 0 0 1 0 0 0 0 55
56 537 1 0 0 0 0 0 0 0 1 0 0 0 56
57 543 1 0 0 0 0 0 0 0 0 1 0 0 57
58 594 1 0 0 0 0 0 0 0 0 0 1 0 58
59 611 1 0 0 0 0 0 0 0 0 0 0 1 59
60 613 1 0 0 0 0 0 0 0 0 0 0 0 60
61 611 1 1 0 0 0 0 0 0 0 0 0 0 61
62 594 1 0 1 0 0 0 0 0 0 0 0 0 62
63 595 1 0 0 1 0 0 0 0 0 0 0 0 63
64 591 1 0 0 0 1 0 0 0 0 0 0 0 64
65 589 1 0 0 0 0 1 0 0 0 0 0 0 65
66 584 1 0 0 0 0 0 1 0 0 0 0 0 66
67 573 1 0 0 0 0 0 0 1 0 0 0 0 67
68 567 1 0 0 0 0 0 0 0 1 0 0 0 68
69 569 1 0 0 0 0 0 0 0 0 1 0 0 69
70 621 1 0 0 0 0 0 0 0 0 0 1 0 70
71 629 1 0 0 0 0 0 0 0 0 0 0 1 71
72 628 1 0 0 0 0 0 0 0 0 0 0 0 72
73 612 1 1 0 0 0 0 0 0 0 0 0 0 73
74 595 1 0 1 0 0 0 0 0 0 0 0 0 74
75 597 1 0 0 1 0 0 0 0 0 0 0 0 75
76 593 1 0 0 0 1 0 0 0 0 0 0 0 76
77 590 1 0 0 0 0 1 0 0 0 0 0 0 77
78 580 1 0 0 0 0 0 1 0 0 0 0 0 78
79 574 1 0 0 0 0 0 0 1 0 0 0 0 79
80 573 1 0 0 0 0 0 0 0 1 0 0 0 80
81 573 1 0 0 0 0 0 0 0 0 1 0 0 81
82 620 1 0 0 0 0 0 0 0 0 0 1 0 82
83 626 1 0 0 0 0 0 0 0 0 0 0 1 83
84 620 1 0 0 0 0 0 0 0 0 0 0 0 84
85 588 1 1 0 0 0 0 0 0 0 0 0 0 85
86 566 1 0 1 0 0 0 0 0 0 0 0 0 86
87 557 1 0 0 1 0 0 0 0 0 0 0 0 87
88 561 1 0 0 0 1 0 0 0 0 0 0 0 88
89 549 1 0 0 0 0 1 0 0 0 0 0 0 89
90 532 1 0 0 0 0 0 1 0 0 0 0 0 90
91 526 1 0 0 0 0 0 0 1 0 0 0 0 91
92 511 1 0 0 0 0 0 0 0 1 0 0 0 92
93 499 1 0 0 0 0 0 0 0 0 1 0 0 93
94 555 1 0 0 0 0 0 0 0 0 0 1 0 94
95 565 1 0 0 0 0 0 0 0 0 0 0 1 95
96 542 1 0 0 0 0 0 0 0 0 0 0 0 96
97 527 1 1 0 0 0 0 0 0 0 0 0 0 97
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) x M1 M2 M3 M4
505.3487 80.5629 -11.5397 -23.2538 -23.2964 -20.5890
M5 M6 M7 M8 M9 M10
-25.7566 -36.0491 -42.9667 -61.3297 -62.1222 -8.4148
M11 t
6.2926 0.1676
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-63.63 -16.16 0.57 18.83 39.41
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 505.3487 9.8983 51.054 < 2e-16 ***
x 80.5629 9.6939 8.311 1.56e-12 ***
M1 -11.5397 11.6664 -0.989 0.325472
M2 -23.2538 12.0308 -1.933 0.056665 .
M3 -23.2964 12.0224 -1.938 0.056055 .
M4 -20.5890 12.0164 -1.713 0.090372 .
M5 -25.7566 12.0129 -2.144 0.034953 *
M6 -36.0491 12.0119 -3.001 0.003552 **
M7 -42.9667 12.0133 -3.577 0.000584 ***
M8 -61.3297 12.0157 -5.104 2.07e-06 ***
M9 -62.1222 12.0071 -5.174 1.57e-06 ***
M10 -8.4148 12.0009 -0.701 0.485151
M11 6.2926 11.9972 0.525 0.601327
t 0.1676 0.1718 0.976 0.332042
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 23.99 on 83 degrees of freedom
Multiple R-Squared: 0.8297, Adjusted R-squared: 0.8031
F-statistic: 31.11 on 13 and 83 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/rcomp/tmp/1baud1195740780.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/2nkac1195740780.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/38oyw1195740780.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/4jf7v1195740780.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/5sxxo1195740780.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 = 97
Frequency = 1
1 2 3 4 5 6
17.0234037 9.5699624 9.4449624 7.5699624 0.5699624 -8.3050376
7 8 9 10 11 12
-6.5550376 -3.3596799 -5.7346799 -10.6096799 7.5153201 -6.3596799
13 14 15 16 17 18
-10.9876053 -20.4410466 -24.5660466 -20.4410466 -22.4410466 -24.3160466
19 20 21 22 23 24
-22.5660466 -11.3706889 -15.7456889 -16.6206889 -5.4956889 3.6293111
25 26 27 28 29 30
5.0013856 -15.4520556 -15.5770556 -13.4520556 -9.4520556 -4.3270556
31 32 33 34 35 36
-6.5770556 5.6183021 7.2433021 14.3683021 7.4933021 11.6183021
37 38 39 40 41 42
18.9903766 20.5369353 23.4119353 27.5369353 30.5369353 33.6619353
43 44 45 46 47 48
39.4119353 -30.9555686 -24.3305686 -16.2055686 -20.0805686 -15.9555686
49 50 51 52 53 54
-17.5834940 -24.0369353 -16.1619353 -12.0369353 -8.0369353 -3.9119353
55 56 57 58 59 60
-8.1619353 3.0334224 9.6584224 6.7834224 8.9084224 17.0334224
61 62 63 64 65 66
26.4054969 20.9520556 21.8270556 14.9520556 17.9520556 23.0770556
67 68 69 70 71 72
18.8270556 31.0224133 33.6474133 31.7724133 24.8974133 30.0224133
73 74 75 76 77 78
25.3944879 19.9410466 21.8160466 14.9410466 16.9410466 17.0660466
79 80 81 82 83 84
17.8160466 35.0114043 35.6364043 28.7614043 19.8864043 20.0114043
85 86 87 88 89 90
-0.6165212 -11.0699624 -20.1949624 -19.0699624 -26.0699624 -32.9449624
91 92 93 94 95 96
-32.1949624 -28.9996047 -40.3746047 -38.2496047 -43.1246047 -59.9996047
97
-63.6275302
> postscript(file="/var/www/html/rcomp/tmp/6gzuf1195740780.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 = 97
Frequency = 1
lag(myerror, k = 1) myerror
0 17.0234037 NA
1 9.5699624 17.0234037
2 9.4449624 9.5699624
3 7.5699624 9.4449624
4 0.5699624 7.5699624
5 -8.3050376 0.5699624
6 -6.5550376 -8.3050376
7 -3.3596799 -6.5550376
8 -5.7346799 -3.3596799
9 -10.6096799 -5.7346799
10 7.5153201 -10.6096799
11 -6.3596799 7.5153201
12 -10.9876053 -6.3596799
13 -20.4410466 -10.9876053
14 -24.5660466 -20.4410466
15 -20.4410466 -24.5660466
16 -22.4410466 -20.4410466
17 -24.3160466 -22.4410466
18 -22.5660466 -24.3160466
19 -11.3706889 -22.5660466
20 -15.7456889 -11.3706889
21 -16.6206889 -15.7456889
22 -5.4956889 -16.6206889
23 3.6293111 -5.4956889
24 5.0013856 3.6293111
25 -15.4520556 5.0013856
26 -15.5770556 -15.4520556
27 -13.4520556 -15.5770556
28 -9.4520556 -13.4520556
29 -4.3270556 -9.4520556
30 -6.5770556 -4.3270556
31 5.6183021 -6.5770556
32 7.2433021 5.6183021
33 14.3683021 7.2433021
34 7.4933021 14.3683021
35 11.6183021 7.4933021
36 18.9903766 11.6183021
37 20.5369353 18.9903766
38 23.4119353 20.5369353
39 27.5369353 23.4119353
40 30.5369353 27.5369353
41 33.6619353 30.5369353
42 39.4119353 33.6619353
43 -30.9555686 39.4119353
44 -24.3305686 -30.9555686
45 -16.2055686 -24.3305686
46 -20.0805686 -16.2055686
47 -15.9555686 -20.0805686
48 -17.5834940 -15.9555686
49 -24.0369353 -17.5834940
50 -16.1619353 -24.0369353
51 -12.0369353 -16.1619353
52 -8.0369353 -12.0369353
53 -3.9119353 -8.0369353
54 -8.1619353 -3.9119353
55 3.0334224 -8.1619353
56 9.6584224 3.0334224
57 6.7834224 9.6584224
58 8.9084224 6.7834224
59 17.0334224 8.9084224
60 26.4054969 17.0334224
61 20.9520556 26.4054969
62 21.8270556 20.9520556
63 14.9520556 21.8270556
64 17.9520556 14.9520556
65 23.0770556 17.9520556
66 18.8270556 23.0770556
67 31.0224133 18.8270556
68 33.6474133 31.0224133
69 31.7724133 33.6474133
70 24.8974133 31.7724133
71 30.0224133 24.8974133
72 25.3944879 30.0224133
73 19.9410466 25.3944879
74 21.8160466 19.9410466
75 14.9410466 21.8160466
76 16.9410466 14.9410466
77 17.0660466 16.9410466
78 17.8160466 17.0660466
79 35.0114043 17.8160466
80 35.6364043 35.0114043
81 28.7614043 35.6364043
82 19.8864043 28.7614043
83 20.0114043 19.8864043
84 -0.6165212 20.0114043
85 -11.0699624 -0.6165212
86 -20.1949624 -11.0699624
87 -19.0699624 -20.1949624
88 -26.0699624 -19.0699624
89 -32.9449624 -26.0699624
90 -32.1949624 -32.9449624
91 -28.9996047 -32.1949624
92 -40.3746047 -28.9996047
93 -38.2496047 -40.3746047
94 -43.1246047 -38.2496047
95 -59.9996047 -43.1246047
96 -63.6275302 -59.9996047
97 NA -63.6275302
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 9.5699624 17.0234037
[2,] 9.4449624 9.5699624
[3,] 7.5699624 9.4449624
[4,] 0.5699624 7.5699624
[5,] -8.3050376 0.5699624
[6,] -6.5550376 -8.3050376
[7,] -3.3596799 -6.5550376
[8,] -5.7346799 -3.3596799
[9,] -10.6096799 -5.7346799
[10,] 7.5153201 -10.6096799
[11,] -6.3596799 7.5153201
[12,] -10.9876053 -6.3596799
[13,] -20.4410466 -10.9876053
[14,] -24.5660466 -20.4410466
[15,] -20.4410466 -24.5660466
[16,] -22.4410466 -20.4410466
[17,] -24.3160466 -22.4410466
[18,] -22.5660466 -24.3160466
[19,] -11.3706889 -22.5660466
[20,] -15.7456889 -11.3706889
[21,] -16.6206889 -15.7456889
[22,] -5.4956889 -16.6206889
[23,] 3.6293111 -5.4956889
[24,] 5.0013856 3.6293111
[25,] -15.4520556 5.0013856
[26,] -15.5770556 -15.4520556
[27,] -13.4520556 -15.5770556
[28,] -9.4520556 -13.4520556
[29,] -4.3270556 -9.4520556
[30,] -6.5770556 -4.3270556
[31,] 5.6183021 -6.5770556
[32,] 7.2433021 5.6183021
[33,] 14.3683021 7.2433021
[34,] 7.4933021 14.3683021
[35,] 11.6183021 7.4933021
[36,] 18.9903766 11.6183021
[37,] 20.5369353 18.9903766
[38,] 23.4119353 20.5369353
[39,] 27.5369353 23.4119353
[40,] 30.5369353 27.5369353
[41,] 33.6619353 30.5369353
[42,] 39.4119353 33.6619353
[43,] -30.9555686 39.4119353
[44,] -24.3305686 -30.9555686
[45,] -16.2055686 -24.3305686
[46,] -20.0805686 -16.2055686
[47,] -15.9555686 -20.0805686
[48,] -17.5834940 -15.9555686
[49,] -24.0369353 -17.5834940
[50,] -16.1619353 -24.0369353
[51,] -12.0369353 -16.1619353
[52,] -8.0369353 -12.0369353
[53,] -3.9119353 -8.0369353
[54,] -8.1619353 -3.9119353
[55,] 3.0334224 -8.1619353
[56,] 9.6584224 3.0334224
[57,] 6.7834224 9.6584224
[58,] 8.9084224 6.7834224
[59,] 17.0334224 8.9084224
[60,] 26.4054969 17.0334224
[61,] 20.9520556 26.4054969
[62,] 21.8270556 20.9520556
[63,] 14.9520556 21.8270556
[64,] 17.9520556 14.9520556
[65,] 23.0770556 17.9520556
[66,] 18.8270556 23.0770556
[67,] 31.0224133 18.8270556
[68,] 33.6474133 31.0224133
[69,] 31.7724133 33.6474133
[70,] 24.8974133 31.7724133
[71,] 30.0224133 24.8974133
[72,] 25.3944879 30.0224133
[73,] 19.9410466 25.3944879
[74,] 21.8160466 19.9410466
[75,] 14.9410466 21.8160466
[76,] 16.9410466 14.9410466
[77,] 17.0660466 16.9410466
[78,] 17.8160466 17.0660466
[79,] 35.0114043 17.8160466
[80,] 35.6364043 35.0114043
[81,] 28.7614043 35.6364043
[82,] 19.8864043 28.7614043
[83,] 20.0114043 19.8864043
[84,] -0.6165212 20.0114043
[85,] -11.0699624 -0.6165212
[86,] -20.1949624 -11.0699624
[87,] -19.0699624 -20.1949624
[88,] -26.0699624 -19.0699624
[89,] -32.9449624 -26.0699624
[90,] -32.1949624 -32.9449624
[91,] -28.9996047 -32.1949624
[92,] -40.3746047 -28.9996047
[93,] -38.2496047 -40.3746047
[94,] -43.1246047 -38.2496047
[95,] -59.9996047 -43.1246047
[96,] -63.6275302 -59.9996047
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 9.5699624 17.0234037
2 9.4449624 9.5699624
3 7.5699624 9.4449624
4 0.5699624 7.5699624
5 -8.3050376 0.5699624
6 -6.5550376 -8.3050376
7 -3.3596799 -6.5550376
8 -5.7346799 -3.3596799
9 -10.6096799 -5.7346799
10 7.5153201 -10.6096799
11 -6.3596799 7.5153201
12 -10.9876053 -6.3596799
13 -20.4410466 -10.9876053
14 -24.5660466 -20.4410466
15 -20.4410466 -24.5660466
16 -22.4410466 -20.4410466
17 -24.3160466 -22.4410466
18 -22.5660466 -24.3160466
19 -11.3706889 -22.5660466
20 -15.7456889 -11.3706889
21 -16.6206889 -15.7456889
22 -5.4956889 -16.6206889
23 3.6293111 -5.4956889
24 5.0013856 3.6293111
25 -15.4520556 5.0013856
26 -15.5770556 -15.4520556
27 -13.4520556 -15.5770556
28 -9.4520556 -13.4520556
29 -4.3270556 -9.4520556
30 -6.5770556 -4.3270556
31 5.6183021 -6.5770556
32 7.2433021 5.6183021
33 14.3683021 7.2433021
34 7.4933021 14.3683021
35 11.6183021 7.4933021
36 18.9903766 11.6183021
37 20.5369353 18.9903766
38 23.4119353 20.5369353
39 27.5369353 23.4119353
40 30.5369353 27.5369353
41 33.6619353 30.5369353
42 39.4119353 33.6619353
43 -30.9555686 39.4119353
44 -24.3305686 -30.9555686
45 -16.2055686 -24.3305686
46 -20.0805686 -16.2055686
47 -15.9555686 -20.0805686
48 -17.5834940 -15.9555686
49 -24.0369353 -17.5834940
50 -16.1619353 -24.0369353
51 -12.0369353 -16.1619353
52 -8.0369353 -12.0369353
53 -3.9119353 -8.0369353
54 -8.1619353 -3.9119353
55 3.0334224 -8.1619353
56 9.6584224 3.0334224
57 6.7834224 9.6584224
58 8.9084224 6.7834224
59 17.0334224 8.9084224
60 26.4054969 17.0334224
61 20.9520556 26.4054969
62 21.8270556 20.9520556
63 14.9520556 21.8270556
64 17.9520556 14.9520556
65 23.0770556 17.9520556
66 18.8270556 23.0770556
67 31.0224133 18.8270556
68 33.6474133 31.0224133
69 31.7724133 33.6474133
70 24.8974133 31.7724133
71 30.0224133 24.8974133
72 25.3944879 30.0224133
73 19.9410466 25.3944879
74 21.8160466 19.9410466
75 14.9410466 21.8160466
76 16.9410466 14.9410466
77 17.0660466 16.9410466
78 17.8160466 17.0660466
79 35.0114043 17.8160466
80 35.6364043 35.0114043
81 28.7614043 35.6364043
82 19.8864043 28.7614043
83 20.0114043 19.8864043
84 -0.6165212 20.0114043
85 -11.0699624 -0.6165212
86 -20.1949624 -11.0699624
87 -19.0699624 -20.1949624
88 -26.0699624 -19.0699624
89 -32.9449624 -26.0699624
90 -32.1949624 -32.9449624
91 -28.9996047 -32.1949624
92 -40.3746047 -28.9996047
93 -38.2496047 -40.3746047
94 -43.1246047 -38.2496047
95 -59.9996047 -43.1246047
96 -63.6275302 -59.9996047
> 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/7twtj1195740780.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/86e0q1195740780.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/9q5q11195740780.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/10try11195740780.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/11ur5j1195740781.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/12uww71195740781.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/13me0u1195740781.tab")
>
> system("convert tmp/1baud1195740780.ps tmp/1baud1195740780.png")
> system("convert tmp/2nkac1195740780.ps tmp/2nkac1195740780.png")
> system("convert tmp/38oyw1195740780.ps tmp/38oyw1195740780.png")
> system("convert tmp/4jf7v1195740780.ps tmp/4jf7v1195740780.png")
> system("convert tmp/5sxxo1195740780.ps tmp/5sxxo1195740780.png")
> system("convert tmp/6gzuf1195740780.ps tmp/6gzuf1195740780.png")
> system("convert tmp/7twtj1195740780.ps tmp/7twtj1195740780.png")
> system("convert tmp/86e0q1195740780.ps tmp/86e0q1195740780.png")
> system("convert tmp/9q5q11195740780.ps tmp/9q5q11195740780.png")
>
>
> proc.time()
user system elapsed
2.448 1.470 2.836