R version 2.9.0 (2009-04-17)
Copyright (C) 2009 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(825,696,627,0,677,825,696,0,656,677,825,0,785,656,677,0,412,785,656,0,352,412,785,0,839,352,412,0,729,839,352,0,696,729,839,0,641,696,729,0,695,641,696,0,638,695,641,0,762,638,695,0,635,762,638,0,721,635,762,0,854,721,635,0,418,854,721,0,367,418,854,0,824,367,418,0,687,824,367,0,601,687,824,0,676,601,687,0,740,676,601,0,691,740,676,0,683,691,740,0,594,683,691,0,729,594,683,0,731,729,594,0,386,731,729,0,331,386,731,0,707,331,386,0,715,707,331,0,657,715,707,0,653,657,715,0,642,653,657,0,643,642,653,0,718,643,642,0,654,718,643,0,632,654,718,0,731,632,654,0,392,731,632,0,344,392,731,0,792,344,392,0,852,792,344,0,649,852,792,0,629,649,852,0,685,629,649,1,617,685,629,1,715,617,685,1,715,715,617,1,629,715,715,1,916,629,715,1,531,916,629,1,357,531,916,1,917,357,531,1,828,917,357,1,708,828,917,1,858,708,828,1),dim=c(4,58),dimnames=list(c('Y(t)','Y(t-1)','Y(t-2)','X'),1:58))
> y <- array(NA,dim=c(4,58),dimnames=list(c('Y(t)','Y(t-1)','Y(t-2)','X'),1:58))
> 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 = '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
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
Y(t) Y(t-1) Y(t-2) X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 825 696 627 0 1 0 0 0 0 0 0 0 0 0 0 1
2 677 825 696 0 0 1 0 0 0 0 0 0 0 0 0 2
3 656 677 825 0 0 0 1 0 0 0 0 0 0 0 0 3
4 785 656 677 0 0 0 0 1 0 0 0 0 0 0 0 4
5 412 785 656 0 0 0 0 0 1 0 0 0 0 0 0 5
6 352 412 785 0 0 0 0 0 0 1 0 0 0 0 0 6
7 839 352 412 0 0 0 0 0 0 0 1 0 0 0 0 7
8 729 839 352 0 0 0 0 0 0 0 0 1 0 0 0 8
9 696 729 839 0 0 0 0 0 0 0 0 0 1 0 0 9
10 641 696 729 0 0 0 0 0 0 0 0 0 0 1 0 10
11 695 641 696 0 0 0 0 0 0 0 0 0 0 0 1 11
12 638 695 641 0 0 0 0 0 0 0 0 0 0 0 0 12
13 762 638 695 0 1 0 0 0 0 0 0 0 0 0 0 13
14 635 762 638 0 0 1 0 0 0 0 0 0 0 0 0 14
15 721 635 762 0 0 0 1 0 0 0 0 0 0 0 0 15
16 854 721 635 0 0 0 0 1 0 0 0 0 0 0 0 16
17 418 854 721 0 0 0 0 0 1 0 0 0 0 0 0 17
18 367 418 854 0 0 0 0 0 0 1 0 0 0 0 0 18
19 824 367 418 0 0 0 0 0 0 0 1 0 0 0 0 19
20 687 824 367 0 0 0 0 0 0 0 0 1 0 0 0 20
21 601 687 824 0 0 0 0 0 0 0 0 0 1 0 0 21
22 676 601 687 0 0 0 0 0 0 0 0 0 0 1 0 22
23 740 676 601 0 0 0 0 0 0 0 0 0 0 0 1 23
24 691 740 676 0 0 0 0 0 0 0 0 0 0 0 0 24
25 683 691 740 0 1 0 0 0 0 0 0 0 0 0 0 25
26 594 683 691 0 0 1 0 0 0 0 0 0 0 0 0 26
27 729 594 683 0 0 0 1 0 0 0 0 0 0 0 0 27
28 731 729 594 0 0 0 0 1 0 0 0 0 0 0 0 28
29 386 731 729 0 0 0 0 0 1 0 0 0 0 0 0 29
30 331 386 731 0 0 0 0 0 0 1 0 0 0 0 0 30
31 707 331 386 0 0 0 0 0 0 0 1 0 0 0 0 31
32 715 707 331 0 0 0 0 0 0 0 0 1 0 0 0 32
33 657 715 707 0 0 0 0 0 0 0 0 0 1 0 0 33
34 653 657 715 0 0 0 0 0 0 0 0 0 0 1 0 34
35 642 653 657 0 0 0 0 0 0 0 0 0 0 0 1 35
36 643 642 653 0 0 0 0 0 0 0 0 0 0 0 0 36
37 718 643 642 0 1 0 0 0 0 0 0 0 0 0 0 37
38 654 718 643 0 0 1 0 0 0 0 0 0 0 0 0 38
39 632 654 718 0 0 0 1 0 0 0 0 0 0 0 0 39
40 731 632 654 0 0 0 0 1 0 0 0 0 0 0 0 40
41 392 731 632 0 0 0 0 0 1 0 0 0 0 0 0 41
42 344 392 731 0 0 0 0 0 0 1 0 0 0 0 0 42
43 792 344 392 0 0 0 0 0 0 0 1 0 0 0 0 43
44 852 792 344 0 0 0 0 0 0 0 0 1 0 0 0 44
45 649 852 792 0 0 0 0 0 0 0 0 0 1 0 0 45
46 629 649 852 0 0 0 0 0 0 0 0 0 0 1 0 46
47 685 629 649 1 0 0 0 0 0 0 0 0 0 0 1 47
48 617 685 629 1 0 0 0 0 0 0 0 0 0 0 0 48
49 715 617 685 1 1 0 0 0 0 0 0 0 0 0 0 49
50 715 715 617 1 0 1 0 0 0 0 0 0 0 0 0 50
51 629 715 715 1 0 0 1 0 0 0 0 0 0 0 0 51
52 916 629 715 1 0 0 0 1 0 0 0 0 0 0 0 52
53 531 916 629 1 0 0 0 0 1 0 0 0 0 0 0 53
54 357 531 916 1 0 0 0 0 0 1 0 0 0 0 0 54
55 917 357 531 1 0 0 0 0 0 0 1 0 0 0 0 55
56 828 917 357 1 0 0 0 0 0 0 0 1 0 0 0 56
57 708 828 917 1 0 0 0 0 0 0 0 0 1 0 0 57
58 858 708 828 1 0 0 0 0 0 0 0 0 0 1 0 58
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `Y(t-1)` `Y(t-2)` X M1 M2
545.18646 0.14135 0.00881 71.42086 98.22305 1.62679
M3 M4 M5 M6 M7 M8
32.02695 160.81743 -232.68271 -257.70035 222.81422 104.72335
M9 M10 M11 t
8.83525 53.27944 48.36391 -0.63721
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-94.499 -34.962 -1.974 24.254 117.703
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.452e+02 1.493e+02 3.653 0.000714 ***
`Y(t-1)` 1.413e-01 1.634e-01 0.865 0.391987
`Y(t-2)` 8.809e-03 1.601e-01 0.055 0.956374
X 7.142e+01 2.822e+01 2.531 0.015219 *
M1 9.822e+01 3.766e+01 2.608 0.012554 *
M2 1.627e+00 3.775e+01 0.043 0.965828
M3 3.203e+01 4.030e+01 0.795 0.431266
M4 1.608e+02 3.695e+01 4.353 8.44e-05 ***
M5 -2.327e+02 4.135e+01 -5.627 1.36e-06 ***
M6 -2.577e+02 6.350e+01 -4.059 0.000210 ***
M7 2.228e+02 7.181e+01 3.103 0.003423 **
M8 1.047e+02 6.546e+01 1.600 0.117152
M9 8.835e+00 4.680e+01 0.189 0.851157
M10 5.328e+01 4.186e+01 1.273 0.210098
M11 4.836e+01 3.941e+01 1.227 0.226583
t -6.372e-01 6.411e-01 -0.994 0.325950
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 54.89 on 42 degrees of freedom
Multiple R-squared: 0.8975, Adjusted R-squared: 0.8609
F-statistic: 24.52 on 15 and 42 DF, p-value: 5.162e-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,] 0.16047209 0.32094418 0.8395279
[2,] 0.08909158 0.17818316 0.9109084
[3,] 0.10404300 0.20808600 0.8959570
[4,] 0.10177846 0.20355691 0.8982215
[5,] 0.06841079 0.13682158 0.9315892
[6,] 0.06211174 0.12422348 0.9378883
[7,] 0.08679078 0.17358155 0.9132092
[8,] 0.04826926 0.09653852 0.9517307
[9,] 0.07286199 0.14572398 0.9271380
[10,] 0.16390263 0.32780525 0.8360974
[11,] 0.11231910 0.22463820 0.8876809
[12,] 0.09065704 0.18131408 0.9093430
[13,] 0.12659368 0.25318736 0.8734063
[14,] 0.10034494 0.20068987 0.8996551
[15,] 0.06506518 0.13013036 0.9349348
[16,] 0.03779126 0.07558251 0.9622087
[17,] 0.02228121 0.04456242 0.9777188
[18,] 0.02117283 0.04234566 0.9788272
[19,] 0.01945300 0.03890600 0.9805470
[20,] 0.01669090 0.03338181 0.9833091
[21,] 0.04438834 0.08877667 0.9556117
> postscript(file="/var/www/html/rcomp/tmp/13tqx1259779246.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/2iz0w1259779246.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/36jif1259779246.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/41wkt1259779246.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/5sst51259779246.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 = 58
Frequency = 1
1 2 3 4 5 6
78.3260482 8.7177766 -22.2620411 -17.1432308 -14.0547993 3.1865048
7 8 9 10 11 12
22.0758744 -37.5040171 37.2794980 -55.8939841 11.7236007 -3.4235635
13 14 15 16 17 18
30.5717386 -16.2198305 56.8760879 50.6856586 -10.7338891 24.3771081
19 20 21 22 23 24
12.5493258 -69.8694059 -44.0052156 0.5506002 60.2598217 50.5539777
25 26 27 28 29 30
-48.6695972 -38.8736919 79.0138164 -65.4374198 -17.7720193 1.6303095
31 32 33 34 35 36
-91.4337196 -17.3680189 16.7142449 -22.9650231 -27.3359604 24.2552310
37 38 39 40 41 42
1.6249432 24.2484957 -19.1288638 -44.6086800 -3.2709966 21.4287491
43 44 45 46 47 48
-0.6775720 115.1494015 -3.7526996 -39.3945737 -44.6474620 -71.3856452
49 50 51 52 53 54
-61.8531326 22.1272501 -94.4989994 76.5036720 45.8317043 -50.6226716
55 56 57 58
57.4860913 9.5920403 -6.2358278 117.7029806
> postscript(file="/var/www/html/rcomp/tmp/6q8rf1259779246.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 = 58
Frequency = 1
lag(myerror, k = 1) myerror
0 78.3260482 NA
1 8.7177766 78.3260482
2 -22.2620411 8.7177766
3 -17.1432308 -22.2620411
4 -14.0547993 -17.1432308
5 3.1865048 -14.0547993
6 22.0758744 3.1865048
7 -37.5040171 22.0758744
8 37.2794980 -37.5040171
9 -55.8939841 37.2794980
10 11.7236007 -55.8939841
11 -3.4235635 11.7236007
12 30.5717386 -3.4235635
13 -16.2198305 30.5717386
14 56.8760879 -16.2198305
15 50.6856586 56.8760879
16 -10.7338891 50.6856586
17 24.3771081 -10.7338891
18 12.5493258 24.3771081
19 -69.8694059 12.5493258
20 -44.0052156 -69.8694059
21 0.5506002 -44.0052156
22 60.2598217 0.5506002
23 50.5539777 60.2598217
24 -48.6695972 50.5539777
25 -38.8736919 -48.6695972
26 79.0138164 -38.8736919
27 -65.4374198 79.0138164
28 -17.7720193 -65.4374198
29 1.6303095 -17.7720193
30 -91.4337196 1.6303095
31 -17.3680189 -91.4337196
32 16.7142449 -17.3680189
33 -22.9650231 16.7142449
34 -27.3359604 -22.9650231
35 24.2552310 -27.3359604
36 1.6249432 24.2552310
37 24.2484957 1.6249432
38 -19.1288638 24.2484957
39 -44.6086800 -19.1288638
40 -3.2709966 -44.6086800
41 21.4287491 -3.2709966
42 -0.6775720 21.4287491
43 115.1494015 -0.6775720
44 -3.7526996 115.1494015
45 -39.3945737 -3.7526996
46 -44.6474620 -39.3945737
47 -71.3856452 -44.6474620
48 -61.8531326 -71.3856452
49 22.1272501 -61.8531326
50 -94.4989994 22.1272501
51 76.5036720 -94.4989994
52 45.8317043 76.5036720
53 -50.6226716 45.8317043
54 57.4860913 -50.6226716
55 9.5920403 57.4860913
56 -6.2358278 9.5920403
57 117.7029806 -6.2358278
58 NA 117.7029806
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 8.7177766 78.3260482
[2,] -22.2620411 8.7177766
[3,] -17.1432308 -22.2620411
[4,] -14.0547993 -17.1432308
[5,] 3.1865048 -14.0547993
[6,] 22.0758744 3.1865048
[7,] -37.5040171 22.0758744
[8,] 37.2794980 -37.5040171
[9,] -55.8939841 37.2794980
[10,] 11.7236007 -55.8939841
[11,] -3.4235635 11.7236007
[12,] 30.5717386 -3.4235635
[13,] -16.2198305 30.5717386
[14,] 56.8760879 -16.2198305
[15,] 50.6856586 56.8760879
[16,] -10.7338891 50.6856586
[17,] 24.3771081 -10.7338891
[18,] 12.5493258 24.3771081
[19,] -69.8694059 12.5493258
[20,] -44.0052156 -69.8694059
[21,] 0.5506002 -44.0052156
[22,] 60.2598217 0.5506002
[23,] 50.5539777 60.2598217
[24,] -48.6695972 50.5539777
[25,] -38.8736919 -48.6695972
[26,] 79.0138164 -38.8736919
[27,] -65.4374198 79.0138164
[28,] -17.7720193 -65.4374198
[29,] 1.6303095 -17.7720193
[30,] -91.4337196 1.6303095
[31,] -17.3680189 -91.4337196
[32,] 16.7142449 -17.3680189
[33,] -22.9650231 16.7142449
[34,] -27.3359604 -22.9650231
[35,] 24.2552310 -27.3359604
[36,] 1.6249432 24.2552310
[37,] 24.2484957 1.6249432
[38,] -19.1288638 24.2484957
[39,] -44.6086800 -19.1288638
[40,] -3.2709966 -44.6086800
[41,] 21.4287491 -3.2709966
[42,] -0.6775720 21.4287491
[43,] 115.1494015 -0.6775720
[44,] -3.7526996 115.1494015
[45,] -39.3945737 -3.7526996
[46,] -44.6474620 -39.3945737
[47,] -71.3856452 -44.6474620
[48,] -61.8531326 -71.3856452
[49,] 22.1272501 -61.8531326
[50,] -94.4989994 22.1272501
[51,] 76.5036720 -94.4989994
[52,] 45.8317043 76.5036720
[53,] -50.6226716 45.8317043
[54,] 57.4860913 -50.6226716
[55,] 9.5920403 57.4860913
[56,] -6.2358278 9.5920403
[57,] 117.7029806 -6.2358278
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 8.7177766 78.3260482
2 -22.2620411 8.7177766
3 -17.1432308 -22.2620411
4 -14.0547993 -17.1432308
5 3.1865048 -14.0547993
6 22.0758744 3.1865048
7 -37.5040171 22.0758744
8 37.2794980 -37.5040171
9 -55.8939841 37.2794980
10 11.7236007 -55.8939841
11 -3.4235635 11.7236007
12 30.5717386 -3.4235635
13 -16.2198305 30.5717386
14 56.8760879 -16.2198305
15 50.6856586 56.8760879
16 -10.7338891 50.6856586
17 24.3771081 -10.7338891
18 12.5493258 24.3771081
19 -69.8694059 12.5493258
20 -44.0052156 -69.8694059
21 0.5506002 -44.0052156
22 60.2598217 0.5506002
23 50.5539777 60.2598217
24 -48.6695972 50.5539777
25 -38.8736919 -48.6695972
26 79.0138164 -38.8736919
27 -65.4374198 79.0138164
28 -17.7720193 -65.4374198
29 1.6303095 -17.7720193
30 -91.4337196 1.6303095
31 -17.3680189 -91.4337196
32 16.7142449 -17.3680189
33 -22.9650231 16.7142449
34 -27.3359604 -22.9650231
35 24.2552310 -27.3359604
36 1.6249432 24.2552310
37 24.2484957 1.6249432
38 -19.1288638 24.2484957
39 -44.6086800 -19.1288638
40 -3.2709966 -44.6086800
41 21.4287491 -3.2709966
42 -0.6775720 21.4287491
43 115.1494015 -0.6775720
44 -3.7526996 115.1494015
45 -39.3945737 -3.7526996
46 -44.6474620 -39.3945737
47 -71.3856452 -44.6474620
48 -61.8531326 -71.3856452
49 22.1272501 -61.8531326
50 -94.4989994 22.1272501
51 76.5036720 -94.4989994
52 45.8317043 76.5036720
53 -50.6226716 45.8317043
54 57.4860913 -50.6226716
55 9.5920403 57.4860913
56 -6.2358278 9.5920403
57 117.7029806 -6.2358278
> 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/77aqf1259779246.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/8npch1259779246.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/9hei51259779246.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/10n1r21259779246.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/11qz2m1259779246.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/12ni711259779246.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/13ncug1259779246.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/14y16v1259779246.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/1539561259779246.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/160t001259779246.tab")
+ }
> system("convert tmp/13tqx1259779246.ps tmp/13tqx1259779246.png")
> system("convert tmp/2iz0w1259779246.ps tmp/2iz0w1259779246.png")
> system("convert tmp/36jif1259779246.ps tmp/36jif1259779246.png")
> system("convert tmp/41wkt1259779246.ps tmp/41wkt1259779246.png")
> system("convert tmp/5sst51259779246.ps tmp/5sst51259779246.png")
> system("convert tmp/6q8rf1259779246.ps tmp/6q8rf1259779246.png")
> system("convert tmp/77aqf1259779246.ps tmp/77aqf1259779246.png")
> system("convert tmp/8npch1259779246.ps tmp/8npch1259779246.png")
> system("convert tmp/9hei51259779246.ps tmp/9hei51259779246.png")
> system("convert tmp/10n1r21259779246.ps tmp/10n1r21259779246.png")
>
>
> proc.time()
user system elapsed
2.385 1.577 3.203