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(102.3,0,98.7,0,104.4,0,97.6,0,102.7,0,103.0,0,92.9,0,96.1,0,94.9,0,99.9,0,96.3,0,89.5,0,104.6,0,101.5,0,109.8,0,112.1,0,110.1,0,107.1,0,108.1,0,99.0,0,104.0,0,106.7,0,101.1,0,97.8,0,113.8,0,107.1,0,117.5,1,113.7,1,106.6,1,109.8,1,108.8,1,102.0,1,114.5,1,116.5,1,108.6,1,113.9,1,109.3,1,112.5,1,123.4,1,115.2,1,110.8,1,120.4,1,117.6,1,111.2,1,131.1,1,118.9,1,115.7,1,119.6,1,113.1,1,106.4,1,115.5,1,111.8,1,109.6,1,121.5,1,109.5,1,109.0,1,113.4,1,112.7,1,114.4,1,109.2,1,116.2,1,113.8,1,123.6,1,112.6,1,117.7,1,113.3,1,110.7,1,114.7,1,116.9,1,120.6,1,111.6,1,111.9,1,116.1,1,111.9,1,125.1,1,115.1,1,116.7,1,115.8,1,116.8,1,113.0,1,106.5,1),dim=c(2,81),dimnames=list(c('y','x
'),1:81))
> y <- array(NA,dim=c(2,81),dimnames=list(c('y','x
'),1:81))
> 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\r M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 102.3 0 1 0 0 0 0 0 0 0 0 0 0 1
2 98.7 0 0 1 0 0 0 0 0 0 0 0 0 2
3 104.4 0 0 0 1 0 0 0 0 0 0 0 0 3
4 97.6 0 0 0 0 1 0 0 0 0 0 0 0 4
5 102.7 0 0 0 0 0 1 0 0 0 0 0 0 5
6 103.0 0 0 0 0 0 0 1 0 0 0 0 0 6
7 92.9 0 0 0 0 0 0 0 1 0 0 0 0 7
8 96.1 0 0 0 0 0 0 0 0 1 0 0 0 8
9 94.9 0 0 0 0 0 0 0 0 0 1 0 0 9
10 99.9 0 0 0 0 0 0 0 0 0 0 1 0 10
11 96.3 0 0 0 0 0 0 0 0 0 0 0 1 11
12 89.5 0 0 0 0 0 0 0 0 0 0 0 0 12
13 104.6 0 1 0 0 0 0 0 0 0 0 0 0 13
14 101.5 0 0 1 0 0 0 0 0 0 0 0 0 14
15 109.8 0 0 0 1 0 0 0 0 0 0 0 0 15
16 112.1 0 0 0 0 1 0 0 0 0 0 0 0 16
17 110.1 0 0 0 0 0 1 0 0 0 0 0 0 17
18 107.1 0 0 0 0 0 0 1 0 0 0 0 0 18
19 108.1 0 0 0 0 0 0 0 1 0 0 0 0 19
20 99.0 0 0 0 0 0 0 0 0 1 0 0 0 20
21 104.0 0 0 0 0 0 0 0 0 0 1 0 0 21
22 106.7 0 0 0 0 0 0 0 0 0 0 1 0 22
23 101.1 0 0 0 0 0 0 0 0 0 0 0 1 23
24 97.8 0 0 0 0 0 0 0 0 0 0 0 0 24
25 113.8 0 1 0 0 0 0 0 0 0 0 0 0 25
26 107.1 0 0 1 0 0 0 0 0 0 0 0 0 26
27 117.5 1 0 0 1 0 0 0 0 0 0 0 0 27
28 113.7 1 0 0 0 1 0 0 0 0 0 0 0 28
29 106.6 1 0 0 0 0 1 0 0 0 0 0 0 29
30 109.8 1 0 0 0 0 0 1 0 0 0 0 0 30
31 108.8 1 0 0 0 0 0 0 1 0 0 0 0 31
32 102.0 1 0 0 0 0 0 0 0 1 0 0 0 32
33 114.5 1 0 0 0 0 0 0 0 0 1 0 0 33
34 116.5 1 0 0 0 0 0 0 0 0 0 1 0 34
35 108.6 1 0 0 0 0 0 0 0 0 0 0 1 35
36 113.9 1 0 0 0 0 0 0 0 0 0 0 0 36
37 109.3 1 1 0 0 0 0 0 0 0 0 0 0 37
38 112.5 1 0 1 0 0 0 0 0 0 0 0 0 38
39 123.4 1 0 0 1 0 0 0 0 0 0 0 0 39
40 115.2 1 0 0 0 1 0 0 0 0 0 0 0 40
41 110.8 1 0 0 0 0 1 0 0 0 0 0 0 41
42 120.4 1 0 0 0 0 0 1 0 0 0 0 0 42
43 117.6 1 0 0 0 0 0 0 1 0 0 0 0 43
44 111.2 1 0 0 0 0 0 0 0 1 0 0 0 44
45 131.1 1 0 0 0 0 0 0 0 0 1 0 0 45
46 118.9 1 0 0 0 0 0 0 0 0 0 1 0 46
47 115.7 1 0 0 0 0 0 0 0 0 0 0 1 47
48 119.6 1 0 0 0 0 0 0 0 0 0 0 0 48
49 113.1 1 1 0 0 0 0 0 0 0 0 0 0 49
50 106.4 1 0 1 0 0 0 0 0 0 0 0 0 50
51 115.5 1 0 0 1 0 0 0 0 0 0 0 0 51
52 111.8 1 0 0 0 1 0 0 0 0 0 0 0 52
53 109.6 1 0 0 0 0 1 0 0 0 0 0 0 53
54 121.5 1 0 0 0 0 0 1 0 0 0 0 0 54
55 109.5 1 0 0 0 0 0 0 1 0 0 0 0 55
56 109.0 1 0 0 0 0 0 0 0 1 0 0 0 56
57 113.4 1 0 0 0 0 0 0 0 0 1 0 0 57
58 112.7 1 0 0 0 0 0 0 0 0 0 1 0 58
59 114.4 1 0 0 0 0 0 0 0 0 0 0 1 59
60 109.2 1 0 0 0 0 0 0 0 0 0 0 0 60
61 116.2 1 1 0 0 0 0 0 0 0 0 0 0 61
62 113.8 1 0 1 0 0 0 0 0 0 0 0 0 62
63 123.6 1 0 0 1 0 0 0 0 0 0 0 0 63
64 112.6 1 0 0 0 1 0 0 0 0 0 0 0 64
65 117.7 1 0 0 0 0 1 0 0 0 0 0 0 65
66 113.3 1 0 0 0 0 0 1 0 0 0 0 0 66
67 110.7 1 0 0 0 0 0 0 1 0 0 0 0 67
68 114.7 1 0 0 0 0 0 0 0 1 0 0 0 68
69 116.9 1 0 0 0 0 0 0 0 0 1 0 0 69
70 120.6 1 0 0 0 0 0 0 0 0 0 1 0 70
71 111.6 1 0 0 0 0 0 0 0 0 0 0 1 71
72 111.9 1 0 0 0 0 0 0 0 0 0 0 0 72
73 116.1 1 1 0 0 0 0 0 0 0 0 0 0 73
74 111.9 1 0 1 0 0 0 0 0 0 0 0 0 74
75 125.1 1 0 0 1 0 0 0 0 0 0 0 0 75
76 115.1 1 0 0 0 1 0 0 0 0 0 0 0 76
77 116.7 1 0 0 0 0 1 0 0 0 0 0 0 77
78 115.8 1 0 0 0 0 0 1 0 0 0 0 0 78
79 116.8 1 0 0 0 0 0 0 1 0 0 0 0 79
80 113.0 1 0 0 0 0 0 0 0 1 0 0 0 80
81 106.5 1 0 0 0 0 0 0 0 0 1 0 0 81
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `x\r` M1 M2 M3 M4
97.70564 8.09074 5.02101 1.57139 9.95167 3.97348
M5 M6 M7 M8 M9 M10
3.32387 5.61711 1.73892 -1.12498 3.96826 5.75161
M11 t
1.05914 0.09247
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-10.7550 -2.8264 -0.2582 2.0886 17.1741
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 97.70564 2.21322 44.146 < 2e-16 ***
`x\r` 8.09074 1.98686 4.072 0.000126 ***
M1 5.02101 2.70954 1.853 0.068275 .
M2 1.57139 2.70918 0.580 0.563843
M3 9.95167 2.71451 3.666 0.000488 ***
M4 3.97348 2.71195 1.465 0.147550
M5 3.32387 2.70996 1.227 0.224290
M6 5.61711 2.70855 2.074 0.041941 *
M7 1.73892 2.70772 0.642 0.522930
M8 -1.12498 2.70747 -0.416 0.679096
M9 3.96826 2.70780 1.465 0.147464
M10 5.75161 2.81020 2.047 0.044614 *
M11 1.05914 2.80936 0.377 0.707362
t 0.09247 0.03961 2.334 0.022577 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 4.865 on 67 degrees of freedom
Multiple R-Squared: 0.6729, Adjusted R-squared: 0.6095
F-statistic: 10.6 on 13 and 67 DF, p-value: 9.48e-12
> postscript(file="/var/www/html/rcomp/tmp/11bkz1195468740.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/241fs1195468740.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/3b8z01195468740.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/4alsy1195468740.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/5wvvc1195468740.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 = 81
Frequency = 1
1 2 3 4 5 6
-0.5191206 -0.7619778 -3.5347285 -4.4490142 1.2081286 -0.8775857
7 8 9 10 11 12
-7.1918714 -1.2204428 -7.6061571 -4.4819825 -3.4819825 -9.3153158
13 14 15 16 17 18
0.6712043 0.9283472 0.7555964 8.9413107 7.4984536 2.1127393
19 20 21 22 23 24
6.8984536 0.5698821 0.3841678 1.2083425 0.2083425 -2.1249909
25 26 27 28 29 30
8.7615292 5.4186721 -0.7448234 1.3408908 -5.2019663 -4.3876806
31 32 33 34 35 36
-1.6019663 -5.6305377 1.6837480 1.8079226 -1.4920774 4.7745893
37 38 39 40 41 42
-4.9388906 1.6182522 4.0455015 1.7312158 -2.1116414 5.1026443
43 44 45 46 47 48
6.0883586 2.4597872 17.1740729 3.0982475 4.4982475 9.3649142
49 50 51 52 53 54
-2.2485657 -5.5914228 -4.9641736 -2.7784593 -4.4213164 5.0929693
55 56 57 58 59 60
-3.1213164 -0.8498879 -1.6356021 -4.2114275 2.0885725 -2.1447609
61 62 63 64 65 66
-0.2582408 0.6989021 2.0261514 -3.0881344 2.5690085 -4.2167058
67 68 69 70 71 72
-3.0309915 3.7404371 0.7547228 2.5788974 -1.8211026 -0.5544359
73 74 75 76 77 78
-1.4679158 -2.3107730 2.4164763 -1.6978094 0.4593334 -2.8263808
79 80 81
1.9593334 0.9307620 -10.7549523
> postscript(file="/var/www/html/rcomp/tmp/6typp1195468740.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 = 81
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.5191206 NA
1 -0.7619778 -0.5191206
2 -3.5347285 -0.7619778
3 -4.4490142 -3.5347285
4 1.2081286 -4.4490142
5 -0.8775857 1.2081286
6 -7.1918714 -0.8775857
7 -1.2204428 -7.1918714
8 -7.6061571 -1.2204428
9 -4.4819825 -7.6061571
10 -3.4819825 -4.4819825
11 -9.3153158 -3.4819825
12 0.6712043 -9.3153158
13 0.9283472 0.6712043
14 0.7555964 0.9283472
15 8.9413107 0.7555964
16 7.4984536 8.9413107
17 2.1127393 7.4984536
18 6.8984536 2.1127393
19 0.5698821 6.8984536
20 0.3841678 0.5698821
21 1.2083425 0.3841678
22 0.2083425 1.2083425
23 -2.1249909 0.2083425
24 8.7615292 -2.1249909
25 5.4186721 8.7615292
26 -0.7448234 5.4186721
27 1.3408908 -0.7448234
28 -5.2019663 1.3408908
29 -4.3876806 -5.2019663
30 -1.6019663 -4.3876806
31 -5.6305377 -1.6019663
32 1.6837480 -5.6305377
33 1.8079226 1.6837480
34 -1.4920774 1.8079226
35 4.7745893 -1.4920774
36 -4.9388906 4.7745893
37 1.6182522 -4.9388906
38 4.0455015 1.6182522
39 1.7312158 4.0455015
40 -2.1116414 1.7312158
41 5.1026443 -2.1116414
42 6.0883586 5.1026443
43 2.4597872 6.0883586
44 17.1740729 2.4597872
45 3.0982475 17.1740729
46 4.4982475 3.0982475
47 9.3649142 4.4982475
48 -2.2485657 9.3649142
49 -5.5914228 -2.2485657
50 -4.9641736 -5.5914228
51 -2.7784593 -4.9641736
52 -4.4213164 -2.7784593
53 5.0929693 -4.4213164
54 -3.1213164 5.0929693
55 -0.8498879 -3.1213164
56 -1.6356021 -0.8498879
57 -4.2114275 -1.6356021
58 2.0885725 -4.2114275
59 -2.1447609 2.0885725
60 -0.2582408 -2.1447609
61 0.6989021 -0.2582408
62 2.0261514 0.6989021
63 -3.0881344 2.0261514
64 2.5690085 -3.0881344
65 -4.2167058 2.5690085
66 -3.0309915 -4.2167058
67 3.7404371 -3.0309915
68 0.7547228 3.7404371
69 2.5788974 0.7547228
70 -1.8211026 2.5788974
71 -0.5544359 -1.8211026
72 -1.4679158 -0.5544359
73 -2.3107730 -1.4679158
74 2.4164763 -2.3107730
75 -1.6978094 2.4164763
76 0.4593334 -1.6978094
77 -2.8263808 0.4593334
78 1.9593334 -2.8263808
79 0.9307620 1.9593334
80 -10.7549523 0.9307620
81 NA -10.7549523
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.7619778 -0.5191206
[2,] -3.5347285 -0.7619778
[3,] -4.4490142 -3.5347285
[4,] 1.2081286 -4.4490142
[5,] -0.8775857 1.2081286
[6,] -7.1918714 -0.8775857
[7,] -1.2204428 -7.1918714
[8,] -7.6061571 -1.2204428
[9,] -4.4819825 -7.6061571
[10,] -3.4819825 -4.4819825
[11,] -9.3153158 -3.4819825
[12,] 0.6712043 -9.3153158
[13,] 0.9283472 0.6712043
[14,] 0.7555964 0.9283472
[15,] 8.9413107 0.7555964
[16,] 7.4984536 8.9413107
[17,] 2.1127393 7.4984536
[18,] 6.8984536 2.1127393
[19,] 0.5698821 6.8984536
[20,] 0.3841678 0.5698821
[21,] 1.2083425 0.3841678
[22,] 0.2083425 1.2083425
[23,] -2.1249909 0.2083425
[24,] 8.7615292 -2.1249909
[25,] 5.4186721 8.7615292
[26,] -0.7448234 5.4186721
[27,] 1.3408908 -0.7448234
[28,] -5.2019663 1.3408908
[29,] -4.3876806 -5.2019663
[30,] -1.6019663 -4.3876806
[31,] -5.6305377 -1.6019663
[32,] 1.6837480 -5.6305377
[33,] 1.8079226 1.6837480
[34,] -1.4920774 1.8079226
[35,] 4.7745893 -1.4920774
[36,] -4.9388906 4.7745893
[37,] 1.6182522 -4.9388906
[38,] 4.0455015 1.6182522
[39,] 1.7312158 4.0455015
[40,] -2.1116414 1.7312158
[41,] 5.1026443 -2.1116414
[42,] 6.0883586 5.1026443
[43,] 2.4597872 6.0883586
[44,] 17.1740729 2.4597872
[45,] 3.0982475 17.1740729
[46,] 4.4982475 3.0982475
[47,] 9.3649142 4.4982475
[48,] -2.2485657 9.3649142
[49,] -5.5914228 -2.2485657
[50,] -4.9641736 -5.5914228
[51,] -2.7784593 -4.9641736
[52,] -4.4213164 -2.7784593
[53,] 5.0929693 -4.4213164
[54,] -3.1213164 5.0929693
[55,] -0.8498879 -3.1213164
[56,] -1.6356021 -0.8498879
[57,] -4.2114275 -1.6356021
[58,] 2.0885725 -4.2114275
[59,] -2.1447609 2.0885725
[60,] -0.2582408 -2.1447609
[61,] 0.6989021 -0.2582408
[62,] 2.0261514 0.6989021
[63,] -3.0881344 2.0261514
[64,] 2.5690085 -3.0881344
[65,] -4.2167058 2.5690085
[66,] -3.0309915 -4.2167058
[67,] 3.7404371 -3.0309915
[68,] 0.7547228 3.7404371
[69,] 2.5788974 0.7547228
[70,] -1.8211026 2.5788974
[71,] -0.5544359 -1.8211026
[72,] -1.4679158 -0.5544359
[73,] -2.3107730 -1.4679158
[74,] 2.4164763 -2.3107730
[75,] -1.6978094 2.4164763
[76,] 0.4593334 -1.6978094
[77,] -2.8263808 0.4593334
[78,] 1.9593334 -2.8263808
[79,] 0.9307620 1.9593334
[80,] -10.7549523 0.9307620
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.7619778 -0.5191206
2 -3.5347285 -0.7619778
3 -4.4490142 -3.5347285
4 1.2081286 -4.4490142
5 -0.8775857 1.2081286
6 -7.1918714 -0.8775857
7 -1.2204428 -7.1918714
8 -7.6061571 -1.2204428
9 -4.4819825 -7.6061571
10 -3.4819825 -4.4819825
11 -9.3153158 -3.4819825
12 0.6712043 -9.3153158
13 0.9283472 0.6712043
14 0.7555964 0.9283472
15 8.9413107 0.7555964
16 7.4984536 8.9413107
17 2.1127393 7.4984536
18 6.8984536 2.1127393
19 0.5698821 6.8984536
20 0.3841678 0.5698821
21 1.2083425 0.3841678
22 0.2083425 1.2083425
23 -2.1249909 0.2083425
24 8.7615292 -2.1249909
25 5.4186721 8.7615292
26 -0.7448234 5.4186721
27 1.3408908 -0.7448234
28 -5.2019663 1.3408908
29 -4.3876806 -5.2019663
30 -1.6019663 -4.3876806
31 -5.6305377 -1.6019663
32 1.6837480 -5.6305377
33 1.8079226 1.6837480
34 -1.4920774 1.8079226
35 4.7745893 -1.4920774
36 -4.9388906 4.7745893
37 1.6182522 -4.9388906
38 4.0455015 1.6182522
39 1.7312158 4.0455015
40 -2.1116414 1.7312158
41 5.1026443 -2.1116414
42 6.0883586 5.1026443
43 2.4597872 6.0883586
44 17.1740729 2.4597872
45 3.0982475 17.1740729
46 4.4982475 3.0982475
47 9.3649142 4.4982475
48 -2.2485657 9.3649142
49 -5.5914228 -2.2485657
50 -4.9641736 -5.5914228
51 -2.7784593 -4.9641736
52 -4.4213164 -2.7784593
53 5.0929693 -4.4213164
54 -3.1213164 5.0929693
55 -0.8498879 -3.1213164
56 -1.6356021 -0.8498879
57 -4.2114275 -1.6356021
58 2.0885725 -4.2114275
59 -2.1447609 2.0885725
60 -0.2582408 -2.1447609
61 0.6989021 -0.2582408
62 2.0261514 0.6989021
63 -3.0881344 2.0261514
64 2.5690085 -3.0881344
65 -4.2167058 2.5690085
66 -3.0309915 -4.2167058
67 3.7404371 -3.0309915
68 0.7547228 3.7404371
69 2.5788974 0.7547228
70 -1.8211026 2.5788974
71 -0.5544359 -1.8211026
72 -1.4679158 -0.5544359
73 -2.3107730 -1.4679158
74 2.4164763 -2.3107730
75 -1.6978094 2.4164763
76 0.4593334 -1.6978094
77 -2.8263808 0.4593334
78 1.9593334 -2.8263808
79 0.9307620 1.9593334
80 -10.7549523 0.9307620
> 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/7c2sd1195468740.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/853bu1195468741.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/9urr61195468741.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/10qst11195468741.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/11pq6o1195468741.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/12sg1w1195468741.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/13au9q1195468741.tab")
>
> system("convert tmp/11bkz1195468740.ps tmp/11bkz1195468740.png")
> system("convert tmp/241fs1195468740.ps tmp/241fs1195468740.png")
> system("convert tmp/3b8z01195468740.ps tmp/3b8z01195468740.png")
> system("convert tmp/4alsy1195468740.ps tmp/4alsy1195468740.png")
> system("convert tmp/5wvvc1195468740.ps tmp/5wvvc1195468740.png")
> system("convert tmp/6typp1195468740.ps tmp/6typp1195468740.png")
> system("convert tmp/7c2sd1195468740.ps tmp/7c2sd1195468740.png")
> system("convert tmp/853bu1195468741.ps tmp/853bu1195468741.png")
> system("convert tmp/9urr61195468741.ps tmp/9urr61195468741.png")
>
>
> proc.time()
user system elapsed
2.394 1.494 2.798