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('Tot'
+ ,'Prod'
+ ,'Conjun'
+ ,'Mach'
+ ,'Elek
')
+ ,1:80))
> y <- array(NA,dim=c(5,80),dimnames=list(c('Tot','Prod','Conjun','Mach','Elek
'),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 = '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
Prod Tot Conjun Mach Elek\r t
1 97.3 106.7 0 104.8 93.5 1
2 101.0 110.2 0 105.6 94.7 2
3 113.2 125.9 0 118.3 112.9 3
4 101.0 100.1 0 89.9 99.2 4
5 105.7 106.4 0 90.2 105.6 5
6 113.9 114.8 0 107.0 113.0 6
7 86.4 81.3 0 64.5 83.1 7
8 96.5 87.0 0 92.6 81.1 8
9 103.3 104.2 0 95.8 96.9 9
10 114.9 108.0 0 94.3 104.3 10
11 105.8 105.0 0 91.2 97.7 11
12 94.2 94.5 0 86.3 102.6 12
13 98.4 92.0 0 77.6 89.9 13
14 99.4 95.9 0 82.5 96.0 14
15 108.8 108.8 0 97.7 112.7 15
16 112.6 103.4 0 83.3 107.1 16
17 104.4 102.1 0 84.2 106.2 17
18 112.2 110.1 0 92.8 121.0 18
19 81.1 83.2 0 77.4 101.2 19
20 97.1 82.7 0 72.5 83.2 20
21 112.6 106.8 0 88.8 105.1 21
22 113.8 113.7 0 93.4 113.3 22
23 107.8 102.5 0 92.6 99.1 23
24 103.2 96.6 0 90.7 100.3 24
25 103.3 92.1 0 81.6 93.5 25
26 101.2 95.6 0 84.1 98.8 26
27 107.7 102.3 0 88.1 106.2 27
28 110.4 98.6 0 85.3 98.3 28
29 101.9 98.2 0 82.9 102.1 29
30 115.9 104.5 0 84.8 117.1 30
31 89.9 84.0 0 71.2 101.5 31
32 88.6 73.8 0 68.9 80.5 32
33 117.2 103.9 0 94.3 105.9 33
34 123.9 106.0 0 97.6 109.5 34
35 100.0 97.2 0 85.6 97.2 35
36 103.6 102.6 0 91.9 114.5 36
37 94.1 89.0 0 75.8 93.5 37
38 98.7 93.8 0 79.8 100.9 38
39 119.5 116.7 0 99.0 121.1 39
40 112.7 106.8 0 88.5 116.5 40
41 104.4 98.5 0 86.7 109.3 41
42 124.7 118.7 0 97.9 118.1 42
43 89.1 90.0 0 94.3 108.3 43
44 97.0 91.9 0 72.9 105.4 44
45 121.6 113.3 0 91.8 116.2 45
46 118.8 113.1 0 93.2 111.2 46
47 114.0 104.1 0 86.5 105.8 47
48 111.5 108.7 0 98.9 122.7 48
49 97.2 96.7 0 77.2 99.5 49
50 102.5 101.0 0 79.4 107.9 50
51 113.4 116.9 0 90.4 124.6 51
52 109.8 105.8 0 81.4 115.0 52
53 104.9 99.0 0 85.8 110.3 53
54 126.1 129.4 0 103.6 132.7 54
55 80.0 83.0 0 73.6 99.7 55
56 96.8 88.9 0 75.7 96.5 56
57 117.2 115.9 1 99.2 118.7 57
58 112.3 104.2 1 88.7 112.9 58
59 117.3 113.4 1 94.6 130.5 59
60 111.1 112.2 1 98.7 137.9 60
61 102.2 100.8 1 84.2 115.0 61
62 104.3 107.3 1 87.7 116.8 62
63 122.9 126.6 1 103.3 140.9 63
64 107.6 102.9 1 88.2 120.7 64
65 121.3 117.9 1 93.4 134.2 65
66 131.5 128.8 1 106.3 147.3 66
67 89.0 87.5 1 73.1 112.4 67
68 104.4 93.8 1 78.6 107.1 68
69 128.9 122.7 1 101.6 128.4 69
70 135.9 126.2 1 101.4 137.7 70
71 133.3 124.6 1 98.5 135.0 71
72 121.3 116.7 1 99.0 151.0 72
73 120.5 115.2 1 89.5 137.4 73
74 120.4 111.1 1 83.5 132.4 74
75 137.9 129.9 1 97.4 161.3 75
76 126.1 113.3 1 87.8 139.8 76
77 133.2 118.5 1 90.4 146.0 77
78 146.6 133.5 1 97.1 154.6 78
79 103.4 102.1 1 79.4 142.1 79
80 117.2 102.4 1 85.0 120.5 80
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Tot Conjun Mach `Elek\r` t
19.19689 1.13373 -0.26464 -0.26463 -0.07827 0.09249
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-11.1032 -2.5096 -0.2529 2.6872 15.7815
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 19.19689 6.17354 3.110 0.00266 **
Tot 1.13373 0.13597 8.338 2.97e-12 ***
Conjun -0.26464 2.27498 -0.116 0.90771
Mach -0.26463 0.12479 -2.121 0.03731 *
`Elek\r` -0.07827 0.09562 -0.819 0.41570
t 0.09249 0.05528 1.673 0.09853 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.254 on 74 degrees of freedom
Multiple R-Squared: 0.8517, Adjusted R-squared: 0.8417
F-statistic: 85 on 5 and 74 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/rcomp/tmp/1bzr61196892109.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/22g4a1196892109.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/3meeg1196892109.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/4cg6z1196892109.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/5z1431196892109.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
-7.90692108 -7.96183115 -8.86857441 -0.49862780 -2.45329290 1.15584988
7 8 9 10 11 12
-2.04370880 8.78107530 -1.92807014 5.45351917 -1.67470796 -2.37623106
13 14 15 16 17 18
1.26932459 -0.47058655 -0.45872620 5.12196001 -1.52896142 0.54290461
19 20 21 22 23 24
-5.77731757 7.99155063 2.10375561 -2.75236149 2.52977875 4.11740481
25 26 27 28 29 30
6.28634482 1.20220211 1.65143893 7.09446050 -1.38222811 7.05961791
31 32 33 34 35 36
-0.61139912 7.30784861 10.39974801 15.78146967 -2.37246149 -1.96588031
37 38 39 40 41 42
-2.04383114 -1.34051331 0.06652999 1.25930534 1.23688637 2.19570948
43 44 45 46 47 48
-2.67850970 -2.91510332 3.17742136 0.49081519 3.60620922 0.40269697
49 50 51 52 53 54
-7.94332492 -6.37120638 -9.37196524 -3.61311594 -0.09975970 -6.99395745
55 56 57 58 59 60
-11.10321781 -0.77943537 -2.86159933 2.17796260 -0.40598911 -3.67384734
61 62 63 64 65 66
-5.37130150 -9.66593497 -7.02489100 -1.12495788 -2.09066444 0.09823938
67 68 69 70 71 72
-7.18854777 2.01711691 1.41348140 5.02791493 3.17064157 1.41919746
73 74 75 76 77 78
-1.35111767 1.12556182 3.15928822 5.86346750 8.14889328 6.89661526
79 80
-6.45912371 6.69959438
> postscript(file="/var/www/html/rcomp/tmp/66hpt1196892109.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 -7.90692108 NA
1 -7.96183115 -7.90692108
2 -8.86857441 -7.96183115
3 -0.49862780 -8.86857441
4 -2.45329290 -0.49862780
5 1.15584988 -2.45329290
6 -2.04370880 1.15584988
7 8.78107530 -2.04370880
8 -1.92807014 8.78107530
9 5.45351917 -1.92807014
10 -1.67470796 5.45351917
11 -2.37623106 -1.67470796
12 1.26932459 -2.37623106
13 -0.47058655 1.26932459
14 -0.45872620 -0.47058655
15 5.12196001 -0.45872620
16 -1.52896142 5.12196001
17 0.54290461 -1.52896142
18 -5.77731757 0.54290461
19 7.99155063 -5.77731757
20 2.10375561 7.99155063
21 -2.75236149 2.10375561
22 2.52977875 -2.75236149
23 4.11740481 2.52977875
24 6.28634482 4.11740481
25 1.20220211 6.28634482
26 1.65143893 1.20220211
27 7.09446050 1.65143893
28 -1.38222811 7.09446050
29 7.05961791 -1.38222811
30 -0.61139912 7.05961791
31 7.30784861 -0.61139912
32 10.39974801 7.30784861
33 15.78146967 10.39974801
34 -2.37246149 15.78146967
35 -1.96588031 -2.37246149
36 -2.04383114 -1.96588031
37 -1.34051331 -2.04383114
38 0.06652999 -1.34051331
39 1.25930534 0.06652999
40 1.23688637 1.25930534
41 2.19570948 1.23688637
42 -2.67850970 2.19570948
43 -2.91510332 -2.67850970
44 3.17742136 -2.91510332
45 0.49081519 3.17742136
46 3.60620922 0.49081519
47 0.40269697 3.60620922
48 -7.94332492 0.40269697
49 -6.37120638 -7.94332492
50 -9.37196524 -6.37120638
51 -3.61311594 -9.37196524
52 -0.09975970 -3.61311594
53 -6.99395745 -0.09975970
54 -11.10321781 -6.99395745
55 -0.77943537 -11.10321781
56 -2.86159933 -0.77943537
57 2.17796260 -2.86159933
58 -0.40598911 2.17796260
59 -3.67384734 -0.40598911
60 -5.37130150 -3.67384734
61 -9.66593497 -5.37130150
62 -7.02489100 -9.66593497
63 -1.12495788 -7.02489100
64 -2.09066444 -1.12495788
65 0.09823938 -2.09066444
66 -7.18854777 0.09823938
67 2.01711691 -7.18854777
68 1.41348140 2.01711691
69 5.02791493 1.41348140
70 3.17064157 5.02791493
71 1.41919746 3.17064157
72 -1.35111767 1.41919746
73 1.12556182 -1.35111767
74 3.15928822 1.12556182
75 5.86346750 3.15928822
76 8.14889328 5.86346750
77 6.89661526 8.14889328
78 -6.45912371 6.89661526
79 6.69959438 -6.45912371
80 NA 6.69959438
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -7.96183115 -7.90692108
[2,] -8.86857441 -7.96183115
[3,] -0.49862780 -8.86857441
[4,] -2.45329290 -0.49862780
[5,] 1.15584988 -2.45329290
[6,] -2.04370880 1.15584988
[7,] 8.78107530 -2.04370880
[8,] -1.92807014 8.78107530
[9,] 5.45351917 -1.92807014
[10,] -1.67470796 5.45351917
[11,] -2.37623106 -1.67470796
[12,] 1.26932459 -2.37623106
[13,] -0.47058655 1.26932459
[14,] -0.45872620 -0.47058655
[15,] 5.12196001 -0.45872620
[16,] -1.52896142 5.12196001
[17,] 0.54290461 -1.52896142
[18,] -5.77731757 0.54290461
[19,] 7.99155063 -5.77731757
[20,] 2.10375561 7.99155063
[21,] -2.75236149 2.10375561
[22,] 2.52977875 -2.75236149
[23,] 4.11740481 2.52977875
[24,] 6.28634482 4.11740481
[25,] 1.20220211 6.28634482
[26,] 1.65143893 1.20220211
[27,] 7.09446050 1.65143893
[28,] -1.38222811 7.09446050
[29,] 7.05961791 -1.38222811
[30,] -0.61139912 7.05961791
[31,] 7.30784861 -0.61139912
[32,] 10.39974801 7.30784861
[33,] 15.78146967 10.39974801
[34,] -2.37246149 15.78146967
[35,] -1.96588031 -2.37246149
[36,] -2.04383114 -1.96588031
[37,] -1.34051331 -2.04383114
[38,] 0.06652999 -1.34051331
[39,] 1.25930534 0.06652999
[40,] 1.23688637 1.25930534
[41,] 2.19570948 1.23688637
[42,] -2.67850970 2.19570948
[43,] -2.91510332 -2.67850970
[44,] 3.17742136 -2.91510332
[45,] 0.49081519 3.17742136
[46,] 3.60620922 0.49081519
[47,] 0.40269697 3.60620922
[48,] -7.94332492 0.40269697
[49,] -6.37120638 -7.94332492
[50,] -9.37196524 -6.37120638
[51,] -3.61311594 -9.37196524
[52,] -0.09975970 -3.61311594
[53,] -6.99395745 -0.09975970
[54,] -11.10321781 -6.99395745
[55,] -0.77943537 -11.10321781
[56,] -2.86159933 -0.77943537
[57,] 2.17796260 -2.86159933
[58,] -0.40598911 2.17796260
[59,] -3.67384734 -0.40598911
[60,] -5.37130150 -3.67384734
[61,] -9.66593497 -5.37130150
[62,] -7.02489100 -9.66593497
[63,] -1.12495788 -7.02489100
[64,] -2.09066444 -1.12495788
[65,] 0.09823938 -2.09066444
[66,] -7.18854777 0.09823938
[67,] 2.01711691 -7.18854777
[68,] 1.41348140 2.01711691
[69,] 5.02791493 1.41348140
[70,] 3.17064157 5.02791493
[71,] 1.41919746 3.17064157
[72,] -1.35111767 1.41919746
[73,] 1.12556182 -1.35111767
[74,] 3.15928822 1.12556182
[75,] 5.86346750 3.15928822
[76,] 8.14889328 5.86346750
[77,] 6.89661526 8.14889328
[78,] -6.45912371 6.89661526
[79,] 6.69959438 -6.45912371
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -7.96183115 -7.90692108
2 -8.86857441 -7.96183115
3 -0.49862780 -8.86857441
4 -2.45329290 -0.49862780
5 1.15584988 -2.45329290
6 -2.04370880 1.15584988
7 8.78107530 -2.04370880
8 -1.92807014 8.78107530
9 5.45351917 -1.92807014
10 -1.67470796 5.45351917
11 -2.37623106 -1.67470796
12 1.26932459 -2.37623106
13 -0.47058655 1.26932459
14 -0.45872620 -0.47058655
15 5.12196001 -0.45872620
16 -1.52896142 5.12196001
17 0.54290461 -1.52896142
18 -5.77731757 0.54290461
19 7.99155063 -5.77731757
20 2.10375561 7.99155063
21 -2.75236149 2.10375561
22 2.52977875 -2.75236149
23 4.11740481 2.52977875
24 6.28634482 4.11740481
25 1.20220211 6.28634482
26 1.65143893 1.20220211
27 7.09446050 1.65143893
28 -1.38222811 7.09446050
29 7.05961791 -1.38222811
30 -0.61139912 7.05961791
31 7.30784861 -0.61139912
32 10.39974801 7.30784861
33 15.78146967 10.39974801
34 -2.37246149 15.78146967
35 -1.96588031 -2.37246149
36 -2.04383114 -1.96588031
37 -1.34051331 -2.04383114
38 0.06652999 -1.34051331
39 1.25930534 0.06652999
40 1.23688637 1.25930534
41 2.19570948 1.23688637
42 -2.67850970 2.19570948
43 -2.91510332 -2.67850970
44 3.17742136 -2.91510332
45 0.49081519 3.17742136
46 3.60620922 0.49081519
47 0.40269697 3.60620922
48 -7.94332492 0.40269697
49 -6.37120638 -7.94332492
50 -9.37196524 -6.37120638
51 -3.61311594 -9.37196524
52 -0.09975970 -3.61311594
53 -6.99395745 -0.09975970
54 -11.10321781 -6.99395745
55 -0.77943537 -11.10321781
56 -2.86159933 -0.77943537
57 2.17796260 -2.86159933
58 -0.40598911 2.17796260
59 -3.67384734 -0.40598911
60 -5.37130150 -3.67384734
61 -9.66593497 -5.37130150
62 -7.02489100 -9.66593497
63 -1.12495788 -7.02489100
64 -2.09066444 -1.12495788
65 0.09823938 -2.09066444
66 -7.18854777 0.09823938
67 2.01711691 -7.18854777
68 1.41348140 2.01711691
69 5.02791493 1.41348140
70 3.17064157 5.02791493
71 1.41919746 3.17064157
72 -1.35111767 1.41919746
73 1.12556182 -1.35111767
74 3.15928822 1.12556182
75 5.86346750 3.15928822
76 8.14889328 5.86346750
77 6.89661526 8.14889328
78 -6.45912371 6.89661526
79 6.69959438 -6.45912371
> 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/763w21196892109.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/8uic41196892109.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/9e50q1196892109.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/102syw1196892109.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/11ux6u1196892110.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/12c5js1196892110.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/13ti5m1196892110.tab")
>
> system("convert tmp/1bzr61196892109.ps tmp/1bzr61196892109.png")
> system("convert tmp/22g4a1196892109.ps tmp/22g4a1196892109.png")
> system("convert tmp/3meeg1196892109.ps tmp/3meeg1196892109.png")
> system("convert tmp/4cg6z1196892109.ps tmp/4cg6z1196892109.png")
> system("convert tmp/5z1431196892109.ps tmp/5z1431196892109.png")
> system("convert tmp/66hpt1196892109.ps tmp/66hpt1196892109.png")
> system("convert tmp/763w21196892109.ps tmp/763w21196892109.png")
> system("convert tmp/8uic41196892109.ps tmp/8uic41196892109.png")
> system("convert tmp/9e50q1196892109.ps tmp/9e50q1196892109.png")
>
>
> proc.time()
user system elapsed
2.502 1.536 5.191