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(106.7
+ ,97.3
+ ,0
+ ,104.8
+ ,93.5
+ ,110.2
+ ,101
+ ,0
+ ,105.6
+ ,94.7
+ ,125.9
+ ,113.2
+ ,0
+ ,118.3
+ ,112.9
+ ,100.1
+ ,101
+ ,0
+ ,89.9
+ ,99.2
+ ,106.4
+ ,105.7
+ ,0
+ ,90.2
+ ,105.6
+ ,114.8
+ ,113.9
+ ,0
+ ,107
+ ,113
+ ,81.3
+ ,86.4
+ ,0
+ ,64.5
+ ,83.1
+ ,87
+ ,96.5
+ ,0
+ ,92.6
+ ,81.1
+ ,104.2
+ ,103.3
+ ,0
+ ,95.8
+ ,96.9
+ ,108
+ ,114.9
+ ,0
+ ,94.3
+ ,104.3
+ ,105
+ ,105.8
+ ,0
+ ,91.2
+ ,97.7
+ ,94.5
+ ,94.2
+ ,0
+ ,86.3
+ ,102.6
+ ,92
+ ,98.4
+ ,0
+ ,77.6
+ ,89.9
+ ,95.9
+ ,99.4
+ ,0
+ ,82.5
+ ,96
+ ,108.8
+ ,108.8
+ ,0
+ ,97.7
+ ,112.7
+ ,103.4
+ ,112.6
+ ,0
+ ,83.3
+ ,107.1
+ ,102.1
+ ,104.4
+ ,0
+ ,84.2
+ ,106.2
+ ,110.1
+ ,112.2
+ ,0
+ ,92.8
+ ,121
+ ,83.2
+ ,81.1
+ ,0
+ ,77.4
+ ,101.2
+ ,82.7
+ ,97.1
+ ,0
+ ,72.5
+ ,83.2
+ ,106.8
+ ,112.6
+ ,0
+ ,88.8
+ ,105.1
+ ,113.7
+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118.5
+ ,133.2
+ ,1
+ ,90.4
+ ,146
+ ,133.5
+ ,146.6
+ ,1
+ ,97.1
+ ,154.6
+ ,102.1
+ ,103.4
+ ,1
+ ,79.4
+ ,142.1
+ ,102.4
+ ,117.2
+ ,1
+ ,85
+ ,120.5)
+ ,dim=c(5
+ ,80)
+ ,dimnames=list(c('Totaal'
+ ,'metaal'
+ ,'conjunctuur'
+ ,'elektrische'
+ ,'mac')
+ ,1:80))
> y <- array(NA,dim=c(5,80),dimnames=list(c('Totaal','metaal','conjunctuur','elektrische','mac'),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 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '2'
> #'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
metaal Totaal conjunctuur elektrische mac
1 97.3 106.7 0 104.8 93.5
2 101.0 110.2 0 105.6 94.7
3 113.2 125.9 0 118.3 112.9
4 101.0 100.1 0 89.9 99.2
5 105.7 106.4 0 90.2 105.6
6 113.9 114.8 0 107.0 113.0
7 86.4 81.3 0 64.5 83.1
8 96.5 87.0 0 92.6 81.1
9 103.3 104.2 0 95.8 96.9
10 114.9 108.0 0 94.3 104.3
11 105.8 105.0 0 91.2 97.7
12 94.2 94.5 0 86.3 102.6
13 98.4 92.0 0 77.6 89.9
14 99.4 95.9 0 82.5 96.0
15 108.8 108.8 0 97.7 112.7
16 112.6 103.4 0 83.3 107.1
17 104.4 102.1 0 84.2 106.2
18 112.2 110.1 0 92.8 121.0
19 81.1 83.2 0 77.4 101.2
20 97.1 82.7 0 72.5 83.2
21 112.6 106.8 0 88.8 105.1
22 113.8 113.7 0 93.4 113.3
23 107.8 102.5 0 92.6 99.1
24 103.2 96.6 0 90.7 100.3
25 103.3 92.1 0 81.6 93.5
26 101.2 95.6 0 84.1 98.8
27 107.7 102.3 0 88.1 106.2
28 110.4 98.6 0 85.3 98.3
29 101.9 98.2 0 82.9 102.1
30 115.9 104.5 0 84.8 117.1
31 89.9 84.0 0 71.2 101.5
32 88.6 73.8 0 68.9 80.5
33 117.2 103.9 0 94.3 105.9
34 123.9 106.0 0 97.6 109.5
35 100.0 97.2 0 85.6 97.2
36 103.6 102.6 0 91.9 114.5
37 94.1 89.0 0 75.8 93.5
38 98.7 93.8 0 79.8 100.9
39 119.5 116.7 0 99.0 121.1
40 112.7 106.8 0 88.5 116.5
41 104.4 98.5 0 86.7 109.3
42 124.7 118.7 0 97.9 118.1
43 89.1 90.0 0 94.3 108.3
44 97.0 91.9 0 72.9 105.4
45 121.6 113.3 0 91.8 116.2
46 118.8 113.1 0 93.2 111.2
47 114.0 104.1 0 86.5 105.8
48 111.5 108.7 0 98.9 122.7
49 97.2 96.7 0 77.2 99.5
50 102.5 101.0 0 79.4 107.9
51 113.4 116.9 0 90.4 124.6
52 109.8 105.8 0 81.4 115.0
53 104.9 99.0 0 85.8 110.3
54 126.1 129.4 0 103.6 132.7
55 80.0 83.0 0 73.6 99.7
56 96.8 88.9 0 75.7 96.5
57 117.2 115.9 1 99.2 118.7
58 112.3 104.2 1 88.7 112.9
59 117.3 113.4 1 94.6 130.5
60 111.1 112.2 1 98.7 137.9
61 102.2 100.8 1 84.2 115.0
62 104.3 107.3 1 87.7 116.8
63 122.9 126.6 1 103.3 140.9
64 107.6 102.9 1 88.2 120.7
65 121.3 117.9 1 93.4 134.2
66 131.5 128.8 1 106.3 147.3
67 89.0 87.5 1 73.1 112.4
68 104.4 93.8 1 78.6 107.1
69 128.9 122.7 1 101.6 128.4
70 135.9 126.2 1 101.4 137.7
71 133.3 124.6 1 98.5 135.0
72 121.3 116.7 1 99.0 151.0
73 120.5 115.2 1 89.5 137.4
74 120.4 111.1 1 83.5 132.4
75 137.9 129.9 1 97.4 161.3
76 126.1 113.3 1 87.8 139.8
77 133.2 118.5 1 90.4 146.0
78 146.6 133.5 1 97.1 154.6
79 103.4 102.1 1 79.4 142.1
80 117.2 102.4 1 85.0 120.5
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Totaal conjunctuur elektrische mac
20.867586 1.125940 1.608872 -0.339737 0.001581
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-9.4736 -2.8029 -0.4728 2.9475 16.6680
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 20.867586 6.164896 3.385 0.00114 **
Totaal 1.125940 0.137513 8.188 5.24e-12 ***
conjunctuur 1.608872 2.003933 0.803 0.42459
elektrische -0.339737 0.117824 -2.883 0.00513 **
mac 0.001581 0.083851 0.019 0.98501
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.316 on 75 degrees of freedom
Multiple R-Squared: 0.8461, Adjusted R-squared: 0.8379
F-statistic: 103.1 on 4 and 75 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/rcomp/tmp/145au1196781018.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/2dxz01196781018.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/3qotv1196781018.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/4cuyw1196781018.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/5imct1196781018.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
-8.24873642 -8.21963356 -9.41099893 -2.18862224 -4.49023888 -0.05225049
7 8 9 10 11 12
-4.22482132 9.00709004 -2.49689292 4.30323336 -2.46169934 -3.91178524
13 14 15 16 17 18
0.16742672 -1.56866979 -1.55568992 3.44102531 -2.98806691 -1.29724178
19 20 21 22 23 24
-7.31010925 7.61660019 1.48454369 -3.53461313 2.82656957 4.22221867
25 26 27 28 29 30
6.30809041 1.10826570 1.41171918 7.33892033 -1.53207856 5.99629091
31 32 33 34 35 36
-1.51770449 7.91868075 11.21705842 16.66802625 -1.38110395 -1.74818126
37 38 39 40 41 42
-1.37196988 -0.82923040 0.67776523 1.46460396 1.90975965 3.25691634
43 44 45 46 47 48
-1.23616899 -2.74124195 4.16760007 2.07632270 5.14208030 1.64878260
49 50 51 52 53 54
-6.47555964 -5.28295724 -8.57469254 -2.71921748 1.53944581 -5.47721756
55 56 57 58 59 60
-9.47355077 1.40190868 -2.25861420 2.45681323 -0.92520502 -4.39285185
61 62 63 64 65 66
-5.34712625 -9.37950198 -7.24833963 -0.96166178 -2.40546751 -0.11631252
67 68 69 70 71 72
-7.33909485 2.84441344 2.58503083 5.56159403 3.78212846 0.82163361
73 74 75 76 77 78
-1.49546146 0.99037377 1.99936651 5.66247833 7.78110678 6.55465133
79 80
-7.28441937 8.11446611
> postscript(file="/var/www/html/rcomp/tmp/6op0p1196781018.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 -8.24873642 NA
1 -8.21963356 -8.24873642
2 -9.41099893 -8.21963356
3 -2.18862224 -9.41099893
4 -4.49023888 -2.18862224
5 -0.05225049 -4.49023888
6 -4.22482132 -0.05225049
7 9.00709004 -4.22482132
8 -2.49689292 9.00709004
9 4.30323336 -2.49689292
10 -2.46169934 4.30323336
11 -3.91178524 -2.46169934
12 0.16742672 -3.91178524
13 -1.56866979 0.16742672
14 -1.55568992 -1.56866979
15 3.44102531 -1.55568992
16 -2.98806691 3.44102531
17 -1.29724178 -2.98806691
18 -7.31010925 -1.29724178
19 7.61660019 -7.31010925
20 1.48454369 7.61660019
21 -3.53461313 1.48454369
22 2.82656957 -3.53461313
23 4.22221867 2.82656957
24 6.30809041 4.22221867
25 1.10826570 6.30809041
26 1.41171918 1.10826570
27 7.33892033 1.41171918
28 -1.53207856 7.33892033
29 5.99629091 -1.53207856
30 -1.51770449 5.99629091
31 7.91868075 -1.51770449
32 11.21705842 7.91868075
33 16.66802625 11.21705842
34 -1.38110395 16.66802625
35 -1.74818126 -1.38110395
36 -1.37196988 -1.74818126
37 -0.82923040 -1.37196988
38 0.67776523 -0.82923040
39 1.46460396 0.67776523
40 1.90975965 1.46460396
41 3.25691634 1.90975965
42 -1.23616899 3.25691634
43 -2.74124195 -1.23616899
44 4.16760007 -2.74124195
45 2.07632270 4.16760007
46 5.14208030 2.07632270
47 1.64878260 5.14208030
48 -6.47555964 1.64878260
49 -5.28295724 -6.47555964
50 -8.57469254 -5.28295724
51 -2.71921748 -8.57469254
52 1.53944581 -2.71921748
53 -5.47721756 1.53944581
54 -9.47355077 -5.47721756
55 1.40190868 -9.47355077
56 -2.25861420 1.40190868
57 2.45681323 -2.25861420
58 -0.92520502 2.45681323
59 -4.39285185 -0.92520502
60 -5.34712625 -4.39285185
61 -9.37950198 -5.34712625
62 -7.24833963 -9.37950198
63 -0.96166178 -7.24833963
64 -2.40546751 -0.96166178
65 -0.11631252 -2.40546751
66 -7.33909485 -0.11631252
67 2.84441344 -7.33909485
68 2.58503083 2.84441344
69 5.56159403 2.58503083
70 3.78212846 5.56159403
71 0.82163361 3.78212846
72 -1.49546146 0.82163361
73 0.99037377 -1.49546146
74 1.99936651 0.99037377
75 5.66247833 1.99936651
76 7.78110678 5.66247833
77 6.55465133 7.78110678
78 -7.28441937 6.55465133
79 8.11446611 -7.28441937
80 NA 8.11446611
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -8.21963356 -8.24873642
[2,] -9.41099893 -8.21963356
[3,] -2.18862224 -9.41099893
[4,] -4.49023888 -2.18862224
[5,] -0.05225049 -4.49023888
[6,] -4.22482132 -0.05225049
[7,] 9.00709004 -4.22482132
[8,] -2.49689292 9.00709004
[9,] 4.30323336 -2.49689292
[10,] -2.46169934 4.30323336
[11,] -3.91178524 -2.46169934
[12,] 0.16742672 -3.91178524
[13,] -1.56866979 0.16742672
[14,] -1.55568992 -1.56866979
[15,] 3.44102531 -1.55568992
[16,] -2.98806691 3.44102531
[17,] -1.29724178 -2.98806691
[18,] -7.31010925 -1.29724178
[19,] 7.61660019 -7.31010925
[20,] 1.48454369 7.61660019
[21,] -3.53461313 1.48454369
[22,] 2.82656957 -3.53461313
[23,] 4.22221867 2.82656957
[24,] 6.30809041 4.22221867
[25,] 1.10826570 6.30809041
[26,] 1.41171918 1.10826570
[27,] 7.33892033 1.41171918
[28,] -1.53207856 7.33892033
[29,] 5.99629091 -1.53207856
[30,] -1.51770449 5.99629091
[31,] 7.91868075 -1.51770449
[32,] 11.21705842 7.91868075
[33,] 16.66802625 11.21705842
[34,] -1.38110395 16.66802625
[35,] -1.74818126 -1.38110395
[36,] -1.37196988 -1.74818126
[37,] -0.82923040 -1.37196988
[38,] 0.67776523 -0.82923040
[39,] 1.46460396 0.67776523
[40,] 1.90975965 1.46460396
[41,] 3.25691634 1.90975965
[42,] -1.23616899 3.25691634
[43,] -2.74124195 -1.23616899
[44,] 4.16760007 -2.74124195
[45,] 2.07632270 4.16760007
[46,] 5.14208030 2.07632270
[47,] 1.64878260 5.14208030
[48,] -6.47555964 1.64878260
[49,] -5.28295724 -6.47555964
[50,] -8.57469254 -5.28295724
[51,] -2.71921748 -8.57469254
[52,] 1.53944581 -2.71921748
[53,] -5.47721756 1.53944581
[54,] -9.47355077 -5.47721756
[55,] 1.40190868 -9.47355077
[56,] -2.25861420 1.40190868
[57,] 2.45681323 -2.25861420
[58,] -0.92520502 2.45681323
[59,] -4.39285185 -0.92520502
[60,] -5.34712625 -4.39285185
[61,] -9.37950198 -5.34712625
[62,] -7.24833963 -9.37950198
[63,] -0.96166178 -7.24833963
[64,] -2.40546751 -0.96166178
[65,] -0.11631252 -2.40546751
[66,] -7.33909485 -0.11631252
[67,] 2.84441344 -7.33909485
[68,] 2.58503083 2.84441344
[69,] 5.56159403 2.58503083
[70,] 3.78212846 5.56159403
[71,] 0.82163361 3.78212846
[72,] -1.49546146 0.82163361
[73,] 0.99037377 -1.49546146
[74,] 1.99936651 0.99037377
[75,] 5.66247833 1.99936651
[76,] 7.78110678 5.66247833
[77,] 6.55465133 7.78110678
[78,] -7.28441937 6.55465133
[79,] 8.11446611 -7.28441937
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -8.21963356 -8.24873642
2 -9.41099893 -8.21963356
3 -2.18862224 -9.41099893
4 -4.49023888 -2.18862224
5 -0.05225049 -4.49023888
6 -4.22482132 -0.05225049
7 9.00709004 -4.22482132
8 -2.49689292 9.00709004
9 4.30323336 -2.49689292
10 -2.46169934 4.30323336
11 -3.91178524 -2.46169934
12 0.16742672 -3.91178524
13 -1.56866979 0.16742672
14 -1.55568992 -1.56866979
15 3.44102531 -1.55568992
16 -2.98806691 3.44102531
17 -1.29724178 -2.98806691
18 -7.31010925 -1.29724178
19 7.61660019 -7.31010925
20 1.48454369 7.61660019
21 -3.53461313 1.48454369
22 2.82656957 -3.53461313
23 4.22221867 2.82656957
24 6.30809041 4.22221867
25 1.10826570 6.30809041
26 1.41171918 1.10826570
27 7.33892033 1.41171918
28 -1.53207856 7.33892033
29 5.99629091 -1.53207856
30 -1.51770449 5.99629091
31 7.91868075 -1.51770449
32 11.21705842 7.91868075
33 16.66802625 11.21705842
34 -1.38110395 16.66802625
35 -1.74818126 -1.38110395
36 -1.37196988 -1.74818126
37 -0.82923040 -1.37196988
38 0.67776523 -0.82923040
39 1.46460396 0.67776523
40 1.90975965 1.46460396
41 3.25691634 1.90975965
42 -1.23616899 3.25691634
43 -2.74124195 -1.23616899
44 4.16760007 -2.74124195
45 2.07632270 4.16760007
46 5.14208030 2.07632270
47 1.64878260 5.14208030
48 -6.47555964 1.64878260
49 -5.28295724 -6.47555964
50 -8.57469254 -5.28295724
51 -2.71921748 -8.57469254
52 1.53944581 -2.71921748
53 -5.47721756 1.53944581
54 -9.47355077 -5.47721756
55 1.40190868 -9.47355077
56 -2.25861420 1.40190868
57 2.45681323 -2.25861420
58 -0.92520502 2.45681323
59 -4.39285185 -0.92520502
60 -5.34712625 -4.39285185
61 -9.37950198 -5.34712625
62 -7.24833963 -9.37950198
63 -0.96166178 -7.24833963
64 -2.40546751 -0.96166178
65 -0.11631252 -2.40546751
66 -7.33909485 -0.11631252
67 2.84441344 -7.33909485
68 2.58503083 2.84441344
69 5.56159403 2.58503083
70 3.78212846 5.56159403
71 0.82163361 3.78212846
72 -1.49546146 0.82163361
73 0.99037377 -1.49546146
74 1.99936651 0.99037377
75 5.66247833 1.99936651
76 7.78110678 5.66247833
77 6.55465133 7.78110678
78 -7.28441937 6.55465133
79 8.11446611 -7.28441937
> 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/7mz351196781018.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/8trid1196781018.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/9kk4b1196781018.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/10gg251196781018.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/11blwd1196781019.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/12klj31196781019.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/135fz41196781019.tab")
>
> system("convert tmp/145au1196781018.ps tmp/145au1196781018.png")
> system("convert tmp/2dxz01196781018.ps tmp/2dxz01196781018.png")
> system("convert tmp/3qotv1196781018.ps tmp/3qotv1196781018.png")
> system("convert tmp/4cuyw1196781018.ps tmp/4cuyw1196781018.png")
> system("convert tmp/5imct1196781018.ps tmp/5imct1196781018.png")
> system("convert tmp/6op0p1196781018.ps tmp/6op0p1196781018.png")
> system("convert tmp/7mz351196781018.ps tmp/7mz351196781018.png")
> system("convert tmp/8trid1196781018.ps tmp/8trid1196781018.png")
> system("convert tmp/9kk4b1196781018.ps tmp/9kk4b1196781018.png")
>
>
> proc.time()
user system elapsed
2.399 1.464 2.891