R version 2.12.0 (2010-10-15)
Copyright (C) 2010 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(3.18
+ ,0.22
+ ,6.62
+ ,3.64
+ ,3.14
+ ,0.22
+ ,6.56
+ ,3.62
+ ,3.02
+ ,0.23
+ ,6.59
+ ,3.61
+ ,3.02
+ ,0.24
+ ,6.56
+ ,3.6
+ ,3.03
+ ,0.25
+ ,6.57
+ ,3.6
+ ,3.04
+ ,0.25
+ ,6.62
+ ,3.63
+ ,3.09
+ ,0.24
+ ,6.69
+ ,3.59
+ ,3.06
+ ,0.24
+ ,6.69
+ ,3.55
+ ,3.06
+ ,0.22
+ ,6.64
+ ,3.54
+ ,3.09
+ ,0.21
+ ,6.6
+ ,3.53
+ ,3.11
+ ,0.21
+ ,6.66
+ ,3.53
+ ,3.1
+ ,0.21
+ ,6.62
+ ,3.53
+ ,3.09
+ ,0.2
+ ,6.64
+ ,3.52
+ ,3.19
+ ,0.2
+ ,6.64
+ ,3.52
+ ,3.22
+ ,0.2
+ ,6.73
+ ,3.48
+ ,3.22
+ ,0.2
+ ,6.73
+ ,3.49
+ ,3.25
+ ,0.2
+ ,6.69
+ ,3.47
+ ,3.25
+ ,0.2
+ ,6.78
+ ,3.46
+ ,3.27
+ ,0.2
+ ,6.77
+ ,3.4
+ ,3.28
+ ,0.2
+ ,6.8
+ ,3.36
+ ,3.24
+ ,0.2
+ ,6.8
+ ,3.3
+ ,3.23
+ ,0.2
+ ,6.74
+ ,3.28
+ ,3.2
+ ,0.2
+ ,6.84
+ ,3.28
+ ,3.19
+ ,0.2
+ ,6.83
+ ,3.24
+ ,3.23
+ ,0.2
+ ,6.89
+ ,3.23
+ ,3.19
+ ,0.2
+ ,6.9
+ ,3.2
+ ,3.16
+ ,0.2
+ ,6.86
+ ,3.15
+ ,3.11
+ ,0.2
+ ,6.78
+ ,3.1
+ ,3.11
+ ,0.2
+ ,6.82
+ ,3.07
+ ,3.07
+ ,0.2
+ ,6.81
+ ,3.03
+ ,3.05
+ ,0.21
+ ,6.81
+ ,2.96
+ ,3
+ ,0.2
+ ,6.78
+ ,2.88
+ ,2.95
+ ,0.2
+ ,6.79
+ ,2.83
+ ,2.9
+ ,0.19
+ ,6.83
+ ,2.8
+ ,2.88
+ ,0.18
+ ,6.9
+ ,2.8
+ ,2.9
+ ,0.18
+ ,6.79
+ ,2.79
+ ,2.89
+ ,0.17
+ ,6.88
+ ,2.79
+ ,2.89
+ ,0.17
+ ,6.89
+ ,2.78
+ ,2.91
+ ,0.17
+ ,6.91
+ ,2.79
+ ,2.9
+ ,0.17
+ ,6.93
+ ,2.78
+ ,2.9
+ ,0.17
+ ,6.89
+ ,2.78
+ ,2.88
+ ,0.16
+ ,7
+ ,2.74
+ ,2.83
+ ,0.16
+ ,7.01
+ ,2.71
+ ,2.8
+ ,0.16
+ ,7.15
+ ,2.69
+ ,2.77
+ ,0.16
+ ,7.25
+ ,2.68
+ ,2.78
+ ,0.16
+ ,7.33
+ ,2.68
+ ,2.75
+ ,0.16
+ ,7.39
+ ,2.68
+ ,2.74
+ ,0.15
+ ,7.38
+ ,2.69
+ ,2.73
+ ,0.15
+ ,7.38
+ ,2.68
+ ,2.69
+ ,0.15
+ ,7.35
+ ,2.69
+ ,2.67
+ ,0.15
+ ,7.38
+ ,2.68
+ ,2.66
+ ,0.15
+ ,7.34
+ ,2.68
+ ,2.67
+ ,0.16
+ ,7.25
+ ,2.63
+ ,2.65
+ ,0.15
+ ,7.07
+ ,2.58
+ ,2.64
+ ,0.15
+ ,6.73
+ ,2.52
+ ,2.63
+ ,0.15
+ ,6.56
+ ,2.5)
+ ,dim=c(4
+ ,56)
+ ,dimnames=list(c('Mayonaise'
+ ,'Eieren'
+ ,'Olijfolie'
+ ,'Mosterd')
+ ,1:56))
> y <- array(NA,dim=c(4,56),dimnames=list(c('Mayonaise','Eieren','Olijfolie','Mosterd'),1:56))
> 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 = '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)
> library(lmtest)
Loading required package: zoo
> 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
Mayonaise Eieren Olijfolie Mosterd
1 3.18 0.22 6.62 3.64
2 3.14 0.22 6.56 3.62
3 3.02 0.23 6.59 3.61
4 3.02 0.24 6.56 3.60
5 3.03 0.25 6.57 3.60
6 3.04 0.25 6.62 3.63
7 3.09 0.24 6.69 3.59
8 3.06 0.24 6.69 3.55
9 3.06 0.22 6.64 3.54
10 3.09 0.21 6.60 3.53
11 3.11 0.21 6.66 3.53
12 3.10 0.21 6.62 3.53
13 3.09 0.20 6.64 3.52
14 3.19 0.20 6.64 3.52
15 3.22 0.20 6.73 3.48
16 3.22 0.20 6.73 3.49
17 3.25 0.20 6.69 3.47
18 3.25 0.20 6.78 3.46
19 3.27 0.20 6.77 3.40
20 3.28 0.20 6.80 3.36
21 3.24 0.20 6.80 3.30
22 3.23 0.20 6.74 3.28
23 3.20 0.20 6.84 3.28
24 3.19 0.20 6.83 3.24
25 3.23 0.20 6.89 3.23
26 3.19 0.20 6.90 3.20
27 3.16 0.20 6.86 3.15
28 3.11 0.20 6.78 3.10
29 3.11 0.20 6.82 3.07
30 3.07 0.20 6.81 3.03
31 3.05 0.21 6.81 2.96
32 3.00 0.20 6.78 2.88
33 2.95 0.20 6.79 2.83
34 2.90 0.19 6.83 2.80
35 2.88 0.18 6.90 2.80
36 2.90 0.18 6.79 2.79
37 2.89 0.17 6.88 2.79
38 2.89 0.17 6.89 2.78
39 2.91 0.17 6.91 2.79
40 2.90 0.17 6.93 2.78
41 2.90 0.17 6.89 2.78
42 2.88 0.16 7.00 2.74
43 2.83 0.16 7.01 2.71
44 2.80 0.16 7.15 2.69
45 2.77 0.16 7.25 2.68
46 2.78 0.16 7.33 2.68
47 2.75 0.16 7.39 2.68
48 2.74 0.15 7.38 2.69
49 2.73 0.15 7.38 2.68
50 2.69 0.15 7.35 2.69
51 2.67 0.15 7.38 2.68
52 2.66 0.15 7.34 2.68
53 2.67 0.16 7.25 2.63
54 2.65 0.15 7.07 2.58
55 2.64 0.15 6.73 2.52
56 2.63 0.15 6.56 2.50
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Eieren Olijfolie Mosterd
2.4787 -0.4654 -0.0989 0.4135
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.192553 -0.098280 0.007702 0.096667 0.190280
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.47865 0.81809 3.030 0.00381 **
Eieren -0.46544 1.32634 -0.351 0.72706
Olijfolie -0.09890 0.09811 -1.008 0.31810
Mosterd 0.41349 0.09117 4.535 3.42e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1127 on 52 degrees of freedom
Multiple R-squared: 0.6914, Adjusted R-squared: 0.6736
F-statistic: 38.84 on 3 and 52 DF, p-value: 2.587e-13
> 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.14600267 0.292005340 0.853997330
[2,] 0.09714470 0.194289398 0.902855301
[3,] 0.07413051 0.148261020 0.925869490
[4,] 0.05102930 0.102058592 0.948970704
[5,] 0.03808240 0.076164803 0.961917599
[6,] 0.04688028 0.093760562 0.953119719
[7,] 0.11026854 0.220537078 0.889731461
[8,] 0.31450608 0.629012151 0.685493924
[9,] 0.47329072 0.946581432 0.526709284
[10,] 0.56499428 0.870011430 0.435005715
[11,] 0.86072607 0.278547851 0.139273925
[12,] 0.89462804 0.210743929 0.105371965
[13,] 0.92673400 0.146531996 0.073265998
[14,] 0.91192871 0.176142584 0.088071292
[15,] 0.87452313 0.250953737 0.125476869
[16,] 0.84455030 0.310899396 0.155449698
[17,] 0.89589789 0.208204221 0.104102110
[18,] 0.90687824 0.186243530 0.093121765
[19,] 0.87921085 0.241578292 0.120789146
[20,] 0.87984246 0.240315081 0.120157540
[21,] 0.85780349 0.284393014 0.142196507
[22,] 0.86129524 0.277409526 0.138704763
[23,] 0.85056579 0.298868411 0.149434205
[24,] 0.90457452 0.190850953 0.095425476
[25,] 0.88855936 0.222881289 0.111440645
[26,] 0.84793614 0.304127715 0.152063857
[27,] 0.81810274 0.363794526 0.181897263
[28,] 0.92207676 0.155846481 0.077923240
[29,] 0.99417324 0.011653515 0.005826758
[30,] 0.99602747 0.007945053 0.003972526
[31,] 0.99817114 0.003657722 0.001828861
[32,] 0.99853801 0.002923977 0.001461989
[33,] 0.99827589 0.003448214 0.001724107
[34,] 0.99815875 0.003682504 0.001841252
[35,] 0.99923413 0.001531744 0.000765872
[36,] 0.99895464 0.002090715 0.001045358
[37,] 0.99852278 0.002954446 0.001477223
[38,] 0.99814801 0.003703986 0.001851993
[39,] 0.99659899 0.006802022 0.003401011
[40,] 0.99485843 0.010283136 0.005141568
[41,] 0.99209703 0.015805948 0.007902974
[42,] 0.99061137 0.018777269 0.009388635
[43,] 0.99791908 0.004161836 0.002080918
> postscript(file="/var/www/rcomp/tmp/1phr21292346870.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/www/rcomp/tmp/2phr21292346870.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/www/rcomp/tmp/3hqq41292346870.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/www/rcomp/tmp/4hqq41292346870.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/www/rcomp/tmp/5hqq41292346870.ps",horizontal=F,onefile=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 = 56
Frequency = 1
1 2 3 4 5 6
-0.046645522 -0.084309681 -0.192553327 -0.186730965 -0.171087525 -0.168547282
7 8 9 10 11 12
-0.099739067 -0.113199400 -0.123318359 -0.097793877 -0.071859886 -0.085815880
13 14 15 16 17 18
-0.094357408 0.005642592 0.061083246 0.056948329 0.091262168 0.104298072
19 20 21 22 23 24
0.148118574 0.177625236 0.162434736 0.154770578 0.134660564 0.140211232
25 26 27 28 29 30
0.190280140 0.163673889 0.150392478 0.113155073 0.129515817 0.105066485
31 32 33 34 35 36
0.118665343 0.094123240 0.065786822 0.027493125 0.009761673 0.023017606
37 38 39 40 41 42
0.017264152 0.022388067 0.040231147 0.036344061 0.032388067 0.035152276
43 44 45 46 47 48
-0.001453975 -0.009338162 -0.025313259 -0.007401271 -0.031467279 -0.051245636
49 50 51 52 53 54
-0.057110719 -0.104212632 -0.117110719 -0.131066714 -0.104638676 -0.126420508
55 56
-0.145236959 -0.163780101
> postscript(file="/var/www/rcomp/tmp/6sipq1292346870.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 = 56
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.046645522 NA
1 -0.084309681 -0.046645522
2 -0.192553327 -0.084309681
3 -0.186730965 -0.192553327
4 -0.171087525 -0.186730965
5 -0.168547282 -0.171087525
6 -0.099739067 -0.168547282
7 -0.113199400 -0.099739067
8 -0.123318359 -0.113199400
9 -0.097793877 -0.123318359
10 -0.071859886 -0.097793877
11 -0.085815880 -0.071859886
12 -0.094357408 -0.085815880
13 0.005642592 -0.094357408
14 0.061083246 0.005642592
15 0.056948329 0.061083246
16 0.091262168 0.056948329
17 0.104298072 0.091262168
18 0.148118574 0.104298072
19 0.177625236 0.148118574
20 0.162434736 0.177625236
21 0.154770578 0.162434736
22 0.134660564 0.154770578
23 0.140211232 0.134660564
24 0.190280140 0.140211232
25 0.163673889 0.190280140
26 0.150392478 0.163673889
27 0.113155073 0.150392478
28 0.129515817 0.113155073
29 0.105066485 0.129515817
30 0.118665343 0.105066485
31 0.094123240 0.118665343
32 0.065786822 0.094123240
33 0.027493125 0.065786822
34 0.009761673 0.027493125
35 0.023017606 0.009761673
36 0.017264152 0.023017606
37 0.022388067 0.017264152
38 0.040231147 0.022388067
39 0.036344061 0.040231147
40 0.032388067 0.036344061
41 0.035152276 0.032388067
42 -0.001453975 0.035152276
43 -0.009338162 -0.001453975
44 -0.025313259 -0.009338162
45 -0.007401271 -0.025313259
46 -0.031467279 -0.007401271
47 -0.051245636 -0.031467279
48 -0.057110719 -0.051245636
49 -0.104212632 -0.057110719
50 -0.117110719 -0.104212632
51 -0.131066714 -0.117110719
52 -0.104638676 -0.131066714
53 -0.126420508 -0.104638676
54 -0.145236959 -0.126420508
55 -0.163780101 -0.145236959
56 NA -0.163780101
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.084309681 -0.046645522
[2,] -0.192553327 -0.084309681
[3,] -0.186730965 -0.192553327
[4,] -0.171087525 -0.186730965
[5,] -0.168547282 -0.171087525
[6,] -0.099739067 -0.168547282
[7,] -0.113199400 -0.099739067
[8,] -0.123318359 -0.113199400
[9,] -0.097793877 -0.123318359
[10,] -0.071859886 -0.097793877
[11,] -0.085815880 -0.071859886
[12,] -0.094357408 -0.085815880
[13,] 0.005642592 -0.094357408
[14,] 0.061083246 0.005642592
[15,] 0.056948329 0.061083246
[16,] 0.091262168 0.056948329
[17,] 0.104298072 0.091262168
[18,] 0.148118574 0.104298072
[19,] 0.177625236 0.148118574
[20,] 0.162434736 0.177625236
[21,] 0.154770578 0.162434736
[22,] 0.134660564 0.154770578
[23,] 0.140211232 0.134660564
[24,] 0.190280140 0.140211232
[25,] 0.163673889 0.190280140
[26,] 0.150392478 0.163673889
[27,] 0.113155073 0.150392478
[28,] 0.129515817 0.113155073
[29,] 0.105066485 0.129515817
[30,] 0.118665343 0.105066485
[31,] 0.094123240 0.118665343
[32,] 0.065786822 0.094123240
[33,] 0.027493125 0.065786822
[34,] 0.009761673 0.027493125
[35,] 0.023017606 0.009761673
[36,] 0.017264152 0.023017606
[37,] 0.022388067 0.017264152
[38,] 0.040231147 0.022388067
[39,] 0.036344061 0.040231147
[40,] 0.032388067 0.036344061
[41,] 0.035152276 0.032388067
[42,] -0.001453975 0.035152276
[43,] -0.009338162 -0.001453975
[44,] -0.025313259 -0.009338162
[45,] -0.007401271 -0.025313259
[46,] -0.031467279 -0.007401271
[47,] -0.051245636 -0.031467279
[48,] -0.057110719 -0.051245636
[49,] -0.104212632 -0.057110719
[50,] -0.117110719 -0.104212632
[51,] -0.131066714 -0.117110719
[52,] -0.104638676 -0.131066714
[53,] -0.126420508 -0.104638676
[54,] -0.145236959 -0.126420508
[55,] -0.163780101 -0.145236959
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.084309681 -0.046645522
2 -0.192553327 -0.084309681
3 -0.186730965 -0.192553327
4 -0.171087525 -0.186730965
5 -0.168547282 -0.171087525
6 -0.099739067 -0.168547282
7 -0.113199400 -0.099739067
8 -0.123318359 -0.113199400
9 -0.097793877 -0.123318359
10 -0.071859886 -0.097793877
11 -0.085815880 -0.071859886
12 -0.094357408 -0.085815880
13 0.005642592 -0.094357408
14 0.061083246 0.005642592
15 0.056948329 0.061083246
16 0.091262168 0.056948329
17 0.104298072 0.091262168
18 0.148118574 0.104298072
19 0.177625236 0.148118574
20 0.162434736 0.177625236
21 0.154770578 0.162434736
22 0.134660564 0.154770578
23 0.140211232 0.134660564
24 0.190280140 0.140211232
25 0.163673889 0.190280140
26 0.150392478 0.163673889
27 0.113155073 0.150392478
28 0.129515817 0.113155073
29 0.105066485 0.129515817
30 0.118665343 0.105066485
31 0.094123240 0.118665343
32 0.065786822 0.094123240
33 0.027493125 0.065786822
34 0.009761673 0.027493125
35 0.023017606 0.009761673
36 0.017264152 0.023017606
37 0.022388067 0.017264152
38 0.040231147 0.022388067
39 0.036344061 0.040231147
40 0.032388067 0.036344061
41 0.035152276 0.032388067
42 -0.001453975 0.035152276
43 -0.009338162 -0.001453975
44 -0.025313259 -0.009338162
45 -0.007401271 -0.025313259
46 -0.031467279 -0.007401271
47 -0.051245636 -0.031467279
48 -0.057110719 -0.051245636
49 -0.104212632 -0.057110719
50 -0.117110719 -0.104212632
51 -0.131066714 -0.117110719
52 -0.104638676 -0.131066714
53 -0.126420508 -0.104638676
54 -0.145236959 -0.126420508
55 -0.163780101 -0.145236959
> 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/rcomp/tmp/7396s1292346870.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/www/rcomp/tmp/8396s1292346870.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/www/rcomp/tmp/9396s1292346870.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
> if (n > n25) {
+ postscript(file="/var/www/rcomp/tmp/10ei6v1292346870.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11h14j1292346870.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/rcomp/tmp/122j3p1292346870.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/rcomp/tmp/13hbig1292346870.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/rcomp/tmp/14kchm1292346870.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/rcomp/tmp/155ufr1292346870.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/rcomp/tmp/169uwx1292346870.tab")
+ }
>
> try(system("convert tmp/1phr21292346870.ps tmp/1phr21292346870.png",intern=TRUE))
character(0)
> try(system("convert tmp/2phr21292346870.ps tmp/2phr21292346870.png",intern=TRUE))
character(0)
> try(system("convert tmp/3hqq41292346870.ps tmp/3hqq41292346870.png",intern=TRUE))
character(0)
> try(system("convert tmp/4hqq41292346870.ps tmp/4hqq41292346870.png",intern=TRUE))
character(0)
> try(system("convert tmp/5hqq41292346870.ps tmp/5hqq41292346870.png",intern=TRUE))
character(0)
> try(system("convert tmp/6sipq1292346870.ps tmp/6sipq1292346870.png",intern=TRUE))
character(0)
> try(system("convert tmp/7396s1292346870.ps tmp/7396s1292346870.png",intern=TRUE))
character(0)
> try(system("convert tmp/8396s1292346870.ps tmp/8396s1292346870.png",intern=TRUE))
character(0)
> try(system("convert tmp/9396s1292346870.ps tmp/9396s1292346870.png",intern=TRUE))
character(0)
> try(system("convert tmp/10ei6v1292346870.ps tmp/10ei6v1292346870.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.960 1.730 4.751