R version 2.8.0 (2008-10-20)
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(104.2,0,103.2,0,112.7,0,106.4,0,102.6,0,110.6,0,95.2,0,89.0,0,112.5,0,116.8,0,107.2,0,113.6,0,101.8,0,102.6,0,122.7,0,110.3,0,110.5,0,121.6,0,100.3,0,100.7,0,123.4,0,127.1,0,124.1,0,131.2,0,111.6,0,114.2,0,130.1,0,125.9,0,119.0,0,133.8,0,107.5,0,113.5,0,134.4,0,126.8,0,135.6,0,139.9,0,129.8,0,131.0,0,153.1,0,134.1,1,144.1,1,155.9,1,123.3,1,128.1,1,144.3,1,153.0,1,149.9,1,150.9,1,141.0,1,138.9,1,157.4,1,142.9,1,151.7,1,161.0,1,138.5,1,135.9,1,151.5,1,164.0,1,159.1,1,157.0,1,142.1,1,144.8,1,152.1,1,154.6,1,148.7,1,157.7,1,146.7,1),dim=c(2,67),dimnames=list(c('y','x'),1:67))
> y <- array(NA,dim=c(2,67),dimnames=list(c('y','x'),1:67))
> 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 104.2 0 1 0 0 0 0 0 0 0 0 0 0 1
2 103.2 0 0 1 0 0 0 0 0 0 0 0 0 2
3 112.7 0 0 0 1 0 0 0 0 0 0 0 0 3
4 106.4 0 0 0 0 1 0 0 0 0 0 0 0 4
5 102.6 0 0 0 0 0 1 0 0 0 0 0 0 5
6 110.6 0 0 0 0 0 0 1 0 0 0 0 0 6
7 95.2 0 0 0 0 0 0 0 1 0 0 0 0 7
8 89.0 0 0 0 0 0 0 0 0 1 0 0 0 8
9 112.5 0 0 0 0 0 0 0 0 0 1 0 0 9
10 116.8 0 0 0 0 0 0 0 0 0 0 1 0 10
11 107.2 0 0 0 0 0 0 0 0 0 0 0 1 11
12 113.6 0 0 0 0 0 0 0 0 0 0 0 0 12
13 101.8 0 1 0 0 0 0 0 0 0 0 0 0 13
14 102.6 0 0 1 0 0 0 0 0 0 0 0 0 14
15 122.7 0 0 0 1 0 0 0 0 0 0 0 0 15
16 110.3 0 0 0 0 1 0 0 0 0 0 0 0 16
17 110.5 0 0 0 0 0 1 0 0 0 0 0 0 17
18 121.6 0 0 0 0 0 0 1 0 0 0 0 0 18
19 100.3 0 0 0 0 0 0 0 1 0 0 0 0 19
20 100.7 0 0 0 0 0 0 0 0 1 0 0 0 20
21 123.4 0 0 0 0 0 0 0 0 0 1 0 0 21
22 127.1 0 0 0 0 0 0 0 0 0 0 1 0 22
23 124.1 0 0 0 0 0 0 0 0 0 0 0 1 23
24 131.2 0 0 0 0 0 0 0 0 0 0 0 0 24
25 111.6 0 1 0 0 0 0 0 0 0 0 0 0 25
26 114.2 0 0 1 0 0 0 0 0 0 0 0 0 26
27 130.1 0 0 0 1 0 0 0 0 0 0 0 0 27
28 125.9 0 0 0 0 1 0 0 0 0 0 0 0 28
29 119.0 0 0 0 0 0 1 0 0 0 0 0 0 29
30 133.8 0 0 0 0 0 0 1 0 0 0 0 0 30
31 107.5 0 0 0 0 0 0 0 1 0 0 0 0 31
32 113.5 0 0 0 0 0 0 0 0 1 0 0 0 32
33 134.4 0 0 0 0 0 0 0 0 0 1 0 0 33
34 126.8 0 0 0 0 0 0 0 0 0 0 1 0 34
35 135.6 0 0 0 0 0 0 0 0 0 0 0 1 35
36 139.9 0 0 0 0 0 0 0 0 0 0 0 0 36
37 129.8 0 1 0 0 0 0 0 0 0 0 0 0 37
38 131.0 0 0 1 0 0 0 0 0 0 0 0 0 38
39 153.1 0 0 0 1 0 0 0 0 0 0 0 0 39
40 134.1 1 0 0 0 1 0 0 0 0 0 0 0 40
41 144.1 1 0 0 0 0 1 0 0 0 0 0 0 41
42 155.9 1 0 0 0 0 0 1 0 0 0 0 0 42
43 123.3 1 0 0 0 0 0 0 1 0 0 0 0 43
44 128.1 1 0 0 0 0 0 0 0 1 0 0 0 44
45 144.3 1 0 0 0 0 0 0 0 0 1 0 0 45
46 153.0 1 0 0 0 0 0 0 0 0 0 1 0 46
47 149.9 1 0 0 0 0 0 0 0 0 0 0 1 47
48 150.9 1 0 0 0 0 0 0 0 0 0 0 0 48
49 141.0 1 1 0 0 0 0 0 0 0 0 0 0 49
50 138.9 1 0 1 0 0 0 0 0 0 0 0 0 50
51 157.4 1 0 0 1 0 0 0 0 0 0 0 0 51
52 142.9 1 0 0 0 1 0 0 0 0 0 0 0 52
53 151.7 1 0 0 0 0 1 0 0 0 0 0 0 53
54 161.0 1 0 0 0 0 0 1 0 0 0 0 0 54
55 138.5 1 0 0 0 0 0 0 1 0 0 0 0 55
56 135.9 1 0 0 0 0 0 0 0 1 0 0 0 56
57 151.5 1 0 0 0 0 0 0 0 0 1 0 0 57
58 164.0 1 0 0 0 0 0 0 0 0 0 1 0 58
59 159.1 1 0 0 0 0 0 0 0 0 0 0 1 59
60 157.0 1 0 0 0 0 0 0 0 0 0 0 0 60
61 142.1 1 1 0 0 0 0 0 0 0 0 0 0 61
62 144.8 1 0 1 0 0 0 0 0 0 0 0 0 62
63 152.1 1 0 0 1 0 0 0 0 0 0 0 0 63
64 154.6 1 0 0 0 1 0 0 0 0 0 0 0 64
65 148.7 1 0 0 0 0 1 0 0 0 0 0 0 65
66 157.7 1 0 0 0 0 0 1 0 0 0 0 0 66
67 146.7 1 0 0 0 0 0 0 1 0 0 0 0 67
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) x M1 M2 M3 M4
109.1950 5.7641 -12.6330 -12.6836 2.1326 -8.5620
M5 M6 M7 M8 M9 M10
-8.9125 1.0036 -21.2636 -22.0778 -3.0484 0.5211
M11 t
-2.5895 0.7505
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-12.27557 -2.83001 -0.08493 2.74526 12.50147
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 109.19497 2.62668 41.571 < 2e-16 ***
x 5.76412 2.37724 2.425 0.01876 *
M1 -12.63303 2.97713 -4.243 8.89e-05 ***
M2 -12.68357 2.97437 -4.264 8.29e-05 ***
M3 2.13256 2.97284 0.717 0.47631
M4 -8.56200 2.99153 -2.862 0.00601 **
M5 -8.91254 2.98560 -2.985 0.00428 **
M6 1.00359 2.98087 0.337 0.73769
M7 -21.26362 2.97736 -7.142 2.67e-09 ***
M8 -22.07785 3.11287 -7.092 3.20e-09 ***
M9 -3.04838 3.10877 -0.981 0.33126
M10 0.52108 3.10584 0.168 0.86740
M11 -2.58946 3.10409 -0.834 0.40791
t 0.75054 0.06033 12.440 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 4.907 on 53 degrees of freedom
Multiple R-squared: 0.9494, Adjusted R-squared: 0.9369
F-statistic: 76.45 on 13 and 53 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/rcomp/tmp/1ap591227560693.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/2khqo1227560693.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/3ko3s1227560693.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/4vrnx1227560693.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/565jm1227560693.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 = 67
Frequency = 1
1 2 3 4 5 6
6.88752834 5.18752834 -0.87913832 2.76488095 -1.43511905 -4.10178571
7 8 9 10 11 12
2.01488095 -4.12142857 -0.40142857 -0.42142857 -7.66142857 -4.60142857
13 14 15 16 17 18
-4.51893424 -4.41893424 0.11439909 -2.34158163 -2.54158163 -2.10824830
19 20 21 22 23 24
-1.89158163 -1.42789116 1.49210884 0.87210884 0.23210884 3.99210884
25 26 27 28 29 30
-3.72539683 -1.82539683 -1.49206349 4.25195578 -3.04804422 1.08528912
31 32 33 34 35 36
-3.69804422 2.36564626 3.48564626 -8.43435374 2.72564626 3.68564626
37 38 39 40 41 42
5.46814059 5.96814059 12.50147392 -2.31862245 7.28137755 8.41471088
43 44 45 46 47 48
-2.66862245 2.19506803 -1.38493197 2.99506803 2.25506803 -0.08493197
49 50 51 52 53 54
1.89756236 -0.90243764 2.03089569 -2.52508503 5.87491497 4.50824830
55 56 57 58 59 60
3.52491497 0.98860544 -3.19139456 4.98860544 2.44860544 -2.99139456
61 62 63 64 65 66
-6.00890023 -4.00890023 -12.27556689 0.16845238 -6.13154762 -7.79821429
67
2.71845238
> postscript(file="/var/www/html/rcomp/tmp/626t81227560693.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 = 67
Frequency = 1
lag(myerror, k = 1) myerror
0 6.88752834 NA
1 5.18752834 6.88752834
2 -0.87913832 5.18752834
3 2.76488095 -0.87913832
4 -1.43511905 2.76488095
5 -4.10178571 -1.43511905
6 2.01488095 -4.10178571
7 -4.12142857 2.01488095
8 -0.40142857 -4.12142857
9 -0.42142857 -0.40142857
10 -7.66142857 -0.42142857
11 -4.60142857 -7.66142857
12 -4.51893424 -4.60142857
13 -4.41893424 -4.51893424
14 0.11439909 -4.41893424
15 -2.34158163 0.11439909
16 -2.54158163 -2.34158163
17 -2.10824830 -2.54158163
18 -1.89158163 -2.10824830
19 -1.42789116 -1.89158163
20 1.49210884 -1.42789116
21 0.87210884 1.49210884
22 0.23210884 0.87210884
23 3.99210884 0.23210884
24 -3.72539683 3.99210884
25 -1.82539683 -3.72539683
26 -1.49206349 -1.82539683
27 4.25195578 -1.49206349
28 -3.04804422 4.25195578
29 1.08528912 -3.04804422
30 -3.69804422 1.08528912
31 2.36564626 -3.69804422
32 3.48564626 2.36564626
33 -8.43435374 3.48564626
34 2.72564626 -8.43435374
35 3.68564626 2.72564626
36 5.46814059 3.68564626
37 5.96814059 5.46814059
38 12.50147392 5.96814059
39 -2.31862245 12.50147392
40 7.28137755 -2.31862245
41 8.41471088 7.28137755
42 -2.66862245 8.41471088
43 2.19506803 -2.66862245
44 -1.38493197 2.19506803
45 2.99506803 -1.38493197
46 2.25506803 2.99506803
47 -0.08493197 2.25506803
48 1.89756236 -0.08493197
49 -0.90243764 1.89756236
50 2.03089569 -0.90243764
51 -2.52508503 2.03089569
52 5.87491497 -2.52508503
53 4.50824830 5.87491497
54 3.52491497 4.50824830
55 0.98860544 3.52491497
56 -3.19139456 0.98860544
57 4.98860544 -3.19139456
58 2.44860544 4.98860544
59 -2.99139456 2.44860544
60 -6.00890023 -2.99139456
61 -4.00890023 -6.00890023
62 -12.27556689 -4.00890023
63 0.16845238 -12.27556689
64 -6.13154762 0.16845238
65 -7.79821429 -6.13154762
66 2.71845238 -7.79821429
67 NA 2.71845238
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 5.18752834 6.88752834
[2,] -0.87913832 5.18752834
[3,] 2.76488095 -0.87913832
[4,] -1.43511905 2.76488095
[5,] -4.10178571 -1.43511905
[6,] 2.01488095 -4.10178571
[7,] -4.12142857 2.01488095
[8,] -0.40142857 -4.12142857
[9,] -0.42142857 -0.40142857
[10,] -7.66142857 -0.42142857
[11,] -4.60142857 -7.66142857
[12,] -4.51893424 -4.60142857
[13,] -4.41893424 -4.51893424
[14,] 0.11439909 -4.41893424
[15,] -2.34158163 0.11439909
[16,] -2.54158163 -2.34158163
[17,] -2.10824830 -2.54158163
[18,] -1.89158163 -2.10824830
[19,] -1.42789116 -1.89158163
[20,] 1.49210884 -1.42789116
[21,] 0.87210884 1.49210884
[22,] 0.23210884 0.87210884
[23,] 3.99210884 0.23210884
[24,] -3.72539683 3.99210884
[25,] -1.82539683 -3.72539683
[26,] -1.49206349 -1.82539683
[27,] 4.25195578 -1.49206349
[28,] -3.04804422 4.25195578
[29,] 1.08528912 -3.04804422
[30,] -3.69804422 1.08528912
[31,] 2.36564626 -3.69804422
[32,] 3.48564626 2.36564626
[33,] -8.43435374 3.48564626
[34,] 2.72564626 -8.43435374
[35,] 3.68564626 2.72564626
[36,] 5.46814059 3.68564626
[37,] 5.96814059 5.46814059
[38,] 12.50147392 5.96814059
[39,] -2.31862245 12.50147392
[40,] 7.28137755 -2.31862245
[41,] 8.41471088 7.28137755
[42,] -2.66862245 8.41471088
[43,] 2.19506803 -2.66862245
[44,] -1.38493197 2.19506803
[45,] 2.99506803 -1.38493197
[46,] 2.25506803 2.99506803
[47,] -0.08493197 2.25506803
[48,] 1.89756236 -0.08493197
[49,] -0.90243764 1.89756236
[50,] 2.03089569 -0.90243764
[51,] -2.52508503 2.03089569
[52,] 5.87491497 -2.52508503
[53,] 4.50824830 5.87491497
[54,] 3.52491497 4.50824830
[55,] 0.98860544 3.52491497
[56,] -3.19139456 0.98860544
[57,] 4.98860544 -3.19139456
[58,] 2.44860544 4.98860544
[59,] -2.99139456 2.44860544
[60,] -6.00890023 -2.99139456
[61,] -4.00890023 -6.00890023
[62,] -12.27556689 -4.00890023
[63,] 0.16845238 -12.27556689
[64,] -6.13154762 0.16845238
[65,] -7.79821429 -6.13154762
[66,] 2.71845238 -7.79821429
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 5.18752834 6.88752834
2 -0.87913832 5.18752834
3 2.76488095 -0.87913832
4 -1.43511905 2.76488095
5 -4.10178571 -1.43511905
6 2.01488095 -4.10178571
7 -4.12142857 2.01488095
8 -0.40142857 -4.12142857
9 -0.42142857 -0.40142857
10 -7.66142857 -0.42142857
11 -4.60142857 -7.66142857
12 -4.51893424 -4.60142857
13 -4.41893424 -4.51893424
14 0.11439909 -4.41893424
15 -2.34158163 0.11439909
16 -2.54158163 -2.34158163
17 -2.10824830 -2.54158163
18 -1.89158163 -2.10824830
19 -1.42789116 -1.89158163
20 1.49210884 -1.42789116
21 0.87210884 1.49210884
22 0.23210884 0.87210884
23 3.99210884 0.23210884
24 -3.72539683 3.99210884
25 -1.82539683 -3.72539683
26 -1.49206349 -1.82539683
27 4.25195578 -1.49206349
28 -3.04804422 4.25195578
29 1.08528912 -3.04804422
30 -3.69804422 1.08528912
31 2.36564626 -3.69804422
32 3.48564626 2.36564626
33 -8.43435374 3.48564626
34 2.72564626 -8.43435374
35 3.68564626 2.72564626
36 5.46814059 3.68564626
37 5.96814059 5.46814059
38 12.50147392 5.96814059
39 -2.31862245 12.50147392
40 7.28137755 -2.31862245
41 8.41471088 7.28137755
42 -2.66862245 8.41471088
43 2.19506803 -2.66862245
44 -1.38493197 2.19506803
45 2.99506803 -1.38493197
46 2.25506803 2.99506803
47 -0.08493197 2.25506803
48 1.89756236 -0.08493197
49 -0.90243764 1.89756236
50 2.03089569 -0.90243764
51 -2.52508503 2.03089569
52 5.87491497 -2.52508503
53 4.50824830 5.87491497
54 3.52491497 4.50824830
55 0.98860544 3.52491497
56 -3.19139456 0.98860544
57 4.98860544 -3.19139456
58 2.44860544 4.98860544
59 -2.99139456 2.44860544
60 -6.00890023 -2.99139456
61 -4.00890023 -6.00890023
62 -12.27556689 -4.00890023
63 0.16845238 -12.27556689
64 -6.13154762 0.16845238
65 -7.79821429 -6.13154762
66 2.71845238 -7.79821429
> 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/7gquw1227560693.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/8tqoc1227560693.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/9i84k1227560693.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/10hejo1227560693.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/11xgns1227560693.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/12mtis1227560694.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/13zggy1227560694.tab")
>
> system("convert tmp/1ap591227560693.ps tmp/1ap591227560693.png")
> system("convert tmp/2khqo1227560693.ps tmp/2khqo1227560693.png")
> system("convert tmp/3ko3s1227560693.ps tmp/3ko3s1227560693.png")
> system("convert tmp/4vrnx1227560693.ps tmp/4vrnx1227560693.png")
> system("convert tmp/565jm1227560693.ps tmp/565jm1227560693.png")
> system("convert tmp/626t81227560693.ps tmp/626t81227560693.png")
> system("convert tmp/7gquw1227560693.ps tmp/7gquw1227560693.png")
> system("convert tmp/8tqoc1227560693.ps tmp/8tqoc1227560693.png")
> system("convert tmp/9i84k1227560693.ps tmp/9i84k1227560693.png")
>
>
> proc.time()
user system elapsed
1.914 1.393 2.322