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(18.0,16.4,19.6,17.8,23.3,22.3,23.7,22.8,20.3,18.3,22.8,22.4,24.3,23.9,21.5,21.3,23.5,23.0,22.2,21.4,20.9,21.2,22.2,20.9,19.5,17.9,21.1,20.7,22.0,22.2,19.2,19.8,17.8,17.7,19.2,19.6,19.9,20.8,19.6,19.8,18.1,18.6,20.4,21.,18.1,18.6,18.6,18.9,17.6,17.3,19.4,20.0,19.3,19.9,18.6,19.5,16.9,16.2,16.4,17.6,19.0,19.8,18.7,19.4,17.1,17.2,21.5,21.1,17.8,17.8,18.1,17.5,19.0,18.0,18.9,19.1,16.8,17.7,18.1,19.2,15.7,15.1,15.1,16.3,18.3,18.6,16.5,17.2,16.9,17.8,18.4,19.1,16.4,16.6,15.7,16.0,16.9,16.7,16.6,17.4,16.7,17.9,16.6,17.8,14.4,13.9,14.5,15.9,17.5,17.9,14.3,15.4,15.4,16.4,17.2,17.9,14.6,15.3,14.2,14.6,14.9,14.9,14.1,15.0,15.6,16.7,14.6,16.3,11.9,11.7,13.5,15.1,14.2,15.5,13.7,15.0,14.4,15.4,15.3,16.0,14.3,14.7,14.5,14.8),dim=c(2,72),dimnames=list(c('Y','X'),1:72))
> y <- array(NA,dim=c(2,72),dimnames=list(c('Y','X'),1:72))
> 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
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 X
1 18.0 16.4
2 19.6 17.8
3 23.3 22.3
4 23.7 22.8
5 20.3 18.3
6 22.8 22.4
7 24.3 23.9
8 21.5 21.3
9 23.5 23.0
10 22.2 21.4
11 20.9 21.2
12 22.2 20.9
13 19.5 17.9
14 21.1 20.7
15 22.0 22.2
16 19.2 19.8
17 17.8 17.7
18 19.2 19.6
19 19.9 20.8
20 19.6 19.8
21 18.1 18.6
22 20.4 21.0
23 18.1 18.6
24 18.6 18.9
25 17.6 17.3
26 19.4 20.0
27 19.3 19.9
28 18.6 19.5
29 16.9 16.2
30 16.4 17.6
31 19.0 19.8
32 18.7 19.4
33 17.1 17.2
34 21.5 21.1
35 17.8 17.8
36 18.1 17.5
37 19.0 18.0
38 18.9 19.1
39 16.8 17.7
40 18.1 19.2
41 15.7 15.1
42 15.1 16.3
43 18.3 18.6
44 16.5 17.2
45 16.9 17.8
46 18.4 19.1
47 16.4 16.6
48 15.7 16.0
49 16.9 16.7
50 16.6 17.4
51 16.7 17.9
52 16.6 17.8
53 14.4 13.9
54 14.5 15.9
55 17.5 17.9
56 14.3 15.4
57 15.4 16.4
58 17.2 17.9
59 14.6 15.3
60 14.2 14.6
61 14.9 14.9
62 14.1 15.0
63 15.6 16.7
64 14.6 16.3
65 11.9 11.7
66 13.5 15.1
67 14.2 15.5
68 13.7 15.0
69 14.4 15.4
70 15.3 16.0
71 14.3 14.7
72 14.5 14.8
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
-1.87 1.09
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.2981 -0.6096 -0.1751 0.3833 2.2218
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.86989 0.70419 -2.655 0.0098 **
X 1.09006 0.03866 28.199 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8094 on 70 degrees of freedom
Multiple R-squared: 0.9191, Adjusted R-squared: 0.9179
F-statistic: 795.2 on 1 and 70 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,] 0.08798948 0.17597896 0.912010522
[2,] 0.10932258 0.21864516 0.890677420
[3,] 0.05073232 0.10146463 0.949267684
[4,] 0.11361991 0.22723982 0.886380091
[5,] 0.06204779 0.12409558 0.937952210
[6,] 0.03516137 0.07032275 0.964838626
[7,] 0.17916199 0.35832398 0.820838012
[8,] 0.18600698 0.37201396 0.813993021
[9,] 0.20986818 0.41973636 0.790131822
[10,] 0.21672623 0.43345245 0.783273775
[11,] 0.25879145 0.51758291 0.741208547
[12,] 0.64780269 0.70439462 0.352197308
[13,] 0.76313653 0.47372694 0.236863471
[14,] 0.83723463 0.32553074 0.162765368
[15,] 0.91494819 0.17010362 0.085051808
[16,] 0.91408612 0.17182777 0.085913883
[17,] 0.93506971 0.12986058 0.064930288
[18,] 0.93614280 0.12771441 0.063857204
[19,] 0.94177850 0.11644300 0.058221500
[20,] 0.93479167 0.13041666 0.065208328
[21,] 0.92709337 0.14581326 0.072906632
[22,] 0.92362784 0.15274432 0.076372159
[23,] 0.91782382 0.16435237 0.082176183
[24,] 0.92707432 0.14585136 0.072925679
[25,] 0.93807420 0.12385161 0.061925804
[26,] 0.96186006 0.07627987 0.038139937
[27,] 0.95888595 0.08222810 0.041114052
[28,] 0.95206079 0.09587841 0.047939206
[29,] 0.93817853 0.12364294 0.061821469
[30,] 0.94076333 0.11847334 0.059236671
[31,] 0.92932297 0.14135407 0.070677034
[32,] 0.94960233 0.10079533 0.050397667
[33,] 0.98893061 0.02213878 0.011069388
[34,] 0.98912437 0.02175126 0.010875630
[35,] 0.98776473 0.02447054 0.012235271
[36,] 0.98698351 0.02603297 0.013016486
[37,] 0.99359462 0.01281077 0.006405383
[38,] 0.99447718 0.01104563 0.005522817
[39,] 0.99413994 0.01172011 0.005860056
[40,] 0.99163209 0.01673581 0.008367905
[41,] 0.98857637 0.02284726 0.011423631
[42,] 0.98594595 0.02810810 0.014054052
[43,] 0.98433776 0.03132448 0.015662238
[44,] 0.97967440 0.04065119 0.020325596
[45,] 0.99095816 0.01808367 0.009041836
[46,] 0.98769143 0.02461714 0.012308568
[47,] 0.98343437 0.03313126 0.016565628
[48,] 0.97724047 0.04551907 0.022759534
[49,] 0.98870446 0.02259107 0.011295536
[50,] 0.98864893 0.02270215 0.011351073
[51,] 0.99290077 0.01419846 0.007099228
[52,] 0.98901590 0.02196820 0.010984101
[53,] 0.98093089 0.03813821 0.019069106
[54,] 0.98841888 0.02316224 0.011581122
[55,] 0.97887143 0.04225714 0.021128568
[56,] 0.96426905 0.07146189 0.035730947
[57,] 0.97841089 0.04317821 0.021589105
[58,] 0.95739078 0.08521845 0.042609224
[59,] 0.93753672 0.12492657 0.062463283
[60,] 0.91241378 0.17517243 0.087586217
[61,] 0.84208999 0.31582002 0.157910012
[62,] 0.87829731 0.24340538 0.121702690
[63,] 0.82014891 0.35970217 0.179851087
> postscript(file="/var/www/html/rcomp/tmp/1e2bs1258741279.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/2df3m1258741279.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/34fhu1258741279.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/48htt1258741279.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/5xvsn1258741279.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 = 72
Frequency = 1
1 2 3 4 5 6
1.99291709 2.06683417 0.86156764 0.71653803 2.22180456 0.25256172
7 8 9 10 11 12
0.11747288 0.15162687 0.29852618 0.74262095 -0.33936721 1.28765056
13 14 15 16 17 18
1.85782825 0.40566241 -0.32942644 -0.51328429 0.37584009 -0.29527244
19 20 21 22 23 24
-0.90334352 -0.11328429 -0.30521321 -0.62135536 -0.30521321 -0.13223098
25 26 27 28 29 30
0.61186378 -0.53129613 -0.52229021 -0.78626652 1.11092893 -0.91515399
31 32 33 34 35 36
-0.71328429 -0.57726060 0.22086971 0.36963872 0.26683417 0.89385194
37 38 39 40 41 42
1.24882232 -0.05024283 -0.62415991 -0.95924875 1.10999409 -0.79807699
43 44 45 46 47 48
-0.10521321 -0.37913029 -0.63316583 -0.55024283 0.17490524 0.12894078
49 50 51 52 53 54
0.56589932 -0.49714214 -0.94217175 -0.93316583 1.11806516 -0.96205330
55 56 57 58 59 60
-0.14217175 -0.61702368 -0.60708291 -0.44217175 -0.20801776 0.15502370
61 62 63 64 65 66
0.52800593 -0.38099999 -0.73410068 -1.29807699 1.01619546 -1.09000591
67 68 69 70 71 72
-0.82602961 -0.78099999 -0.51702368 -0.27105922 0.14601778 0.23701185
> postscript(file="/var/www/html/rcomp/tmp/63qqt1258741279.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 = 72
Frequency = 1
lag(myerror, k = 1) myerror
0 1.99291709 NA
1 2.06683417 1.99291709
2 0.86156764 2.06683417
3 0.71653803 0.86156764
4 2.22180456 0.71653803
5 0.25256172 2.22180456
6 0.11747288 0.25256172
7 0.15162687 0.11747288
8 0.29852618 0.15162687
9 0.74262095 0.29852618
10 -0.33936721 0.74262095
11 1.28765056 -0.33936721
12 1.85782825 1.28765056
13 0.40566241 1.85782825
14 -0.32942644 0.40566241
15 -0.51328429 -0.32942644
16 0.37584009 -0.51328429
17 -0.29527244 0.37584009
18 -0.90334352 -0.29527244
19 -0.11328429 -0.90334352
20 -0.30521321 -0.11328429
21 -0.62135536 -0.30521321
22 -0.30521321 -0.62135536
23 -0.13223098 -0.30521321
24 0.61186378 -0.13223098
25 -0.53129613 0.61186378
26 -0.52229021 -0.53129613
27 -0.78626652 -0.52229021
28 1.11092893 -0.78626652
29 -0.91515399 1.11092893
30 -0.71328429 -0.91515399
31 -0.57726060 -0.71328429
32 0.22086971 -0.57726060
33 0.36963872 0.22086971
34 0.26683417 0.36963872
35 0.89385194 0.26683417
36 1.24882232 0.89385194
37 -0.05024283 1.24882232
38 -0.62415991 -0.05024283
39 -0.95924875 -0.62415991
40 1.10999409 -0.95924875
41 -0.79807699 1.10999409
42 -0.10521321 -0.79807699
43 -0.37913029 -0.10521321
44 -0.63316583 -0.37913029
45 -0.55024283 -0.63316583
46 0.17490524 -0.55024283
47 0.12894078 0.17490524
48 0.56589932 0.12894078
49 -0.49714214 0.56589932
50 -0.94217175 -0.49714214
51 -0.93316583 -0.94217175
52 1.11806516 -0.93316583
53 -0.96205330 1.11806516
54 -0.14217175 -0.96205330
55 -0.61702368 -0.14217175
56 -0.60708291 -0.61702368
57 -0.44217175 -0.60708291
58 -0.20801776 -0.44217175
59 0.15502370 -0.20801776
60 0.52800593 0.15502370
61 -0.38099999 0.52800593
62 -0.73410068 -0.38099999
63 -1.29807699 -0.73410068
64 1.01619546 -1.29807699
65 -1.09000591 1.01619546
66 -0.82602961 -1.09000591
67 -0.78099999 -0.82602961
68 -0.51702368 -0.78099999
69 -0.27105922 -0.51702368
70 0.14601778 -0.27105922
71 0.23701185 0.14601778
72 NA 0.23701185
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.06683417 1.99291709
[2,] 0.86156764 2.06683417
[3,] 0.71653803 0.86156764
[4,] 2.22180456 0.71653803
[5,] 0.25256172 2.22180456
[6,] 0.11747288 0.25256172
[7,] 0.15162687 0.11747288
[8,] 0.29852618 0.15162687
[9,] 0.74262095 0.29852618
[10,] -0.33936721 0.74262095
[11,] 1.28765056 -0.33936721
[12,] 1.85782825 1.28765056
[13,] 0.40566241 1.85782825
[14,] -0.32942644 0.40566241
[15,] -0.51328429 -0.32942644
[16,] 0.37584009 -0.51328429
[17,] -0.29527244 0.37584009
[18,] -0.90334352 -0.29527244
[19,] -0.11328429 -0.90334352
[20,] -0.30521321 -0.11328429
[21,] -0.62135536 -0.30521321
[22,] -0.30521321 -0.62135536
[23,] -0.13223098 -0.30521321
[24,] 0.61186378 -0.13223098
[25,] -0.53129613 0.61186378
[26,] -0.52229021 -0.53129613
[27,] -0.78626652 -0.52229021
[28,] 1.11092893 -0.78626652
[29,] -0.91515399 1.11092893
[30,] -0.71328429 -0.91515399
[31,] -0.57726060 -0.71328429
[32,] 0.22086971 -0.57726060
[33,] 0.36963872 0.22086971
[34,] 0.26683417 0.36963872
[35,] 0.89385194 0.26683417
[36,] 1.24882232 0.89385194
[37,] -0.05024283 1.24882232
[38,] -0.62415991 -0.05024283
[39,] -0.95924875 -0.62415991
[40,] 1.10999409 -0.95924875
[41,] -0.79807699 1.10999409
[42,] -0.10521321 -0.79807699
[43,] -0.37913029 -0.10521321
[44,] -0.63316583 -0.37913029
[45,] -0.55024283 -0.63316583
[46,] 0.17490524 -0.55024283
[47,] 0.12894078 0.17490524
[48,] 0.56589932 0.12894078
[49,] -0.49714214 0.56589932
[50,] -0.94217175 -0.49714214
[51,] -0.93316583 -0.94217175
[52,] 1.11806516 -0.93316583
[53,] -0.96205330 1.11806516
[54,] -0.14217175 -0.96205330
[55,] -0.61702368 -0.14217175
[56,] -0.60708291 -0.61702368
[57,] -0.44217175 -0.60708291
[58,] -0.20801776 -0.44217175
[59,] 0.15502370 -0.20801776
[60,] 0.52800593 0.15502370
[61,] -0.38099999 0.52800593
[62,] -0.73410068 -0.38099999
[63,] -1.29807699 -0.73410068
[64,] 1.01619546 -1.29807699
[65,] -1.09000591 1.01619546
[66,] -0.82602961 -1.09000591
[67,] -0.78099999 -0.82602961
[68,] -0.51702368 -0.78099999
[69,] -0.27105922 -0.51702368
[70,] 0.14601778 -0.27105922
[71,] 0.23701185 0.14601778
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.06683417 1.99291709
2 0.86156764 2.06683417
3 0.71653803 0.86156764
4 2.22180456 0.71653803
5 0.25256172 2.22180456
6 0.11747288 0.25256172
7 0.15162687 0.11747288
8 0.29852618 0.15162687
9 0.74262095 0.29852618
10 -0.33936721 0.74262095
11 1.28765056 -0.33936721
12 1.85782825 1.28765056
13 0.40566241 1.85782825
14 -0.32942644 0.40566241
15 -0.51328429 -0.32942644
16 0.37584009 -0.51328429
17 -0.29527244 0.37584009
18 -0.90334352 -0.29527244
19 -0.11328429 -0.90334352
20 -0.30521321 -0.11328429
21 -0.62135536 -0.30521321
22 -0.30521321 -0.62135536
23 -0.13223098 -0.30521321
24 0.61186378 -0.13223098
25 -0.53129613 0.61186378
26 -0.52229021 -0.53129613
27 -0.78626652 -0.52229021
28 1.11092893 -0.78626652
29 -0.91515399 1.11092893
30 -0.71328429 -0.91515399
31 -0.57726060 -0.71328429
32 0.22086971 -0.57726060
33 0.36963872 0.22086971
34 0.26683417 0.36963872
35 0.89385194 0.26683417
36 1.24882232 0.89385194
37 -0.05024283 1.24882232
38 -0.62415991 -0.05024283
39 -0.95924875 -0.62415991
40 1.10999409 -0.95924875
41 -0.79807699 1.10999409
42 -0.10521321 -0.79807699
43 -0.37913029 -0.10521321
44 -0.63316583 -0.37913029
45 -0.55024283 -0.63316583
46 0.17490524 -0.55024283
47 0.12894078 0.17490524
48 0.56589932 0.12894078
49 -0.49714214 0.56589932
50 -0.94217175 -0.49714214
51 -0.93316583 -0.94217175
52 1.11806516 -0.93316583
53 -0.96205330 1.11806516
54 -0.14217175 -0.96205330
55 -0.61702368 -0.14217175
56 -0.60708291 -0.61702368
57 -0.44217175 -0.60708291
58 -0.20801776 -0.44217175
59 0.15502370 -0.20801776
60 0.52800593 0.15502370
61 -0.38099999 0.52800593
62 -0.73410068 -0.38099999
63 -1.29807699 -0.73410068
64 1.01619546 -1.29807699
65 -1.09000591 1.01619546
66 -0.82602961 -1.09000591
67 -0.78099999 -0.82602961
68 -0.51702368 -0.78099999
69 -0.27105922 -0.51702368
70 0.14601778 -0.27105922
71 0.23701185 0.14601778
> 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/7vgdx1258741279.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/8cuqa1258741279.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/9l0ca1258741279.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/10e0jz1258741279.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/11mdji1258741279.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/120wln1258741279.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/132onv1258741279.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/14j8f41258741279.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/153bw51258741279.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/16v76h1258741279.tab")
+ }
>
> system("convert tmp/1e2bs1258741279.ps tmp/1e2bs1258741279.png")
> system("convert tmp/2df3m1258741279.ps tmp/2df3m1258741279.png")
> system("convert tmp/34fhu1258741279.ps tmp/34fhu1258741279.png")
> system("convert tmp/48htt1258741279.ps tmp/48htt1258741279.png")
> system("convert tmp/5xvsn1258741279.ps tmp/5xvsn1258741279.png")
> system("convert tmp/63qqt1258741279.ps tmp/63qqt1258741279.png")
> system("convert tmp/7vgdx1258741279.ps tmp/7vgdx1258741279.png")
> system("convert tmp/8cuqa1258741279.ps tmp/8cuqa1258741279.png")
> system("convert tmp/9l0ca1258741279.ps tmp/9l0ca1258741279.png")
> system("convert tmp/10e0jz1258741279.ps tmp/10e0jz1258741279.png")
>
>
> proc.time()
user system elapsed
2.628 1.580 3.018