R version 2.7.0 (2008-04-22)
Copyright (C) 2008 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(17.3,0,15.4,0,16.9,0,20.8,0,16.4,0,11.3,0,17.5,0,16.6,0,17.5,0,19.5,0,18.8,0,20.2,0,19.2,0,14.4,0,24.5,0,25.7,0,27.1,0,21,0,18.6,0,20,0,21.8,0,20.4,0,18,1,21.5,1,19.1,1,19.7,1,26,1,26.3,1,24.6,1,22.4,1,32,1,24,1,30,1,24.1,1,26.3,1,29.8,1,21.9,1,22.8,1,29.2,1,27.5,1,27.4,1,31,1,26.1,1,22.2,1,34,1,26.9,1,31.9,1,34.2,1,31.2,1,28.5,1,37.1,1,36,1,34.8,1,32.1,1,37.2,1,36.3,1,39.5,1,37.1,1,35.6,1,36.2,1,35.9,1,32.5,1,39.2,1,39.4,1,42.8,1,34.5,1,43.7,1,46.3,1,40.8,1,48.4,1,43.2,1,48.1,1,42.8,1),dim=c(2,73),dimnames=list(c('y','x'),1:73))
> y <- array(NA,dim=c(2,73),dimnames=list(c('y','x'),1:73))
> 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 17.3 0 1 0 0 0 0 0 0 0 0 0 0 1
2 15.4 0 0 1 0 0 0 0 0 0 0 0 0 2
3 16.9 0 0 0 1 0 0 0 0 0 0 0 0 3
4 20.8 0 0 0 0 1 0 0 0 0 0 0 0 4
5 16.4 0 0 0 0 0 1 0 0 0 0 0 0 5
6 11.3 0 0 0 0 0 0 1 0 0 0 0 0 6
7 17.5 0 0 0 0 0 0 0 1 0 0 0 0 7
8 16.6 0 0 0 0 0 0 0 0 1 0 0 0 8
9 17.5 0 0 0 0 0 0 0 0 0 1 0 0 9
10 19.5 0 0 0 0 0 0 0 0 0 0 1 0 10
11 18.8 0 0 0 0 0 0 0 0 0 0 0 1 11
12 20.2 0 0 0 0 0 0 0 0 0 0 0 0 12
13 19.2 0 1 0 0 0 0 0 0 0 0 0 0 13
14 14.4 0 0 1 0 0 0 0 0 0 0 0 0 14
15 24.5 0 0 0 1 0 0 0 0 0 0 0 0 15
16 25.7 0 0 0 0 1 0 0 0 0 0 0 0 16
17 27.1 0 0 0 0 0 1 0 0 0 0 0 0 17
18 21.0 0 0 0 0 0 0 1 0 0 0 0 0 18
19 18.6 0 0 0 0 0 0 0 1 0 0 0 0 19
20 20.0 0 0 0 0 0 0 0 0 1 0 0 0 20
21 21.8 0 0 0 0 0 0 0 0 0 1 0 0 21
22 20.4 0 0 0 0 0 0 0 0 0 0 1 0 22
23 18.0 1 0 0 0 0 0 0 0 0 0 0 1 23
24 21.5 1 0 0 0 0 0 0 0 0 0 0 0 24
25 19.1 1 1 0 0 0 0 0 0 0 0 0 0 25
26 19.7 1 0 1 0 0 0 0 0 0 0 0 0 26
27 26.0 1 0 0 1 0 0 0 0 0 0 0 0 27
28 26.3 1 0 0 0 1 0 0 0 0 0 0 0 28
29 24.6 1 0 0 0 0 1 0 0 0 0 0 0 29
30 22.4 1 0 0 0 0 0 1 0 0 0 0 0 30
31 32.0 1 0 0 0 0 0 0 1 0 0 0 0 31
32 24.0 1 0 0 0 0 0 0 0 1 0 0 0 32
33 30.0 1 0 0 0 0 0 0 0 0 1 0 0 33
34 24.1 1 0 0 0 0 0 0 0 0 0 1 0 34
35 26.3 1 0 0 0 0 0 0 0 0 0 0 1 35
36 29.8 1 0 0 0 0 0 0 0 0 0 0 0 36
37 21.9 1 1 0 0 0 0 0 0 0 0 0 0 37
38 22.8 1 0 1 0 0 0 0 0 0 0 0 0 38
39 29.2 1 0 0 1 0 0 0 0 0 0 0 0 39
40 27.5 1 0 0 0 1 0 0 0 0 0 0 0 40
41 27.4 1 0 0 0 0 1 0 0 0 0 0 0 41
42 31.0 1 0 0 0 0 0 1 0 0 0 0 0 42
43 26.1 1 0 0 0 0 0 0 1 0 0 0 0 43
44 22.2 1 0 0 0 0 0 0 0 1 0 0 0 44
45 34.0 1 0 0 0 0 0 0 0 0 1 0 0 45
46 26.9 1 0 0 0 0 0 0 0 0 0 1 0 46
47 31.9 1 0 0 0 0 0 0 0 0 0 0 1 47
48 34.2 1 0 0 0 0 0 0 0 0 0 0 0 48
49 31.2 1 1 0 0 0 0 0 0 0 0 0 0 49
50 28.5 1 0 1 0 0 0 0 0 0 0 0 0 50
51 37.1 1 0 0 1 0 0 0 0 0 0 0 0 51
52 36.0 1 0 0 0 1 0 0 0 0 0 0 0 52
53 34.8 1 0 0 0 0 1 0 0 0 0 0 0 53
54 32.1 1 0 0 0 0 0 1 0 0 0 0 0 54
55 37.2 1 0 0 0 0 0 0 1 0 0 0 0 55
56 36.3 1 0 0 0 0 0 0 0 1 0 0 0 56
57 39.5 1 0 0 0 0 0 0 0 0 1 0 0 57
58 37.1 1 0 0 0 0 0 0 0 0 0 1 0 58
59 35.6 1 0 0 0 0 0 0 0 0 0 0 1 59
60 36.2 1 0 0 0 0 0 0 0 0 0 0 0 60
61 35.9 1 1 0 0 0 0 0 0 0 0 0 0 61
62 32.5 1 0 1 0 0 0 0 0 0 0 0 0 62
63 39.2 1 0 0 1 0 0 0 0 0 0 0 0 63
64 39.4 1 0 0 0 1 0 0 0 0 0 0 0 64
65 42.8 1 0 0 0 0 1 0 0 0 0 0 0 65
66 34.5 1 0 0 0 0 0 1 0 0 0 0 0 66
67 43.7 1 0 0 0 0 0 0 1 0 0 0 0 67
68 46.3 1 0 0 0 0 0 0 0 1 0 0 0 68
69 40.8 1 0 0 0 0 0 0 0 0 1 0 0 69
70 48.4 1 0 0 0 0 0 0 0 0 0 1 0 70
71 43.2 1 0 0 0 0 0 0 0 0 0 0 1 71
72 48.1 1 0 0 0 0 0 0 0 0 0 0 0 72
73 42.8 1 1 0 0 0 0 0 0 0 0 0 0 73
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) x M1 M2 M3 M4
15.5292 -3.9141 -3.0518 -5.4835 0.6546 0.6594
M5 M6 M7 M8 M9 M10
-0.2358 -4.1644 -0.8263 -2.9048 -0.3334 -1.9953
M11 t
-2.2381 0.4619
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.833269 -1.862146 0.004265 1.387854 6.892698
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 15.52924 1.39194 11.157 3.64e-16 ***
x -3.91414 1.25373 -3.122 0.00278 **
M1 -3.05178 1.63822 -1.863 0.06746 .
M2 -5.48350 1.70541 -3.215 0.00211 **
M3 0.65462 1.70392 0.384 0.70222
M4 0.65940 1.70287 0.387 0.69998
M5 -0.23582 1.70225 -0.139 0.89029
M6 -4.16437 1.70207 -2.447 0.01742 *
M7 -0.82626 1.70233 -0.485 0.62921
M8 -2.90481 1.70303 -1.706 0.09333 .
M9 -0.33337 1.70417 -0.196 0.84558
M10 -1.99525 1.70575 -1.170 0.24682
M11 -2.23811 1.69761 -1.318 0.19247
t 0.46189 0.02734 16.896 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.94 on 59 degrees of freedom
Multiple R-squared: 0.9141, Adjusted R-squared: 0.8951
F-statistic: 48.28 on 13 and 59 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/rcomp/tmp/1rlgy1229262118.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/29vri1229262118.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/3iscz1229262118.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/454g21229262118.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/5a1jf1229262118.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 = 73
Frequency = 1
1 2 3 4 5 6
4.360653903 4.430486991 -0.669513009 2.763820324 -1.202846343 -2.836179676
7 8 9 10 11 12
-0.436179676 0.280486991 -1.852846343 1.347153657 0.428129602 -0.871870398
13 14 15 16 17 18
0.718020619 -2.112146294 1.387853706 2.121187040 3.954520373 1.321187040
19 20 21 22 23 24
-4.878812960 -1.862146294 -3.095479627 -3.295479627 -2.000359352 -1.200359352
25 26 27 28 29 30
-1.010468336 1.559364752 1.259364752 1.092698085 -0.173968581 1.092698085
31 32 33 34 35 36
6.892698085 0.509364752 3.476031419 -1.223968581 0.757007364 1.557007364
37 38 39 40 41 42
-3.753101620 -0.883268532 -1.083268532 -3.249935199 -2.916601865 4.150064801
43 44 45 46 47 48
-4.549935199 -6.833268532 1.933398135 -3.966601865 0.814374080 0.414374080
49 50 51 52 53 54
0.004265096 -0.725901816 1.274098184 -0.292568483 -1.059235150 -0.292568483
55 56 57 58 59 60
1.007431517 1.724098184 1.890764850 0.690764850 -1.028259205 -3.128259205
61 62 63 64 65 66
-0.838368189 -2.268535101 -2.168535101 -2.435201767 1.398131566 -3.435201767
67 68 69 70 71 72
1.964798233 6.181464899 -2.351868434 6.448131566 1.029107511 3.229107511
73
0.518998527
> postscript(file="/var/www/html/rcomp/tmp/62hl61229262118.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 = 73
Frequency = 1
lag(myerror, k = 1) myerror
0 4.360653903 NA
1 4.430486991 4.360653903
2 -0.669513009 4.430486991
3 2.763820324 -0.669513009
4 -1.202846343 2.763820324
5 -2.836179676 -1.202846343
6 -0.436179676 -2.836179676
7 0.280486991 -0.436179676
8 -1.852846343 0.280486991
9 1.347153657 -1.852846343
10 0.428129602 1.347153657
11 -0.871870398 0.428129602
12 0.718020619 -0.871870398
13 -2.112146294 0.718020619
14 1.387853706 -2.112146294
15 2.121187040 1.387853706
16 3.954520373 2.121187040
17 1.321187040 3.954520373
18 -4.878812960 1.321187040
19 -1.862146294 -4.878812960
20 -3.095479627 -1.862146294
21 -3.295479627 -3.095479627
22 -2.000359352 -3.295479627
23 -1.200359352 -2.000359352
24 -1.010468336 -1.200359352
25 1.559364752 -1.010468336
26 1.259364752 1.559364752
27 1.092698085 1.259364752
28 -0.173968581 1.092698085
29 1.092698085 -0.173968581
30 6.892698085 1.092698085
31 0.509364752 6.892698085
32 3.476031419 0.509364752
33 -1.223968581 3.476031419
34 0.757007364 -1.223968581
35 1.557007364 0.757007364
36 -3.753101620 1.557007364
37 -0.883268532 -3.753101620
38 -1.083268532 -0.883268532
39 -3.249935199 -1.083268532
40 -2.916601865 -3.249935199
41 4.150064801 -2.916601865
42 -4.549935199 4.150064801
43 -6.833268532 -4.549935199
44 1.933398135 -6.833268532
45 -3.966601865 1.933398135
46 0.814374080 -3.966601865
47 0.414374080 0.814374080
48 0.004265096 0.414374080
49 -0.725901816 0.004265096
50 1.274098184 -0.725901816
51 -0.292568483 1.274098184
52 -1.059235150 -0.292568483
53 -0.292568483 -1.059235150
54 1.007431517 -0.292568483
55 1.724098184 1.007431517
56 1.890764850 1.724098184
57 0.690764850 1.890764850
58 -1.028259205 0.690764850
59 -3.128259205 -1.028259205
60 -0.838368189 -3.128259205
61 -2.268535101 -0.838368189
62 -2.168535101 -2.268535101
63 -2.435201767 -2.168535101
64 1.398131566 -2.435201767
65 -3.435201767 1.398131566
66 1.964798233 -3.435201767
67 6.181464899 1.964798233
68 -2.351868434 6.181464899
69 6.448131566 -2.351868434
70 1.029107511 6.448131566
71 3.229107511 1.029107511
72 0.518998527 3.229107511
73 NA 0.518998527
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 4.430486991 4.360653903
[2,] -0.669513009 4.430486991
[3,] 2.763820324 -0.669513009
[4,] -1.202846343 2.763820324
[5,] -2.836179676 -1.202846343
[6,] -0.436179676 -2.836179676
[7,] 0.280486991 -0.436179676
[8,] -1.852846343 0.280486991
[9,] 1.347153657 -1.852846343
[10,] 0.428129602 1.347153657
[11,] -0.871870398 0.428129602
[12,] 0.718020619 -0.871870398
[13,] -2.112146294 0.718020619
[14,] 1.387853706 -2.112146294
[15,] 2.121187040 1.387853706
[16,] 3.954520373 2.121187040
[17,] 1.321187040 3.954520373
[18,] -4.878812960 1.321187040
[19,] -1.862146294 -4.878812960
[20,] -3.095479627 -1.862146294
[21,] -3.295479627 -3.095479627
[22,] -2.000359352 -3.295479627
[23,] -1.200359352 -2.000359352
[24,] -1.010468336 -1.200359352
[25,] 1.559364752 -1.010468336
[26,] 1.259364752 1.559364752
[27,] 1.092698085 1.259364752
[28,] -0.173968581 1.092698085
[29,] 1.092698085 -0.173968581
[30,] 6.892698085 1.092698085
[31,] 0.509364752 6.892698085
[32,] 3.476031419 0.509364752
[33,] -1.223968581 3.476031419
[34,] 0.757007364 -1.223968581
[35,] 1.557007364 0.757007364
[36,] -3.753101620 1.557007364
[37,] -0.883268532 -3.753101620
[38,] -1.083268532 -0.883268532
[39,] -3.249935199 -1.083268532
[40,] -2.916601865 -3.249935199
[41,] 4.150064801 -2.916601865
[42,] -4.549935199 4.150064801
[43,] -6.833268532 -4.549935199
[44,] 1.933398135 -6.833268532
[45,] -3.966601865 1.933398135
[46,] 0.814374080 -3.966601865
[47,] 0.414374080 0.814374080
[48,] 0.004265096 0.414374080
[49,] -0.725901816 0.004265096
[50,] 1.274098184 -0.725901816
[51,] -0.292568483 1.274098184
[52,] -1.059235150 -0.292568483
[53,] -0.292568483 -1.059235150
[54,] 1.007431517 -0.292568483
[55,] 1.724098184 1.007431517
[56,] 1.890764850 1.724098184
[57,] 0.690764850 1.890764850
[58,] -1.028259205 0.690764850
[59,] -3.128259205 -1.028259205
[60,] -0.838368189 -3.128259205
[61,] -2.268535101 -0.838368189
[62,] -2.168535101 -2.268535101
[63,] -2.435201767 -2.168535101
[64,] 1.398131566 -2.435201767
[65,] -3.435201767 1.398131566
[66,] 1.964798233 -3.435201767
[67,] 6.181464899 1.964798233
[68,] -2.351868434 6.181464899
[69,] 6.448131566 -2.351868434
[70,] 1.029107511 6.448131566
[71,] 3.229107511 1.029107511
[72,] 0.518998527 3.229107511
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 4.430486991 4.360653903
2 -0.669513009 4.430486991
3 2.763820324 -0.669513009
4 -1.202846343 2.763820324
5 -2.836179676 -1.202846343
6 -0.436179676 -2.836179676
7 0.280486991 -0.436179676
8 -1.852846343 0.280486991
9 1.347153657 -1.852846343
10 0.428129602 1.347153657
11 -0.871870398 0.428129602
12 0.718020619 -0.871870398
13 -2.112146294 0.718020619
14 1.387853706 -2.112146294
15 2.121187040 1.387853706
16 3.954520373 2.121187040
17 1.321187040 3.954520373
18 -4.878812960 1.321187040
19 -1.862146294 -4.878812960
20 -3.095479627 -1.862146294
21 -3.295479627 -3.095479627
22 -2.000359352 -3.295479627
23 -1.200359352 -2.000359352
24 -1.010468336 -1.200359352
25 1.559364752 -1.010468336
26 1.259364752 1.559364752
27 1.092698085 1.259364752
28 -0.173968581 1.092698085
29 1.092698085 -0.173968581
30 6.892698085 1.092698085
31 0.509364752 6.892698085
32 3.476031419 0.509364752
33 -1.223968581 3.476031419
34 0.757007364 -1.223968581
35 1.557007364 0.757007364
36 -3.753101620 1.557007364
37 -0.883268532 -3.753101620
38 -1.083268532 -0.883268532
39 -3.249935199 -1.083268532
40 -2.916601865 -3.249935199
41 4.150064801 -2.916601865
42 -4.549935199 4.150064801
43 -6.833268532 -4.549935199
44 1.933398135 -6.833268532
45 -3.966601865 1.933398135
46 0.814374080 -3.966601865
47 0.414374080 0.814374080
48 0.004265096 0.414374080
49 -0.725901816 0.004265096
50 1.274098184 -0.725901816
51 -0.292568483 1.274098184
52 -1.059235150 -0.292568483
53 -0.292568483 -1.059235150
54 1.007431517 -0.292568483
55 1.724098184 1.007431517
56 1.890764850 1.724098184
57 0.690764850 1.890764850
58 -1.028259205 0.690764850
59 -3.128259205 -1.028259205
60 -0.838368189 -3.128259205
61 -2.268535101 -0.838368189
62 -2.168535101 -2.268535101
63 -2.435201767 -2.168535101
64 1.398131566 -2.435201767
65 -3.435201767 1.398131566
66 1.964798233 -3.435201767
67 6.181464899 1.964798233
68 -2.351868434 6.181464899
69 6.448131566 -2.351868434
70 1.029107511 6.448131566
71 3.229107511 1.029107511
72 0.518998527 3.229107511
> 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/78u2m1229262118.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/8qo541229262118.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/9bolu1229262118.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
>
> #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> 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/10mx771229262118.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/11wnh51229262118.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/126lkc1229262119.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/13uwhp1229262119.tab")
>
> system("convert tmp/1rlgy1229262118.ps tmp/1rlgy1229262118.png")
> system("convert tmp/29vri1229262118.ps tmp/29vri1229262118.png")
> system("convert tmp/3iscz1229262118.ps tmp/3iscz1229262118.png")
> system("convert tmp/454g21229262118.ps tmp/454g21229262118.png")
> system("convert tmp/5a1jf1229262118.ps tmp/5a1jf1229262118.png")
> system("convert tmp/62hl61229262118.ps tmp/62hl61229262118.png")
> system("convert tmp/78u2m1229262118.ps tmp/78u2m1229262118.png")
> system("convert tmp/8qo541229262118.ps tmp/8qo541229262118.png")
> system("convert tmp/9bolu1229262118.ps tmp/9bolu1229262118.png")
>
>
> proc.time()
user system elapsed
4.076 2.529 4.410