R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(9,700,9,081,9,084,9,743,8,587,9,731,9,563,9,998,9,437,10,038,9,918,9,252,9,737,9,035,9,133,9,487,8,700,9,627,8,947,9,283,8,829,9,947,9,628,9,318,9,605,8,640,9,214,9,567,8,547,9,185,9,470,9,123,9,278,10,170,9,434,9,655,9,429,8,739,9,552,9,687,9,019,9,672,9,206,9,069,9,788,10,312,10,105,9,863,9,656,9,295,9,946,9,701,9,049,10,190,9,706,9,765,9,893,9,994,10,433,10,073,10,112,9,266,9,820,10,097,9,115,10,411,9,678,10,408,10,153,10,368,10,581,10,597,10,680,9,738,9,556),dim=c(2,75),dimnames=list(c('y',''),1:75))
> y <- array(NA,dim=c(2,75),dimnames=list(c('y',''),1:75))
> 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'
> 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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 9 700 1 0 0 0 0 0 0 0 0 0 0 1
2 9 81 0 1 0 0 0 0 0 0 0 0 0 2
3 9 84 0 0 1 0 0 0 0 0 0 0 0 3
4 9 743 0 0 0 1 0 0 0 0 0 0 0 4
5 8 587 0 0 0 0 1 0 0 0 0 0 0 5
6 9 731 0 0 0 0 0 1 0 0 0 0 0 6
7 9 563 0 0 0 0 0 0 1 0 0 0 0 7
8 9 998 0 0 0 0 0 0 0 1 0 0 0 8
9 9 437 0 0 0 0 0 0 0 0 1 0 0 9
10 10 38 0 0 0 0 0 0 0 0 0 1 0 10
11 9 918 0 0 0 0 0 0 0 0 0 0 1 11
12 9 252 0 0 0 0 0 0 0 0 0 0 0 12
13 9 737 1 0 0 0 0 0 0 0 0 0 0 13
14 9 35 0 1 0 0 0 0 0 0 0 0 0 14
15 9 133 0 0 1 0 0 0 0 0 0 0 0 15
16 9 487 0 0 0 1 0 0 0 0 0 0 0 16
17 8 700 0 0 0 0 1 0 0 0 0 0 0 17
18 9 627 0 0 0 0 0 1 0 0 0 0 0 18
19 8 947 0 0 0 0 0 0 1 0 0 0 0 19
20 9 283 0 0 0 0 0 0 0 1 0 0 0 20
21 8 829 0 0 0 0 0 0 0 0 1 0 0 21
22 9 947 0 0 0 0 0 0 0 0 0 1 0 22
23 9 628 0 0 0 0 0 0 0 0 0 0 1 23
24 9 318 0 0 0 0 0 0 0 0 0 0 0 24
25 9 605 1 0 0 0 0 0 0 0 0 0 0 25
26 8 640 0 1 0 0 0 0 0 0 0 0 0 26
27 9 214 0 0 1 0 0 0 0 0 0 0 0 27
28 9 567 0 0 0 1 0 0 0 0 0 0 0 28
29 8 547 0 0 0 0 1 0 0 0 0 0 0 29
30 9 185 0 0 0 0 0 1 0 0 0 0 0 30
31 9 470 0 0 0 0 0 0 1 0 0 0 0 31
32 9 123 0 0 0 0 0 0 0 1 0 0 0 32
33 9 278 0 0 0 0 0 0 0 0 1 0 0 33
34 10 170 0 0 0 0 0 0 0 0 0 1 0 34
35 9 434 0 0 0 0 0 0 0 0 0 0 1 35
36 9 655 0 0 0 0 0 0 0 0 0 0 0 36
37 9 429 1 0 0 0 0 0 0 0 0 0 0 37
38 8 739 0 1 0 0 0 0 0 0 0 0 0 38
39 9 552 0 0 1 0 0 0 0 0 0 0 0 39
40 9 687 0 0 0 1 0 0 0 0 0 0 0 40
41 9 19 0 0 0 0 1 0 0 0 0 0 0 41
42 9 672 0 0 0 0 0 1 0 0 0 0 0 42
43 9 206 0 0 0 0 0 0 1 0 0 0 0 43
44 9 69 0 0 0 0 0 0 0 1 0 0 0 44
45 9 788 0 0 0 0 0 0 0 0 1 0 0 45
46 10 312 0 0 0 0 0 0 0 0 0 1 0 46
47 10 105 0 0 0 0 0 0 0 0 0 0 1 47
48 9 863 0 0 0 0 0 0 0 0 0 0 0 48
49 9 656 1 0 0 0 0 0 0 0 0 0 0 49
50 9 295 0 1 0 0 0 0 0 0 0 0 0 50
51 9 946 0 0 1 0 0 0 0 0 0 0 0 51
52 9 701 0 0 0 1 0 0 0 0 0 0 0 52
53 9 49 0 0 0 0 1 0 0 0 0 0 0 53
54 10 190 0 0 0 0 0 1 0 0 0 0 0 54
55 9 706 0 0 0 0 0 0 1 0 0 0 0 55
56 9 765 0 0 0 0 0 0 0 1 0 0 0 56
57 9 893 0 0 0 0 0 0 0 0 1 0 0 57
58 9 994 0 0 0 0 0 0 0 0 0 1 0 58
59 10 433 0 0 0 0 0 0 0 0 0 0 1 59
60 10 73 0 0 0 0 0 0 0 0 0 0 0 60
61 10 112 1 0 0 0 0 0 0 0 0 0 0 61
62 9 266 0 1 0 0 0 0 0 0 0 0 0 62
63 9 820 0 0 1 0 0 0 0 0 0 0 0 63
64 10 97 0 0 0 1 0 0 0 0 0 0 0 64
65 9 115 0 0 0 0 1 0 0 0 0 0 0 65
66 10 411 0 0 0 0 0 1 0 0 0 0 0 66
67 9 678 0 0 0 0 0 0 1 0 0 0 0 67
68 10 408 0 0 0 0 0 0 0 1 0 0 0 68
69 10 153 0 0 0 0 0 0 0 0 1 0 0 69
70 10 368 0 0 0 0 0 0 0 0 0 1 0 70
71 10 581 0 0 0 0 0 0 0 0 0 0 1 71
72 10 597 0 0 0 0 0 0 0 0 0 0 0 72
73 10 680 1 0 0 0 0 0 0 0 0 0 0 73
74 9 738 0 1 0 0 0 0 0 0 0 0 0 74
75 9 556 0 0 1 0 0 0 0 0 0 0 0 75
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) V2 M1 M2 M3 M4
9.2763443 -0.0008876 0.0966722 -0.6284846 -0.2890441 -0.0005731
M5 M6 M7 M8 M9 M10
-0.8654557 0.0750102 -0.3245145 -0.1389495 -0.2083956 0.3659803
M11 t
0.2281859 0.0110716
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.56460 -0.18603 0.04305 0.18823 0.65990
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.2763443 0.1489558 62.276 < 2e-16 ***
V2 -0.0008876 0.0001230 -7.218 9.76e-10 ***
M1 0.0966722 0.1636416 0.591 0.556867
M2 -0.6284846 0.1633165 -3.848 0.000287 ***
M3 -0.2890441 0.1630867 -1.772 0.081333 .
M4 -0.0005731 0.1699394 -0.003 0.997320
M5 -0.8654557 0.1702457 -5.084 3.77e-06 ***
M6 0.0750102 0.1694310 0.443 0.659535
M7 -0.3245145 0.1701321 -1.907 0.061176 .
M8 -0.1389495 0.1693029 -0.821 0.415004
M9 -0.2083956 0.1696937 -1.228 0.224139
M10 0.3659803 0.1692011 2.163 0.034470 *
M11 0.2281859 0.1693156 1.348 0.182740
t 0.0110716 0.0015727 7.040 1.98e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.293 on 61 degrees of freedom
Multiple R-squared: 0.7611, Adjusted R-squared: 0.7102
F-statistic: 14.95 on 13 and 61 DF, p-value: 2.25e-14
> postscript(file="/var/wessaorg/rcomp/tmp/1a0uv1322567700.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/2w5j81322567700.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/3rx4f1322567700.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/4doiu1322567700.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/5lp451322567700.ps",horizontal=F,onefile=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 = 75
Frequency = 1
1 2 3 4 5 6
0.237260422 0.401895901 0.054046760 0.339459421 0.054798390 0.231081166
7 8 9 10 11 12
0.470410654 0.659897745 0.220305754 0.280689545 0.188536269 -0.185518244
13 14 15 16 17 18
0.137243734 0.228205027 -0.035318239 -0.020636018 0.022242402 0.005907127
19 20 21 22 23 24
-0.321594680 -0.107624815 -0.564598455 -0.045304376 -0.201738956 -0.259793349
25 26 27 28 29 30
-0.112784247 -0.367631693 -0.096278732 -0.082484152 -0.246426035 -0.519289499
31 32 33 34 35 36
0.122141267 -0.382506739 -0.186547926 0.132139334 -0.506800666 -0.093517801
37 38 39 40 41 42
-0.401868423 -0.412614652 0.070884457 -0.108826655 0.152040232 -0.219867832
43 44 45 46 47 48
-0.245055298 -0.563298738 0.133289479 0.125324929 0.068306117 -0.041747914
49 50 51 52 53 54
-0.333233361 0.060413441 0.287755530 -0.229259081 0.045810058 0.219429911
55 56 57 58 59 60
0.065905698 -0.078360147 0.093632364 -0.402163451 0.226592899 0.124156466
61 62 63 64 65 66
0.051030653 -0.098187539 0.043053394 0.101746486 -0.028465047 0.282739128
67 68 69 70 71 72
-0.091807641 0.471892695 0.303918784 -0.090685981 0.225104338 0.456420842
73 74 75
0.422351223 0.187919516 -0.324143171
> postscript(file="/var/wessaorg/rcomp/tmp/6w6xf1322567700.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 75
Frequency = 1
lag(myerror, k = 1) myerror
0 0.237260422 NA
1 0.401895901 0.237260422
2 0.054046760 0.401895901
3 0.339459421 0.054046760
4 0.054798390 0.339459421
5 0.231081166 0.054798390
6 0.470410654 0.231081166
7 0.659897745 0.470410654
8 0.220305754 0.659897745
9 0.280689545 0.220305754
10 0.188536269 0.280689545
11 -0.185518244 0.188536269
12 0.137243734 -0.185518244
13 0.228205027 0.137243734
14 -0.035318239 0.228205027
15 -0.020636018 -0.035318239
16 0.022242402 -0.020636018
17 0.005907127 0.022242402
18 -0.321594680 0.005907127
19 -0.107624815 -0.321594680
20 -0.564598455 -0.107624815
21 -0.045304376 -0.564598455
22 -0.201738956 -0.045304376
23 -0.259793349 -0.201738956
24 -0.112784247 -0.259793349
25 -0.367631693 -0.112784247
26 -0.096278732 -0.367631693
27 -0.082484152 -0.096278732
28 -0.246426035 -0.082484152
29 -0.519289499 -0.246426035
30 0.122141267 -0.519289499
31 -0.382506739 0.122141267
32 -0.186547926 -0.382506739
33 0.132139334 -0.186547926
34 -0.506800666 0.132139334
35 -0.093517801 -0.506800666
36 -0.401868423 -0.093517801
37 -0.412614652 -0.401868423
38 0.070884457 -0.412614652
39 -0.108826655 0.070884457
40 0.152040232 -0.108826655
41 -0.219867832 0.152040232
42 -0.245055298 -0.219867832
43 -0.563298738 -0.245055298
44 0.133289479 -0.563298738
45 0.125324929 0.133289479
46 0.068306117 0.125324929
47 -0.041747914 0.068306117
48 -0.333233361 -0.041747914
49 0.060413441 -0.333233361
50 0.287755530 0.060413441
51 -0.229259081 0.287755530
52 0.045810058 -0.229259081
53 0.219429911 0.045810058
54 0.065905698 0.219429911
55 -0.078360147 0.065905698
56 0.093632364 -0.078360147
57 -0.402163451 0.093632364
58 0.226592899 -0.402163451
59 0.124156466 0.226592899
60 0.051030653 0.124156466
61 -0.098187539 0.051030653
62 0.043053394 -0.098187539
63 0.101746486 0.043053394
64 -0.028465047 0.101746486
65 0.282739128 -0.028465047
66 -0.091807641 0.282739128
67 0.471892695 -0.091807641
68 0.303918784 0.471892695
69 -0.090685981 0.303918784
70 0.225104338 -0.090685981
71 0.456420842 0.225104338
72 0.422351223 0.456420842
73 0.187919516 0.422351223
74 -0.324143171 0.187919516
75 NA -0.324143171
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.401895901 0.237260422
[2,] 0.054046760 0.401895901
[3,] 0.339459421 0.054046760
[4,] 0.054798390 0.339459421
[5,] 0.231081166 0.054798390
[6,] 0.470410654 0.231081166
[7,] 0.659897745 0.470410654
[8,] 0.220305754 0.659897745
[9,] 0.280689545 0.220305754
[10,] 0.188536269 0.280689545
[11,] -0.185518244 0.188536269
[12,] 0.137243734 -0.185518244
[13,] 0.228205027 0.137243734
[14,] -0.035318239 0.228205027
[15,] -0.020636018 -0.035318239
[16,] 0.022242402 -0.020636018
[17,] 0.005907127 0.022242402
[18,] -0.321594680 0.005907127
[19,] -0.107624815 -0.321594680
[20,] -0.564598455 -0.107624815
[21,] -0.045304376 -0.564598455
[22,] -0.201738956 -0.045304376
[23,] -0.259793349 -0.201738956
[24,] -0.112784247 -0.259793349
[25,] -0.367631693 -0.112784247
[26,] -0.096278732 -0.367631693
[27,] -0.082484152 -0.096278732
[28,] -0.246426035 -0.082484152
[29,] -0.519289499 -0.246426035
[30,] 0.122141267 -0.519289499
[31,] -0.382506739 0.122141267
[32,] -0.186547926 -0.382506739
[33,] 0.132139334 -0.186547926
[34,] -0.506800666 0.132139334
[35,] -0.093517801 -0.506800666
[36,] -0.401868423 -0.093517801
[37,] -0.412614652 -0.401868423
[38,] 0.070884457 -0.412614652
[39,] -0.108826655 0.070884457
[40,] 0.152040232 -0.108826655
[41,] -0.219867832 0.152040232
[42,] -0.245055298 -0.219867832
[43,] -0.563298738 -0.245055298
[44,] 0.133289479 -0.563298738
[45,] 0.125324929 0.133289479
[46,] 0.068306117 0.125324929
[47,] -0.041747914 0.068306117
[48,] -0.333233361 -0.041747914
[49,] 0.060413441 -0.333233361
[50,] 0.287755530 0.060413441
[51,] -0.229259081 0.287755530
[52,] 0.045810058 -0.229259081
[53,] 0.219429911 0.045810058
[54,] 0.065905698 0.219429911
[55,] -0.078360147 0.065905698
[56,] 0.093632364 -0.078360147
[57,] -0.402163451 0.093632364
[58,] 0.226592899 -0.402163451
[59,] 0.124156466 0.226592899
[60,] 0.051030653 0.124156466
[61,] -0.098187539 0.051030653
[62,] 0.043053394 -0.098187539
[63,] 0.101746486 0.043053394
[64,] -0.028465047 0.101746486
[65,] 0.282739128 -0.028465047
[66,] -0.091807641 0.282739128
[67,] 0.471892695 -0.091807641
[68,] 0.303918784 0.471892695
[69,] -0.090685981 0.303918784
[70,] 0.225104338 -0.090685981
[71,] 0.456420842 0.225104338
[72,] 0.422351223 0.456420842
[73,] 0.187919516 0.422351223
[74,] -0.324143171 0.187919516
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.401895901 0.237260422
2 0.054046760 0.401895901
3 0.339459421 0.054046760
4 0.054798390 0.339459421
5 0.231081166 0.054798390
6 0.470410654 0.231081166
7 0.659897745 0.470410654
8 0.220305754 0.659897745
9 0.280689545 0.220305754
10 0.188536269 0.280689545
11 -0.185518244 0.188536269
12 0.137243734 -0.185518244
13 0.228205027 0.137243734
14 -0.035318239 0.228205027
15 -0.020636018 -0.035318239
16 0.022242402 -0.020636018
17 0.005907127 0.022242402
18 -0.321594680 0.005907127
19 -0.107624815 -0.321594680
20 -0.564598455 -0.107624815
21 -0.045304376 -0.564598455
22 -0.201738956 -0.045304376
23 -0.259793349 -0.201738956
24 -0.112784247 -0.259793349
25 -0.367631693 -0.112784247
26 -0.096278732 -0.367631693
27 -0.082484152 -0.096278732
28 -0.246426035 -0.082484152
29 -0.519289499 -0.246426035
30 0.122141267 -0.519289499
31 -0.382506739 0.122141267
32 -0.186547926 -0.382506739
33 0.132139334 -0.186547926
34 -0.506800666 0.132139334
35 -0.093517801 -0.506800666
36 -0.401868423 -0.093517801
37 -0.412614652 -0.401868423
38 0.070884457 -0.412614652
39 -0.108826655 0.070884457
40 0.152040232 -0.108826655
41 -0.219867832 0.152040232
42 -0.245055298 -0.219867832
43 -0.563298738 -0.245055298
44 0.133289479 -0.563298738
45 0.125324929 0.133289479
46 0.068306117 0.125324929
47 -0.041747914 0.068306117
48 -0.333233361 -0.041747914
49 0.060413441 -0.333233361
50 0.287755530 0.060413441
51 -0.229259081 0.287755530
52 0.045810058 -0.229259081
53 0.219429911 0.045810058
54 0.065905698 0.219429911
55 -0.078360147 0.065905698
56 0.093632364 -0.078360147
57 -0.402163451 0.093632364
58 0.226592899 -0.402163451
59 0.124156466 0.226592899
60 0.051030653 0.124156466
61 -0.098187539 0.051030653
62 0.043053394 -0.098187539
63 0.101746486 0.043053394
64 -0.028465047 0.101746486
65 0.282739128 -0.028465047
66 -0.091807641 0.282739128
67 0.471892695 -0.091807641
68 0.303918784 0.471892695
69 -0.090685981 0.303918784
70 0.225104338 -0.090685981
71 0.456420842 0.225104338
72 0.422351223 0.456420842
73 0.187919516 0.422351223
74 -0.324143171 0.187919516
> 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/wessaorg/rcomp/tmp/7f36o1322567700.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/839fd1322567700.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/9aa971322567700.ps",horizontal=F,onefile=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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/10ftf71322567700.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/wessaorg/rcomp/tmp/11rkm51322567700.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/wessaorg/rcomp/tmp/1294zu1322567700.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/wessaorg/rcomp/tmp/13t40q1322567700.tab")
>
> try(system("convert tmp/1a0uv1322567700.ps tmp/1a0uv1322567700.png",intern=TRUE))
character(0)
> try(system("convert tmp/2w5j81322567700.ps tmp/2w5j81322567700.png",intern=TRUE))
character(0)
> try(system("convert tmp/3rx4f1322567700.ps tmp/3rx4f1322567700.png",intern=TRUE))
character(0)
> try(system("convert tmp/4doiu1322567700.ps tmp/4doiu1322567700.png",intern=TRUE))
character(0)
> try(system("convert tmp/5lp451322567700.ps tmp/5lp451322567700.png",intern=TRUE))
character(0)
> try(system("convert tmp/6w6xf1322567700.ps tmp/6w6xf1322567700.png",intern=TRUE))
character(0)
> try(system("convert tmp/7f36o1322567700.ps tmp/7f36o1322567700.png",intern=TRUE))
character(0)
> try(system("convert tmp/839fd1322567700.ps tmp/839fd1322567700.png",intern=TRUE))
character(0)
> try(system("convert tmp/9aa971322567700.ps tmp/9aa971322567700.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.231 0.563 3.851