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(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,0,88.6,0,117.2,0,123.9,0,100,0,103.6,0,94.1,0,98.7,0,119.5,0,112.7,0,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),dim=c(2,72),dimnames=list(c('y','x'),1:72))
> y <- array(NA,dim=c(2,72),dimnames=list(c('y','x'),1:72))
> 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 0 0 0 0 0 0 0 1 0 0 0 0 31
32 88.6 0 0 0 0 0 0 0 0 1 0 0 0 32
33 117.2 0 0 0 0 0 0 0 0 0 1 0 0 33
34 123.9 0 0 0 0 0 0 0 0 0 0 1 0 34
35 100.0 0 0 0 0 0 0 0 0 0 0 0 1 35
36 103.6 0 0 0 0 0 0 0 0 0 0 0 0 36
37 94.1 0 1 0 0 0 0 0 0 0 0 0 0 37
38 98.7 0 0 1 0 0 0 0 0 0 0 0 0 38
39 119.5 0 0 0 1 0 0 0 0 0 0 0 0 39
40 112.7 0 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
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) x M1 M2 M3 M4
99.0425 -0.2683 -6.5322 -4.3030 8.5595 3.1220
M5 M6 M7 M8 M9 M10
1.0458 14.4583 -20.5458 -9.9333 9.9292 12.8583
M11 t
5.7542 0.2042
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-11.9425 -3.2242 -0.3917 3.7587 14.2758
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 99.04247 2.81647 35.165 < 2e-16 ***
x -0.26827 2.64099 -0.102 0.919441
M1 -6.53221 3.24228 -2.015 0.048581 *
M2 -4.30304 3.23673 -1.329 0.188907
M3 8.55946 3.23240 2.648 0.010411 *
M4 3.12196 3.22931 0.967 0.337679
M5 1.04583 3.24939 0.322 0.748719
M6 14.45833 3.24138 4.461 3.81e-05 ***
M7 -20.54583 3.23459 -6.352 3.56e-08 ***
M8 -9.93333 3.22902 -3.076 0.003196 **
M9 9.92917 3.22468 3.079 0.003170 **
M10 12.85833 3.22158 3.991 0.000187 ***
M11 5.75417 3.21972 1.787 0.079137 .
t 0.20417 0.06323 3.229 0.002047 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.576 on 58 degrees of freedom
Multiple R-squared: 0.8224, Adjusted R-squared: 0.7826
F-statistic: 20.66 on 13 and 58 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/rcomp/tmp/1jrfg1227364670.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/2huwu1227364670.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/3am9b1227364670.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/4ct7t1227364670.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/54ml41227364670.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 = 72
Frequency = 1
1 2 3 4 5 6
4.58557692 5.85224359 4.98557692 -1.98108974 4.59086538 -0.82580128
7 8 9 10 11 12
6.47419872 5.75753205 -7.50913462 0.95753205 -1.24246795 -7.29246795
13 14 15 16 17 18
3.23557692 1.80224359 -1.86442308 7.16891026 0.84086538 -4.97580128
19 20 21 22 23 24
-1.27580128 3.90753205 -0.65913462 -2.59246795 -1.69246795 -0.74246795
25 26 27 28 29 30
5.68557692 1.15224359 -5.41442308 2.51891026 -4.10913462 -3.72580128
31 32 33 34 35 36
5.07419872 -7.04246795 1.49086538 5.05753205 -11.94246795 -2.79246795
37 38 39 40 41 42
-5.96442308 -3.79775641 3.93557692 2.36891026 -3.79086538 2.89246795
43 44 45 46 47 48
2.09246795 -0.82419872 3.70913462 -2.22419872 -0.12419872 2.92580128
49 50 51 52 53 54
-5.04615385 -2.17948718 -4.34615385 -2.71282051 -5.74086538 1.84246795
55 56 57 58 59 60
-9.45753205 -3.47419872 -3.14086538 -11.17419872 0.72580128 0.07580128
61 62 63 64 65 66
-2.49615385 -2.82948718 2.70384615 -7.36282051 8.20913462 4.79246795
67 68 69 70 71 72
-2.90753205 1.67580128 6.10913462 9.97580128 14.27580128 7.82580128
> postscript(file="/var/www/html/rcomp/tmp/6skgy1227364670.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 = 72
Frequency = 1
lag(myerror, k = 1) myerror
0 4.58557692 NA
1 5.85224359 4.58557692
2 4.98557692 5.85224359
3 -1.98108974 4.98557692
4 4.59086538 -1.98108974
5 -0.82580128 4.59086538
6 6.47419872 -0.82580128
7 5.75753205 6.47419872
8 -7.50913462 5.75753205
9 0.95753205 -7.50913462
10 -1.24246795 0.95753205
11 -7.29246795 -1.24246795
12 3.23557692 -7.29246795
13 1.80224359 3.23557692
14 -1.86442308 1.80224359
15 7.16891026 -1.86442308
16 0.84086538 7.16891026
17 -4.97580128 0.84086538
18 -1.27580128 -4.97580128
19 3.90753205 -1.27580128
20 -0.65913462 3.90753205
21 -2.59246795 -0.65913462
22 -1.69246795 -2.59246795
23 -0.74246795 -1.69246795
24 5.68557692 -0.74246795
25 1.15224359 5.68557692
26 -5.41442308 1.15224359
27 2.51891026 -5.41442308
28 -4.10913462 2.51891026
29 -3.72580128 -4.10913462
30 5.07419872 -3.72580128
31 -7.04246795 5.07419872
32 1.49086538 -7.04246795
33 5.05753205 1.49086538
34 -11.94246795 5.05753205
35 -2.79246795 -11.94246795
36 -5.96442308 -2.79246795
37 -3.79775641 -5.96442308
38 3.93557692 -3.79775641
39 2.36891026 3.93557692
40 -3.79086538 2.36891026
41 2.89246795 -3.79086538
42 2.09246795 2.89246795
43 -0.82419872 2.09246795
44 3.70913462 -0.82419872
45 -2.22419872 3.70913462
46 -0.12419872 -2.22419872
47 2.92580128 -0.12419872
48 -5.04615385 2.92580128
49 -2.17948718 -5.04615385
50 -4.34615385 -2.17948718
51 -2.71282051 -4.34615385
52 -5.74086538 -2.71282051
53 1.84246795 -5.74086538
54 -9.45753205 1.84246795
55 -3.47419872 -9.45753205
56 -3.14086538 -3.47419872
57 -11.17419872 -3.14086538
58 0.72580128 -11.17419872
59 0.07580128 0.72580128
60 -2.49615385 0.07580128
61 -2.82948718 -2.49615385
62 2.70384615 -2.82948718
63 -7.36282051 2.70384615
64 8.20913462 -7.36282051
65 4.79246795 8.20913462
66 -2.90753205 4.79246795
67 1.67580128 -2.90753205
68 6.10913462 1.67580128
69 9.97580128 6.10913462
70 14.27580128 9.97580128
71 7.82580128 14.27580128
72 NA 7.82580128
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 5.85224359 4.58557692
[2,] 4.98557692 5.85224359
[3,] -1.98108974 4.98557692
[4,] 4.59086538 -1.98108974
[5,] -0.82580128 4.59086538
[6,] 6.47419872 -0.82580128
[7,] 5.75753205 6.47419872
[8,] -7.50913462 5.75753205
[9,] 0.95753205 -7.50913462
[10,] -1.24246795 0.95753205
[11,] -7.29246795 -1.24246795
[12,] 3.23557692 -7.29246795
[13,] 1.80224359 3.23557692
[14,] -1.86442308 1.80224359
[15,] 7.16891026 -1.86442308
[16,] 0.84086538 7.16891026
[17,] -4.97580128 0.84086538
[18,] -1.27580128 -4.97580128
[19,] 3.90753205 -1.27580128
[20,] -0.65913462 3.90753205
[21,] -2.59246795 -0.65913462
[22,] -1.69246795 -2.59246795
[23,] -0.74246795 -1.69246795
[24,] 5.68557692 -0.74246795
[25,] 1.15224359 5.68557692
[26,] -5.41442308 1.15224359
[27,] 2.51891026 -5.41442308
[28,] -4.10913462 2.51891026
[29,] -3.72580128 -4.10913462
[30,] 5.07419872 -3.72580128
[31,] -7.04246795 5.07419872
[32,] 1.49086538 -7.04246795
[33,] 5.05753205 1.49086538
[34,] -11.94246795 5.05753205
[35,] -2.79246795 -11.94246795
[36,] -5.96442308 -2.79246795
[37,] -3.79775641 -5.96442308
[38,] 3.93557692 -3.79775641
[39,] 2.36891026 3.93557692
[40,] -3.79086538 2.36891026
[41,] 2.89246795 -3.79086538
[42,] 2.09246795 2.89246795
[43,] -0.82419872 2.09246795
[44,] 3.70913462 -0.82419872
[45,] -2.22419872 3.70913462
[46,] -0.12419872 -2.22419872
[47,] 2.92580128 -0.12419872
[48,] -5.04615385 2.92580128
[49,] -2.17948718 -5.04615385
[50,] -4.34615385 -2.17948718
[51,] -2.71282051 -4.34615385
[52,] -5.74086538 -2.71282051
[53,] 1.84246795 -5.74086538
[54,] -9.45753205 1.84246795
[55,] -3.47419872 -9.45753205
[56,] -3.14086538 -3.47419872
[57,] -11.17419872 -3.14086538
[58,] 0.72580128 -11.17419872
[59,] 0.07580128 0.72580128
[60,] -2.49615385 0.07580128
[61,] -2.82948718 -2.49615385
[62,] 2.70384615 -2.82948718
[63,] -7.36282051 2.70384615
[64,] 8.20913462 -7.36282051
[65,] 4.79246795 8.20913462
[66,] -2.90753205 4.79246795
[67,] 1.67580128 -2.90753205
[68,] 6.10913462 1.67580128
[69,] 9.97580128 6.10913462
[70,] 14.27580128 9.97580128
[71,] 7.82580128 14.27580128
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 5.85224359 4.58557692
2 4.98557692 5.85224359
3 -1.98108974 4.98557692
4 4.59086538 -1.98108974
5 -0.82580128 4.59086538
6 6.47419872 -0.82580128
7 5.75753205 6.47419872
8 -7.50913462 5.75753205
9 0.95753205 -7.50913462
10 -1.24246795 0.95753205
11 -7.29246795 -1.24246795
12 3.23557692 -7.29246795
13 1.80224359 3.23557692
14 -1.86442308 1.80224359
15 7.16891026 -1.86442308
16 0.84086538 7.16891026
17 -4.97580128 0.84086538
18 -1.27580128 -4.97580128
19 3.90753205 -1.27580128
20 -0.65913462 3.90753205
21 -2.59246795 -0.65913462
22 -1.69246795 -2.59246795
23 -0.74246795 -1.69246795
24 5.68557692 -0.74246795
25 1.15224359 5.68557692
26 -5.41442308 1.15224359
27 2.51891026 -5.41442308
28 -4.10913462 2.51891026
29 -3.72580128 -4.10913462
30 5.07419872 -3.72580128
31 -7.04246795 5.07419872
32 1.49086538 -7.04246795
33 5.05753205 1.49086538
34 -11.94246795 5.05753205
35 -2.79246795 -11.94246795
36 -5.96442308 -2.79246795
37 -3.79775641 -5.96442308
38 3.93557692 -3.79775641
39 2.36891026 3.93557692
40 -3.79086538 2.36891026
41 2.89246795 -3.79086538
42 2.09246795 2.89246795
43 -0.82419872 2.09246795
44 3.70913462 -0.82419872
45 -2.22419872 3.70913462
46 -0.12419872 -2.22419872
47 2.92580128 -0.12419872
48 -5.04615385 2.92580128
49 -2.17948718 -5.04615385
50 -4.34615385 -2.17948718
51 -2.71282051 -4.34615385
52 -5.74086538 -2.71282051
53 1.84246795 -5.74086538
54 -9.45753205 1.84246795
55 -3.47419872 -9.45753205
56 -3.14086538 -3.47419872
57 -11.17419872 -3.14086538
58 0.72580128 -11.17419872
59 0.07580128 0.72580128
60 -2.49615385 0.07580128
61 -2.82948718 -2.49615385
62 2.70384615 -2.82948718
63 -7.36282051 2.70384615
64 8.20913462 -7.36282051
65 4.79246795 8.20913462
66 -2.90753205 4.79246795
67 1.67580128 -2.90753205
68 6.10913462 1.67580128
69 9.97580128 6.10913462
70 14.27580128 9.97580128
71 7.82580128 14.27580128
> 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/7w02m1227364671.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/8y2ev1227364671.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/94wvl1227364671.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/10ruo11227364671.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/11gq6o1227364671.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/12derq1227364671.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/13nx431227364671.tab")
>
> system("convert tmp/1jrfg1227364670.ps tmp/1jrfg1227364670.png")
> system("convert tmp/2huwu1227364670.ps tmp/2huwu1227364670.png")
> system("convert tmp/3am9b1227364670.ps tmp/3am9b1227364670.png")
> system("convert tmp/4ct7t1227364670.ps tmp/4ct7t1227364670.png")
> system("convert tmp/54ml41227364670.ps tmp/54ml41227364670.png")
> system("convert tmp/6skgy1227364670.ps tmp/6skgy1227364670.png")
> system("convert tmp/7w02m1227364671.ps tmp/7w02m1227364671.png")
> system("convert tmp/8y2ev1227364671.ps tmp/8y2ev1227364671.png")
> system("convert tmp/94wvl1227364671.ps tmp/94wvl1227364671.png")
>
>
> proc.time()
user system elapsed
4.082 2.539 4.426