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(0,34,41,0,9,39,35,0,1,40,34,0,4,45,36,0,6,43,39,0,21,42,40,0,24,49,30,0,23,43,33,0,22,50,30,0,21,44,32,0,20,40,41,0,16,41,40,0,18,45,41,0,18,45,40,0,24,48,39,0,16,54,34,0,15,47,34,0,24,35,46,0,18,28,45,0,15,28,44,0,4,34,40,0,3,23,39,0,6,33,37,0,5,38,39,0,12,41,35,0,12,47,26,0,12,46,26,0,14,45,33,0,12,47,27,0,17,49,30,0,12,50,26,0,20,56,27,0,21,50,18,0,15,56,19,0,22,58,13,0,19,59,14,0,19,51,41,0,26,59,21,0,25,60,16,0,19,60,17,0,20,68,9,0,30,62,14,0,31,62,14,0,35,58,16,0,33,56,11,0,26,50,10,0,25,52,6,0,17,36,9,0,14,33,5,0,8,26,7,0,12,28,2,0,7,27,0,0,4,20,8,0,10,16,13,0,8,11,11,0,16,0,19,1,14,3,23,1,20,10,23,1,9,0,43,1,10,3,59,1),dim=c(4,60),dimnames=list(c('Spa','Eco','Wer','Val'),1:60))
> y <- array(NA,dim=c(4,60),dimnames=list(c('Spa','Eco','Wer','Val'),1:60))
> 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 = '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)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> 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
Eco Spa Wer Val M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 34 0 41 0 1 0 0 0 0 0 0 0 0 0 0 1
2 39 9 35 0 0 1 0 0 0 0 0 0 0 0 0 2
3 40 1 34 0 0 0 1 0 0 0 0 0 0 0 0 3
4 45 4 36 0 0 0 0 1 0 0 0 0 0 0 0 4
5 43 6 39 0 0 0 0 0 1 0 0 0 0 0 0 5
6 42 21 40 0 0 0 0 0 0 1 0 0 0 0 0 6
7 49 24 30 0 0 0 0 0 0 0 1 0 0 0 0 7
8 43 23 33 0 0 0 0 0 0 0 0 1 0 0 0 8
9 50 22 30 0 0 0 0 0 0 0 0 0 1 0 0 9
10 44 21 32 0 0 0 0 0 0 0 0 0 0 1 0 10
11 40 20 41 0 0 0 0 0 0 0 0 0 0 0 1 11
12 41 16 40 0 0 0 0 0 0 0 0 0 0 0 0 12
13 45 18 41 0 1 0 0 0 0 0 0 0 0 0 0 13
14 45 18 40 0 0 1 0 0 0 0 0 0 0 0 0 14
15 48 24 39 0 0 0 1 0 0 0 0 0 0 0 0 15
16 54 16 34 0 0 0 0 1 0 0 0 0 0 0 0 16
17 47 15 34 0 0 0 0 0 1 0 0 0 0 0 0 17
18 35 24 46 0 0 0 0 0 0 1 0 0 0 0 0 18
19 28 18 45 0 0 0 0 0 0 0 1 0 0 0 0 19
20 28 15 44 0 0 0 0 0 0 0 0 1 0 0 0 20
21 34 4 40 0 0 0 0 0 0 0 0 0 1 0 0 21
22 23 3 39 0 0 0 0 0 0 0 0 0 0 1 0 22
23 33 6 37 0 0 0 0 0 0 0 0 0 0 0 1 23
24 38 5 39 0 0 0 0 0 0 0 0 0 0 0 0 24
25 41 12 35 0 1 0 0 0 0 0 0 0 0 0 0 25
26 47 12 26 0 0 1 0 0 0 0 0 0 0 0 0 26
27 46 12 26 0 0 0 1 0 0 0 0 0 0 0 0 27
28 45 14 33 0 0 0 0 1 0 0 0 0 0 0 0 28
29 47 12 27 0 0 0 0 0 1 0 0 0 0 0 0 29
30 49 17 30 0 0 0 0 0 0 1 0 0 0 0 0 30
31 50 12 26 0 0 0 0 0 0 0 1 0 0 0 0 31
32 56 20 27 0 0 0 0 0 0 0 0 1 0 0 0 32
33 50 21 18 0 0 0 0 0 0 0 0 0 1 0 0 33
34 56 15 19 0 0 0 0 0 0 0 0 0 0 1 0 34
35 58 22 13 0 0 0 0 0 0 0 0 0 0 0 1 35
36 59 19 14 0 0 0 0 0 0 0 0 0 0 0 0 36
37 51 19 41 0 1 0 0 0 0 0 0 0 0 0 0 37
38 59 26 21 0 0 1 0 0 0 0 0 0 0 0 0 38
39 60 25 16 0 0 0 1 0 0 0 0 0 0 0 0 39
40 60 19 17 0 0 0 0 1 0 0 0 0 0 0 0 40
41 68 20 9 0 0 0 0 0 1 0 0 0 0 0 0 41
42 62 30 14 0 0 0 0 0 0 1 0 0 0 0 0 42
43 62 31 14 0 0 0 0 0 0 0 1 0 0 0 0 43
44 58 35 16 0 0 0 0 0 0 0 0 1 0 0 0 44
45 56 33 11 0 0 0 0 0 0 0 0 0 1 0 0 45
46 50 26 10 0 0 0 0 0 0 0 0 0 0 1 0 46
47 52 25 6 0 0 0 0 0 0 0 0 0 0 0 1 47
48 36 17 9 0 0 0 0 0 0 0 0 0 0 0 0 48
49 33 14 5 0 1 0 0 0 0 0 0 0 0 0 0 49
50 26 8 7 0 0 1 0 0 0 0 0 0 0 0 0 50
51 28 12 2 0 0 0 1 0 0 0 0 0 0 0 0 51
52 27 7 0 0 0 0 0 1 0 0 0 0 0 0 0 52
53 20 4 8 0 0 0 0 0 1 0 0 0 0 0 0 53
54 16 10 13 0 0 0 0 0 0 1 0 0 0 0 0 54
55 11 8 11 0 0 0 0 0 0 0 1 0 0 0 0 55
56 0 16 19 1 0 0 0 0 0 0 0 1 0 0 0 56
57 3 14 23 1 0 0 0 0 0 0 0 0 1 0 0 57
58 10 20 23 1 0 0 0 0 0 0 0 0 0 1 0 58
59 0 9 43 1 0 0 0 0 0 0 0 0 0 0 1 59
60 3 10 59 1 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Spa Wer Val M1 M2
36.3121 1.2533 -0.1127 -28.4495 -1.8051 -2.4452
M3 M4 M5 M6 M7 M8
-1.5333 4.0766 3.7940 -10.8670 -9.5612 -10.3559
M9 M10 M11 t
-5.1461 -4.6346 -3.2664 -0.2330
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-11.869 -5.641 -1.071 5.404 18.362
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 36.3121 9.7342 3.730 0.000544 ***
Spa 1.2533 0.1639 7.648 1.3e-09 ***
Wer -0.1127 0.1560 -0.722 0.473864
Val -28.4495 6.6671 -4.267 0.000104 ***
M1 -1.8051 5.6642 -0.319 0.751475
M2 -2.4452 5.7739 -0.423 0.674006
M3 -1.5333 5.8304 -0.263 0.793786
M4 4.0766 5.8049 0.702 0.486209
M5 3.7940 5.8114 0.653 0.517246
M6 -10.8670 5.7294 -1.897 0.064445 .
M7 -9.5612 5.7189 -1.672 0.101648
M8 -10.3559 5.8318 -1.776 0.082688 .
M9 -5.1461 5.8257 -0.883 0.381850
M10 -4.6346 5.7598 -0.805 0.425357
M11 -3.2664 5.6375 -0.579 0.565275
t -0.2330 0.1325 -1.759 0.085531 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 8.81 on 44 degrees of freedom
Multiple R-squared: 0.7872, Adjusted R-squared: 0.7146
F-statistic: 10.85 on 15 and 44 DF, p-value: 2.915e-10
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.119021159 0.238042318 0.8809788
[2,] 0.073091752 0.146183503 0.9269082
[3,] 0.057691169 0.115382339 0.9423088
[4,] 0.035802001 0.071604003 0.9641980
[5,] 0.017353820 0.034707639 0.9826462
[6,] 0.011666933 0.023333865 0.9883331
[7,] 0.008695842 0.017391684 0.9913042
[8,] 0.003640069 0.007280137 0.9963599
[9,] 0.001960947 0.003921893 0.9980391
[10,] 0.009246464 0.018492927 0.9907535
[11,] 0.047865422 0.095730845 0.9521346
[12,] 0.173813860 0.347627720 0.8261861
[13,] 0.307793371 0.615586741 0.6922066
[14,] 0.522709609 0.954580782 0.4772904
[15,] 0.642240328 0.715519344 0.3577597
[16,] 0.793339179 0.413321642 0.2066608
[17,] 0.751954687 0.496090627 0.2480453
[18,] 0.693666585 0.612666830 0.3063334
[19,] 0.685194343 0.629611315 0.3148057
[20,] 0.836183858 0.327632285 0.1638161
[21,] 0.825778955 0.348442091 0.1742210
[22,] 0.858806100 0.282387800 0.1411939
[23,] 0.880858018 0.238283964 0.1191420
> postscript(file="/var/www/html/rcomp/tmp/1wp5q1228688787.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/2u8e01228688787.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/3moko1228688787.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/4qqsp1228688787.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/5qtnq1228688787.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 60
Frequency = 1
1 2 3 4 5 6
4.3468908 -1.7363094 8.4988465 4.5872744 0.9343336 -3.8590528
7 8 9 10 11 12
-2.8189253 -6.1997260 -3.2613195 -8.0611211 -10.9286393 -8.0613664
13 14 15 16 17 18
-4.4172459 -3.6568828 -8.9684548 1.1177546 -4.1132875 -11.1468950
19 20 21 22 23 24
-11.8123852 -7.1373295 7.2217494 -2.9161665 1.9632119 5.4085860
25 26 27 28 29 30
1.2224941 7.0812190 5.4023780 -2.6923325 1.6537345 12.6191349
31 32 33 34 35 36
18.3621927 15.4759431 2.2314455 15.5856277 7.0008362 8.8401810
37 38 39 40 41 42
5.9213009 3.7669094 4.7778823 7.0336449 13.3942892 10.3184105
43 44 45 46 47 48
7.9922611 0.2320671 -4.8015982 -2.4194878 -0.7521681 -9.4207252
49 50 51 52 53 54
-7.0734399 -5.4549362 -9.7106519 -10.0463414 -11.8690698 -7.9315976
55 56 57 58 59 60
-11.7231434 -2.3709546 -1.3902771 -2.1888522 2.7167592 3.2333247
> postscript(file="/var/www/html/rcomp/tmp/61ww41228688787.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 4.3468908 NA
1 -1.7363094 4.3468908
2 8.4988465 -1.7363094
3 4.5872744 8.4988465
4 0.9343336 4.5872744
5 -3.8590528 0.9343336
6 -2.8189253 -3.8590528
7 -6.1997260 -2.8189253
8 -3.2613195 -6.1997260
9 -8.0611211 -3.2613195
10 -10.9286393 -8.0611211
11 -8.0613664 -10.9286393
12 -4.4172459 -8.0613664
13 -3.6568828 -4.4172459
14 -8.9684548 -3.6568828
15 1.1177546 -8.9684548
16 -4.1132875 1.1177546
17 -11.1468950 -4.1132875
18 -11.8123852 -11.1468950
19 -7.1373295 -11.8123852
20 7.2217494 -7.1373295
21 -2.9161665 7.2217494
22 1.9632119 -2.9161665
23 5.4085860 1.9632119
24 1.2224941 5.4085860
25 7.0812190 1.2224941
26 5.4023780 7.0812190
27 -2.6923325 5.4023780
28 1.6537345 -2.6923325
29 12.6191349 1.6537345
30 18.3621927 12.6191349
31 15.4759431 18.3621927
32 2.2314455 15.4759431
33 15.5856277 2.2314455
34 7.0008362 15.5856277
35 8.8401810 7.0008362
36 5.9213009 8.8401810
37 3.7669094 5.9213009
38 4.7778823 3.7669094
39 7.0336449 4.7778823
40 13.3942892 7.0336449
41 10.3184105 13.3942892
42 7.9922611 10.3184105
43 0.2320671 7.9922611
44 -4.8015982 0.2320671
45 -2.4194878 -4.8015982
46 -0.7521681 -2.4194878
47 -9.4207252 -0.7521681
48 -7.0734399 -9.4207252
49 -5.4549362 -7.0734399
50 -9.7106519 -5.4549362
51 -10.0463414 -9.7106519
52 -11.8690698 -10.0463414
53 -7.9315976 -11.8690698
54 -11.7231434 -7.9315976
55 -2.3709546 -11.7231434
56 -1.3902771 -2.3709546
57 -2.1888522 -1.3902771
58 2.7167592 -2.1888522
59 3.2333247 2.7167592
60 NA 3.2333247
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.7363094 4.3468908
[2,] 8.4988465 -1.7363094
[3,] 4.5872744 8.4988465
[4,] 0.9343336 4.5872744
[5,] -3.8590528 0.9343336
[6,] -2.8189253 -3.8590528
[7,] -6.1997260 -2.8189253
[8,] -3.2613195 -6.1997260
[9,] -8.0611211 -3.2613195
[10,] -10.9286393 -8.0611211
[11,] -8.0613664 -10.9286393
[12,] -4.4172459 -8.0613664
[13,] -3.6568828 -4.4172459
[14,] -8.9684548 -3.6568828
[15,] 1.1177546 -8.9684548
[16,] -4.1132875 1.1177546
[17,] -11.1468950 -4.1132875
[18,] -11.8123852 -11.1468950
[19,] -7.1373295 -11.8123852
[20,] 7.2217494 -7.1373295
[21,] -2.9161665 7.2217494
[22,] 1.9632119 -2.9161665
[23,] 5.4085860 1.9632119
[24,] 1.2224941 5.4085860
[25,] 7.0812190 1.2224941
[26,] 5.4023780 7.0812190
[27,] -2.6923325 5.4023780
[28,] 1.6537345 -2.6923325
[29,] 12.6191349 1.6537345
[30,] 18.3621927 12.6191349
[31,] 15.4759431 18.3621927
[32,] 2.2314455 15.4759431
[33,] 15.5856277 2.2314455
[34,] 7.0008362 15.5856277
[35,] 8.8401810 7.0008362
[36,] 5.9213009 8.8401810
[37,] 3.7669094 5.9213009
[38,] 4.7778823 3.7669094
[39,] 7.0336449 4.7778823
[40,] 13.3942892 7.0336449
[41,] 10.3184105 13.3942892
[42,] 7.9922611 10.3184105
[43,] 0.2320671 7.9922611
[44,] -4.8015982 0.2320671
[45,] -2.4194878 -4.8015982
[46,] -0.7521681 -2.4194878
[47,] -9.4207252 -0.7521681
[48,] -7.0734399 -9.4207252
[49,] -5.4549362 -7.0734399
[50,] -9.7106519 -5.4549362
[51,] -10.0463414 -9.7106519
[52,] -11.8690698 -10.0463414
[53,] -7.9315976 -11.8690698
[54,] -11.7231434 -7.9315976
[55,] -2.3709546 -11.7231434
[56,] -1.3902771 -2.3709546
[57,] -2.1888522 -1.3902771
[58,] 2.7167592 -2.1888522
[59,] 3.2333247 2.7167592
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.7363094 4.3468908
2 8.4988465 -1.7363094
3 4.5872744 8.4988465
4 0.9343336 4.5872744
5 -3.8590528 0.9343336
6 -2.8189253 -3.8590528
7 -6.1997260 -2.8189253
8 -3.2613195 -6.1997260
9 -8.0611211 -3.2613195
10 -10.9286393 -8.0611211
11 -8.0613664 -10.9286393
12 -4.4172459 -8.0613664
13 -3.6568828 -4.4172459
14 -8.9684548 -3.6568828
15 1.1177546 -8.9684548
16 -4.1132875 1.1177546
17 -11.1468950 -4.1132875
18 -11.8123852 -11.1468950
19 -7.1373295 -11.8123852
20 7.2217494 -7.1373295
21 -2.9161665 7.2217494
22 1.9632119 -2.9161665
23 5.4085860 1.9632119
24 1.2224941 5.4085860
25 7.0812190 1.2224941
26 5.4023780 7.0812190
27 -2.6923325 5.4023780
28 1.6537345 -2.6923325
29 12.6191349 1.6537345
30 18.3621927 12.6191349
31 15.4759431 18.3621927
32 2.2314455 15.4759431
33 15.5856277 2.2314455
34 7.0008362 15.5856277
35 8.8401810 7.0008362
36 5.9213009 8.8401810
37 3.7669094 5.9213009
38 4.7778823 3.7669094
39 7.0336449 4.7778823
40 13.3942892 7.0336449
41 10.3184105 13.3942892
42 7.9922611 10.3184105
43 0.2320671 7.9922611
44 -4.8015982 0.2320671
45 -2.4194878 -4.8015982
46 -0.7521681 -2.4194878
47 -9.4207252 -0.7521681
48 -7.0734399 -9.4207252
49 -5.4549362 -7.0734399
50 -9.7106519 -5.4549362
51 -10.0463414 -9.7106519
52 -11.8690698 -10.0463414
53 -7.9315976 -11.8690698
54 -11.7231434 -7.9315976
55 -2.3709546 -11.7231434
56 -1.3902771 -2.3709546
57 -2.1888522 -1.3902771
58 2.7167592 -2.1888522
59 3.2333247 2.7167592
> 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/74qro1228688787.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/80msg1228688787.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/9usni1228688787.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
> if (n > n25) {
+ postscript(file="/var/www/html/rcomp/tmp/10bydd1228688787.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ 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/1120w51228688788.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/12xkye1228688788.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/13c0151228688788.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/14ao4p1228688788.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/rcomp/tmp/15chj21228688788.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/rcomp/tmp/16ef721228688788.tab")
+ }
>
> system("convert tmp/1wp5q1228688787.ps tmp/1wp5q1228688787.png")
> system("convert tmp/2u8e01228688787.ps tmp/2u8e01228688787.png")
> system("convert tmp/3moko1228688787.ps tmp/3moko1228688787.png")
> system("convert tmp/4qqsp1228688787.ps tmp/4qqsp1228688787.png")
> system("convert tmp/5qtnq1228688787.ps tmp/5qtnq1228688787.png")
> system("convert tmp/61ww41228688787.ps tmp/61ww41228688787.png")
> system("convert tmp/74qro1228688787.ps tmp/74qro1228688787.png")
> system("convert tmp/80msg1228688787.ps tmp/80msg1228688787.png")
> system("convert tmp/9usni1228688787.ps tmp/9usni1228688787.png")
> system("convert tmp/10bydd1228688787.ps tmp/10bydd1228688787.png")
>
>
> proc.time()
user system elapsed
4.924 2.749 5.297