R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-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(1.34
+ ,1.98
+ ,1.97
+ ,2.62
+ ,5.05
+ ,8.02
+ ,1.34
+ ,1.97
+ ,1.98
+ ,2.62
+ ,5.04
+ ,7.98
+ ,1.34
+ ,1.98
+ ,1.98
+ ,2.61
+ ,5.02
+ ,7.98
+ ,1.34
+ ,1.98
+ ,1.98
+ ,2.61
+ ,5.03
+ ,7.97
+ ,1.34
+ ,1.98
+ ,1.98
+ ,2.60
+ ,5.01
+ ,7.96
+ ,1.33
+ ,1.97
+ ,1.98
+ ,2.59
+ ,5.00
+ ,7.95
+ ,1.33
+ ,1.97
+ ,1.98
+ ,2.59
+ ,5.00
+ ,7.94
+ ,1.33
+ ,1.97
+ ,1.97
+ ,2.59
+ ,5.00
+ ,7.91
+ ,1.33
+ ,1.97
+ ,1.97
+ ,2.58
+ ,5.00
+ ,7.90
+ ,1.33
+ ,1.96
+ ,1.97
+ ,2.58
+ ,4.97
+ ,7.90
+ ,1.33
+ ,1.96
+ ,1.97
+ ,2.58
+ ,4.97
+ ,7.88
+ ,1.33
+ ,1.96
+ ,1.97
+ ,2.57
+ ,4.96
+ ,7.88
+ ,1.32
+ ,1.95
+ ,1.97
+ ,2.56
+ ,4.93
+ ,7.86
+ ,1.32
+ ,1.95
+ ,1.96
+ ,2.57
+ ,4.93
+ ,7.86
+ ,1.32
+ ,1.95
+ ,1.96
+ ,2.56
+ ,4.92
+ ,7.86
+ ,1.32
+ ,1.95
+ ,1.96
+ ,2.56
+ ,4.92
+ ,7.84
+ ,1.32
+ ,1.94
+ ,1.96
+ ,2.57
+ ,4.92
+ ,7.79
+ ,1.31
+ ,1.93
+ ,1.96
+ ,2.55
+ ,4.91
+ ,7.62
+ ,1.30
+ ,1.93
+ ,1.95
+ ,2.53
+ ,4.88
+ ,7.60
+ ,1.27
+ ,1.90
+ ,1.92
+ ,2.50
+ ,4.83
+ ,7.55
+ ,1.27
+ ,1.90
+ ,1.93
+ ,2.49
+ ,4.82
+ ,7.53
+ ,1.27
+ ,1.90
+ ,1.92
+ ,2.48
+ ,4.81
+ ,7.50
+ ,1.26
+ ,1.88
+ ,1.90
+ ,2.46
+ ,4.77
+ ,7.40
+ ,1.26
+ ,1.88
+ ,1.90
+ ,2.44
+ ,4.74
+ ,7.35
+ ,1.25
+ ,1.87
+ ,1.89
+ ,2.43
+ ,4.77
+ ,7.31
+ ,1.25
+ ,1.88
+ ,1.89
+ ,2.43
+ ,4.75
+ ,7.35
+ ,1.25
+ ,1.87
+ ,1.89
+ ,2.44
+ ,4.76
+ ,7.38
+ ,1.25
+ ,1.88
+ ,1.89
+ ,2.43
+ ,4.76
+ ,7.37
+ ,1.25
+ ,1.87
+ ,1.89
+ ,2.43
+ ,4.75
+ ,7.37
+ ,1.25
+ ,1.87
+ ,1.89
+ ,2.44
+ ,4.73
+ ,7.32
+ ,1.25
+ ,1.87
+ ,1.89
+ ,2.43
+ ,4.74
+ ,7.24
+ ,1.25
+ ,1.87
+ ,1.89
+ ,2.43
+ ,4.74
+ ,7.21
+ ,1.25
+ ,1.87
+ ,1.89
+ ,2.43
+ ,4.74
+ ,7.21
+ ,1.25
+ ,1.87
+ ,1.89
+ ,2.43
+ ,4.72
+ ,7.19
+ ,1.24
+ ,1.87
+ ,1.89
+ ,2.43
+ ,4.71
+ ,7.14
+ ,1.25
+ ,1.87
+ ,1.89
+ ,2.42
+ ,4.70
+ ,7.13
+ ,1.25
+ ,1.87
+ ,1.89
+ ,2.43
+ ,4.71
+ ,7.12
+ ,1.24
+ ,1.87
+ ,1.89
+ ,2.44
+ ,4.72
+ ,7.08
+ ,1.24
+ ,1.87
+ ,1.89
+ ,2.44
+ ,4.70
+ ,7.04
+ ,1.24
+ ,1.87
+ ,1.89
+ ,2.44
+ ,4.70
+ ,7.04
+ ,1.24
+ ,1.87
+ ,1.89
+ ,2.44
+ ,4.70
+ ,7.03
+ ,1.24
+ ,1.87
+ ,1.89
+ ,2.44
+ ,4.68
+ ,7.03
+ ,1.25
+ ,1.87
+ ,1.89
+ ,2.43
+ ,4.68
+ ,6.99
+ ,1.26
+ ,1.88
+ ,1.89
+ ,2.44
+ ,4.67
+ ,7.00
+ ,1.26
+ ,1.88
+ ,1.90
+ ,2.44
+ ,4.67
+ ,6.97
+ ,1.26
+ ,1.87
+ ,1.89
+ ,2.43
+ ,4.67
+ ,6.91
+ ,1.26
+ ,1.87
+ ,1.89
+ ,2.42
+ ,4.62
+ ,6.83
+ ,1.26
+ ,1.87
+ ,1.89
+ ,2.42
+ ,4.62
+ ,6.80
+ ,1.26
+ ,1.87
+ ,1.88
+ ,2.41
+ ,4.61
+ ,6.79
+ ,1.26
+ ,1.87
+ ,1.88
+ ,2.41
+ ,4.61
+ ,6.77)
+ ,dim=c(6
+ ,50)
+ ,dimnames=list(c('Speciaal400'
+ ,'Speciaal800'
+ ,'Bruin800'
+ ,'Meergranen800'
+ ,'Kramiek'
+ ,'Broodje')
+ ,1:50))
> y <- array(NA,dim=c(6,50),dimnames=list(c('Speciaal400','Speciaal800','Bruin800','Meergranen800','Kramiek','Broodje'),1:50))
> 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 = '6'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '6'
> #'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, 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
Broodje Speciaal400 Speciaal800 Bruin800 Meergranen800 Kramiek
1 8.02 1.34 1.98 1.97 2.62 5.05
2 7.98 1.34 1.97 1.98 2.62 5.04
3 7.98 1.34 1.98 1.98 2.61 5.02
4 7.97 1.34 1.98 1.98 2.61 5.03
5 7.96 1.34 1.98 1.98 2.60 5.01
6 7.95 1.33 1.97 1.98 2.59 5.00
7 7.94 1.33 1.97 1.98 2.59 5.00
8 7.91 1.33 1.97 1.97 2.59 5.00
9 7.90 1.33 1.97 1.97 2.58 5.00
10 7.90 1.33 1.96 1.97 2.58 4.97
11 7.88 1.33 1.96 1.97 2.58 4.97
12 7.88 1.33 1.96 1.97 2.57 4.96
13 7.86 1.32 1.95 1.97 2.56 4.93
14 7.86 1.32 1.95 1.96 2.57 4.93
15 7.86 1.32 1.95 1.96 2.56 4.92
16 7.84 1.32 1.95 1.96 2.56 4.92
17 7.79 1.32 1.94 1.96 2.57 4.92
18 7.62 1.31 1.93 1.96 2.55 4.91
19 7.60 1.30 1.93 1.95 2.53 4.88
20 7.55 1.27 1.90 1.92 2.50 4.83
21 7.53 1.27 1.90 1.93 2.49 4.82
22 7.50 1.27 1.90 1.92 2.48 4.81
23 7.40 1.26 1.88 1.90 2.46 4.77
24 7.35 1.26 1.88 1.90 2.44 4.74
25 7.31 1.25 1.87 1.89 2.43 4.77
26 7.35 1.25 1.88 1.89 2.43 4.75
27 7.38 1.25 1.87 1.89 2.44 4.76
28 7.37 1.25 1.88 1.89 2.43 4.76
29 7.37 1.25 1.87 1.89 2.43 4.75
30 7.32 1.25 1.87 1.89 2.44 4.73
31 7.24 1.25 1.87 1.89 2.43 4.74
32 7.21 1.25 1.87 1.89 2.43 4.74
33 7.21 1.25 1.87 1.89 2.43 4.74
34 7.19 1.25 1.87 1.89 2.43 4.72
35 7.14 1.24 1.87 1.89 2.43 4.71
36 7.13 1.25 1.87 1.89 2.42 4.70
37 7.12 1.25 1.87 1.89 2.43 4.71
38 7.08 1.24 1.87 1.89 2.44 4.72
39 7.04 1.24 1.87 1.89 2.44 4.70
40 7.04 1.24 1.87 1.89 2.44 4.70
41 7.03 1.24 1.87 1.89 2.44 4.70
42 7.03 1.24 1.87 1.89 2.44 4.68
43 6.99 1.25 1.87 1.89 2.43 4.68
44 7.00 1.26 1.88 1.89 2.44 4.67
45 6.97 1.26 1.88 1.90 2.44 4.67
46 6.91 1.26 1.87 1.89 2.43 4.67
47 6.83 1.26 1.87 1.89 2.42 4.62
48 6.80 1.26 1.87 1.89 2.42 4.62
49 6.79 1.26 1.87 1.88 2.41 4.61
50 6.77 1.26 1.87 1.88 2.41 4.61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Speciaal400 Speciaal800 Bruin800 Meergranen800
-7.427 1.048 -2.614 3.257 -2.702
Kramiek
3.942
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.13203 -0.03966 -0.01039 0.04681 0.13737
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -7.4269 1.4601 -5.086 7.24e-06 ***
Speciaal400 1.0481 1.8114 0.579 0.5658
Speciaal800 -2.6144 2.2187 -1.178 0.2450
Bruin800 3.2573 1.9837 1.642 0.1077
Meergranen800 -2.7018 1.2013 -2.249 0.0296 *
Kramiek 3.9424 0.3344 11.788 3.31e-15 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.06574 on 44 degrees of freedom
Multiple R-squared: 0.9756, Adjusted R-squared: 0.9728
F-statistic: 352.2 on 5 and 44 DF, p-value: < 2.2e-16
> 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,] 2.861124e-02 5.722248e-02 0.971388760
[2,] 1.802704e-02 3.605408e-02 0.981972961
[3,] 6.593913e-03 1.318783e-02 0.993406087
[4,] 3.333953e-03 6.667906e-03 0.996666047
[5,] 1.025822e-03 2.051643e-03 0.998974178
[6,] 3.144626e-04 6.289251e-04 0.999685537
[7,] 1.204181e-04 2.408362e-04 0.999879582
[8,] 3.387742e-05 6.775484e-05 0.999966123
[9,] 2.975603e-04 5.951206e-04 0.999702440
[10,] 5.453692e-02 1.090738e-01 0.945463084
[11,] 1.413483e-01 2.826966e-01 0.858651697
[12,] 2.509661e-01 5.019322e-01 0.749033912
[13,] 2.066540e-01 4.133081e-01 0.793345963
[14,] 1.868661e-01 3.737323e-01 0.813133864
[15,] 1.302488e-01 2.604976e-01 0.869751207
[16,] 1.194013e-01 2.388027e-01 0.880598660
[17,] 1.462463e-01 2.924927e-01 0.853753651
[18,] 1.037215e-01 2.074431e-01 0.896278465
[19,] 1.205869e-01 2.411738e-01 0.879413079
[20,] 8.034190e-02 1.606838e-01 0.919658098
[21,] 1.267318e-01 2.534636e-01 0.873268224
[22,] 8.478879e-01 3.042241e-01 0.152112065
[23,] 8.844369e-01 2.311262e-01 0.115563119
[24,] 9.120464e-01 1.759072e-01 0.087953608
[25,] 9.131323e-01 1.737353e-01 0.086867669
[26,] 9.644780e-01 7.104401e-02 0.035522007
[27,] 9.678677e-01 6.426460e-02 0.032132300
[28,] 9.704956e-01 5.900870e-02 0.029504352
[29,] 9.984964e-01 3.007138e-03 0.001503569
[30,] 9.965855e-01 6.829023e-03 0.003414512
[31,] 9.903137e-01 1.937262e-02 0.009686309
[32,] 9.722085e-01 5.558306e-02 0.027791529
[33,] 9.632302e-01 7.353952e-02 0.036769760
> postscript(file="/var/fisher/rcomp/tmp/1zcm61353330874.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/fisher/rcomp/tmp/2l0dz1353330874.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/fisher/rcomp/tmp/33h8l1353330874.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/fisher/rcomp/tmp/44ii71353330874.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/fisher/rcomp/tmp/58bch1353330874.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 = 50
Frequency = 1
1 2 3 4 5 6
-0.028130387 -0.087424464 -0.009451100 -0.058874789 -0.017045721 -0.030303463
7 8 9 10 11 12
-0.040303463 -0.037729994 -0.074748305 0.017378467 -0.002621533 0.009783845
13 14 15 16 17 18
0.065373482 0.124965262 0.137370641 0.117370641 0.068244655 -0.132031398
19 20 21 22 23 24
-0.044742306 0.072052255 0.031884165 0.046863012 0.073860669 0.088095115
25 26 27 28 29 30
-0.080283914 0.064707761 0.056158086 0.045284072 0.058563464 0.114429154
31 32 33 34 35 36
-0.032012846 -0.062012846 -0.062012846 -0.003165468 -0.003260602 -0.011336400
37 38 39 40 41 42
-0.033741779 -0.075665980 -0.036818602 -0.036818602 -0.046818602 0.032028777
43 44 45 46 47 48
-0.045470711 0.046634409 -0.015939060 -0.096528198 -0.006428063 -0.036428063
49 50
-0.001449215 -0.021449215
> postscript(file="/var/fisher/rcomp/tmp/6e86z1353330874.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 = 50
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.028130387 NA
1 -0.087424464 -0.028130387
2 -0.009451100 -0.087424464
3 -0.058874789 -0.009451100
4 -0.017045721 -0.058874789
5 -0.030303463 -0.017045721
6 -0.040303463 -0.030303463
7 -0.037729994 -0.040303463
8 -0.074748305 -0.037729994
9 0.017378467 -0.074748305
10 -0.002621533 0.017378467
11 0.009783845 -0.002621533
12 0.065373482 0.009783845
13 0.124965262 0.065373482
14 0.137370641 0.124965262
15 0.117370641 0.137370641
16 0.068244655 0.117370641
17 -0.132031398 0.068244655
18 -0.044742306 -0.132031398
19 0.072052255 -0.044742306
20 0.031884165 0.072052255
21 0.046863012 0.031884165
22 0.073860669 0.046863012
23 0.088095115 0.073860669
24 -0.080283914 0.088095115
25 0.064707761 -0.080283914
26 0.056158086 0.064707761
27 0.045284072 0.056158086
28 0.058563464 0.045284072
29 0.114429154 0.058563464
30 -0.032012846 0.114429154
31 -0.062012846 -0.032012846
32 -0.062012846 -0.062012846
33 -0.003165468 -0.062012846
34 -0.003260602 -0.003165468
35 -0.011336400 -0.003260602
36 -0.033741779 -0.011336400
37 -0.075665980 -0.033741779
38 -0.036818602 -0.075665980
39 -0.036818602 -0.036818602
40 -0.046818602 -0.036818602
41 0.032028777 -0.046818602
42 -0.045470711 0.032028777
43 0.046634409 -0.045470711
44 -0.015939060 0.046634409
45 -0.096528198 -0.015939060
46 -0.006428063 -0.096528198
47 -0.036428063 -0.006428063
48 -0.001449215 -0.036428063
49 -0.021449215 -0.001449215
50 NA -0.021449215
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.087424464 -0.028130387
[2,] -0.009451100 -0.087424464
[3,] -0.058874789 -0.009451100
[4,] -0.017045721 -0.058874789
[5,] -0.030303463 -0.017045721
[6,] -0.040303463 -0.030303463
[7,] -0.037729994 -0.040303463
[8,] -0.074748305 -0.037729994
[9,] 0.017378467 -0.074748305
[10,] -0.002621533 0.017378467
[11,] 0.009783845 -0.002621533
[12,] 0.065373482 0.009783845
[13,] 0.124965262 0.065373482
[14,] 0.137370641 0.124965262
[15,] 0.117370641 0.137370641
[16,] 0.068244655 0.117370641
[17,] -0.132031398 0.068244655
[18,] -0.044742306 -0.132031398
[19,] 0.072052255 -0.044742306
[20,] 0.031884165 0.072052255
[21,] 0.046863012 0.031884165
[22,] 0.073860669 0.046863012
[23,] 0.088095115 0.073860669
[24,] -0.080283914 0.088095115
[25,] 0.064707761 -0.080283914
[26,] 0.056158086 0.064707761
[27,] 0.045284072 0.056158086
[28,] 0.058563464 0.045284072
[29,] 0.114429154 0.058563464
[30,] -0.032012846 0.114429154
[31,] -0.062012846 -0.032012846
[32,] -0.062012846 -0.062012846
[33,] -0.003165468 -0.062012846
[34,] -0.003260602 -0.003165468
[35,] -0.011336400 -0.003260602
[36,] -0.033741779 -0.011336400
[37,] -0.075665980 -0.033741779
[38,] -0.036818602 -0.075665980
[39,] -0.036818602 -0.036818602
[40,] -0.046818602 -0.036818602
[41,] 0.032028777 -0.046818602
[42,] -0.045470711 0.032028777
[43,] 0.046634409 -0.045470711
[44,] -0.015939060 0.046634409
[45,] -0.096528198 -0.015939060
[46,] -0.006428063 -0.096528198
[47,] -0.036428063 -0.006428063
[48,] -0.001449215 -0.036428063
[49,] -0.021449215 -0.001449215
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.087424464 -0.028130387
2 -0.009451100 -0.087424464
3 -0.058874789 -0.009451100
4 -0.017045721 -0.058874789
5 -0.030303463 -0.017045721
6 -0.040303463 -0.030303463
7 -0.037729994 -0.040303463
8 -0.074748305 -0.037729994
9 0.017378467 -0.074748305
10 -0.002621533 0.017378467
11 0.009783845 -0.002621533
12 0.065373482 0.009783845
13 0.124965262 0.065373482
14 0.137370641 0.124965262
15 0.117370641 0.137370641
16 0.068244655 0.117370641
17 -0.132031398 0.068244655
18 -0.044742306 -0.132031398
19 0.072052255 -0.044742306
20 0.031884165 0.072052255
21 0.046863012 0.031884165
22 0.073860669 0.046863012
23 0.088095115 0.073860669
24 -0.080283914 0.088095115
25 0.064707761 -0.080283914
26 0.056158086 0.064707761
27 0.045284072 0.056158086
28 0.058563464 0.045284072
29 0.114429154 0.058563464
30 -0.032012846 0.114429154
31 -0.062012846 -0.032012846
32 -0.062012846 -0.062012846
33 -0.003165468 -0.062012846
34 -0.003260602 -0.003165468
35 -0.011336400 -0.003260602
36 -0.033741779 -0.011336400
37 -0.075665980 -0.033741779
38 -0.036818602 -0.075665980
39 -0.036818602 -0.036818602
40 -0.046818602 -0.036818602
41 0.032028777 -0.046818602
42 -0.045470711 0.032028777
43 0.046634409 -0.045470711
44 -0.015939060 0.046634409
45 -0.096528198 -0.015939060
46 -0.006428063 -0.096528198
47 -0.036428063 -0.006428063
48 -0.001449215 -0.036428063
49 -0.021449215 -0.001449215
> 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/fisher/rcomp/tmp/76rov1353330874.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/fisher/rcomp/tmp/82u0n1353330874.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/fisher/rcomp/tmp/9kgj21353330874.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/fisher/rcomp/tmp/102db91353330874.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/fisher/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/fisher/rcomp/tmp/112l6x1353330874.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/fisher/rcomp/tmp/128g821353330874.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/fisher/rcomp/tmp/132chs1353330874.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/fisher/rcomp/tmp/1495741353330874.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/fisher/rcomp/tmp/153def1353330874.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/fisher/rcomp/tmp/169svi1353330874.tab")
+ }
>
> try(system("convert tmp/1zcm61353330874.ps tmp/1zcm61353330874.png",intern=TRUE))
character(0)
> try(system("convert tmp/2l0dz1353330874.ps tmp/2l0dz1353330874.png",intern=TRUE))
character(0)
> try(system("convert tmp/33h8l1353330874.ps tmp/33h8l1353330874.png",intern=TRUE))
character(0)
> try(system("convert tmp/44ii71353330874.ps tmp/44ii71353330874.png",intern=TRUE))
character(0)
> try(system("convert tmp/58bch1353330874.ps tmp/58bch1353330874.png",intern=TRUE))
character(0)
> try(system("convert tmp/6e86z1353330874.ps tmp/6e86z1353330874.png",intern=TRUE))
character(0)
> try(system("convert tmp/76rov1353330874.ps tmp/76rov1353330874.png",intern=TRUE))
character(0)
> try(system("convert tmp/82u0n1353330874.ps tmp/82u0n1353330874.png",intern=TRUE))
character(0)
> try(system("convert tmp/9kgj21353330874.ps tmp/9kgj21353330874.png",intern=TRUE))
character(0)
> try(system("convert tmp/102db91353330874.ps tmp/102db91353330874.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
6.333 1.409 7.741