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(97.3,0,101,0,113.2,0,101,0,105.7,0,113.9,0,86.4,0,96.5,0,103.3,0,114.9,0,105.8,0,94.2,0,98.4,0,99.4,0,108.8,0,112.6,0,104.4,0,112.2,0,81.1,0,97.1,0,112.6,0,113.8,0,107.8,0,103.2,0,103.3,0,101.2,0,107.7,0,110.4,0,101.9,0,115.9,0,89.9,1,88.6,1,117.2,1,123.9,1,100,1,103.6,1,94.1,1,98.7,1,119.5,1,112.7,1,104.4,1,124.7,1,89.1,1,97,1,121.6,1,118.8,1,114,1,111.5,1,97.2,1,102.5,1,113.4,1,109.8,1,104.9,1,126.1,1,80,1,96.8,1,117.2,1,112.3,1,117.3,1,111.1,1,102.2,1,104.3,1,122.9,1,107.6,1,121.3,1,131.5,1,89,1,104.4,1,128.9,1,135.9,1,133.3,1,121.3,1,120.5,1,120.4,1,137.9,1,126.1,1,133.2,1,146.6,1,103.4,1,117.2,1),dim=c(2,80),dimnames=list(c('Y','X'),1:80))
> y <- array(NA,dim=c(2,80),dimnames=list(c('Y','X'),1:80))
> 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 97.3 0 1 0 0 0 0 0 0 0 0 0 0 1
2 101.0 0 0 1 0 0 0 0 0 0 0 0 0 2
3 113.2 0 0 0 1 0 0 0 0 0 0 0 0 3
4 101.0 0 0 0 0 1 0 0 0 0 0 0 0 4
5 105.7 0 0 0 0 0 1 0 0 0 0 0 0 5
6 113.9 0 0 0 0 0 0 1 0 0 0 0 0 6
7 86.4 0 0 0 0 0 0 0 1 0 0 0 0 7
8 96.5 0 0 0 0 0 0 0 0 1 0 0 0 8
9 103.3 0 0 0 0 0 0 0 0 0 1 0 0 9
10 114.9 0 0 0 0 0 0 0 0 0 0 1 0 10
11 105.8 0 0 0 0 0 0 0 0 0 0 0 1 11
12 94.2 0 0 0 0 0 0 0 0 0 0 0 0 12
13 98.4 0 1 0 0 0 0 0 0 0 0 0 0 13
14 99.4 0 0 1 0 0 0 0 0 0 0 0 0 14
15 108.8 0 0 0 1 0 0 0 0 0 0 0 0 15
16 112.6 0 0 0 0 1 0 0 0 0 0 0 0 16
17 104.4 0 0 0 0 0 1 0 0 0 0 0 0 17
18 112.2 0 0 0 0 0 0 1 0 0 0 0 0 18
19 81.1 0 0 0 0 0 0 0 1 0 0 0 0 19
20 97.1 0 0 0 0 0 0 0 0 1 0 0 0 20
21 112.6 0 0 0 0 0 0 0 0 0 1 0 0 21
22 113.8 0 0 0 0 0 0 0 0 0 0 1 0 22
23 107.8 0 0 0 0 0 0 0 0 0 0 0 1 23
24 103.2 0 0 0 0 0 0 0 0 0 0 0 0 24
25 103.3 0 1 0 0 0 0 0 0 0 0 0 0 25
26 101.2 0 0 1 0 0 0 0 0 0 0 0 0 26
27 107.7 0 0 0 1 0 0 0 0 0 0 0 0 27
28 110.4 0 0 0 0 1 0 0 0 0 0 0 0 28
29 101.9 0 0 0 0 0 1 0 0 0 0 0 0 29
30 115.9 0 0 0 0 0 0 1 0 0 0 0 0 30
31 89.9 1 0 0 0 0 0 0 1 0 0 0 0 31
32 88.6 1 0 0 0 0 0 0 0 1 0 0 0 32
33 117.2 1 0 0 0 0 0 0 0 0 1 0 0 33
34 123.9 1 0 0 0 0 0 0 0 0 0 1 0 34
35 100.0 1 0 0 0 0 0 0 0 0 0 0 1 35
36 103.6 1 0 0 0 0 0 0 0 0 0 0 0 36
37 94.1 1 1 0 0 0 0 0 0 0 0 0 0 37
38 98.7 1 0 1 0 0 0 0 0 0 0 0 0 38
39 119.5 1 0 0 1 0 0 0 0 0 0 0 0 39
40 112.7 1 0 0 0 1 0 0 0 0 0 0 0 40
41 104.4 1 0 0 0 0 1 0 0 0 0 0 0 41
42 124.7 1 0 0 0 0 0 1 0 0 0 0 0 42
43 89.1 1 0 0 0 0 0 0 1 0 0 0 0 43
44 97.0 1 0 0 0 0 0 0 0 1 0 0 0 44
45 121.6 1 0 0 0 0 0 0 0 0 1 0 0 45
46 118.8 1 0 0 0 0 0 0 0 0 0 1 0 46
47 114.0 1 0 0 0 0 0 0 0 0 0 0 1 47
48 111.5 1 0 0 0 0 0 0 0 0 0 0 0 48
49 97.2 1 1 0 0 0 0 0 0 0 0 0 0 49
50 102.5 1 0 1 0 0 0 0 0 0 0 0 0 50
51 113.4 1 0 0 1 0 0 0 0 0 0 0 0 51
52 109.8 1 0 0 0 1 0 0 0 0 0 0 0 52
53 104.9 1 0 0 0 0 1 0 0 0 0 0 0 53
54 126.1 1 0 0 0 0 0 1 0 0 0 0 0 54
55 80.0 1 0 0 0 0 0 0 1 0 0 0 0 55
56 96.8 1 0 0 0 0 0 0 0 1 0 0 0 56
57 117.2 1 0 0 0 0 0 0 0 0 1 0 0 57
58 112.3 1 0 0 0 0 0 0 0 0 0 1 0 58
59 117.3 1 0 0 0 0 0 0 0 0 0 0 1 59
60 111.1 1 0 0 0 0 0 0 0 0 0 0 0 60
61 102.2 1 1 0 0 0 0 0 0 0 0 0 0 61
62 104.3 1 0 1 0 0 0 0 0 0 0 0 0 62
63 122.9 1 0 0 1 0 0 0 0 0 0 0 0 63
64 107.6 1 0 0 0 1 0 0 0 0 0 0 0 64
65 121.3 1 0 0 0 0 1 0 0 0 0 0 0 65
66 131.5 1 0 0 0 0 0 1 0 0 0 0 0 66
67 89.0 1 0 0 0 0 0 0 1 0 0 0 0 67
68 104.4 1 0 0 0 0 0 0 0 1 0 0 0 68
69 128.9 1 0 0 0 0 0 0 0 0 1 0 0 69
70 135.9 1 0 0 0 0 0 0 0 0 0 1 0 70
71 133.3 1 0 0 0 0 0 0 0 0 0 0 1 71
72 121.3 1 0 0 0 0 0 0 0 0 0 0 0 72
73 120.5 1 1 0 0 0 0 0 0 0 0 0 0 73
74 120.4 1 0 1 0 0 0 0 0 0 0 0 0 74
75 137.9 1 0 0 1 0 0 0 0 0 0 0 0 75
76 126.1 1 0 0 0 1 0 0 0 0 0 0 0 76
77 133.2 1 0 0 0 0 1 0 0 0 0 0 0 77
78 146.6 1 0 0 0 0 0 1 0 0 0 0 0 78
79 103.4 1 0 0 0 0 0 0 1 0 0 0 0 79
80 117.2 1 0 0 0 0 0 0 0 1 0 0 0 80
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
94.890 -7.064 -4.239 -2.580 10.708 4.125
M5 M6 M7 M8 M9 M10
3.084 16.258 -19.145 -8.314 10.553 13.274
M11 t
5.962 0.412
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-12.69406 -3.70371 0.03786 4.36981 10.56800
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 94.89005 2.78748 34.042 < 2e-16 ***
X -7.06429 2.62179 -2.694 0.008932 **
M1 -4.23912 3.39327 -1.249 0.215977
M2 -2.57966 3.39268 -0.760 0.449746
M3 10.70836 3.39298 3.156 0.002410 **
M4 4.12496 3.39416 1.215 0.228576
M5 3.08442 3.39622 0.908 0.367081
M6 16.25816 3.39916 4.783 1.01e-05 ***
M7 -19.14462 3.39102 -5.646 3.76e-07 ***
M8 -8.31374 3.39066 -2.452 0.016862 *
M9 10.55258 3.52178 2.996 0.003846 **
M10 13.27394 3.51965 3.771 0.000349 ***
M11 5.96197 3.51838 1.695 0.094880 .
t 0.41197 0.05477 7.522 1.90e-10 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.093 on 66 degrees of freedom
Multiple R-Squared: 0.8221, Adjusted R-squared: 0.7871
F-statistic: 23.46 on 13 and 66 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/rcomp/tmp/1wq4j1195069654.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/2f2qx1195069655.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/3xnqj1195069655.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/4dxuw1195069655.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/56i6c1195069655.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 = 80
Frequency = 1
1 2 3 4 5 6
6.2370997 7.8656711 6.3656711 0.3370997 5.6656711 0.2799568
7 8 9 10 11 12
7.7707719 6.6279147 -5.8503778 2.6162888 0.4162888 -5.6337112
13 14 15 16 17 18
2.3934389 1.3220103 -2.9779897 6.9934389 -0.5779897 -6.3637040
19 20 21 22 23 24
-2.4728889 2.2842539 -1.4940386 -3.4273720 -2.5273720 -1.5773720
25 26 27 28 29 30
2.3497781 -1.8216505 -9.0216505 -0.1502219 -8.0216505 -7.6073648
31 32 33 34 35 36
8.4477450 -4.0951122 5.2265953 8.7932620 -8.2067380 0.9432620
37 38 39 40 41 42
-4.7295880 -2.2010166 4.8989834 4.2704120 -3.4010166 3.3132692
43 44 45 46 47 48
2.7040842 -0.6387729 4.6829345 -1.2503988 0.8496012 3.8996012
49 50 51 52 53 54
-6.5732488 -3.3446773 -6.1446773 -3.5732488 -7.8446773 -0.2303916
55 56 57 58 59 60
-11.3395766 -5.7824337 -4.6607263 -12.6940596 -0.7940596 -1.4440596
61 62 63 64 65 66
-6.5169096 -6.4883381 -1.5883381 -10.7169096 3.6116619 0.2259476
67 68 69 70 71 72
-7.2832374 -3.1260945 2.0956129 5.9622796 10.2622796 3.8122796
73 74 75 76 77 78
6.8394297 4.6680011 8.4680011 2.8394297 10.5680011 10.3822868
79 80
2.1731018 4.7302447
> postscript(file="/var/www/html/rcomp/tmp/6p15x1195069655.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 = 80
Frequency = 1
lag(myerror, k = 1) myerror
0 6.2370997 NA
1 7.8656711 6.2370997
2 6.3656711 7.8656711
3 0.3370997 6.3656711
4 5.6656711 0.3370997
5 0.2799568 5.6656711
6 7.7707719 0.2799568
7 6.6279147 7.7707719
8 -5.8503778 6.6279147
9 2.6162888 -5.8503778
10 0.4162888 2.6162888
11 -5.6337112 0.4162888
12 2.3934389 -5.6337112
13 1.3220103 2.3934389
14 -2.9779897 1.3220103
15 6.9934389 -2.9779897
16 -0.5779897 6.9934389
17 -6.3637040 -0.5779897
18 -2.4728889 -6.3637040
19 2.2842539 -2.4728889
20 -1.4940386 2.2842539
21 -3.4273720 -1.4940386
22 -2.5273720 -3.4273720
23 -1.5773720 -2.5273720
24 2.3497781 -1.5773720
25 -1.8216505 2.3497781
26 -9.0216505 -1.8216505
27 -0.1502219 -9.0216505
28 -8.0216505 -0.1502219
29 -7.6073648 -8.0216505
30 8.4477450 -7.6073648
31 -4.0951122 8.4477450
32 5.2265953 -4.0951122
33 8.7932620 5.2265953
34 -8.2067380 8.7932620
35 0.9432620 -8.2067380
36 -4.7295880 0.9432620
37 -2.2010166 -4.7295880
38 4.8989834 -2.2010166
39 4.2704120 4.8989834
40 -3.4010166 4.2704120
41 3.3132692 -3.4010166
42 2.7040842 3.3132692
43 -0.6387729 2.7040842
44 4.6829345 -0.6387729
45 -1.2503988 4.6829345
46 0.8496012 -1.2503988
47 3.8996012 0.8496012
48 -6.5732488 3.8996012
49 -3.3446773 -6.5732488
50 -6.1446773 -3.3446773
51 -3.5732488 -6.1446773
52 -7.8446773 -3.5732488
53 -0.2303916 -7.8446773
54 -11.3395766 -0.2303916
55 -5.7824337 -11.3395766
56 -4.6607263 -5.7824337
57 -12.6940596 -4.6607263
58 -0.7940596 -12.6940596
59 -1.4440596 -0.7940596
60 -6.5169096 -1.4440596
61 -6.4883381 -6.5169096
62 -1.5883381 -6.4883381
63 -10.7169096 -1.5883381
64 3.6116619 -10.7169096
65 0.2259476 3.6116619
66 -7.2832374 0.2259476
67 -3.1260945 -7.2832374
68 2.0956129 -3.1260945
69 5.9622796 2.0956129
70 10.2622796 5.9622796
71 3.8122796 10.2622796
72 6.8394297 3.8122796
73 4.6680011 6.8394297
74 8.4680011 4.6680011
75 2.8394297 8.4680011
76 10.5680011 2.8394297
77 10.3822868 10.5680011
78 2.1731018 10.3822868
79 4.7302447 2.1731018
80 NA 4.7302447
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 7.8656711 6.2370997
[2,] 6.3656711 7.8656711
[3,] 0.3370997 6.3656711
[4,] 5.6656711 0.3370997
[5,] 0.2799568 5.6656711
[6,] 7.7707719 0.2799568
[7,] 6.6279147 7.7707719
[8,] -5.8503778 6.6279147
[9,] 2.6162888 -5.8503778
[10,] 0.4162888 2.6162888
[11,] -5.6337112 0.4162888
[12,] 2.3934389 -5.6337112
[13,] 1.3220103 2.3934389
[14,] -2.9779897 1.3220103
[15,] 6.9934389 -2.9779897
[16,] -0.5779897 6.9934389
[17,] -6.3637040 -0.5779897
[18,] -2.4728889 -6.3637040
[19,] 2.2842539 -2.4728889
[20,] -1.4940386 2.2842539
[21,] -3.4273720 -1.4940386
[22,] -2.5273720 -3.4273720
[23,] -1.5773720 -2.5273720
[24,] 2.3497781 -1.5773720
[25,] -1.8216505 2.3497781
[26,] -9.0216505 -1.8216505
[27,] -0.1502219 -9.0216505
[28,] -8.0216505 -0.1502219
[29,] -7.6073648 -8.0216505
[30,] 8.4477450 -7.6073648
[31,] -4.0951122 8.4477450
[32,] 5.2265953 -4.0951122
[33,] 8.7932620 5.2265953
[34,] -8.2067380 8.7932620
[35,] 0.9432620 -8.2067380
[36,] -4.7295880 0.9432620
[37,] -2.2010166 -4.7295880
[38,] 4.8989834 -2.2010166
[39,] 4.2704120 4.8989834
[40,] -3.4010166 4.2704120
[41,] 3.3132692 -3.4010166
[42,] 2.7040842 3.3132692
[43,] -0.6387729 2.7040842
[44,] 4.6829345 -0.6387729
[45,] -1.2503988 4.6829345
[46,] 0.8496012 -1.2503988
[47,] 3.8996012 0.8496012
[48,] -6.5732488 3.8996012
[49,] -3.3446773 -6.5732488
[50,] -6.1446773 -3.3446773
[51,] -3.5732488 -6.1446773
[52,] -7.8446773 -3.5732488
[53,] -0.2303916 -7.8446773
[54,] -11.3395766 -0.2303916
[55,] -5.7824337 -11.3395766
[56,] -4.6607263 -5.7824337
[57,] -12.6940596 -4.6607263
[58,] -0.7940596 -12.6940596
[59,] -1.4440596 -0.7940596
[60,] -6.5169096 -1.4440596
[61,] -6.4883381 -6.5169096
[62,] -1.5883381 -6.4883381
[63,] -10.7169096 -1.5883381
[64,] 3.6116619 -10.7169096
[65,] 0.2259476 3.6116619
[66,] -7.2832374 0.2259476
[67,] -3.1260945 -7.2832374
[68,] 2.0956129 -3.1260945
[69,] 5.9622796 2.0956129
[70,] 10.2622796 5.9622796
[71,] 3.8122796 10.2622796
[72,] 6.8394297 3.8122796
[73,] 4.6680011 6.8394297
[74,] 8.4680011 4.6680011
[75,] 2.8394297 8.4680011
[76,] 10.5680011 2.8394297
[77,] 10.3822868 10.5680011
[78,] 2.1731018 10.3822868
[79,] 4.7302447 2.1731018
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 7.8656711 6.2370997
2 6.3656711 7.8656711
3 0.3370997 6.3656711
4 5.6656711 0.3370997
5 0.2799568 5.6656711
6 7.7707719 0.2799568
7 6.6279147 7.7707719
8 -5.8503778 6.6279147
9 2.6162888 -5.8503778
10 0.4162888 2.6162888
11 -5.6337112 0.4162888
12 2.3934389 -5.6337112
13 1.3220103 2.3934389
14 -2.9779897 1.3220103
15 6.9934389 -2.9779897
16 -0.5779897 6.9934389
17 -6.3637040 -0.5779897
18 -2.4728889 -6.3637040
19 2.2842539 -2.4728889
20 -1.4940386 2.2842539
21 -3.4273720 -1.4940386
22 -2.5273720 -3.4273720
23 -1.5773720 -2.5273720
24 2.3497781 -1.5773720
25 -1.8216505 2.3497781
26 -9.0216505 -1.8216505
27 -0.1502219 -9.0216505
28 -8.0216505 -0.1502219
29 -7.6073648 -8.0216505
30 8.4477450 -7.6073648
31 -4.0951122 8.4477450
32 5.2265953 -4.0951122
33 8.7932620 5.2265953
34 -8.2067380 8.7932620
35 0.9432620 -8.2067380
36 -4.7295880 0.9432620
37 -2.2010166 -4.7295880
38 4.8989834 -2.2010166
39 4.2704120 4.8989834
40 -3.4010166 4.2704120
41 3.3132692 -3.4010166
42 2.7040842 3.3132692
43 -0.6387729 2.7040842
44 4.6829345 -0.6387729
45 -1.2503988 4.6829345
46 0.8496012 -1.2503988
47 3.8996012 0.8496012
48 -6.5732488 3.8996012
49 -3.3446773 -6.5732488
50 -6.1446773 -3.3446773
51 -3.5732488 -6.1446773
52 -7.8446773 -3.5732488
53 -0.2303916 -7.8446773
54 -11.3395766 -0.2303916
55 -5.7824337 -11.3395766
56 -4.6607263 -5.7824337
57 -12.6940596 -4.6607263
58 -0.7940596 -12.6940596
59 -1.4440596 -0.7940596
60 -6.5169096 -1.4440596
61 -6.4883381 -6.5169096
62 -1.5883381 -6.4883381
63 -10.7169096 -1.5883381
64 3.6116619 -10.7169096
65 0.2259476 3.6116619
66 -7.2832374 0.2259476
67 -3.1260945 -7.2832374
68 2.0956129 -3.1260945
69 5.9622796 2.0956129
70 10.2622796 5.9622796
71 3.8122796 10.2622796
72 6.8394297 3.8122796
73 4.6680011 6.8394297
74 8.4680011 4.6680011
75 2.8394297 8.4680011
76 10.5680011 2.8394297
77 10.3822868 10.5680011
78 2.1731018 10.3822868
79 4.7302447 2.1731018
> 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/7dtxh1195069655.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/8h3jk1195069655.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/9za551195069655.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/106q591195069655.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/11hoe21195069655.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/12l3951195069655.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/13x94p1195069655.tab")
>
> system("convert tmp/1wq4j1195069654.ps tmp/1wq4j1195069654.png")
> system("convert tmp/2f2qx1195069655.ps tmp/2f2qx1195069655.png")
> system("convert tmp/3xnqj1195069655.ps tmp/3xnqj1195069655.png")
> system("convert tmp/4dxuw1195069655.ps tmp/4dxuw1195069655.png")
> system("convert tmp/56i6c1195069655.ps tmp/56i6c1195069655.png")
> system("convert tmp/6p15x1195069655.ps tmp/6p15x1195069655.png")
> system("convert tmp/7dtxh1195069655.ps tmp/7dtxh1195069655.png")
> system("convert tmp/8h3jk1195069655.ps tmp/8h3jk1195069655.png")
> system("convert tmp/9za551195069655.ps tmp/9za551195069655.png")
>
>
> proc.time()
user system elapsed
2.410 1.489 2.793